- L-system
An L-system 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 ofplant development, but also able to model the morphology of a variety of organisms. [Grzegorz Rozenberg and Arto Salomaa. The mathematical theory of L systems (Academic Press, New York, 1980). ISBN 0125971400] L-systems can also be used to generate self-similarfractal s such asiterated function system s. L-systems were introduced and developed in 1968 by the Hungarian theoreticalbiologist andbotanist from the University of Utrecht,Aristid Lindenmayer (1925–1989).Origins
As a biologist, Lindenmayer worked with
yeast and filamentousfungi and studied the growth patterns of various types of algae, such as the blue/green bacteria "Anabaena catenula". Originally the L-systems 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.L-system structure
The recursive nature of the L-system rules leads to
self-similarity and therebyfractal -like forms which are easy to describe with an L-system. Plant models and natural-looking 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 ofartificial life .L-system grammars are very similar to the
semi-Thue grammar (seeChomsky hierarchy ). L-systems are now commonly known as "parametric" L systems, defined as atuple :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 rule s" 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 L-system 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 L-system and the
formal language generated by agrammar . If the production rules were to be applied only one at a time, one would quite simply generate a language, rather than an L-system. Thus, L-systems are strict subsets of languages.An L-system is "context-free" if each production rule refers only to an individual symbol and not to its neighbours. Context-free L-systems are thus specified by either a
prefix grammar , or aregular grammar .If a rule depends not only on a single symbol but also on its neighbours, it is termed a "context-sensitive" L-system.
If there is exactly one production for each symbol, then the L-system is said to be "deterministic" (a deterministic context-free L-system is popularly called a "D0L-system"). If there are several, and each is chosen with a certain probability during each iteration, then it is a "stochastic" L-system.
Using L-systems 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 theLogo programming language ) to produce screen images. It interprets each constant in an L-system model as a turtle command.Examples of L-systems
Example 1: Algae
Lindenmayer's original L-system 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
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
Example 2:
Fibonacci number sIf we define the following simple grammar:
: variables : A B: constants : none: start : A: rules : (A → B), (B → AB)
then this L-system 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 "k"th 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 (k-1,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)".
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.
Example 4: Koch curve
A variant of the Koch curve which uses only right-angles.
: 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 ).: "n" = 0:
F
: "n" = 1:
F+F-F-F+F
: "n" = 2:
F+F-F-F+F+F+F-F-F+F-F+F-F-F+F-F+F-F-F+F+F+F-F-F+F
: "n" = 3:
F+F-F-F+F+F+F-F-F+F-F+F-F-F+F-F+F-F-F+F+F+F-F-F+F+ F+F-F-F+F+F+F-F-F+F-F+F-F-F+F-F+F-F-F+F+F+F-F-F+F- F+F-F-F+F+F+F-F-F+F-F+F-F-F+F-F+F-F-F+F+F+F-F-F+F- F+F-F-F+F+F+F-F-F+F-F+F-F-F+F-F+F-F-F+F+F+F-F-F+F+ F+F-F-F+F+F+F-F-F+F-F+F-F-F+F-F+F-F-F+F+F+F-F-F+F
Example 5: Penrose tilings
The following images were generated by an L-system. They are related and very similar to
Penrose tiling s, invented byRoger Penrose .As an L-system these tilings are called "Penrose's rhombuses" and "Penrose's tiles". The above pictures were generated for "n" = 6 as an L-system. If we properly superimpose Penrose tiles as an L-system we get next tiling:
otherwise we get patterns which do not cover an infinite surface completely:
Example 6: Sierpinski triangle
The
Sierpinski triangle drawn using an L-system.: 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 L-system.: 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".
Example 7: Dragon curve
The
Dragon curve drawn using an L-system.: variables : X Y F : constants : + −: start : FX : rules : (X → X+YF+),(Y → -FX-Y): 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
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
Example 9: Modified Koch L-system
A fractal figure drawn introducing a periodic change of angle sign in the iteration of the usual Koch curve L-system.
Open problems
There are many open problems involving studies of L-systems. For example:
* Characterisation of all the deterministic context-free L-systems which are locally catenative. (A complete solution is known only in the case where there are only two variables).
* Given a structure, find an L-system that can produce that structure.
Types of L-systems
L-systems on the real line R:
*Prouhet-Thue-Morse system Well-known L-systems on a plane R2 are:
*space-filling curve s (Hilbert curve ,Peano's curves , Dekking's church,kolam s),
* median space-filling curves (Lévy C curve , Harter-Heighway dragon curve, Davis-Knuth terdragon),
* tilings (sphinx tiling,Penrose tiling ),
* trees, plants, and the like.Books
* Przemyslaw Prusinkiewicz, Aristid Lindenmayer -
The Algorithmic Beauty of Plants [http://algorithmicbotany.org/papers/#abop PDF version available here for free]
* Grzegorz Rozenberg, Arto Salomaa - Lindenmayer Systems: Impacts on Theoretical Computer Science, Computer Graphics, and Developmental BiologyNotes
ee also
*
Graftal
*Fractal
*Iterated function system
*Hilbert curve External links
* [http://www.math.okstate.edu/mathdept/dynamics/lecnotes/node12.html#SECTION00040000000000000000 David J. Wright's article on L-systems]
* [http://algorithmicbotany.org/ Algorithmic Botany at the University of Calgary]
* [http://www.mizuno.org/applet/branching/ Branching: L-system Tree] AJava applet of the botanical tree growth simulation using the L-system.
* [http://spanky.triumf.ca/www/fractint/lsys/truefractal.html Fractint L-System True Fractals]
* [http://www.biologie.uni-hamburg.de/b-online/e28_3/lsys.html "An introduction to Lindenmayer systems", by Gabriela Ochoa] . Brief description of L-systems and how the strings they generate can be interpreted by computer.
* [http://sourceforge.net/projects/pplant/ "powerPlant" an open-source landscape modelling software]
* [http://spanky.triumf.ca/www/fractint/fractint.html "Fractint" home page]
* [http://www.mh-portfolio.com/lsystems.html L-Systems in Architecture]
* [http://www.generation5.org/content/2002/lse.asp A simple L-systems generator (Windows)]
* [http://www.lab4web.com/chelmiger/lyndyhop/ Lyndyhop: another simple L-systems generator (Windows & Mac)]
* [http://www.cs.ucl.ac.uk/staff/W.Langdon/pfeiffer.html An evolutionary L-systems generator (anyos*)]
* [http://fractint.oblivion.cz./ L-systems gallery – a tribute to Fractint]
* [http://www.pawfal.org/index.php?page=LsystemComposition "LsystemComposition"] . Page at Pawfal ("poor artists working for a living") about using L-systems andgenetic algorithms to generate music.
* [http://www.grogra.de/ eXtended L-Systems (XL), Relational Growth Grammars, and open-source software platform GroIMP.]
* [http://to-campos.planetaclix.pt/fractal/plantae.htm A JAVA applet with many fractal figures generated by L-systems.]
* [http://uk.geocities.com/joelewisbowen/lsystem.html Another L-system applet, supporting programming, with explanation and examples.]
* [http://www.arch.columbia.edu/Students/Fall2003/Cheng.Chih-Wei/ L-systems in Architecture; genetic housing.]
* [http://www.somporn.net/ L-systems in Plant Growth,Simulation and Visualization (PlantVR).]
* [http://www.modularbrains.net/support/SteliosManousakis-Musical_L-systems.pdf Musical L-systems: Theory and applications about using L-systems to generate musical structures, from waveforms to macro-forms.]
* [http://www.modularbrains.net/dodigitalmonkeysinhabitvirtualtrees.html L-system digital sound synthesis: 'Do Digital Monkeys Inhabit Virtual Trees?' Electronic music piece composed with L-systems.]
* [http://lsysjs.qwert.ch/ LSys/JS] - Interactive L-System interpreter using the Canvas HTML element.
* [http://www.qwerkop.de/qwerkop-projects-lsystem.php/ Lindenmayer System for plant visualisation (Java Applet)] .
* [http://cs.unm.edu/~joel/PaperFoldingFractal/paper.html Fractal Grower: Free Java paper folding L-System intended for elementary and middle school students.]
* [http://www.cove.org/default.aspx?id=1&sid=3&mid=2 Programmatic animations in actionscript showing various L-systems.]
* [http://www.cs.ucf.edu/~acampbel/applets/LSystems/LSystems.php Java applet showing random L-Systems while driving down Lindenmayer Boulevard]
* [http://magicgarden.sourceforge.net/ Magic Garden - Artificial Plants Laboratory] - free plants generator using L-Systems
* [http://www.inkscape.org/ Inkscape] a free software vector graphics program which implements, among its plugins, an L-system generator
* [http://garabatos.wikidot.com Garabatos] , an interactive evolutionary image generator based in L-Systems
Wikimedia Foundation. 2010.