Lindenmayer systems
L-systems
Aristid Lindenmayer introduced L-systems in 1968 to model plant growth. A symbolic axiom is rewritten in parallel at every step by applying production rules; the resulting string is then interpreted by a turtle that walks and turns, drawing the fractal as it goes.
At a glance
| Inventor | Aristid Lindenmayer, 1968 |
|---|---|
| Original motivation | Modelling cell division in algae |
| Formal class | Parallel string-rewriting grammar |
| Common variants | D0L (deterministic context-free), stochastic, parametric, 3D |
How an L-system works
- Axiom: a starting string, e.g.
ForF++F++F. - Production rules: each symbol can be replaced by a string, e.g.
F → F+F−F−F+F. - Iteration: apply every rule to every symbol in parallel. After n steps the string can be exponentially long.
- Turtle interpretation: walk through the final string.
F G A Bstep forward (drawing);+ −turn by a fixed angle;[ ]push and pop the turtle’s position and heading on a stack so the curve can branch.
Classic examples
- Koch curve: axiom
F, ruleF → F+F−F−F+F, angle 90°. - Koch snowflake: axiom
F++F++F, ruleF → F−F++F−F, angle 60°. - Sierpinski triangle: axiom
F−G−G, rulesF → F−G+F+G−F,G → GG, angle 120°. - Heighway dragon: axiom
FX, rulesX → X+YF+,Y → −FX−Y, angle 90°. - Plant: axiom
X, rulesX → F+[[X]−X]−F[−FX]+X,F → FF, angle 25°. - Hilbert curve: axiom
A, rulesA → +BF−AFA−FB+,B → −AF+BFB+FA−, angle 90°.
Why parallel rewriting matters
In a context-free grammar, derivation is sequential, one symbol at a time. L-systems rewrite all symbols simultaneously at each step, modelling biological cells that divide together. Mathematically this means an L-system step is a homomorphism on strings, and string length under iteration is governed by the rule’s growth matrix.
Try it
The L-system playground renders any of seven classic systems with adjustable iteration depth.
References
- Lindenmayer, A., “Mathematical models for cellular interactions in development,” J. Theoretical Biology, 1968.
- Prusinkiewicz, P. & Lindenmayer, A., The Algorithmic Beauty of Plants, Springer, 1990.
- Prusinkiewicz, P. & Hanan, J., Lindenmayer Systems, Fractals, and Plants, Springer, 1989.
- Koch snowflake · Dragon curve · L-system playground
Quick quiz
Test yourself on lsystems
10 multiple-choice questions. Pick an answer for each, then submit to see explanations.
Q1.An L-system was originally introduced to model:
Q2.A deterministic context-free L-system is sometimes abbreviated:
Q3.In turtle interpretation of L-systems, the symbol '+' usually means:
Q4.Square brackets [ and ] are used in L-systems to:
Q5.How many iterations of an L-system roughly suffice to produce a recognisable Koch curve?
Q6.The growth of an L-system string with rule F → FF is:
Q7.Non-drawing 'helper' symbols like X and Y in L-systems are useful because:
Q8.Stochastic L-systems differ from deterministic ones by:
Q9.A 3D extension of L-systems uses extra symbols for:
Q10.L-systems are closely related to: