This is a post from a series in my project.

PBS Nova is a great TV show. They have really neat episodes. One of my favorites is “Hunting the Hidden Dimension.” It’s about basic ideas of fractal geometry, applications of fractals to our lives, and a little history about the people involved in exploring fractals. I found it on YouTube (below). It’s something to watch when you have about an hour free.

Fractals are everywhere in our lives. You could call it nature’s geometry. Bacterial growth, plant growth and development, and lightning patterns can be fractal.

This is a cousin of the broccoli family: Romanesco. It’s Mandelbrot’s favorite vegetable.

Cut a red cabbage in half. What do you get? A neat, complicated pattern.

What’s a fractal? Strangely, a simple Google search of the term “fractal” yields a wide range of results. Some definitions claim self-similarity as a prerequisite, while others rely on various numerical methods. A simple interpretation: **a fractal is a geometric shape whose complexity is independent of any spatial scale**. Between the particulars of varying definitions, one thing is consistent: they all agree that the main idea of fractals is that a simple condition undergoes many iterations to become a very complex process. This implies that you can model complicated processes via fairly simple underlying principles.

In my opinion, the kind gentleman in the video below explains the Mandelbrot set and Julia sets really well. Enormous complexity comes from a deceivingly simple equation: . You don’t need to know that much about fractals or mathematics to understand what he’s telling you. (Well I guess you should know that there are such things as imaginary numbers and when you have a combination of real and imaginary numbers, it’s called a complex number).

There are many ways to create fractals on the computer, and a popular mathematical theory of plant development is called a Lindemayer system, or L-system for short. Aristid Lindenmayer, a biologist, developed L-systems to capture the developmental processes of plants. The central concept of L-systems is rewriting; defining complex objects by continually overwriting parts of a simple initial object using a particular set of rewriting rules. This quality (rewriting) is what naturally lends this method of modelling to fractal geometry. He collaborated with Przemyslaw Prusinkiewicz to write this book: The Algorithmic Beauty of Plants. The book explores various algorithms to generate realistic images of plants on the computer. The value of this kind of work is that you can find out how significantly (or insignificantly) certain factors (climate change, pollution, drought, fire, etc.) affect plant growth without actually spending months or years cultivating a plant. Modeling plant growth on the computer is a way of quickly finding out what we need to do to preserve our environment. Other applications of this work are in computer graphics (think movies like Star Wars or video games like Assassin’s Creed); there are a lot of problems computer scientists face to make scenery look realistic and to keep things within memory limits. This post is a general overview of the main ideas of this book. You can easily implement the ideas from this book into any programming language. I generated the plots below in Matlab.

# L-Systems

To see an L-system in action, you should visualize a small turtle on the display of your personal computer. This turtle will only move once he is given the proper instructions. His state is defined in terms of , where is his position on the Cartesian plane and is the direction he is facing. For instance, moving one step forward of length is encoded as , turning to the left at the angle is and turning right at the angle is . The increment angle is simply a constant combined with the turtle’s initial direction. The figure below demonstrates how a turtle would interpret these encoded instructions:

L-systems rewrite strings in parallel and simultaneously, and this is what differentiates them from other string rewriting methods, such as Chomsky grammars. In Chomsky grammars, strings are rewritten sequentially. Biologically speaking, many natural processes occur simultaneously and in parallel to each other (e.g. cell division). L-systems follow this principle most closely. For instance, consider cell division of the filamentous cyanobacteria, *Anabaena catenula*.

*Anabaena catenula* lives in ponds. You might consider it a type of pond scum. Interestingly, it is also found in the roots of certain cycads, participating in a symbiotic relationship with them. Cycads with this relationship have apogeotrophic roots (roots that grow towards the sun) in addition to subterranean ones so that the cyanobacteria can photosynthesize. This cyanobacteria reproduces asexually. Each cell splits into two daughter cells, each with a different polarity (orientation) and size. Once a cell has reached a certain maturity (indicated by its size), it may divide into two more cells. This process can occur at any place in the filament.

Let us begin with four characters: and . The symbols and represent different types of cells in the filament. The subscripts and represent the directions left and right, respectively, and indicate a cell’s polarity. Furthermore, let us implement some rewriting rules. For every in our character string, let us use the rule . This means that will replace every instance where occurs in our character string. The remaining rules are listed below:

We can capture the cytological states of the cells (their size and readiness to divide) with these symbols and rewriting rules. The figure below is a pictorial representation of a few iterations of our new rules:

This was a simple example that should help you understand the underlying logic of an L-system. But, let’s be real. This model draws a straight line. B-o-r-i-n-g. Making the system a little more complicated will generate some really cool shapes. Due to the discrete nature of L-systems, the main limitation of this model is that it cannot capture the infinitely many subdivisions that take place. Thus, there is another parameter that determines the maximum number of iterations for each L-system, . L-systems are a powerful tool because they help us decompose an aspect of a complex process into a set of rewriting rules, an axiom, and a maximum number of iterations.

This is the evolution of a Gosper curve.

(here, just means the starting place.)

This sequence of pictures represents how many iterations the computer did to generate the last picture: . That’s the power of L-systems. You can get incredibly complicated shapes in just 4 repetitions! Compare that to other fractal modeling methods, like stochastic models, which require thousands of iterations to converge. How neat is this?

# Plants

What about plants? Right. Here is a carrot leaf:

This is how you would model it in the computer:

I had to use some new symbols and techniques to create this leaf in the computer: the square brackets. It’s not a really complicated idea, but it may seem strange to people who aren’t familiar with computer science. The brackets represent when to “push” or “pop” something off of the “stack.” Every time you see a “[“, it means “Store the current drawing position and orientation. Write it to a stack (a type of data structure) so that many states are saved in order.” A “]” means “Use the last state (the top of the stack) as the current state of the turtle.” The stack is just a way of bookkeeping turtle orientations. And here are the iterations:

For a stick figure, I think this is a pretty close representation of a carrot leaf! (Although since I coded it, I guess I am a little biased.) This is basically what the book explores. It has much more detail, many more examples, and many other techniques. You can model the way the scales on a pineapple form or maybe you’re interested in the way seeds on a sunflower orient themselves. Both of these examples are in the book. There are so many applications of fractals to our lives and our world. This is just one example of how they apply to us. Think about your cell phone. How does it receive signals? The antennae in it is bent into a fractal pattern because it turns out that this pattern maximizes the amount of antennae you can fit into a small space, which means you can receive the widest range of signals (bluetooth, radio, satellite, etc.). The world around us is teeming with fractals just waiting to be discovered.

Speaking of sunflowers, this is a nice video that explores them as an aspect of the golden ratio, yet another fascinating number.

In the words of the late and great Mandelbrot: “Clouds are not spheres, mountains are not cones, coastlines are not circles, and bark is not smooth, nor does lightning travel in a straight line.”

Pingback: Eating fractals | Carmen Torres-Sanchez