1

Parametric L-Systems and borderline fractals A preprint version of a “Mathematical graphics” column from Mathematica in Education and Research . Mark McClure Department of Mathematics University of North Carolina at Asheville Asheville, NC 28804 [email protected] Abstract L-systems have been widely used to describe fractal curves and generate realistic images of plants. In this column, we discuss L-systems that depend upon a parameter and their application to borderline fractals. Note: To reduce the size of the file, the graphics in this file have all been converted to bitmap form. Of course, they may be regenerated within Mathematica.

ü Initialization

1. Introduction An L-system is a type of tool that can be used to generate artificial plants, fractal curves, and other complicated objects on a computer. The basic components of an L-system are an initial string or axiom, a list of replacement rules that act recursively on the axiom to construct more complicated strings, and a technique to generate an image from these strings. While the axiom and replacement rules might be very simple, recursive application of the replacement rules can generate very complicated strings which, in turn, can lead to interesting graphics. Translation of the string into a graphic is sometimes called turtle graphics due to the following interpretation. Imagine you hand a string to a turtle who interprets the individual characters as instructions. Typically, "F" is interpreted to mean step forward one unit and draw a line, "+" is interpreted to mean rotate counter-clockwise through some pre-specified angle (say 60° ), and "-" is interpreted to mean rotate clockwise through the same angle. Given this interpretation, the string "F -- F -- F" would generate an equilateral triangle. Now suppose that each "F" in the axiom is replaced by a more complicated string, say "F + F -- F + F", and this process is repeated several times. As we can see using Nest and StringReplace, this generates a much more complicated string.

2

axiom = "F--F--F"; replacementRule = "F" Ø "F+F--F+F"; Nest@StringReplace@#, replacementRuleD &, axiom, 2D F+F--F+F+F+F--F+F--F+F--F+F+F+F--F+F--F+F--F+F+F+ F--F+F--F+F--F+F+F+F--F+F--F+F--F+F+F+F--F+F--F+F--F+F+F+F--F+F

The recursive nature of this process has led to a very complicated string and turtle interpretation of such strings can lead to stunning images. The notion of an L-system originated in the work of Aristid Lindenmayer and was further developed by Lindenmayer, Prusinkiewicz, and others. Their main objective was to obtain an efficient means to model plant growth on a computer, but L-systems are also a natural way to describe many fractal curves. The definitive description of the L-system concept is contained in [1] and an L-system generator based on this work is available online [2]. There are a number of L-system implementations in Mathematica as well (for example, [3,4,5]). The code described in this column is based in large part on the work of Wagon [5], although a number of extensions have been made. In particular, we focus on L-systems where more complicated substitutions involving a parameter are involved and investigate how these can lead to borderline fractals.

2. Implemention of parametric L-systems The basic idea behind a parametric L-system is to include a parameter and allow the substitution rule to affect the parameter as well. We'll illustrate the technique by generating a famous fractal set called the Koch snowflake. The typical L-system technique to generate this set is to iteratively apply the simple rule "F" Ø "F + F -- F + F" starting from the axiom "F -- F -- F". Using a parametric approach, we could represent the rule as "FHxL" Ø "FHx ê 3L rHp ê 3L FHx ê 3L rH-2 p ê 3L FHx ê 3L rHp ê 3L FHx ê 3L" and the axiom as "FH1L rH-2 p ê 3L FH1L rH-2 p ê 3L FH1L". The turtle could then interpret the parameters as step size, rotation angle, or some other appropriate geometric quantity. While this is a bit more complicated, it is also more flexible, allowing more general step sizes and rotations angles to be used. To implement this in Mathematica, it makes more sense to work with a list of expressions rather than with a string, even though L-systems were initially defined in terms of strings. That is, it's easier to work in Mathematica with F[x_] than it is to work with "F(x)". Thus our fundamental objects will be lists of Mathematica expressions corresponding to turtle directives. The two simplest turtle directives are F[x], meaning move forward x units and draw a line, and r[q], meaning rotate through the angle q. Thus the axiom and rule for the Koch snowflake can be represented as follows. axiom = 8F@1D, r@-2 p ê 3D, F@1D, r@-2 p ê 3D, F@1D<; KochRule = F@x_D ß 8F@x ê 3D, r@p ê 3D, F@x ê 3D, r@-2 p ê 3D, F@x ê 3D, r@p ê 3D, F@x ê 3D<;

