Some Fractals

The Tree package from the text

BeginPackage["Tree`"];

Needs["Geometry`Rotations`"];

Clear[Tree, rotateLine, branchLine, createBranches];

Tree::usage = "Tree[options___] creates a fractal tree. The options of
the function Tree determine the form of the fractal created. Options are
	    Generation -> 10, \n
	    BranchRotation -> 0.65, \n
	    BranchScaling -> 0.75, \n
	    BranchThickness -> 0.7,  \n
	    OriginalThickness -> 0.07, \n
	    BranchColor -> {RGBColor[0,0,0]} \n
Example: Tree[BranchColor->l1,BranchRotation->0.3] \n
	 l1 is a list created in the package Tree.";

(* --- global variables --- *)

Generation::usage;
BranchRotation::usage;
BranchSkaling::usage;
BranchThickness::usage;
OriginalThickness::usage;
BranchColor::usage;

Begin["`Private`"];

(* --- rotate a line --- *)
rotateLine[Line[{start_, end_}], angle_] :=
Line[{end, end + branchScaling*
		 Rotate2D[end - start, angle Random[Real, {0.5,1.5}]
                 ]}];

(* --- branch a line --- *)
branchLine[Line[points_]] := {rotateLine[Line[points],
			      branchRotation],
			      rotateLine[Line[points],
			      - branchRotation]};

(* --- change thickness --- *)
branchLine[Thickness[th_]] := Thickness[th branchThickness];

(* --- define color of a branch --- *)
branchLine[RGBColor[r_, g_, b_]] := (
			branchColor = RotateLeft[branchColor];
			First[branchColor] );

(* --- create branches --- *)
createBranches[lines_] := Flatten[Map[branchLine, lines]];

(* --- options if Tree[] --- *)
Options[Tree] =
      {
	    Generation -> 10,
	    BranchRotation -> 0.65,
	    BranchScaling -> 0.75,
	    BranchThickness -> 0.7,
	    OriginalThickness -> 0.07,
	    BranchColor ->
                {
                  RGBColor[0,0,0]}
      };

(* --- create a tree --- *)

Tree[options___] := Block[
   {generations, branchRotation,
    branchScaling, branchThickness,
    originalThickness, branchColor},
(* --- check options --- *)
    {generations, branchRotation, branchScaling, branchThickness,
     originalThickness, branchColor} =
    {Generation, BranchRotation, BranchScaling, BranchThickness,
     OriginalThickness, BranchColor}  /. {options}
			    /. Options[Tree];
(* --- iterate the functions and display the tree --- *)
    Show[
         Graphics[
            NestList[
		createBranches,
                {
                        First[branchColor],
			Thickness[originalThickness],
                        Line[{{0,0},{0,1}}]
                 },
		 generations]],
	    FilterOptions[Show, options],
            AspectRatio -> Automatic,
            PlotRange -> All]];

(* --- filter for options --- *)

FilterOptions[ command_Symbol, opts___] :=
      Block[{keywords = First /@ Options[command]},
           Sequence @@ Select [{opts},
			    MemberQ[keywords, First[#]]&]];
End[];
EndPackage[];

(* --- an example of a color list --- *)


l1 = {RGBColor[0.5620000000000001, 0.236, 0.071], 
      RGBColor[0.5470000000000001, 0.229, 0.06900000000000001],
      RGBColor[0.5, 0.21, 0.063],
      RGBColor[0.469, 0.196, 0.059],
      RGBColor[0.033, 0.281, 0.035],
      RGBColor[0.046, 0.395, 0.05],
      RGBColor[0.055, 0.469, 0.059],
      RGBColor[0.07000000000000001, 0.602, 0.076],
      RGBColor[0.085, 0.727, 0.092],
      RGBColor[0.109, 0.937, 0.118],
      RGBColor[0.109, 0.937, 0.118],
      RGBColor[0.109, 0.937, 0.118],
      RGBColor[0.013, 0.75, 0.028]};

l2 = {RGBColor[0.60, 0.24, 0.07], 
RGBColor[0.50, 
            0.27, 0.07], 
RGBColor[0.40, 0.30, 
            0.07], 
RGBColor[0.30, 0.33, 
            0.07], 
RGBColor[0.20, 0.36, 
            0.07], 
RGBColor[0.10, 0.39, 
            0.07], 
RGBColor[0.05, 0.45, 
            0.07], 
RGBColor[0.04, 0.60, 
            0.07], 
RGBColor[0.03, 0.75, 
            0.07], 
RGBColor[0.02, 0.90, 
            0.07], 
RGBColor[0.01, 0.91, 
            0.07], 
RGBColor[0.00, 0.92, 
            0.07], 
RGBColor[0.00, 0.93, 
            0.07]};

Tree[Generation -> 12, BranchColor -> l2];

Tree[Generation -> 12, BranchColor -> l1];

Do[Tree[Generation -> 12, BranchColor -> l2], {n, 1, 
        5}]

Do[Tree[Generation -> n], {n, 1, 5}]

The sum of the outline may be calculated, assuming that each limb is 3/4 of the length of the previous one as:
	2(1) + 4(3/4) + 8 ((((3/4))^2)) + ⋯
	= \(TraditionalForm\`2\ \((\(2\^0\) \((3/4)\)\^0\  + \ \(2\^1\) \((3/4)\)\^1\  + \ \(2\^2\) \((3/4)\)\^2\  + \ ⋯)\)\)
	= 2 Sum[(((3/2))^n), {n, 0, (Subscript[n, Total])}]

For the next-to-previous limb length ratio L, we have:
	2 Sum[(((2 L))^n), {n, 0, (Subscript[n, Total])}]
	= 2 (1/(1 - 2  L))  if  (Subscript[n, Total]) ->  ∞.
which is true provided |2  L|<1, or |L|<(1/2). Thus, the length of the outline of our trees above diverges in the limit  (Subscript[n, Total]) ->  ∞, since (3/4) > (1/2).