Michael Bradford Williams

Home / Programming / L-Systems

A Lindenmayer system, or L-System is a collection of symbols and set of rules for replacing any symbol with one or more other symbols. That may not sound immediately interesting, but when combined with a means to generate a graphical representation of a sequence of symbols, L-Systems are capable of producing a huge array of complex images.

More precisely, an L-System consists of three items:

  1. A set of symbols, called the alphabet, which is composed of two disjoint subsets:
    1. variables
    2. constants
  2. A set of replacement rules, which transform a symbol from the alphabet into a sequence of symbols from the alphabet, such that
    1. a variable can be replaced a sequence of any symbols in the alphabet
    2. a constant can only be replaced by itself
  3. An initial sequence of symbols, called the axiom

Once an L-System is defined, the rules can be applied simulaneously to each symbol in the axiom to generate a new sequence of symbols. This process can be repeated for the new sequence, and so on.

A simple example of an L-System has alphabet \(\{A, B\}\) (both variables), rules \(\{A \rightarrow AB, B \rightarrow BA\}\), and axiom \(A\). Then repeated application of the rules, starting from the axiom, yields

  1. \(A\)
  2. \(AB\)
  3. \(ABBA\)
  4. \(ABBABAAB\)
  5. etc.

To visualize an L-System, geometric notions are typically associated with the symbols. For example, a symbol might mean "draw a line segment of unit length" or "rotate by angle \(\pi/2\)". The following app has a collection of pre-defined L-Systems that can be loaded, and the rules can be applied iteratively and visualized. The details of the L-System will be printed below the image.

A huge gallery of interesting examples of L-Systems can be found here.

Your browser is currently unsupported.