Classic Computer Magazine Archive CREATIVE COMPUTING VOL. 10, NO. 5 / MAY 1984 / PAGE 168

Going around in circles: mathematics and computer art. Sheldon P. Gordon; Florence S. Gordon.

Going Around In Circles: Mathematics and Computer Art

Part 1

Mathematicians have a reputation for being strange people. This is probably due to their fatal fascination for things that would never occur to most people or, if they ever did, would be quickly forgotten. For example, suppose you stick a wad of chewing gum on the rim of a bicycle tire. Have you any idea of the path travelled by the gum as the wheel turns? Just in case you are tempted to find out, the curve is shown in Figure 1. It is famous enough in mathematics to have its own name; it is called a cycloid.

Until the microcomputer revolution, curves such as this could be handled only with higher mathematics and could be drawn only with the greatest difficulty by hand. Today, though, such a picture can be drawn with great accuracy, color, and even sound at the push of a button. This tremendous power in the hands of a mathematician must surely lead to the creation of even more esoteric shapes.

Now suppose that the wheel with the gum on it is rolling around the inside rim of a still larger wheel, as shown in Figure 2. (The problem of how this can actually happen in practice is something that is left to physicists and engineers to figure out.) Again, the challenge is to determine the path traced by the gum. The curve that is formed depends very much on the radius of the rolling circle, A, and the radius of the larger outer circle, B.

For those readers who are mathematically inclined, the curve generated in this manner is called a hypocycloid, and it is given by the pair of equations:

x = (B-A)cos(At/B)-A cos(B-A/Bt)

y = (B-A)sin(At/B)+A sin(B-A/B t)

Once these equations are supplied to a computer program which will graph any parametric curve, we can obtain the shape of the hypocycloid for any choice of the two radii. Let's start with A = 1 and B = 4, for example. The program produces the shapes in Figure 3a, while 3b corresponds to A = 1 and B = 7. Clearly, from these two examples, we can predict what shape will occur when A = 1 and B is any integer.

Finding Patterns

However, what if A is not 1? What happens, for example, when A = 2 and B = 7. The result is shown in Figure 4a while 4b shows what results when A = 2 and B = 9. In the first case, there are exactly seven points to the figure and, in the second, there are exactly nine points. This is certainly not a coincidence. Further, if you trace around each of the figures with a finger, you will notice that one complete cycle (until you get back to the original starting point) involves two full revolutions. Thus, we might wonder if using A = 3 would require three full revolutions to trace out the full curve. Let's try A = 3 and B = 7. As anticipated (See Figure 5) there are seven points to the figure and it takes three full revolutions to complete it.

At this point, you might feel that you have completely mastered the patterns for the hypocycloid. For example, if A=12 and B=47, then you would probably expect a shape containing 47 points that requires five full revolutions to complete. That happens to be correct; however, there are still a few surprises left. For example, what if we have the computer draw the hypocycloid with A=4 and B=12. The result is shown in Figure 6 and looks suspiciously like what you would expect the curve for A=1 and B=3 to be. What happened?

Well, if you look at the radii 12 and 4, you might notice that their ratio is 3:1. With this in mind, it turns out that the shape for A=5 and B=15 is the same, as is the shape for A=10 and B=30. For that matter, the identical shape is obtained whenever B is three times A. Similarly, the shape for A=12 and B=33 is the same as for A=4 and B=11, as shown in Figure 7.

The shapes shown above are all very simple; you can easily count the number of points and the number of revolutions. This was done to demonstrate the geometric patterns that exist. However, if we use larger values for A and B, we get some extremely beautiful shapes, so let's stop worrying about the mathematics and concentrate on the aesthetics instead. For example, suppose we take A=13 and B=33, so that we produce the shape shown in Figure 8. If we jump to even larger values for the radii, say A = 17 and B = 59, then we get an even more intricate and fascinating shape, as seen in Figure 9. In each of these last two cases, the predicted pattern holds.

Problems With Resolution

From a mathematician's point of view, one of the big drawbacks in suing computer graphics is the resolution. The results obtained may not be precisely accurate enough. The addressable points on the computer screen are not fine enough to get exactly the right location; the points are located by a rounding process which introduces a certain degree of error. When the number of points involved becomes very large, this error can be drastically magnified and the mathematician will cringe at the result. On the other hand, these inaccuracies also produce some striking visual effects as the predicted patterns break down. So we will now forego mathematical accuracy in the pursuit of art.

Let A=2222 and B=8888. The corresponding curve is shown in Figure 10. It may not be accurate, but it is certainly pretty. Similarly, Figure 11 shows the results of using A=1250 and B=5000. Finally, in Figure 12, we show the results obtained for A = 2500 and B = 10,000. For each of the three cases, the pattern predicts that the shape should reduce to the case A=1 and B = 4, but the resolution inaccuracies are just too large. However, while the shapes are not what we would expect mathematically, they are certainly beautiful to look at.

At this point, it makes little sense to keep showing sample pictures. It is much more fun to try the program yourself. Listing 1 is a simple program to generate these shapes. It is written for a TRS-80 Color Computer with Extended Basic. It is fairly simple to convert it to run on other machines if you are familiar with graphics. Incidentally, the inaccuracies which make some of the designs so attractive vary from machine to machine, so different shapes may result from the same values for A and B when they are both large.

However, before we get to the actual program, it might be worth noting that there are still several slight twists possible when dealing with hypocycloids and similar mathematical curves which lead to other fascinating and beautiful patterns. These will be described in a series of follow-up articles.

Table: Listing 1.

Photo: Figure 1.

Photo: Figure 2.

Photo: Figure 3a.

Photo: Figure 3b.

Photo: Figure 4a.

Photo: Figure 4b.

Photo: Figure 5.

Photo: Figure 6.

Photo: Figure 7.

Photo: Figure 8.

Photo: Figure 9.

Photo: Figure 10.

Photo: Figure 11.

Photo: Figure 12.