A recursive figure for beginners

When I was a college sophmore, I went to the University of Illinois "Engineering Open House." This was an amazing event, where almost all of the engineering departments put on amazing displays to impress and recruit students, potential students, and civilians. The exception was the Computer Science department, where graduate students sat at their computers occasionally doing cool things but talking to no one.

One display really intrigued me, a curly scribble that grew from an upside-down L. When I was young, I was eager, bold, and shameless, and I pestered the graduate student into explaining the curve to me. Last weekend, I went to a seminar on the MAPLE programming language, and wanted to practice, and so I wrote a program to create the figure I remembered from so-long-ago. I am quite the procrastinator.

This sequence of figures was a lovely introduction to recursion, and even fractals, and I thought I would share it with you:

Figure 1: Arbitrary

Figure 1


We start with a base-shape. I picked the one above because that is the one that my Engineering Open House pal had used in his computer program. If this website inspires you, and you would like to see what happens with a different base-shape, send me an email with your shape, and I will run my program and show you the result. Or, if you have MAPLE, you can use mine (right-click here).

Don't think of this shape as a backwards 7, upside-down L, or capital gamma. Think of it as a set of four instructions: "Take a step, take a step, turn right, take a step." This figure represents a process. Step, step, ninety degree right turn, step. Got it? Good. Now you are ready for figure 2, which is based on figure 1:

Figure 2: 3 copies of Figure 1

Figure 2

This figure also represents the process "Take a step, take a step, turn 90 degrees, take a step." The difference is how we define the phrase "take a step." In figure one, we used the intuitive meaning - draw a line about two inches long (on my terminal). Here "take a step" will mean to make a copy of figure 1. Let me draw on Figure 2 to show you what I mean by that:

Figure 2 is the SAME set of four instructions: "Step, Step, Turn, Step" The difference is that now by "Step" I mean "copy figure 1."

Figure 3: Three copies of figure 2

Figure 3

We are continuing the process here. Same idea: "Step, Step, Turn 90 degrees to the right, Step." Only now a "step" means a copy of Figure 2! Look at the picture above, and try to see the three copies of figure 2 in it. (You also should be able to see 9 copies of figure 1)

Figure 4: It starts to get rich-looking

At this point I'm assuming you see where I am going with this

Figure 4

I like to look at this figure. At first glance, it looks like a random scribble, but there is quite a bit of order to it, which makes the eye linger. Now that you've seen where it comes from, you know where the concealed order is. Three copies of figure 3. (Or, if you like, 9 copies of figure 2, or 27 copies of figure 1). ALL of the previous figures appear in this one.

Figure 9: Yes, we skip to figure 9

I thought you would like to see what a later figure looks like. This one (Figure 9) consists of three copies of (you guessed it) figure 8. Even though I've skipped some, you can see each of the previous 8 figures wrapped up in figure 9.

Figure 9

Notice how curvy it seems? It is still just a whole bunch of those Ls, strung together in a pattern.

A bit more information

One would be tempted to say that I've created a fractal - but I haven't. If I took this process out to infinity, and got some well-defined shape, that shape would be a fractal. Unfortunately, you can see that this particular example isn't converging to a single shape - the distance between the start and end points keeps increasing. So while this is a nice recursive figure, it is not a fractal.

If you have MAPLE and would like to play with this - right-click here. If you are curious, and want to see all the figures in a row without any being skipped, click here.

Feel free to email me if you have any questions. I like to talk about this stuff.


Click here to go to Doug's AP page
Click here to go to Doug's homepage