Mathematics of L System Fractals

 

L Systems are a compact way to describe iterative turtle graphics. It was originally developed by Aristid Lindenmeyer in studies of plant morphology and development. The fractals are constructed from line segments using a set of rules. The rules include commands such as draw forward, move forward, turn by a specified angle, etc. The commands start with an initial drawing string, called the axiom. The axiom can reference additional command strings, which themselves can be recursive. The axiom is then executed recursively. With each iteration, every line segment is replaced with all the commands in the axiom. Lets define some commands, create an axiom, and we what types of structures are produced.

    Angle n             default rotation by 360/n degrees
    +                        rotate counterclockwise
    -                         rotate clockwise
    F                        Draw forward
    G                       Move forward
    Cnn                   Select color nn
    <nn                    Increment color by nn
    >nn                    Decrement color by nn

The following set of rules will produce a colored Koch snowflake. 

    Angle 6
    Axiom F--F--F
    F=F>1+F--F+F

Koch Snowflake from 6 Iterations
of the Axiom

The following rules produce a dragon curve.

    Angle 8
    Axiom FX
    F=>1
    Y=+FX--FY+
    X=-FX++FY-

Dragon Curve from 14 Iterations
of the Axiom

The L System rules are capable of producing considerably more complex images, as shown below: