Lsystem
From Wikipedia, the free encyclopedia
An Lsystem or Lindenmayer system is a parallel rewriting system, namely a variant of a formal grammar (a set of rules and symbols), most famously used to model the growth processes of plant development, but also able to model the morphology of a variety of organisms.^{[1]} Lsystems can also be used to generate selfsimilar fractals such as iterated function systems. Lsystems were introduced and developed in 1968 by the Hungarian theoretical biologist and botanist from the University of Utrecht, Aristid Lindenmayer (1925–1989).
Contents

[edit] Origins
As a biologist, Lindenmayer worked with yeast and filamentous fungi and studied the growth patterns of various types of algae, such as the blue/green bacteria Anabaena catenula. Originally the Lsystems were devised to provide a formal description of the development of such simple multicellular organisms, and to illustrate the neighbourhood relationships between plant cells. Later on, this system was extended to describe higher plants and complex branching structures.
[edit] Lsystem structure
The recursive nature of the Lsystem rules leads to selfsimilarity and thereby fractallike forms which are easy to describe with an Lsystem. Plant models and naturallooking organic forms are similarly easy to define, as by increasing the recursion level the form slowly 'grows' and becomes more complex. Lindenmayer systems are also popular in the generation of artificial life.
Lsystem grammars are very similar to the semiThue grammar (see Chomsky hierarchy). Lsystems are now commonly known as parametric L systems, defined as a tuple
 G = {V, S, ω, P},
where
 V (the alphabet) is a set of symbols containing elements that can be replaced (variables)
 S is a set of symbols containing elements that remain fixed (constants)
 ω (start, axiom or initiator) is a string of symbols from V defining the initial state of the system
 P is a set of production rules or productions defining the way variables can be replaced with combinations of constants and other variables. A production consists of two strings  the predecessor and the successor.
The rules of the Lsystem grammar are applied iteratively starting from the initial state. As many rules as possible are applied simultaneously, per iteration; this is the distinguishing feature between an Lsystem and the formal language generated by a formal grammar. If the production rules were to be applied only one at a time, one would quite simply generate a language, rather than an Lsystem. Thus, Lsystems are strict subsets of languages.
An Lsystem is contextfree if each production rule refers only to an individual symbol and not to its neighbours. Contextfree Lsystems are thus specified by either a prefix grammar, or a regular grammar.
If a rule depends not only on a single symbol but also on its neighbours, it is termed a contextsensitive Lsystem.
If there is exactly one production for each symbol, then the Lsystem is said to be deterministic (a deterministic contextfree Lsystem is popularly called a D0Lsystem). If there are several, and each is chosen with a certain probability during each iteration, then it is a stochastic Lsystem.
Using Lsystems for generating graphical images requires that the symbols in the model refer to elements of a drawing on the computer screen. For example, the program FractInt (see external links below) uses turtle graphics (similar to those in the Logo programming language) to produce screen images. It interprets each constant in an Lsystem model as a turtle command.
[edit] Examples of Lsystems
[edit] Example 1: Algae
Lindenmayer's original Lsystem for modelling the growth of algae.
 variables : A B
 constants : none
 start : A
 rules : (A → AB), (B → A)
which produces:
 n = 0 : A
 n = 1 : AB
 n = 2 : ABA
 n = 3 : ABAAB
 n = 4 : ABAABABA
 n = 5 : ABAABABAABAAB
 n = 6 : ABAABABAABAABABAABABA
 n = 7 : ABAABABAABAABABAABABAABAABABAABAAB
[edit] Example 1: Algae, explained
n=0: A start (axiom/initiator) / \ n=1: A B the initial single A spawned into AB by rule (A → AB), rule (B → A) couldn't be applied / \ n=2: A B A former string AB with all rules applied, A spawned into AB again, former B turned into A /  \ n=3: A B A A B note all A's producing a copy of themselves in the first place, then a B, which turns ... /  \ \ \ n=4: A B A A B A B A ... into an A one generation later, starting to spawn/repeat/recurse then
[edit] Example 2: Fibonacci numbers
If we define the following simple grammar:
 variables : A B
 constants : none
 start : A
 rules : (A → B), (B → AB)
