Free course · Module II · Dimension and construction · Lesson 13 of 21 · about 15 minutes

L-systems

In this lesson you will
  • Define an L-system: alphabet, axiom and rules
  • Interpret strings with turtle graphics
  • Build branching plants with brackets

The biologist Aristid Lindenmayer introduced L-systems in 1968 to model how plants and algae grow. An L-system has an alphabet of symbols, a starting string called the axiom, and production rules. At each step, every symbol is rewritten at the same time, which mimics cells dividing in parallel.

To draw the result, a “turtle” reads the string as commands: F draws forward, + and − turn by a fixed angle, [ saves the turtle’s position and heading, and ] returns to the saved state. Brackets make branching possible.

The Koch curve is the L-system with axiom F, rule F → F+F−−F+F and angle 60°. A simple plant is F → F[+F]F[−F]F with an angle of about 25°. The Heighway dragon in the Types of fractals section uses two symbols, X → X+YF+ and Y → −FX−Y, with 90° turns.

L-systems are now standard in botanical modelling and in graphics software for generating trees and vegetation. Przemysław Prusinkiewicz and Lindenmayer’s book The Algorithmic Beauty of Plants (1990) is the classic reference.

Key terms L-system axiom production rule turtle graphics bracketed L-system

Try it live: Adjust the branching tree in the Growth rules section →

Lesson quiz

  1. How are symbols rewritten in an L-system?

    • One at a time, left to right
    • All at once, in parallel
    • Only the last symbol
    • At random
    Show answer

    All at once, in parallel. Parallel rewriting is what distinguishes L-systems from ordinary grammars.

  2. What does the symbol “[” tell the turtle to do?

    • Turn left
    • Draw forward
    • Save its current position and heading
    • Stop drawing
    Show answer

    Save its current position and heading. “[” pushes the state; “]” pops it, so branches return to where they started.

  3. Which rule produces the Koch curve with a 60° angle?

    • F → F+F−−F+F
    • F → FF
    • F → F[+F]F
    • X → X+YF+
    Show answer

    F → F+F−−F+F. Each F becomes four segments with the 60° bump in the middle.

Take this quiz interactively and save your progress (free) →