We now iteratively apply the rule to the axiom and store the result as instructions. instructions = Flatten@Nest@# ê. KochRule &, axiom, 5DD;

The variable instructions now contains a fairly complicated list. In [5], Wagon devised an elegant way to interpret this as a graphic. We first define a few variables to contain the image, specify the location and direction of the turtle, and define a rotation matrix. lines = 8<; lastpt = 80, 0<; dir = 81, 0<;

3

rotate@q_D := N@8 8Cos@qD, -Sin@qD<, 8Sin@qD, Cos@qD<
We now define a list of substitutions that will be performed on the instructions. Note that these substitutions will be performed in order on each element in the list instructions and each substitution results in a modification of lines, lastpt, or dir. turtleInterpretation = 8 F@x_D ß Hlines = 8Line@8lastpt, lastpt += x dir
Finally, we perform the substitutions and display the resulting image contained in lines. instructions ê. turtleInterpretation; Show@Graphics@linesD, AspectRatio Ø AutomaticD;

3. Examples The algorithm described in the previous section has been encapsulated in the ShowPLSystem command defined in the PLSystem package. We now load this package, after removing a couple of symbols we've used to avoid shadowing. Remove@r, FD; Needs@"PLSystem`"D;

The package recognizes the standard string notation used by many L-system implementations, provided no parameters are used. Thus, here is a look at the Koch curve, which is part of the Koch snowflake.

4

ShowPLSystem@"F" Ø "F+F--F+F", "F", 6, Angle Ø p ê 3D;

While the main objective in this column is to explore borderline fractals, care has been taken to make the package capabilities and notation consistent with [1] where possible. We refer the interested reader to [1] and give a few more examples here. For example, open and closed brackets ("[" and "]") may be used to construct branching structures, "!" may be used to decrement the width segments by a pre-specified factor, and miscellaneous symbols may be used in the expansion rules, which are then subsequently ignored by the turtle.

5

ShowPLSystem@8"F" Ø "FF", "X" Ø "F!@+!XD@--!XDFX"<, "X", 7, Angle Ø 12 Degree, InitialDirection Ø 80, 1<, InitialWidth Ø .03, WidthRatio Ø .8D;

When parameters do appear, we must represent the rules and axiom usings lists of Mathematica expressions. Again, this allows much greater flexibility and, therefore, variety. In the following example, A[l,w] might represent one type of branch with a specified length and width, while B[l,w] represents another type. The types are very similar, but differ slightly in how they decompose into smaller branches. Note that "+"/"-", "!", "[", and "]" have been replaced by r, setWidth, push, and pop respectively.

6

ShowPLSystem@8 A@l_, w_D ß 8setWidth@wD, F@lD, push, r@24 DegreeD, [email protected] l, 0.7 wD, pop, push, r@-22 DegreeD, [email protected] l, 0.8 wD, pop<, B@l_, w_D ß 8setWidth@wD, F@lD, push, r@19 DegreeD, [email protected] l, 0.8 wD, pop, push, r@-39 DegreeD, [email protected] l, 0.6 wD, pop<<, B@1, .035D, 9, InitialDirection Ø 80, 1<, PlotRange Ø AllD;

All the turtle directives for two-dimensional graphics described on page 209 of [1] are supported. The TurtleDirectiveButtons[] command returns a list of the turtle directives with pointers to their usage statements.

4. Borderline fractals To introduce the concept of a borderline fractal, we begin by looking at several approximations to Koch's curve using the parametric formulation. KochRule = F@t_D ß 8F@t ê 3D, r@p ê 3D, F@t ê 3D, r@-2 p ê 3D, F@t ê 3D, r@p ê 3D, F@t ê 3D<; KochAxiom = F@1D; ShowPLSystem@KochRule, KochAxiom, #, FrameTicks Ø 881 ê 3, 2 ê 3, 1<, 8<, 8<, 8<<, Frame Ø TrueD & êü Range@4D;

