Now let's try to do something more interesting. Begin with a straight segment (command ``F''). Now remove the middle third of the segment, and replace it with the top two sides of an equilateral triangle. Since the overall figure produced by the turtle is always rescaled to unit size, we can represent the latter with the command ``F LFRRFL F'', where the part LFRRFL describes the bump we added. Of course, we have to set the angle the turtle turns to be 60, and we need the RR in the middle to make a 120 turn.
Now let's put a bump on each segment in the second figure. This
is the same as replacing each F in the second command with ``FLFRRFLF'',
TurtleCmd(`FLFRRFLF L FLFRRFLF RR FLFRRFLF L FLFRRFLF`);
Putting bumps on each segment of that figure, and then adding smaller bumps to each segment of that figure, and then doing it yet again, gives us a very wiggly curve:
Notice that the width of each bump added is 1/3 of the one added previously, so by the time we have done this five times (as in the previous figure), the bumps are 1/35 the size of the whole figure. If we continue much more, the changes become smaller than we can discern. It should be clear that there is a well defined ``curve'' which corresponds to the limit of doing this process infinitely often. We shall try to make this statement a little more precise now.
Let be the figure at the 0-th stage, that is, the straight segment, and let be the curve after we have added one bump. In general, let be the curve after the n-th step. We claim that there is a well-defined limit curve .
To make sense of this statement, we need a way to measure how far apart two sets in the plane are. That is, if S1 and S2 are two sets of points, we shall define the ``Hausdorff distance'' between S1 and S2 as follows. First, define the distance from a point x to a set S as the distance between x and the closest point in S, that is
Once you have absorbed that, it should be simple to see that that we now need only show that for any > 0, we can always find N sufficiently large so that d ( for all n > N. This follows from the fact that the size of the bumps goes down by a factor of 1/3 at each stage. Thus, d (, and
Now, this ``curve'' has some interesting properties. First, notice that the distance in the plane from one end to the other is 1, but the ``curve'' itself is infinitely long. In fact, the length of any small part of the curve is infinite, as well. We can see that by examining how the lengths of each varies with n:
|curve||# segments||segment length||total length|
At each stage, every segment is replaced by four segments 1/3 as long. Thus, the overall length grows by a factor of 4/3 at each step. For any finite length we choose, we can find an n so that the length of is greater than .
Note also that is nowhere differentiable: it has corners densely throughout it. Finally, note that is ``self-similar''. By this we mean that if you take any small piece of it, no matter how small, there is a small copy of the whole within it.
The curve is an example of a fractal.5.4 This particular example is called the von Koch curve, and was discovered by H. von Koch in the late nineteenth century. This curve, and others like it, caused quite a stir in the mathematics community at the time because of its peculiar properties. We will explore additional fractals and some of their properties in the remainder of this chapter.
The particular way we generated the Koch curve is called an ``L-system'' or a ``Lindenmeyer system''. In an L-system, one begins with an initial figure (called the initiator), and a set of rules for modifying any figure to obtain the next in the sequence. In our example above, the initiatior was a straight segment (F) and the recursion rule was F FLFRRFLF.