Growth of an organism or a population can be simulated using a deterministic context free grammar, also known as a parallel string rewriting 'L'-System. The simulation is started with an initial string called the 'axiom'. Here the symbol B represents a developing (subadult) organism and the symbol A represents a reproducing (adult) organism. In this example there are two grammar rules which are applied "in parallel" (simultaneously to all corresponding symbols at each step or generation):
| Axiom | B |
|---|---|
| Rule 1 | B => A |
| Rule 2 | A => AB |
Here are the results from the first ten generations (starting with the axiom) and counts for the populations size (number of organisms present) at each step:
| Step | Count | String |
|---|---|---|
| 1 | 1 | B |
| 2 | 1 | A |
| 3 | 2 | AB |
| 4 | 3 | ABA |
| 5 | 5 | ABAAB |
| 6 | 8 | ABAABABA |
| 7 | 13 | ABAABABAABAAB |
| 8 | 21 | ABAABABAABAABABAABABA |
| 9 | 34 | ABAABABAABAABABAABAABABAABAAB |
| 10 | 55 | ABAABABAABAABABAABAABABAABAABABAABABAABAABABAABABA |
Note that for the resulting population growth the size (number of organisms) at each generation is the sum of the sizes of the previous two generations. This pattern is called a Fibonacci sequence, and is commonly found in nature.