7

Clearly, these curves are converging to a limit curve, which we call the Koch curve. By all accounts, this is an example of a fractal curve, but what exactly is a fractal curve? The definition suggested by Mandelbrot essentially boils down to this: a fractal curve is one whose fractal dimension is larger than one. As we will see, however, there are curves naturally described using parametric L-systems whose fractal dimension is one, but that are qualitatively similar to the Koch curve. A related way to classify a curve is in terms of local rectifiability.

ü Rectifiability A curve is said to be rectifiable, if it is of finite length. Furthermore, there is a natural way to describe the length of the curves generated by L-systems. Suppose that the nth level approximation of a curve described by a parametric L-system consists of Nk segments of length k . Then the length of the nth level approximation is simply Nk k . The limit of this expression as k Ø ¶ (possibly infinite) is defined to be the length of the curve. For the Koch curve, we have Nk = 4k and k = 3-k . Thus the length of the Koch curve is limkض H4 ê 3Lk = ¶. Furthermore, the length of any connected piece of the Koch curve containing more than a single point is also infinite. A curve having this property is said to be non-locally rectifiable and we might consider such a curve to be fractal.

ü Dimension For a curve of infinite length, the quantities Nk and k can be used to define a notion of fractal dimension which distinguishes the relative sizes of infinitely long curves. In fact the divider dimension d (see [6]) is simply log Nk d = - lim ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ . kض log k Although we won't go into an explanation of why this is a reasonable definition here, we can show that if the curve is rectifiable, d = 1 as we would expect. If the curve is rectifiable, then there is some positive finite number L (the length) so that Nk k Ø L as k Ø ¶. If we simply take the logarithm of both sides and solve for -logHNk L ê logHk L, we get log Nk L - ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ~ 1 - ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ Ø 1, log k log k

8

as expected. Now applying this formula to the Koch curve we find that the dimension is log 4k k log 4 log 4 d = - lim ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅ = - ÅÅÅÅÅÅÅÅÅÅ lim ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ = ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ º 1.262 . kض log 3-k -k kض log 3 log 3 Thus, we'd certainly call this a fractal curve.

ü More examples We now generalize the Koch curve construction to obtain curves of other dimensions and fractal-like curves which have dimension one. (Thus the term borderline fractal.) Suppose that 8k <¶ k=0 is a sequence so that 0 = 1 and k ê 4 § k+1 < k ê 2. Note that such a sequence must decrease monotonically to zero. Given such a sequence, there is a natural generalization of the Koch curve so that the nth level approximation consists of 4k pieces of length k . The zeroth level approximation is simply the unit interval and the Hn + 1Lst level approximation is obtained from the nth level approximation by replacing each segment of length k with four segments of length k+1 in the same manner as for the Koch curve. A precise description may be given using a parametric L-system. curveRule = F@x_, k_D ß 8F@a@kD x, k + 1D, r@ArcCos@1 ê H2 a@kDL - 1DD, F@a@kD x, k + 1D, r@-2 ArcCos@1 ê H2 a@kDL - 1DD, F@a@kD x, k + 1D, r@ArcCos@1 ê H2 a@kDL - 1DD, F@a@kD x, k + 1D<; curveAxiom = F@1, 0D;

Note that the term a[k] indicates how the length scales from the level k to level k + 1. Thus to generate the Koch curve we could take a[k]=1/3, so that k = 1 ê 3k . We can generate a curve of any dimension we like by choosing a[k] to be the appropriate constant between 1 ê 4 and 1 ê 2. For example, here is a curve of dimension -logH4L ê H logH.45LL º 1.736. Note how thick this curve seems compared to the Koch curve. a@k_D := .45; ShowPLSystem@curveRule, curveAxiom, 7D;

