Upload
others
View
4
Download
0
Embed Size (px)
Citation preview
Fractal Dimension and Crystalline Formationsby Shahin M Movafagh
“Since six is the true number of water, when water congeals into flowers they must be six
pointed” – T’ang Chin (few centuries BC)
IntroductionCrystalline and polycrystalline structures are common states of solid objects. The
crystallized structure of snow is intuitively reminiscent of fractal formations.
Conversely, certain class of fractal objects is closely identified with snowflakes. Whether
such natural objects exhibit fractal dimensions or certain classical fractals approximate
real objects has a direct bearing on the understanding of these objects and concepts. A
fresh understanding of these possibilities could ultimately lead to a better understanding
of the processes and properties involved in crystal formations.
Although some success has been reached in laboratory formation of crystalline snowflake
structures, conclusive modeling and simulation remains incomplete. Most notably,
Diffusion Limited Aggregation (DLA) simulations have yielded random dentritic
configurations and the Hele-Shaw cell devices, introduced 1898, have produced self-
organized snowflake type patterns very successfully. Most recently, surface tension,
singular perturbation and tip splitting have been combined towards a more complete
understanding of the process (Ben-Jacob 1993). Despite great progress, physical and
mathematical models describing the formation of self-organized snowflake crystals are
still lacking.
After a brief background overview of relevant topics, an attempt will be made to take a
hypothetical fractal object and subject it to a series of subsequent image transformation
steps mimicking a growth process. The premise for the methodology is that, during
formation, crystal atoms gravitate towards groups or clusters of atoms because they exert
greater attraction. This is more of a simplified exploration of the topic and is meant
mostly to provide a fresh angle on the subject.
BackgroundSolid objects generally come in three major classes: crystalline, polycrystalline and
amorphous. The type of solid formed is often dependant on the cooling process. For a
single crystal to be formed from liquid silver, cooling has to be less than 10o C per hour.
Such a single crystal will have a uniform, stable and orderly crystal lattice displaying
translation, rotation and reflection symmetry. At significantly faster cooling rates,
polycrystalline silver is formed as branched dendritic grains of crystal, consisting of
many tiny complete crystals, stuck together. A glassy or amorphous solid will be formed
if “splat-cooling” or very fast cooling is applied to the silver liquid. In such an object the
atoms have been frozen in their liquid arrangement forming an unstable solid that may
eventually rearrange itself to the lower energy, more stable crystalline arrangement over
time. Snowflakes are best categorized as dendritic crystals.
They form in the upper atmosphere as water vapor freezes on tiny seed particles such as
dust. Snowflakes will serve as the primary area of focus for this study.
Figure 1: Mineral MgO on Limestone Figure 2: DLA Simulation Results
Diffusion plays a key role in solidification. DLA computer simulations match well with
various natural processes involving diffusion. The process is depicted in Figure 3.
Random motion particles attach themselves to the object creating a type of Monte-Carlo
or random growth mechanism. These types of patterns have been observed in injected
fluids, electrical discharges, dendritic growth and other processes governed by the
Laplace Equation of potential theory; the gradient of the potential corresponding to the
diffusion field in DLA (Shroeder 1991). The resultant object has a scale invariant fractal
dimension of ~1.7 in a two dimensional simulation. The DLA model is limited in that it
has no analogue to surface tension and fails to produce the crystal lattice of a snowflake.
It is in effect “Monte Carlo simulations of the diffusive growth in the limit of zero surface
tension, no anisotropy, zero under-cooling and infinite diffusion length (the diffusion
length is replaced by the Laplace equation).” (Ben Jacob, 1993).
Figure 3: DLA Diagram
Two independent efforts attempted simplified models of solidification during 1983. Of
these, the Boundary Layer Model assumed the entire change in temperature occurs in a
narrow layer near the interface using an educated guess for the equations of motion. Tip
splitting and Dense Branching Morphology (DBM) were surprising results of the
numerical simulations of these models.
The Hele-Shaw cell results (Figure 4) prompted a proposal on a morphology selection
principle. “It was assumed that in the presence of anisotropy, both tip splitting and
dentritic solutions exist but the fastest growing morphology is the dynamically selected
one. In general, if more than one morphology is a possible solution, only the fastest
growing morphology is nonlinearly stable and will be observed.” (Ben Jacob, 1993).
Figure 4: Hele-Shaw Martian CO2 Snowflake
The question of symmetry in the branching of snowflakes is still imminent. One attempt
to address it was made in 1994. A crossover from a random growth pattern to a
symmetrically branched formation was observed with silver aggregates at the
microscopic scale when the deposition flux was increased emphasizing the increasing
importance of anisotropy of edge diffusion at higher flux. (Brune et. al. 1994)
MethodologyUsing the Mathematica software, a six-sided fractal object is created. The object is then
converted to a graphics array. It is later passed through a blurring filter, followed by a
sharpening filter introducing grays into the black and white image. The average pixel
value is then used and the object is turned back into a black and white image using this
value as a threshold. These steps are cycled through repeatedly simulating growth of the
object.
Creating a snowflake fractal in Mathematica can be best accomplished using Iterated
Function System algorithms. Three different methods were explored. The first uses the
software package IFSRender from the Mathematica Journal volume 7, first issue. The
second method uses the built-in IFS function in Mathematica 4 and the final method
simple code was written to accomplish the task. The last method was ultimately used to
create the object.
IFSRender (below) is a very fast and flexible algorithm.
SetDirectory["/a/MathematicaVol7/Graphics/Gutierrz"]
<< IFS.m
?IFSRender
IFSRenderIFS, n,optsrenders n pointsof the fractal image associated with the IFSfractal model using the Chaos Game algorithm.
IFSRender[Crystal, 10000]
Internally, IFSRender stores the data on Crystal as follows:
Crystal=List[ List[{{0.255, 0.},{0., 0.255}},{0.372, 0.671}], List[{{0.255, 0.},{0., 0.255}},{0.115, 0.223}], List[{{0.255, 0.},{0., 0.255}},{0.631, 0.223}], List[{{0.37, -0.642},{0.642, 0.37}},{0.636, -0.006}]]; The code listing and IFS definitions for over 25 other objects are listed in appendix A.
Next, the Mathematica built-in package can be invoked as shown below. This function
can take maps as well as functions for its transformations as further exemplified in
Appendix B.
Needs"ProgrammingInMathematica IFS "
?IFS
IFSmaps..,options..generates an iterated function systemIFS.
ifs0IFSAffineMap.255, 0., .372,0., .255, .671,AffineMap.255, 0., .115,0., .255, .223,AffineMap.255, 0., .631,0., .255, .223,AffineMap.37, .642, .6636,.642, .37, .006
gr1ShowGraphicsPolygon0, 0,0, .1,.1, .1,.1, 0,AspectRatio Automatic;
ShowNestifs0, gr1, 7
Finally, the code below was developed to create similar output based on points and not
graphics objects and in a more controllable fashion. First the transformations are defined
as:
iTran.255, 0., 0., .255, .372, .671,.255, 0., 0., .255, .115, .223,.255, 0., 0., .255, .631, .223,.37, .642, .642, .37, .636, .006MatrixForm0.255 0. 0. 0.255 0.372 0.6710.255 0. 0. 0.255 0.115 0.2230.255 0. 0. 0.255 0.631 0.2230.37 0.642 0.642 0.37 0.636 0.006
Get the fixed point of the first transformation as follows:
x0iTran15iTran14 1. iTran12iTran16iTran11 1.iTran14 1. iTran12iTran13y0iTran16iTran11 1. iTran13iTran15iTran11 1.iTran14 1. iTran12iTran13Define a random index function:
Randix: CeilingLengthTransposeiTran1 RandomCreate a function that given an x,y and a random number creates the next x,y and random
number:
ClearNextXYNextXYx_, y_, r_:iTranr1x iTranr2y iTranr5,iTranr3xiTranr4y iTranr6, Randix
Set the directory and generate the object:
SetDirectory"a"TransposeDropTransposeNestListNextXY,x0, y0, Randix, 100000, 1;ListPlot%, Axes False
Then the image is exported and imported converting it to a graphics array from point
objects:
Export"c.gif", %Import"c.gif"At this point image processing can be applied to the image. First the image is blurred:fir 1
9.Table1,3,3MatrixForm0.111111 0.111111 0.111111
0.111111 0.111111 0.1111110.111111 0.111111 0.111111
img Import"c.gif";cryst img1, 1;SetOptionsListDensityPlot, Mesh False, FrameTicks False, ImageSize Dimensionscryst 32,AspectRatio Automatic;
tmp ListConvolvefir, cryst;ShowGraphicsArrayListDensityPlot#, DisplayFunction Identity&tmp;
Then the image is sharpened by another convolve:
unsharp ReplacePartTable1,5,525., 2. 125.,3, 3;tmp ListConvolveunsharp, tmp;ShowGraphicsArrayListDensityPlot#, DisplayFunction Identity&tmp;
Finally the average pixel value is calculated and the image is made into black and white
using the average as a threshold value:
AveragePixel ApplyPlus, FlattentmpLengthFlattentmptmp MapIf# AveragePixel, 0, 1&, tmp,2;ShowGraphicsArrayListDensityPlot#, DisplayFunction Identity&tmp;
This is cycles through a number of times creating the growth pattern as indicated in the
images below and the attached animated GIF file:
ShowGraphicsArrayListDensityPlot#, DisplayFunction Identity&cryst;
Export"c1.gif", %tmp ListConvolvefir, cryst;tmp ListConvolveunsharp, tmp;AveragePixel ApplyPlus, FlattentmpLengthFlattentmp;tmp MapIf# AveragePixel, 0, 1&, tmp,2;ShowGraphicsArrayListDensityPlot#, DisplayFunction Identity&tmp;
ConclusionA definite growth patterns emerges. The lack of splitting could probably be remedied by
changing the threshold value to a higher value. Though the algorithm is quite simple the
significance lies in creating a crystal type growth using a mathematical fractal. Simple
models that seem to work are often worthy of further examination as mentioned earlier in
this paper. Future work should include measuring the box-counting dimension of various
actual snowflake images as well as simulation results for comparisons of consistency.
Appendix A: IFSRender Listing (Mathematica Journal Volume 7, Issue 1, Gutierrez et. al.)(*************************************************************************)
(* This sample IFS consists of one scaling map, an affine map given by rotation angles, scaling factors and translation components, and one map given in functional form. *)ifs0 = IFS[{ scale[0.3, 0.8], AffineMap[0.2, 0.4, 0.9, 0.5, 2, -2], AffineMap[{x, y}, {0.9y - 2, x - 0.1y - 2}] }](* IFS can be applied to graphics. Here is a sample graphic from section on affine maps *)gr1 = Show[ Graphics[{ Line[{{-1, -1}, {1, -1}, {1, 1}}], Polygon[{{-1, 1}, {0.5, -1.5}, {0.7, 0.8}}], {PointSize[0.05], Point[{-0.7, -0.6}]}, {Thickness[0.04], GrayLevel[0.6], Line[{{-1, -1.5}, {1, 1.2}}]}, {GrayLevel[0.8], Disk[{-0.8, 0.1}, 0.3]}, {GrayLevel[0.4], Rectangle[{.8, .1}, {1.6, .5}]}, Circle[{0, -0.8}, 0.5] }], AspectRatio -> Automatic ];(* Each IFS has an invariant set, is often a fractal. can be foundede by starting with an arbitrary initial \and nesting the IFS several times. *)Show[Nest[ifs0, gr1, 4]];
(**********************************************************************)f[x_] := Transpose[{{.5, -Sqrt[3]/2}, {.5, Sqrt[3]/2}}] . x - {.5, 0}a = Map[f, Table[Sort[{Random[], Random[]}], {j, 1, 10000}]]; ListPlot[a]
b = Table[{Random[] - .5, Random[] - .5}, {j, 1, 1000}]; ListPlot[b]
Needs["ProgrammingInMathematica`IFS`"]ifsSier = IFS[{AffineMap[0, 0, 0.5, 0.5, -1, 0], AffineMap[0, 0, 0.5, 0.5, 1, 0], AffineMap[0, 0, 0.5, 0.5, 0, 1]}]gr2 = Graphics[{Polygon[{{0, 0}, {0, 1}, {1, 1}, {1, 0}}]}]Show[Nest[ifsSier, gr2, 8], Axes -> True];
ifs0=IFS[{AffineMap[0, Pi, -0.5, 0.5, 0.5, 1], AffineMap[0, 0, 0.5, -0.5, 0.5, 0.5], AffineMap[0, 0, -0.5, -0.5, 0.25, 0.5]}]
gr1 = Show[Graphics[{Polygon[{{0, 0}, {0, 1}, {1, 1}, {1, 0}}]}], AspectRatio -> Automatic]; Show [Nest[ifs0, gr1, 7]];
SetDirectory["/a/mathematicavol7/Graphics/Gutierrz"]
<< IFS.m
rot[a_] := {{Cos[a], Sin[a]}, {-Sin[a], Cos[a]}}
Sierpinsky = { {1/2 id, {-1, 0}}, {1/2 id, {1, 0}}, {1/2 id, {0, 1}} } // N;
(*********************************************************************)(* :Title: Efficient Rendering of Fractal Images *)
(* :Authors: J. M. GutiŽrrez ([email protected]) A. Iglesias ([email protected]) Dpto. Matem‡tica Aplicada, Universidad de Cantabria. M. A. Rodr’guez V. J. Rodr’guez Instituto de F’sica de Cantabria, CSIC-Universidad de Cantabria.*)
(* :Summary: The Iterated Function Systems (IFS) model is a useful method for generating self-similar fractals. This paper introduces a package for modelling and generating IFS fractal images using the Chaos Game algorithm. The performance of this algorithm is improved choosing the most efficient set of probabilities. A "Fractal Gallery" with several illustrative examples is provided to illustrate the use of the package.*)
(*:Source: J.M. Gutierrez, A. Iglesias, M.A. Rodriguez, and V.J. Rodriguez, "Generating and Rendering Fractal Images," The Mathematica Journal 7(1): 6-13. 1997.*)
(* :Examples: FixedPoints[Fern] IFSDRender[Sierpinsky,Point[{{2,2}}],5] IFSRender[Fern,2000] IFSRender[Fern,2000,ShowProbabilities->True,ShowMaps->True] IFSRender[Sierpinsky,2000,Probabilities->{0.1,0.1,0.8}] IFSCompare[Fern,2000] "Animation" NNoisy=List[ List[{{0.4,-0.65},{-0.48,-0.34}},{p,4.28}], List[{{-0.08,-0.20},{-0.74, 0.20}},{-4.09,3.95}] ]; IFSAnimate[NNoisy,{p,3,9,0.25},1000, PlotRange->{{-8,20},{-11,11}}]*)
BeginPackage["IFS`"]
Needs["Statistics`DataManipulation`"]
IFSDRender::usage ="IFSDRender[Ifs, n, poly] renders the fractal image associated with the IFS model using the Deterministic Algorithm, taking the polygon poly as the initial image."
ChaosGame::usage ="ChaosGame[IFS, probs, x0, n] generates an orbit of n points using the Chaos Game algorithm with probabilities probs, starting at the point x0."
IFSRender::usage ="IFSRender[IFS, n, (opts)] renders n points of the fractal image associated with the IFS fractal model using the Chaos Game algorithm."
IFSMeasure::usage ="IFSMeasure[IFS, probs, n, {nx, ny}] generates an array of densityvalues for the Hutchinson measure of the IFS with given probabilities by applying n iterations of the Chaos Game algorithm."
ShowIFSMeasure::usage ="ShowIFSMeasure[IFS, probs, n, {nx, ny}] displays an array of density values for the Hutchinson measure of the IFS with given probabilities by applying n iterations of the Chaos Game algorithm."
IFSAnimate::usage ="AnimateIFS[IFS, {par, min, max, rang}, n, (opts)] generates a moovie with the fractal images resulting of apply IFSRender command to the IFS models resulting of substituting the parameter 'par' by the given values from'min' to 'max' with varying step 'rang'."
fixedPoints::usage ="fixedPoints[IFS] returns the fixed points of the affine mappings of the IFS"
factors::usage ="factors[IFS] computes the contractivity factors of the IFS."
FractalDimension::usage ="FractalDimension[IFS] returns an approximation of the fractal dimension associated with the fractal attractor of the IFS. The fractal dimensionis exact for non-overlaping IFS models."
StandardProbs::usage ="StandardProbs[IFS] returns the standard probabilities to render an IFSusing the Chaos Game algorithm."
OptimalProbs::usage ="OptimalProbs[IFS] returns the optimal probabilities to render an IFSusing the Chaos Game algorithm."
IFSCompare::usage ="IFSRender[IFS, n, (opts)] renders n points of the fractal image associated with the IFS fractal model using a Chaos Algorithm with both standard and optimal sets of probabilities."
(* Options *)
Probabilities::usage ="Probabilities is an option for IFSRender, which specifies the set of probabilities to render the fractal. The possible setting for Probabilities are Standard, Optimal, and {p1,...,pn}."
ShowFixedPoints::usage ="ShowFixedPoints is an option for IFSRender. With ShowFixedPoints->True,the fixed points corresponding to the affine contractions formingthe IFS are drawn."
ShowMaps::usage ="ShowMaps is an option for IFSRender, which shows in
a different color each one of the maps."
ShowProbabilities::usage ="ShowProbabilities is an option for IFSRender, which displaysthe probabilities used to render the fractal."
ShowFrames::usage ="ShowFrames is an option for IFSRender. With ShowFrames->True, a frame is drawn around the differentcomponents of the fractal associated with the affine contractions."
Optimal::usage ="Optimal is a setting for the Probabilities option of IFSRender."
Standard::usage ="Standard is a setting for the Probabilities option of IFSRender."
(* Output messages and errors *)
IFSRender::PrintProbabilities ="Rendering the IFS with probabilities: ``."
IFSRender::PrintOpProbabilities ="Rendering the IFS with optimal probabilities: ``."
IFSRender::PrintStProbabilities ="Rendering the IFS with standard probabilities: ``."
IFSRender::AddUpToOne ="The list of probabilities `` does not add up to one. Running with normalized probabilities."
IFSRender::IncorrectProbabilities ="`` is not a valid Probabilities specification."
(* Fractal Gallery *)
Cantor::usage="This set was introduced by G. Cantor in 1855 and emergedas an example of certain exceptional sets: start with the unit interval(0,1), remove the middle third (1/2,2/3) and apply a repetitive schemeof operations to the remaining two parts."
CantorTwoScales::usage="Two scaled Cantor set."
Koch::usage=Koch2::usage="Koch's IFS model."
Sierpinsky::usage="The Sierpinsky triangle IFS model."
Fern::usage="Barnsley's fern IFS model."
Coral::usage=Twig::usage=Tree::usage=Leaf::usage="IFS model."
Spiral::usage=ZigZag::usage=Dragon::usage="IFS model."
Bones::usage=Noisy::usage=Neuron::usage="IFS model."
Gather::usage=Cloud::usage=Blocks::usage="IFS model."
Asbestos::usage=Leaf2::usage=Art::usage="IFS model."
Crystal::usage=ChristmasTree::usage="IFS model."
Chaos::usage="IFS model example of a fractal text."
Begin["`Private`"]
(* Default values *)
Options[IFSRender] = {Probabilities -> Optimal, ShowProbabilities -> False, ShowFixedPoints -> False, ShowMaps -> False, ShowFrames -> False, PlotRange -> Automatic, AspectRatio -> Automatic, DisplayFunction -> $DisplayFunction};
(*************)(* Main Code *)(*************)
fp[{a_, b_}] := -Inverse[a - id].b
fixedPoints[ifs_] := Map[fp, ifs]
f[{a_, b_}, x_] := a.x + b
ifsdStep[ifs_, Point[x_]] := Map[Point[f[#, x]]&, ifs]
ifsdStep[ifs_, h_[x__]] := Map[h, Outer[f, ifs, x, 1]]
IFSDRender[ifs_, n_Integer, start_:Point[{-1,1}] ] := Show[Graphics[ Nest[Function[grlist, Flatten[Map[ifsdStep[ifs, #]&, grlist]]], {start}, n] ], AspectRatio -> Automatic]
ChaosGame[ifs_, pr_, {x0_, y0_}, n_] :=Module[{cum, r, i, j}, cum = Rest[FoldList[Plus, 0.0, pr]]; NestList[ (r = Random[]; i = 1; j = Scan[If[# > r, Return[i], i++]&, cum]; f[ifs[[j]], #])&, {x0, y0}, n] ]
factors[ifs_] := Map[Sqrt[Abs[Det[First[#]]]]&, ifs]
FractalDimension[ifs_] :=Module[{ecu, d}, ecu = Apply[Plus, factors[ifs]^d]; d /. FindRoot[ecu == 1, {d, 0.5}] ]
ChaosGame[ifs_, pr_, {x0_, y0_}, n_] :=Module[{cum, r, i, j}, cum = Rest[FoldList[Plus, 0.0, pr]]; NestList[ (r = Random[]; i = 1; j = Scan[If[# > r, Return[i], i++]&, cum]; f[ifs[[j]], #])&, {x0, y0}, n] ]
StandardProbs[ifs_] := (#/(Plus @@ #))& @ Map[Max[0.1, Abs[Det[First[#]]]]&, ifs]
OptimalProbs[ifs_] := Module[{ss, ls, ecu, p1}, ss = Map[Max[0.1, #]&, factors[ifs]]; ls = Log[Rest[ss]]/Log[First[ss]]; ecu = Plus @@ (p^ls); p1 = Chop[p /. FindRoot[ecu + p == 1, {p, 0.5}]]; Prepend[p1^ls, p1] ]
IFSMeasure[ifs_, probs_, npoints_, {nx_, ny_}] :=Module[{s, a, b, c, d}, s = ChaosGame[ifs, probs, {0.5, 0.5}, npoints]; {{a, b}, {c, d}} = Map[{Min[#], Max[#]}&, Transpose[s]];
BinCounts[s, {a, b, (b-a)/nx}, {c, d, (d-c)/ny}]/ (Length[s] - 2) // N]
ShowIFSMeasure[ifs_, probs_, npoints_, {nx_, ny_}, opts___Rule] := ListPlot3D[ IFSMeasure[ifs, probs, npoints, {nx, ny}], opts, ColorFunction -> Hue, PlotRange -> {0, 1/(nx + ny)}, ViewPoint -> {0.3, -0.7, 1.8}, Axes -> False, Boxed -> False]
IFSRender[ifs_, n_, opts___Rule] :=Module[{probs, sFixed, sMaps, sProbs, sFrames, p, rang, aspect, displayF, le = Length[ifs], sum, points, x, xx, y, yy, rect},
{probs, sFixed, sMaps, sProbs, sFrames, rang, aspect, displayF} = {Probabilities, ShowFixedPoints, ShowMaps, ShowProbabilities, ShowFrames, PlotRange, AspectRatio, DisplayFunction} /. {opts} /. Options[IFSRender];
(* calculate probabilities *)
If[!(probs === Standard || probs === Optimal), If[VectorQ[probs] && Length[probs] == le, If[(sum = Plus @@ probs) == 1, p = N[probs], Message[IFSRender::AddUpToOne, probs]; p = N[probs/sum] ], Message[IFSRender::IncorrectProbabilities, probs]; Return[$Failed]; ], Which[probs === Optimal, p = OptimalProbs[ifs], probs === Standard, p = StandardProbs[ifs] ] ];
(* print probabilities? *)
If[sProbs, Which[probs === Standard,
Message[IFSRender::PrintStProbabilities, p], probs === Optimal, Message[IFSRender::PrintOpProbabilities, p], True, Message[IFSRender::PrintProbabilities, p] ] ]; (* calculate fractal with Chaos game algorithm *)
points = Drop[ChaosGame[ifs, p, {0.5, 0.5}, 100 + If[sMaps, Round[n/le], n]], 100];
(* render fractal *)
Show[Graphics[{ If[sMaps, (* ShowMaps = True *) {PointSize[0.005], MapIndexed[Function[{map, i}, {Hue[(1 + i[[1]])/le], Map[Point[f[map, #]]&, points]}], ifs]}, (* ShowMaps = False *) {PointSize[0.005], Map[Point, points]}],
If[sFixed, (* show fixed points? *) {PointSize[0.02], Map[Point, fixedPoints[ifs]]}, {}],
If[sFrames, (* show frames? *) {{x, xx}, {y, yy}} = Map[{Min[#], Max[#]}&, Transpose[points]]; rect = {{x, y}, {x, yy}, {xx, yy}, {xx, y}, {x, y}}; Map[Line, Outer[f, ifs, rect, 1]], {}] }, PlotRange -> rang, AspectRatio -> aspect, DisplayFunction -> displayF ]]]
IFSAnimate[ifs_, {par_, min_, max_, step_}, n_, opts___Rule] := Table[IFSRender[ifs /. par -> i, n, opts], {i, min, max, step}]
IFSCompare[ifs_, n_, opts___Rule] := Show[GraphicsArray[
Map[IFSRender[ifs, n, Probabilities -> #, ShowProbabilities -> True, DisplayFunction -> Identity, opts]&, {Standard, Optimal}] ]]
(* Fractal Gallery *)(* IFS Fractal = {{Rotations-Scales_matrix,Translation_vector},...} *)
id = IdentityMatrix[2];
rot[a_] := {{Cos[a], Sin[a]}, {-Sin[a], Cos[a]}}
Sierpinsky = { {1/2 id, {-1, 0}}, {1/2 id, {1, 0}}, {1/2 id, {0, 1}} } // N;
Cantor = { {1/3 id, {0., 0.4}}, {1/3 id, {0.67, 0.4}} } // N; CantorTwoScales = { {0.6 id, {0, 0}}, {0.3 id, {0.7, 0}} };
Koch = { {1/3 id, {0, 0}}, {1/3 rot[-Pi/3], {1/3, 0}}, {1/3 rot[Pi/3], {1/2, Sin[Pi/3]/3}}, {1/3 id, {2/3, 0}} } // N;
Tree = { {{{0.195, -0.448}, {0.334, 0.443}}, {0.443, 0.245}}, {{{0.462, 0.414}, {-0.252, 0.361}}, {0.251, 0.569}}, {{{-0.058, -0.07}, {0.453, -0.111}}, {0.598, 0.097}}, {{{-0.035, 0.07}, {-0.469, -0.022}}, {0.488, 0.507}}, {{{-0.637, 0.}, {0., 0.501}}, {0.856, 0.251}} };
(* Barnsley's Fern *)
Fern = { {{{0.81, 0.07}, {-0.04, 0.84}}, {0.12, 0.195}}, {{{0.18, -0.25}, {0.27, 0.23}}, {0.12, 0.02}}, {{{0.19, 0.275}, {0.238, -0.14}}, {0.16, 0.12}}, {{{0.0235, 0.087}, {0.045, 0.1666}}, {0.11, 0.0}} };
Koch2=List[
List[{{0.31,0.00},{0.00,0.29}},{4.12,1.60}], List[{{0.19,-0.21},{0.65,0.09}},{-0.69,5.98}], List[{{0.19,0.21},{-0.65,0.09}},{0.67,5.96}], List[{{0.31,0.00},{0.00,0.29}},{-4.14,1.60}], List[{{0.38,0.00},{0.00,-0.29}},{-0.01,2.94}]];
Coral=List[ List[{{0.31,-0.53},{-0.46,-0.29}},{ 5.40,8.66}], List[{{0.31,-0.08},{ 0.15,-0.45}},{-1.30,4.15}], List[{{0.00, 0.55},{ 0.69,-0.20}},{-4.89,7.27}]];
Twig=List[ List[{{-0.46,0.02},{-0.11,0.01}},{0.4,0.4}], List[{{0.39,0.43},{0.43,-0.39}},{0.26,0.52}], List[{{0.44,-0.09},{-0.01,-0.32}},{0.42,0.51}]];
Crystal=List[ List[{{0.255, 0.},{0., 0.255}},{0.372, 0.671}], List[{{0.255, 0.},{0., 0.255}},{0.115, 0.223}], List[{{0.255, 0.},{0., 0.255}},{0.631, 0.223}], List[{{0.37, -0.642},{0.642, 0.37}},{0.636, -0.006}]];
Tree1=List[ List[{{ 0.05 , 0} , { 0 ,.5 }},{ 0 , 0}], List[{{.42 ,-.42}, {.42 , .42 }},{ 0, .2 }], List[{{.42 , .42} ,{-.42 ,.42 }},{ 0, .2 }]];
ChristmasTree=List[ List[{{0., -0.5},{0.5, 0.}},{0.5, 0.}], List[{{0., 0.5},{-0.5, 0.}},{0.5, 0.5}], List[{{0.5, 0.},{0., 0.5}},{0.25, 0.5}]];
Leaf=List[ List[{{0.515152,-0.719697},{-0.636364,-0.397727}},{4.301069,6.186183}], List[{{-0.515152,0.219697},{-0.242424,-0.234848}},{-3.667063,8.847470}]];
Spiral=List[ List[{{0.79,-0.42},{0.24,0.86}},{1.76,1.41}],
List[{{-0.12,0.26},{0.15,0.05}},{-6.72,1.38}], List[{{0.18,-0.14},{0.09,0.18}},{6.09,1.57}]];
ZigZag=List[ List[{{-0.63,-0.61},{-0.55,0.66}},{3.84,1.28}], List[{{-0.04,0.44},{0.21,0.04}},{2.07,8.33}]];
Dragon=List[ List[{{0.82,0.28},{-0.21,0.86}},{-1.88,-0.11}], List[{{0.09,0.52},{-0.46,-0.38}},{0.79,8.10}]];
Bones=List[ List[{{ 0.771,-0.485},{-0.419,-0.725}},{ 2.094,7.425}], List[{{-0.259,-0.109},{-0.136, 0.171}},{ 5.865,0.737}], List[{{ 0.309, 0.125},{ 0.265,-0.074}},{-5.623,8.169}]];
Noisy=List[ List[{{ 0.424,-0.651},{-0.485,-0.345}},{ 3.964, 4.222}], List[{{-0.080,-0.203},{-0.743, 0.205}},{-4.092, 3.957}]];
Neuron=List[ List[{{0.636,-0.727},{-0.636,-0.398}},{ 3.433,6.078}], List[{{0.030,-0.189},{ 0.666,-0.167}},{ 0.527,3.675}], List[{{0.212, 0.049},{ 0.273, 0.545}},{ 3.038,1.347}], List[{{0.090, 0.182},{-0.152, 0.447}},{-3.220,5.596}]];
Gather=List[ List[{{-0.312,-0.832},{ 0.812,-0.283}},{ 3.870,7.404}], List[{{0.125, 0.317},{-0.187,-0.130}},{ 2.043,7.917}], List[{{-0.062,-0.197},{ 0.250, 0.173}},{-3.132,0.846}]];
Cloud=List[ List[{{ 0.75,0.},{0.,-0.75}},{ 1.025,8.419}], List[{{-0.75,0.},{0., 0.75}},{-1.468,1.203}], List[{{-0.75,0.},{0., 0.75}},{-2.549,2.283}], List[{{ 0.75,0.},{0.,-0.75}},{ 2.106,7.338}]];
Blocks=List[ List[{{ 0.0,0.3},{0.54,0.}},{.69,.44}], List[{{-0.65,0.},{0., .41}},{.66,.57}], List[{{ 0.24,0.},{0.,-.32}},{.33,.35}], List[{{ 0.38,0.},{0., .41}},{.6,.02}], List[{{-0.28,0.},{0.,-.523}},{.3,.53}]]; Asbestos=List[ List[{{ 0.308,-0.531},{-0.461,-0.294}},{ 4.123,7.711}], List[{{ 0.308,-0.077},{ 0.153,-0.448}},{-1.536,5.002}], List[{{ 0.000, 0.545},{ 0.692,-0.196}},{-5.296,7.590}], List[{{-0.308,-0.014},{ 0.231,-0.399}},{ 2.393,5.071}]];
Leaf2=List[ List[{{ 0.242,-0.640},{-0.909,-0.318}},{ 4.612,5.593}], List[{{-0.091,-0.557},{-0.485, 0.155}},{-1.064,5.654}]];
Art=List[ List[{{ 0.75,-0.46},{ 0.41, 0.89}},{1.46,0.69}], List[{{-0.42,-0.07},{-0.18,-0.22}},{3.81,6.74}]];
Chaos=List[ List[{{0, 0.053},{-0.429, 0}},{-7.083, 5.43}], List[{{0.143, 0},{0, -0.053}},{-5.619, 8.513}], List[{{0.143, 0},{0, 0.083}},{-5.619, 2.057 }], List[{{0, 0.053},{0.429, 0}},{-3.952, 5.43 }], List[{{0.119, 0},{0, 0.053}},{-2.555, 4.536 }], List[{{-0.0123806, -0.0649723},{0.423819, 0.00189797}},{-1.226, 5.235 }], List[{{0.0852291, 0.0506328},{0.420449, 0.0156626}},{-0.421, 4.569 }], List[{{0.104432, 0.00529117},{0.0570516, 0.0527352}},{0.976, 8.113 }], List[{{-0.00814186, -0.0417935},{0.423922, 0.00415972}},{1.934, 5.37}], List[{{0.093, 0},{0, 0.053}},{0.861, 4.536 }], List[{{0, 0.053},{-0.429, 0}},{2.447, 5.43 }], List[{{0.119, 0},{0, -0.053}},{3.363, 8.513 }], List[{{0.119, 0},{0, 0.053}},{3.363, 1.487 }], List[{{0, 0.053},{0.429, 0}},{3.972, 4.569 }], List[{{0.123998, -0.00183957},{0.000691208, 0.0629731}},{6.275, 7.716}], List[{{0, 0.053},{0.167, 0}},{5.215, 6.483 }], List[{{0.071, 0},{0, 0.053}},{6.279, 5.298 }], List[{{0, -0.053},{-0.238, 0}},{6.805, 3.714 }], List[{{-0.121, 0},{0, 0.053}},{5.941, 1.487 }]];
End[] EndPackage[]
Appendix A: IFS primitive exampleifs0 IFSscale0.3, 0.8, AffineMap0.2, 0.4, 0.9, 0.5, 2, 2, AffineMapx, y,0.9y 2, x 0.1y 2gr1ShowGraphicsLine1, 1,1, 1,1, 1, Polygon1, 1,0.5, 1.5,0.7, 0.8,PointSize0.05, Point0.7, 0.6,Thickness0.04, GrayLevel0.6, Line1, 1.5,1, 1.2,GrayLevel0.8, Disk0.8, 0.1, 0.3,GrayLevel0.4, Rectangle.8, .1,1.6, .5, Circle0, 0.8, 0.5, AspectRatio Automatic;
ShowNestifs0, gr1, 4;
BibliographyFrom snowflake formation to growth of bacterial colonies. Part I. Diffusive patterning in
azoic systems, Eshel Ben-Jacon, Contemporary Physics, 1993, volume 34, number 5,
pages 247-273
Fractals, Chaos, Power Laws, Manfred Shroeder, W.H. Freeman and company, 1991,
pages 198-200
Mechanism of the transition from fractal to dendritic growth of surface aggregates, Brune
et. al., Nature, 9 June 1994, Volume 369