Using the Package

    Digraph fractal images may be generated using my DigraphFractals package.  I wrote this package in support of an article which appeared in Mathematica in Education and Research.  The article describes the algorithms in detail.  Here I'll provide the basics of how to describe digraph fractals and how to use the package.  Of course, we first need to load the DigraphFractals package.  This should first be dropped in the Mathematica/AddOns/Applications directory.

Needs["DigraphFractals`"]

    The first step is to determine an appropriate data structure to describe a digraph IFS.  For this purpose, we will use an adjacency matrix of lists of affine functions.  The element in row [Graphics:../Images/index_gr_31.gif] and column [Graphics:../Images/index_gr_32.gif] will be a list of affine functions which map [Graphics:../Images/index_gr_33.gif] into [Graphics:../Images/index_gr_34.gif].  Each affine function will be described by a pair [Graphics:../Images/index_gr_35.gif], where [Graphics:../Images/index_gr_36.gif] is a two dimensional matrix indicating the linear part and [Graphics:../Images/index_gr_37.gif] is a two dimensional vector indicating the shift.  Here is the code describing the digraph IFS for the curves [Graphics:../Images/index_gr_38.gif] and [Graphics:../Images/index_gr_39.gif]

rotate[t_] := {{Cos[t], -Sin[t]}, {Sin[t], Cos[t]}}; 
a1 = {{{1/2, 0}, {0, 1/2}}, {1/4, Sqrt[3]/4}};
a2 = {1/2 rotate[Pi/3], {0, 0}};
a3 = {1/2 rotate[-Pi/3], {3/4, Sqrt[3]/4}};
b1 = {{{1/2, 0}, {0, -1/2}}, {1/2, 0}};
b2 = {{{1/2, 0}, {0, 1/2}}, {0, 0}};
curvesDigraph = {{{a1}, {a2, a3}}, {{b1}, {b2}}};

We also need an initial approximation to each digraph fractal for the digraph IFS to act upon.  In general, these could be any Graphics primitives, but some objects lead to more natural approximations than others.  Note that each initiator is a list of Graphics primitives. This way each initiator may be a fairly complicated graphic.  Here is our choice of initiators.

lineSegment = Line[{{0, 0}, {1, 0}}]; 
initiators = {{lineSegment}, {lineSegment}};

We now use the function ShowDigraphFractals.  

ShowDigraphFractals[curvesDigraph,10, 
    Initiators -> initiators];

[Graphics:../Images/index_gr_40.gif]

[Graphics:../Images/index_gr_41.gif]

Note that the first argument is the digraph describing the sets, the second argument is the depth of the approximation and the option Initiators describes the initial approximation.  If we use the default Initiators -> Automatic, then a single point at the origin is used for each initiator.  If we use a digraph with one node, then we get a self-affine set.  So here is the Sierpinski gasket.  Note that standard Graphics options such as Prolog are accepted.
    

Sierpinski = {{{
    {{{1/2, 0}, {0, 1/2}}, {0, 0}},
    {{{1/2, 0}, {0, 1/2}}, {1/2, 0}},
    {{{1/2, 0}, {0, 1/2}}, {1/4, Sqrt[3]/4}}
}}};
ShowDigraphFractals[Sierpinski,8,
    Prolog -> {AbsolutePointSize[.4]}];

[Graphics:../Images/index_gr_42.gif]

The package contains a function ComputeDimension which computes the similarity dimension of the digraph IFS.  This gives a numerical estimate of the fractal (Hausdorff) dimension of the set which should be accurate when certain hypotheses are satisfied.

ComputeDimension[Sierpinski]
[Graphics:../Images/index_gr_43.gif]


Converted by Mathematica      July 22, 2001