then this Lsystem produces the following sequence of strings:
 n = 0 : A
 n = 1 : B
 n = 2 : AB
 n = 3 : BAB
 n = 4 : ABBAB
 n = 5 : BABABBAB
 n = 6 : ABBABBABABBAB
 n = 7 : BABABBABABBABBABABBAB
These are the mirror images of the strings from the first example, with A and B interchanged. Once again, each string is the concatenation of the preceding two, but in the reversed order.
In either example, if we count the length of each string, we obtain the famous Fibonacci sequence of numbers:
 1 1 2 3 5 8 13 21 34 55 89 ...
For n>0, if we count the kth position from the invariant end of the string (left in Example 1 or right in Example 2), the value is determined by whether a multiple of the golden mean falls within the interval (k1,k). The ratio of A to B likewise converges to the golden mean.
This example yields the same result (in terms of the length of each string, not the sequence of As and Bs) if the rule (B → AB) is replaced with (B → BA).
[edit] Example 3: Cantor dust
 variables : A B
 constants : none
 start : A {starting character string}
 rules : (A → ABA), (B → BBB)
Let A mean "draw forward" and B mean "move forward".
This produces the famous Cantor's fractal set on a real straight line R.
[edit] Example 4: Koch curve
A variant of the Koch curve which uses only rightangles.
 variables : F
 constants : + −
 start : F
 rules : (F → F+F−F−F+F)
Here, F means "draw forward", + means "turn left 90°", and  means "turn right 90°" (see turtle graphics).
F
F+FFF+F
F+FFF+F+F+FFF+FF+FFF+FF+FFF+F+F+FFF+F
F+FFF+F+F+FFF+FF+FFF+FF+FFF+F+F+FFF+F+ F+FFF+F+F+FFF+FF+FFF+FF+FFF+F+F+FFF+F F+FFF+F+F+FFF+FF+FFF+FF+FFF+F+F+FFF+F F+FFF+F+F+FFF+FF+FFF+FF+FFF+F+F+FFF+F+ F+FFF+F+F+FFF+FF+FFF+FF+FFF+F+F+FFF+F
[edit] Example 5: Penrose tilings
The following images were generated by an Lsystem. They are related and very similar to Penrose tilings, invented by Roger Penrose.
As an Lsystem these tilings are called Penrose's rhombuses and Penrose's tiles. The above pictures were generated for n = 6 as an Lsystem. If we properly superimpose Penrose tiles as an Lsystem we get next tiling:
otherwise we get patterns which do not cover an infinite surface completely:
[edit] Example 6: Sierpinski triangle
The Sierpinski triangle drawn using an Lsystem.
 variables : A B
 constants : + −
 start : A
 rules : (A → B−A−B), (B → A+B+A)
 angle : 60°
Here, A and B mean both "draw forward", + means "turn left by angle", and − means "turn right by angle" (see turtle graphics). The angle changes sign at each iteration so that the base of the triangular shapes are always in the bottom (they would be in the top and bottom, alternatively, otherwise).
Evolution for n = 2, n = 4, n = 6, n = 9
There is another way to draw the Sierpinski triangle using an Lsystem.
 variables : F G
 constants : + −
 start : F−G−G
 rules : (F → F−G+F+G−F), (G → GG)
 angle : 120°
F and G both mean "draw forward", + means "turn left by angle", and − means "turn right by angle".
[edit] Example 7: Dragon curve
The Dragon curve drawn using an Lsystem.
 variables : X Y F
 constants : + −
 start : FX
 rules : (X → X+YF+), (Y → FXY)
 angle : 90°