If a[k]=1/4, then k = 1 ê 4k and the dimension is one. In fact, the limit curve is simply the unit interval. Now suppose that a[k] is the kth term in a sequence decreasing to 1 ê 4. Then we might expect the dimension to be one, but the curve could still be non-rectifiable. Here's an example of such a curve using a parametric L-system.

9 a@k_D := 1 ê 4 + 1 ê Hk + 5L; ShowPLSystem@curveRule, curveAxiom, 7D;

Note that the curve still appears very fractal in nature. It is non-rectifiable; in fact, the length of the nth level approximation is the following expression. @n_D := ‰ a@kD; n

k=1

totalLength = 4n @nD

H6 + nL H7 + nL H8 + nL H9 + nL ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ 3024

Note that as n Ø ¶, the total length diverges to infinity. However, the rate of divergence is only comparable to n4 . This rate would have to be exponential to force the fractal dimension to be larger than 1. In fact, Mathematica can compute the dimension. Limit@-Log@4n D ê Log@@nDD, n Ø ¶D 1

If n Ø 0 a little faster, then the curve may even be rectifiable. Consider the following example. a@k_D := 1 ê 4 + 1 ê Hk2 + 5L; ShowPLSystem@curveRule, curveAxiom, 7D;

We can compute the length of the nth level approximation in the same manner. @n_D := ‰ a@kD; n

k=1

totalLength = 4n @nD

è!!! è!!! H 5 Csch@ 5 pD Gamma@H1 - 3 ÂL + nD Gamma@H1 + 3 ÂL + nD Sinh@3 pDL ë è!!! è!!! H3 Gamma@1 - Â 5 + nD Gamma@1 + Â 5 + nDL

10

Although this is a more complicated expression, Mathematica can still compute the length of the limit curve. Limit@4n @nD, n Ø ¶D

1 è!!! è!!! ÅÅÅÅ 5 Csch@ 5 pD Sinh@3 pD 3

Of course, the dimension should still be one. Limit@-Log@4n D ê Log@@nDD, n Ø ¶D 1

We invite the reader to construct a curve with dimension two and area zero.

References 1. Lindenmayer, A. and Prusinkiewicz, P., The Algorithmic Beauty of Plants. Spring-Verlag, New York, 1990. 2. Prusinkiewicz, P., The Virtual Laboratory. http://algorithmicbotany.org/virtual_laboratory/. 3. Jacob, C. Modeling growth with L-systems & Mathematica. Mathematica in Education and Research, 4 #3 (1995) 12-19. 4. Maeder, R., The Mathematica programmer (Chapter 8). AP Professional, Boston, 1994. 5. Wagon, S., Mathematica in action, 2nd ed. (Chapter 7). Spring-Verlag, New York, 1999. 6. Falconer, K., Fractal Geometry: Mathematical Foundations and Applications (Section 3.5). John Wiley & Sons, New York, 1990.

Parametric L-Systems and borderline fractals - Mark McClure

parameter and their application to borderline fractals. Note: To reduce the size of the ..... Maeder, R., The Mathematica programmer (Chapter 8). AP Professional ...

196KB Sizes 16 Downloads 224 Views

Recommend Documents

Boundary scanning and complex dynamics - Mark McClure
with this notebook. .... [2] J. Glynn and T. Gray, The Beginner's Guide to Mathematica Version 4. Cambridge University Press, NY, 2000. BoundaryScanPP.nb. 9.

Generating Google™ maps - Mark McClure
complete information is presented at the Google Maps™ API reference [2]. ... and display a Google map: an HTML file for the webpage and a javascript file that ...

Boundary scanning and complex dynamics - Mark McClure
with this notebook. .... [2] J. Glynn and T. Gray, The Beginner's Guide to Mathematica Version 4. Cambridge University Press, NY, 2000. BoundaryScanPP.nb. 9.

Generating Google™ maps - Mark McClure
If you view the HTML file in a web browser, you should see the ..... We can illustrate the algorithm using the first 360 points of the Mt. Mitchell path. dataXML ...

the prevalent dimension of graphs - Mark McClure
The extension of the various notions of \almost every" in Rn to infinite dimen- sional spaces is an interesting and difficult problem. Perhaps the simplest and most successful generalization has been through the use of category. Banach's application

