Presentation on theme: "L-System Aristid Lindenmayer (1968), biologist. L-System A method of constructing a FRACTAL that is also a MODEL for plant growth. The Computational Beauty."— Presentation transcript:
L-System Aristid Lindenmayer (1968), biologist
L-System A method of constructing a FRACTAL that is also a MODEL for plant growth. The Computational Beauty of Nature – Gary William Flake
L-System L-systems use an AXIOM as a starting STRING and ITERATIVELY apply a set of PARALLEL string substitution rules to yield one long string that can be used as instructions for drawing the fractal.
Production systems String : concatenation of alphabets (symbols). Axiom : the first initial symbol(s). Production rules : the description of how one string of symbols generate another.
An example Alphabets: a, b Axiom: b Rules: a -> ab b -> a
Test the generation StepResult 0b 1a 2ab 3aba 4abaab 5abaababa 6abaababaabaab
Another example Alphabets: a, b Axiom: b Rules: a -> ba b -> ab
Test the generation StepResult 0b 1ab 2baab 3abbabaab 4baababbaabbabaab
Terminal and non-terminal symbols We can use lower and UPPER case alphabets to represent the terminal and non-terminal symbols. Terminal symbols are those need no further expansion. Non-terminal symbols are those can further expand using the production rules.
Terminal and non-terminal symbols Rules: A -> b A -> bA In this case, A is a non-terminal symbol; b is a terminal symbol. The rules state that A can generate b and stop. A can also expand to bA where the A on the right hand side can expand again using the two rules.
Terminal and non-terminal symbols Rules: A -> b (terminal) A -> bA (non-terminal) The results will be, b, bb, bbb, bbbb, … Remember the regular expression last time, bb*
Exercise time Alphabets: A, a, b Axiom: A Rules: A -> ab (terminal) A -> aAb (non-terminal) Let’s see what can be generated.
Language Remember that the Finite State Automata can generate a language we called Regular Expression. The L-system can also generate another language we named Context-Free language.
Language According to Noam Chomsky, there are 4 types/hierarchies of Formal Language. We have learnt the, Regular expression, Context-free language. There are two more, namely the, Context-sensitive language, Unrestricted language.
Production rules Regular expression uses the rules, A -> b or A -> bC; While Context-Free language uses the rules like, A -> α; where α is any string of both terminal and non- terminal symbols.
Simple exercise Alphabets: F, -, + Axiom: F Rules: F -> F + F - - F + F We have only one production rule with the symbol F. Let’s see what happens.
Any meaning? We have not touched on any ideas about meaning – semantics yet. The language we generated is pure syntactic. We can, however, assign external meaning to the symbols and see what happens.
The meaning Now we assign meaning to the symbols. F: draw a line segment forward +: turn anti-clockwise 60° -: turn clockwise 60 ° The rule F -> F + F - - F + F will become:
The meaning F F F F
Turtle graphics That is the Turtle Graphics (Logo) we learnt in primary school. The commands are, CommandTurtle action FDraw forward by a fixed length. fMove forward by a fixed length. +Turn anti-clockwise by a fixed angle. -Turn clockwise by a fixed angle. [Save the current location and orientation. ]Restore the last saved location and orientation.
L-system applet Try to create the graphics using the applet at
Exercise time Can you figure out the rule for this plant?