Isabel Beach

Logo

Math Fun

Non-Math Fun

Spirographs

A spirograph is a popular drawing toy that is easy to emulate on a computer. For any parameters $a,r\in[0,1]$ and $t\in\mathbb{R}$, a spirograph draws the curve paremeterized by

\[x(t) = (1 - r)\cos(t) + ar\cos(\frac{1 - r}{r}t)\] \[y(t) = (1 - r)\sin(t) - ar\sin(\frac{1 - r}{r}t)\]

Overlaying these curves for a variety of choices of $a$ and $r$ produces a nice effect.

Similar images can be made with this simple MATLAB code snippet.

ptRes = 1000;
numSpiro = 3;
theta = linspace(0, 100*pi, ptRes);
figure(1);
clf(1);
hold on;
for i = 1:numSpiro
	r = rand();
	l = rand();
	x = (1 - r).*cos(theta) + l.*r.*cos(theta.*(1 - r)./r);
	y = (1 - r).*sin(theta) - l.*r.*sin(theta.*(1 - r)./r);    
	plot(x, y, 'Color', rand(1, 3));
end