An L-system, short for Lindermayer system, consists of a set of rules created from an alphabet. The alphabet can vary but for this page the alphabet will be

**F**from current position, draw a segment of length 1 in direction angle**f**from current position, move length 1 in direction angle**+**from current position, rotate left angle degrees**-**from current position, rotate right angle degrees**[**put the current position on the stack**]**make the current position the last position on the stack

From this small alphabet of 6 symbols lots of complicated figures can be created by defining a set of rules. You'll need to choose an angle (eg 90 degrees) and define an axiom (the starting iteration). After that you'll need to define two replacement rules, one for F and the other for f. Each F in the axiom is replaced by the string of characters in the replacement rule for F. Likewise each f in the axiom is replaced by the string of characters in the replacement rule for f. For example, an angle of 90 degrees and an axiom of F-F-F-F creates a square because you've gone Forward for 1 unit, turned right 90 degrees, gone Forward another unit, turned right 90 degrees, gone Forward 1 unit, turned 90 degrees and moved Forward 1 unit. Subsequent iterations rely on replacement rules that govern what each symbol (F or f) is replaced with.

Here's a nice page on creating L-systems using Inkscape. Another page on using Inkscape is here and I found this page was useful as well. This web page has examples made using a bigger alphabet and more rules.

**Teaching point:** Repeating simple rules can create complicated structures.

Here are a variety of L-systems along with the rules to create them.

- Axiom: F-F-F-F-F
- F->FF-F-F-F-F-FF
- No rule needed: the rule f->fff is never implemented since the f isn't in the axiom or the replacement rule for F
- angle: 72 degrees

The Koch snowflake is constructed by these rules:

- Axiom: F--F--F
- F->F+F--F+F
- No rule needed: the rule f->fff is never implemented since the f isn't in the axiom or the replacement rule for F
- angle: 60 degrees

Created by the rules:

- Axiom: F++F++F
- F->F+F-F-F+F
- No rule needed: the rule f->fff is never implemented since the f isn't in the axiom or the replacement rule for F
- angle: 60 degrees

Sierpinski's triangle is created by the rules:

- Axiom: F+F+F
- F->F+F-F-F+F
- angle: 120 degrees

L-systems can be used to model plants, too. Perhaps real plant growth is governed by simple rules as well?

- Axiom: FF+[F]FF
- F->FF-[-F+F]+[+F-F]
- angle: 17 degrees

Here's an example where the second replacement rule is used.

- Axiom: FF--FF--FF--FF
- F-> fF-F-F-F-Ff
- f-> F[f--FF]fF+F
- angle: 45 degrees