by Dirk Brockmann

This explorable illustrates one of the simplest ways to generate fractals by an iteration process in which elements of a structure are replaced by a smaller version of the whole structure. Similar to the Weeds & Trees Explorable, these structures can be viewed as Lindenmayer systems. A great variety of examples of such fractals exist.

Here you can explore some of the most famous ones (e.g. the Koch Snowflake and the Sierpinski Triangle) and a few that aren’t so well known (e.g. the Golden Dragon or the Anti Koch Snowflake).

This is how it works:

First, select a system (my favorite is the Golden Dragon) and iterate the system by repeatedly pressing the play button.

Initially, the object is usually just a single line segment, or a set of segments. When you press play each segment is replaced by a set of smaller segments. When you press play again, this process is repeated and the whole structure evolves into a fractal curve characterized by a non-integer dimension (typically).

Each of the different systems differs in it’s rules, i.e. in the way an initial segiment is replaced by a set of smaller ones. For example, in the Dragon Curve the initial segment is replaced by two segments that make a 90° angle. The smaller segments are scaled down by a factor $1/\sqrt{2}$. In the Sierpinski Triangle the initial segment is replaced by three smaller lines that are scaled by $1/2$. This way, as the number of iterations increases, the number of segments increases and their individual length decreases.

Just a tiny bit of math:

To understand a bit of the fractal nature of the structures and the concept of fractal dimension we can look at the Sierpinski curve again. Here we begin with a single ($N _0 = 1$) line that has length $l _0 = 1$. After one iteration we have $N _1=3$ segments of length $l _1 = 1/2$, at step 2 we have $N _2=9$ segments each of length $l _2=1/4$. At iteration step $k$ we have

[ N _k = 3 ^k \qquad l _k = 2 ^{-k} ]

which means that the total length of the curve is $L _k = (3/2) ^k$ which becomes infinitely large as $k\rightarrow \infty$.

We can define a dimension $D$ associated with the structure like so:

[ N _k \sim \left( \frac {1}{l _k}\right)^D. ]

In the case of the Sierpinski triangle this gives $D=\log 3 / \log 2 \approx 1.5849$ which is between 1 and 2, so a bit larger than the dimension of a line, and smaller than the dimension of a plane. For the Koch Snowflake we get $D = 2 \log 2 / \log 3 \approx 1.2618$, also between 1 and 2.

For the Dragon Curve we obtain $D= \log 2 / \log \sqrt 2 = 2$, so it’s two dimensional, which you can also see if you iterate it sufficiently often. The same is true for the Terdragon Curve.


Each one of the systems above can be represented as a series of symbol sequences, each sequence representing the geometry of the structure at the corrensponding iteration step. For example, the Sierpinski triangle can be represented as

  1. $A$
  2. $B-A-B$
  3. $A+B+A-B-A-B-A+B+A$
  4. $…$

at iterations 1,2,3,… This series is generated by the two replacement rules $A\rightarrow B-A-B$ and $B\rightarrow A+B+A$. If we now interpret the letters A and B as “draw a segment” and the symbols + and - as “turn left” and “turn right” by 60°, respectively, we obtain the first three geometries of the Sierpinski triangle.

For each of the fractals above a similar system can be defined. For more information see Lindenmayer systems.

Related Explorables:

Prime Time

The distribution of primes along number spirals


A stochastic cellular automaton

Weeds & Trees

Lindenmayer Systems

Anomalous Itinerary

Lévy flights

Anomalous Itinerary

Lévy flights

Stranger Things

Strange attractors