I became a kid again and purchased a Spirograph set. The Spirograph is a mathematical toy, which you can use for drawing nice figures. In the simplest case it exists of a fixed circle, used as a template, and a smaller rolling circle with holes. The result of my experiment is at the end of this post.
Thereafter, I turned my attention to mathematical generation of the Spirograph figures, and to my surprise I was able to find a number of good resources on the net.
The parametric equations for a Spirograph are: x(t)=(R+r)cos(t) + p*cos((R+r)t/r)
y(t)=(R+r)sin(t) + p*sin((R+r)t/r)
A digital spirograph can be created using, for example, the following equations:
with HSB Grapher.
An applet, and some data to play with it can be found here.
However, what I found more useful and interesting is this page: http://linuxgazette.net/133/luana.html. It provides a Spirograph compiler (an awk script). This awk script takes a Spirograph specification and generates a gnuplot script to create the Spirograph. Go try it – its very interesting. If you are on windows, read these to help you get started on awk and gnuplot.
Licensing and information about the blog available here.