Circles on circles
Walk once around a closed outline, with time t running from 0 to 1, and write each point as a complex number z = x + iy. Fourier’s idea, applied to this path, is that it can be written as a sum of steadily turning arrows:
z(t) = Σk ck e2πikt
Each term is one circle. Its radius is |ck|, it turns k times for each lap around the outline (counterclockwise when k is positive, clockwise when it is negative), and it starts at the angle of ck. Set the circles end to end and the tip of the last one traces the path. The k = 0 term never turns: it is the average of all the points, and the chain starts there.
The name comes from ancient astronomy. In Ptolemy’s Almagest a planet moves on a small circle, the epicycle, whose center travels around a larger one, the deferent.
Finding the circles
A drawing is a list of points. The outline is resampled at N = 512 points spaced evenly along its length, and the discrete Fourier transform gives one coefficient for each frequency from −256 to 255:
ck = 1N N−1Σn=0 zn e−2πikn/N
With all 511 turning circles the chain passes exactly through every sample. The clef and the spiral are open lines, so their path follows the line to its end and returns along it. A drawing that ends away from its starting point is closed with a straight line.
Why the distance falls
The terms are orthogonal, so the mean squared distance between the traced curve and the samples is exactly the sum of |ck|2 over the circles left out (Parseval’s theorem). Its square root is the root mean square (RMS) distance. Each circle that is added removes its own |ck|2 from that sum, so of all the ways to choose n circles, the n largest give the smallest distance.
A smooth, rounded outline needs only a few large circles. A corner needs many small, fast ones. Without them, the trace draws a curve where the corner should be.
A square wave from odd harmonics
The same idea works on a line. A square wave that is +1 for the first half of each period and −1 for the second is a sum of sines at the odd multiples of its frequency:
f(x) = 4π (sin x + sin 3x3 + sin 5x5 + …)
| x | Square wave | SN(x) |
|---|
Each circle in the figure is one term, with radius 4/(πn), turning n times as fast as the first. The height of the last tip is the partial sum SN(x) of the first N odd harmonics.
At x = π/2 the series becomes (4/π)(1 − 1/3 + 1/5 − …), Leibniz’s series for π/4, so the sums are alternately above and below 1 and approach it. At the jump, x = π, every term is zero, so each partial sum passes through 0, halfway between −1 and 1. Just before the jump the sum overshoots. Its highest peak, at x = π − π/(2N), moves closer to the jump as terms are added but does not fall to 1: it approaches about 1.179, an overshoot of about 9% of the jump from −1 to 1. This is the Gibbs phenomenon. It happens at every jump in a Fourier series, however many terms are added.
Keyboard
- Space
- Play or pause
- ← →
- One circle fewer or more
- Shift + ← →
- Halve or double the circles
- B
- Build from one circle
- C A T O
- Show or hide circles, arrows, trace, outline
- Esc
- Cancel drawing
- Ctrl + Z
- Undo the last drawing