Vibration of the Koch drum - Mark McClure
A preprint version of a “Mathematical graphics” column from .... More precisely, there are seven functions f0 , f1 , …, f6 that map the snow- flake onto the ...

Generating self-affine tiles and their boundaries - Mark McClure
Now for each pair Ha, bL where a and b are chosen from , we want MHa, bL to denote the set of pairs of digits. Hd, d'L so that b = A a ..... used by the program.

the prevalent dimension of graphs - Mark McClure
An easy but important property of is that it respects closure. That is. (E) = (E). Another ( F] p. 41) is that the limsup need only be taken along any sequence fcng1n=1 where c 2 (01) and we still obtain the same value. One problem with is that it is

Vibration of the Koch drum - Mark McClure
We begin by setting up the boundary of the snowflake. The level .... Norm@interiorGrid@@#DD - KochVertices@@nDDD § stepSize к 2 &D@@1DD;.

The Read-Bajraktarevic Operator - Mark McClure
0.4. 0.6. 0.8. 1. References. [1] Massopust, Peter R. Fractal functions, fractal surfaces, and wavelets. Academic Press, Inc., San Diego, CA, 1994. ReadBajPP.nb.

Vibration of the Koch drum - Mark McClure
The fundamental modes of vibration of this drum can be modelled by the eigenfunctions of the .... We begin by setting up the boundary of the snowflake.

"Decremental tag systems and random trees". - Mark McClure
1. Introduction. We fix a positive natural number m and consider sequences of the form xn ... tree construction we call the use it or lose it construction. In fact, our ...

"Decremental tag systems and random trees". - Mark McClure
We fix a positive natural number m and consider sequences of the form xn. = (x1,...,xn), where each ..... Sequences, http://www.research.att.com/~njas/sequences/.

Generating self-affine tiles and their boundaries - Mark McClure
For example, the image in figure 1 is a self-affine four-tile (i.e. it consists of four parts) ... Self-similarity and iterated function systems are, by now, fairly well known concepts. .... In figure 5, we see the image of figure 4 under the mapping

The connected locus for complex cubic iteration - Mark McClure
SupplementaryFiles directory, which should come with this notebook. The initialization .... 9 » a »2 +2 M, then the orbit of z0 will diverge to ¶. (See [4], page 266.) ...

The connected locus for complex cubic iteration - Mark McClure
SupplementaryFiles directory, which should come with this notebook. The initialization .... 9 » a »2 +2 M, then the orbit of z0 will diverge to ¶. (See [4], page 266.) ...

A Stochastic Cellular Automaton for Three-Coloring ... - Mark McClure
Aug 24, 2001 - of the tiling maps each tile to another tile. Figure 2 shows part of such a tiling. ... dynamic images are available on the author's web page:.

Infrastructural fractals
emerge, these are attempts to bridge a dualism whose terms are left intact. .... Marilyn Strathern above: 'the observer's facility to move between discrete ...... So in spite of his earlier call for a 'glorious bonfire of the dualities'(262) he is no

The Borel Structure of the Collections of Sub-Self ... - Mark McClure
|T(x) -T(y)| = r|x-y| Vx y GRd: If r < 1, then T is called contractive. A fundamental result ( Ed], Thm. 4.1.3) states that if Ti : Rd → Rd is a contractive similarity for ...

Comparison of Parametric and Non-Parametric ...
Systems (ITS) applications, in particular for safety and energy management ... Technology, China. R. Bajcsy is with the ... Section III introduces the models implemented ... 1As an alternative to iterative prediction, the GMR and ANN approaches.

The Borel Structure of the Collections of Sub-Self ... - Mark McClure
Abstract. We show that the sets of sub-self-similar sets and super-self-similar sets are both dense, first category, F subsets of K(Rd), the Hausdorff metric space of non-empty compact, subsets of Rd. We also investigate the set of self-similar sets

diffusions on fractals
probability law pn(x, ·) puts most of its mass on a ball of radius cdn. If G is not the whole of Zd then the movement of the process is on the average restricted by ...