Hang a pen from one pendulum and the paper from another, set them swinging, and the pen draws the sum of two dying sine waves. Pick an interval below and watch. The whole machine turns on one hidden fact: the figure closes into a loop if and only if the two frequencies are in a rational ratio — and a real machine, which always loses energy, never quite closes at all.
The harmonograph is a real Victorian instrument. The Glasgow physicist Hugh Blackburn described the two-pendulum form around 1844; by the 1870s drawing-room versions were a parlour craze, and engineers used them to study the superposition of vibrations. There is nothing mysterious in the machine — and that is the point. Every loop above is the sum of two decaying sine waves and nothing else.
One pendulum moves the pen left–right; another moves the paper up–down. If
each swings at its own frequency, with its own phase, and dies away at its
own rate, the pen's position at time t is just:
With no damping (d = e = 0) this is a Lissajous figure
— the shapes you see on an oscilloscope when you feed two tones into the
two axes. The shape is set entirely by the frequency ratio f : g
and the phase. That is why the buttons are named after musical intervals:
an octave is exactly 2 : 1, a perfect fifth 3 : 2,
a major third 5 : 4. You are drawing the harmony.
Here is the one true fact under all the prettiness, and you can test it
yourself. An undamped figure with f / g = p / q in lowest
terms closes into a single repeating loop, and it closes after
exactly:
The fifth (3:2) closes after the pen has swung three times one
way and twice the other; you can literally count the lobes — three touches
on the left and right edges, two on the top and bottom. That lobe-count
is the ratio, read straight off the figure.
But push the ratio toward an irrational number — there is no preset
for it because it cannot be written as p:q — and the curve
never closes. It comes arbitrarily close to its starting point,
infinitely often, yet never lands exactly, and so it slowly fills the whole
box with a dense, ever-shifting weave. Rationality is the knife-edge
between a closed ornament and an endless wandering. The verifier checks
both sides: √2 has no exact period at any denominator up to
4096, while its rational neighbour 99/70 closes to machine
precision.
Turn the Damping slider up. Every real harmonograph loses energy to
friction and air, so d > 0 always — and the moment it does,
the curve stops closing. Each loop falls a little inside the last,
and the figure spirals inward to a point and dies. The "closing" you see at
zero damping is an idealisation; the beautiful inward spiral is what the
drawing-room machines actually produced, and it is arguably more beautiful
for being doomed. The readout shows the return gap — the distance
between where the pen starts and where it is one full period later. At zero
damping it is zero. Add a breath of friction and it is never zero again.
research/harmonograph/harmonograph.mjs. The check,
research/harmonograph/verify.mjs, confirms offline
(19/19): the six musical presets close at T = 2π·p/f in
both position and velocity; an irrational ratio has no finite period yet is
dense; damping makes the return gap strictly positive and growing; the
lobe-count equals the ratio; and the faint companion pendulum never moves
the pen further than its own amplitude. Run it yourself:
node research/harmonograph/verify.mjs.