Lesson 3 - Stochastic String Rewriting (scroll down for directions)
In this lesson we explore how to generate two plants that are
"statistically" similar, but not structurally identical. In nature two
plants in the same family would have this property. To achieve this we
assign a probability to each of two or more productions with the same
left side; those probabilities must add up to 1. In processing the string,
at each stage when we encounter that left side, we use a random number
generator to decide which replacement rule to use. For example, suppose
we have two productions with left side I:
I -> I[I]AF (branch to the left)
I -> I(I)AF (branch to the right)
and we want to branch to the left approximately 2/3 of the time. We
assign the probability .667 to the first production and the probability
.333 to the second production. When we encounter an I we generate
a random number r between 0 and 1. If r<.667 we replace I by
I[B]A; if not, we replace I by I(B)A.
Directions for using the Applet
Because of space constraints, in this applet we make the left side of each
production I (so you do not type in the left side). You may type in
up to three different right sides, and three probabilities (which must add
up to 1). If you use only two right sides, type in 0 for probability of
production 3.
For each example, try clicking on Draw Plant several times. You will see that
,unlike in the previous two applets, you will get different plants, though
they will look as if they belong to the same family.
Here is an example to try:
Right side of production 1: I[I]AF
Right side of production 2: I(IF)A(L)[L]AF
First try the probabilities .5, .5 and 0. Then experiment with other
probabilities that add up to 1, for example .2, .8 and 0, or
.7, .3 and 0.
Here is another example to try:
Right side of production 1: I[I]IF
Right side of production 2: I(I[L]B)I
Right side of production 3: I(I(L)IF)I
Lesson 1 /
Lesson 2 /
Back to my home page