↤ Artificial Wasteland Pattern · a tool that is the proof

The Circles That Draw You

Draw any closed loop with one finger. A stack of spinning circles will redraw it — and that stack is nothing more than the Fourier transform of your line, made visible. Each circle is one frequency. Keep only the biggest ones and the drawing gets rougher by an amount you can read off the page.

draw a closed loop here — or tap a shape below
your line the circles' pen tip the epicycles (one per frequency)
samples on the loop (N):
circles kept (M of N):
picture error, measured:
picture error, predicted (dropped-circle energy):
do they match?

What you are looking at

Your loop is a list of points. Walk around it at a steady pace and you can write each point as a complex number — x + iy — sampled N times. The discrete Fourier transform turns that list of points into a list of circles: for every whole-number frequency k, one circle with a radius, a starting angle, and a turning rate. Add the circles tip to tip — biggest first — and the tip of the last one retraces your line. Nothing is approximated when you keep them all; the redraw lands on your exact points, to fifteen decimal places.

Z[k] = (1/N) · Σₙ z[n] · e−2πi·k·n/N   (circles from points)
z[n] = Σₖ Z[k] · e+2πi·k·n/N   (points back from circles)

That is the whole machine. The blue wheels on the canvas are the terms of that second sum, drawn in order of size. This is the same idea an old epicycle orrery used to chase the planets, and the same idea that lets a JPEG keep the big shapes and throw the small ones away.

The slider is the proof

Pull the circles-kept slider down and you stop summing the small wheels. The pen-tip curve pulls away from your line — but not by a mystery amount. Pythagoras on the frequencies (Parseval's theorem) says the mean-squared gap between the rough drawing and your real one equals exactly the summed squared radii of the circles you dropped. The page measures the gap one way (compare the two curves point by point) and predicts it the other (add up the dropped radii²) and shows you both numbers. They agree to floating-point dust. That agreement is the claim, made operable: the error you see is the energy you threw away — no fudge factor, nothing hidden.

Show the check. The arithmetic on this page runs engine.js. The offline verifier research/fourier-epicycles/verify.mjs imports the same file and asserts, over random paths and hand-shaped loops: the round trip IDFT(DFT(z)) = z to ~10⁻¹⁴; the transform is linear; Parseval holds as Σ|z|² = N·Σ|Z|²; a pure circle needs exactly one wheel; the measured truncation error equals the dropped-circle energy at every setting of the slider; and more circles never make the picture worse. 20 of 20 checks pass. No number on screen is one the verifier doesn't also check.

What's true, and what's just pretty

Everything quantitative here is exact discrete maths: the transform, the reconstruction, the error law. Three honest caveats. (1) Your finger is resampled to an even spacing around the loop before the transform — a smooth, hand-drawn line barely changes, but a path with wildly uneven point spacing is gently regularised first; the resampled points are what the readout calls "your line," and they are what is reconstructed exactly. (2) "Biggest circles first" sorts by radius, which is the right greedy order for squared error precisely because of Parseval — a fact the verifier leans on, not a hope. (3) The continuous Fourier series of a corner (like the square's) has infinitely many nonzero terms and overshoots near the corner — the Gibbs phenomenon; here you have only N samples, so the sum is finite and lands on the samples exactly, but you can still watch the in-between wobble as you drop circles. The maths is the star; the glow and the gold pen are just paint.