Fourier Series: Drawing With Rotations
Any closed path can be decomposed into a sum of rotating circles. The Fourier series, the epicycle construction, and why sharp corners are the hardest part of the approximation.
The Fourier series is one of those mathematical ideas that keeps turning up in different costumes. In signal processing, it is the decomposition of a waveform into sine and cosine components. In heat conduction, it was Joseph Fourier's original tool for solving the heat equation on a metal rod. In image compression, it is the basis of the JPEG format's lossy step. And in a construction that dates back to Ptolemy, it is a way to draw any closed path with a stack of rotating circles.
The construction is called epicycles. A circle rotates around a point. A smaller circle rotates around the moving point of the first circle. An even smaller circle rotates around the moving point of the second. And so on. The path traced by the outermost point is the sum of all those rotations. With the right radii and the right rotation speeds, you can trace any closed curve — a square, a star, a handwritten word, a portrait of Fourier himself.
The math, briefly
Take a closed path parameterized as a complex function of time, z(t), where t runs from 0 to T (the period). The discrete Fourier transform gives a set of complex coefficients c_n, one for each integer frequency n, where:
- c_n = (1/T) ∫₀ᵀ z(t) e^(−2πint/T) dt
The reconstruction is the inverse transform:
- z(t) = Σ c_n e^(2πint/T)
Each term in the sum is a circle. The magnitude |c_n| is the radius of that circle. The argument of c_n is the starting angle. The frequency n is the rotation speed, with positive n rotating counterclockwise and negative n rotating clockwise. Stack the circles, each centered on the moving point of the previous one, and the outermost point traces the original path.
This is the discrete Fourier transform applied to a closed curve, which is exactly what the Fourier Series tool in Fluxcade does. You draw a path with your mouse, the tool computes the coefficients, and then it re-renders the path as a sum of rotating circles term by term.
Why sharp corners are hard
Draw a square and watch the approximation converge. With three terms, you get a wobbly oval. With ten terms, the corners start to appear, but each corner is accompanied by a small overshoot — a bump that sticks out past the corner and a matching dip on the inside. With fifty terms, the overshoot shrinks in width but not in height. The bump gets narrower, but it stays roughly the same amount above the corner.
This is the Gibbs phenomenon, and it is a fundamental property of Fourier series approximations near discontinuities. Anywhere the path has a sharp corner — a place where the tangent jumps — the Fourier series overshoots by about 9% of the jump height, regardless of how many terms you add. The overshoot does not go away; it just gets squeezed into a narrower region.
This is why the trace in the tool looks "fuzzy" at the corners of a square but clean on the curves of a circle. Smooth functions are easy for Fourier series. Sharp corners are not. To draw a square cleanly, you need an infinite number of terms. To draw a circle, you need one.
The Ptolemy connection
The epicycle construction predates Fourier by nearly two thousand years. Claudius Ptolemy's Almagest, written around 150 AD, modeled planetary motion as a stack of circles — a deferent (the big circle) plus an epicycle (a smaller circle riding on the deferent) plus sometimes an eccenter or an equant. The model was empirically accurate enough to predict planetary positions for over a thousand years, and it was eventually replaced not because it was wrong, but because Copernicus and Kepler found a simpler model with fewer moving parts.
The joke, often repeated, is that Ptolemy's epicycles were just Fourier series in disguise — that any periodic motion can be modeled by stacking enough circles, so the model was unfalsifiable. The joke is not quite fair. Ptolemy's circles were physical objects in a geocentric cosmology, not a mathematical decomposition. But the underlying geometry is the same: a sum of rotating vectors, in any order, traces a path. Fourier just made the choice of radii and frequencies principled.
A way to feel it
The Fourier Series tool in Fluxcade is the cleanest way to feel what the transform does. Draw a closed shape with your mouse, release, then crank the term count slider from 1 up to 50 and watch the trace converge on your shape. Draw a circle and it converges in one term. Draw a square and watch the Gibbs bumps form at the corners. Draw a star, a heart, your signature — anything closed — and the rotating circles will find a way to trace it.
The function that is zero everywhere except at one point has a Fourier series that is everywhere nonzero.
— Paraphrased from a common Fourier paradox
The Fourier series is two hundred years old. It is still the cleanest bridge between the time domain and the frequency domain, and it still draws a surprisingly good square.
Fourier Series
Drawing with epicycles.