Imagine two ants crawling around a circle at different speeds and draw a line between the two ants at regular time intervals.
The position of the two ants at time t are (cos pt, sin pt) and (cos qt, sin qt) where p and q are integers, p > q, and t comes from dividing the interval [0, 2π] into an integer number of points.
These lines form an envelope, a set of tangent lines, around a curve in the middle known as an epicycloid.
I found this via .
An interesting tidbit from the paper is that the number of cusps in each epicycloid is (p – q) / gcd(p, q).
Here are some examples.
Here’s the code that produced the plots above.
from numpy import sin, cos, linspace, pi import matplotlib.
pyplot as plt def draw(p, q, n=200): xs = linspace(0, 2*pi, n) plt.
axis(off) for x in xs: plt.
plot([cos(p*x), cos(q*x)], [sin(p*x), sin(q*x)], “b-“, alpha=0.
close() draw(4, 3) draw(4, 1) draw(7, 3) draw(9, 4)  Andrew Simoson.
An Envelope for a Spirograph.
The College Mathematics Journal, Vol.
, 1997), pp.