loading...
running...
The science
Lindenmayer systems. Aristid Lindenmayer (1968) introduced parallel string rewriting to model growth of algae and plants. A system has an alphabet, an axiom (the starting string) and rules; at each generation every symbol is replaced simultaneously. The "algae" system A -> AB, B -> A gives strings of length 1, 2, 3, 5, 8, 13...: the Fibonacci numbers, so the length grows by the golden ratio each generation (checked in the page).
Growth rate. For a rule set the number of each symbol evolves as n_(k+1) = M n_k where M counts how many of each symbol a rule produces. The string length grows like lambda^k with lambda the dominant eigenvalue of M; the first graph shows that straight line on a log axis. Koch: lambda = 4, so segments multiply by 4 each generation.
Turtle interpretation. The final string is drawn by a turtle: F moves forward and draws, f moves without drawing, + and - turn by the angle, [ saves position and heading, ] restores them (a stack), which is what produces branching. In 3-D the turtle carries three axes (heading, left, up) and rotates about them: + - yaw, & ^ pitch, / \ roll; ! shrinks the stem width and length for the next segments and L places a leaf.
Self-similarity and dimension. After n steps the Koch curve consists of 4^n pieces each 3^-n as long, so its similarity dimension is D = ln 4 / ln 3 = 1.2619 and its length (4/3)^n grows without bound. The page estimates D from the picture itself by box counting (slope of ln N against ln(1/size)) and compares with ln 4 / ln 3 in the checks. Space-filling curves (Hilbert, Gosper) reach D = 2: the Hilbert curve of order n visits all 4^n cells once, which is checked as well.
Stochastic rules. If a symbol has several alternatives, one is drawn at random with the given probabilities, using the seed you choose. The same grammar then yields a whole family of plants, which is closer to nature than a deterministic one.
Honest simplifications. (1) Real plants are shaped by light, water and hormones; the grammar here is context free and has no environment. (2) Branch widths come from a simple geometric rule, not from the pipe model of vessel conduction. (3) Strings are capped at 1.8 million symbols and the 3-D page draws at most 140 000 stem segments and 90 000 leaves (excess is sampled evenly). (4) Leaves are flattened ellipsoids, not measured leaf shapes. (5) Wind sway is a rigid rocking of the whole tree.
Checks run in the page. Segment counts 4^n of the Koch curve; the length of the Koch curve end to end; the box-counting dimension; the Hilbert curve visiting every grid cell once; the Fibonacci lengths of the algae system; the 2^n segments of the dragon curve; in 3-D also the number of drawn stems and leaves against the F and L symbols in the string and the length of the first stem against the closed form.