Here, F means "draw forward",  means "turn left 90°", and + means "turn right 90°". X and Y do not correspond to any drawing action and are only used to control the evolution of the curve.
Dragon curve for n = 10
[edit] Example 8: Fractal plant
 variables : X F
 constants : + −
 start : X
 rules : (X → F[[X]+X]+F[+FX]X), (F → FF)
 angle : 25°
Here, F means "draw forward",  means "turn left 25°", and + means "turn right 25°". X does not correspond to any drawing action and is used to control the evolution of the curve. [ corresponds to saving the current values for position and angle, which are restored when the corresponding ] is executed.
Fractal plant for n = 6
[edit] Example 9: Modified Koch Lsystem
A fractal figure drawn introducing a periodic change of angle sign in the iteration of the usual Koch curve Lsystem.
[edit] Open problems
There are many open problems involving studies of Lsystems. For example:
 Characterisation of all the deterministic contextfree Lsystems which are locally catenative. (A complete solution is known only in the case where there are only two variables).
 Given a structure, find an Lsystem that can produce that structure.
[edit] Types of Lsystems
Lsystems on the real line R:
Wellknown Lsystems on a plane R^{2} are:
 spacefilling curves (Hilbert curve, Peano's curves, Dekking's church, kolams),
 median spacefilling curves (Lévy C curve, HarterHeighway dragon curve, DavisKnuth terdragon),
 tilings (sphinx tiling, Penrose tiling),
 trees, plants, and the like.
[edit] Books
 Przemyslaw Prusinkiewicz, Aristid Lindenmayer  The Algorithmic Beauty of Plants PDF version available here for free
 Grzegorz Rozenberg, Arto Salomaa  Lindenmayer Systems: Impacts on Theoretical Computer Science, Computer Graphics, and Developmental Biology
[edit] See also
Wikimedia Commons has media related to: LSystems 
[edit] Notes
 ^ Grzegorz Rozenberg and Arto Salomaa. The mathematical theory of L systems (Academic Press, New York, 1980). ISBN 0125971400
[edit] External links
 David J. Wright's article on Lsystems
 Algorithmic Botany at the University of Calgary
 Branching: Lsystem Tree A Java applet of the botanical tree growth simulation using the Lsystem.
 Fractint LSystem True Fractals
 "powerPlant" an opensource landscape modelling software
 Fractint home page
 LSystems in Architecture
 A simple Lsystems generator (Windows)
 Lyndyhop: another simple Lsystems generator (Windows & Mac)
 An evolutionary Lsystems generator (anyos*)
 "LsystemComposition". Page at Pawfal ("poor artists working for a living") about using Lsystems and genetic algorithms to generate music.
 eXtended LSystems (XL), Relational Growth Grammars, and opensource software platform GroIMP.
 A JAVA applet with many fractal figures generated by Lsystems.
 Another Lsystem applet, supporting programming, with explanation and examples.
 Lsystems in Architecture; genetic housing.
 Lsystems in Plant Growth,Simulation and Visualization (PlantVR).
 Musical Lsystems: Theory and applications about using Lsystems to generate musical structures, from waveforms to macroforms.
 Lsystem digital sound synthesis: 'Do Digital Monkeys Inhabit Virtual Trees?' Electronic music piece composed with Lsystems.
 "An introduction to Lindenmayer systems", by Gabriela Ochoa. Brief description of Lsystems and how the strings they generate can be interpreted by computer.
 LSys/JS  Interactive LSystem interpreter using the Canvas HTML element.
 Lindenmayer System for plant visualisation (Java Applet).
 Fractal Grower: Free Java paper folding LSystem intended for elementary and middle school students.
 Programmatic animations in actionscript showing various Lsystems.
 Java applet showing random LSystems while driving down Lindenmayer Boulevard
 Magic Garden  Artificial Plants Laboratory  free plants generator using LSystems
 Inkscape a free software vector graphics program which implements, among its plugins, an Lsystem generator
 Garabatos, an interactive evolutionary image generator based in LSystems
 Online experiments with LSystems using JSXGraph (JavaScript)