Tuesday, December 30, 2014

Unforgivable Math Pun Alert: Getting Triggy With It


Had fun at a local library looking through the book Trigonometric Delights by Eli Maor, the author of one of my favorite math-geek books, e: The Story of a Number. Maor often approaches math problems from an unexpected angle and in Chapter 7 he tackles the equations behind the artsy toy from the '70s, the Spirograph.

For those familiar with polar equations, it's easy to figure out the coordinates of point C in the figure (the center of the small circle) with respect to O, the origin. But it's more difficult to find out the coordinates of point P with respect to O. This alone would make a great trig exploration for somebody's precalculus class. But Maor points out that the angles of rotation, theta and phi, are not independent; the arc lengths on the two circles must be equal (because their circumferences are connected by the gears). He substitutes phi = [(R - r)/r]*theta to get everything in terms of theta:

Now that's a couple of parametric equations that were made for a computer! Let's get a turtle to play Spirograph.

Since Python makes a distinction between uppercase R and lowercase r, I could put those equations in almost verbatim. But there's no symbol for theta, so I created a variable "theta."


The rest of the Python code (available here) is just a loop so the turtle goes to that x,y coordinate, then increase theta a little, recalculate x and y and go to that coordinate, over and over and over. But what I got out wasn't what I expected.

None of the output had curved loops, but pointed ends instead. Then I realized that Maor's equations assumed the "pen" was right on the edge of the smaller circle, not somewhere in the middle. I added a variable p for "proportion" to the second term of the formulas:


That got me a much more realistic Spirograph:

Later in the chapter Maor deals with cases of different ratios of R/r, such as 2, when you simply get a horizontal line. "Even more interesting is the case R/r = 4," when you get a four-pronged thingy:

"Interesting"? I don't know, but if you change the proportion variable, you get a slightly different thingy. 


Keep going with this Maor says you get an "Astroid," which looks like this:

So I modified my code to draw a thingy (theta goes from 0 to 2*pi), then lower the proportion variable and draw another one and so on. I didn't get an astroid but something wholly unexpected:


This is something that can't be made with the physical Spirograph, but using computers and extending patterns, a lot of interesting things suddenly become possible!

Even changing the proportion so it goes up rather than down didn't get me the textbook astroid:


I'm trying to decide which one to call "The Farrell Hypercycloid."

No comments:

Post a Comment