Main menuGallery

Fourier epicycles

Fourier epicycles

Shape
Harmonics used: 5
Speed: 1.0×
Run
Show

Drag inside the picture to draw your own closed shape (it is closed for you). Keys: space play/pause, [ and ] change the number of circles, R restart the trace.

Circles5
Fit error (RMS)

Amplitude of each harmonic. Gold bars are the ones being used.

What's the maths?

Where's the maths? This is trigonometry meeting vectors — the branch of mathematics that describes anything that repeats. Every circle you see on screen is a vector of fixed length spinning at a steady rate, and its tip is at (a cos bt, a sin bt): the amplitude a is the radius and the frequency b is how many turns it makes per cycle. The circles are joined tip‑to‑tail, which is exactly the triangle law for adding vectors — the pen at the very end is the sum of them all. Astonishingly, if you choose the right radii and starting angles, that sum of plain circles can trace any closed curve you like: a heart, a letter, your own scribble. The strip beside the picture plots just the height of the pen against time, so you can watch the same sum as an ordinary wave built out of sine curves. Adding waves of different amplitude and frequency to build a new shape is the whole idea of Fourier analysis, and it is how music, images and mobile phone signals are stored and compressed today.

📘 On the Sec 1–4 syllabus
  • Sec 3/4 (A-Math) · G1 — graphs of y = a sin(bx) + c; amplitude and periodicity
  • Sec 3/4 · G7 — 7.6 sum of two vectors (each circle is a rotating vector)

Beyond the syllabus: Fourier series proper is university mathematics.

One circle is a sine curve. Take a circle of radius a whose arm has turned through an angle bt. The height of the tip above the centre is y = a sin(bt) — the graph in the A‑Math syllabus. The radius a is the amplitude (how tall the wave is) and b is how many complete waves fit into one turn, so the period is 2π/b. Everything on this screen is built from that single fact.

Many circles: add the vectors. Put the second circle's centre on the first one's tip, the third on the second's tip, and so on. Each arm is a vector, so the position of the pen is

pen = v₁ + v₂ + v₃ + … + vN

which is the syllabus rule for adding vectors, just repeated. Taking only the vertical parts gives a sum of sine curves: y(t) = a₁ sin(b₁t) + a₂ sin(b₂t) + …

The square wave. Use only the odd frequencies 1, 3, 5, 7, … with amplitudes 1, ⅓, ⅕, ⅐, … in the same proportion. Then

y = sin t + (sin 3t)/3 + (sin 5t)/5 + (sin 7t)/7 + …

and as you add terms the smooth ripples flatten into a square, flat‑topped wave that jumps between two levels. The bar chart shows those amplitudes: each one is 1/k for harmonic k, so bar 3 is a third the height of bar 1 and bar 5 a fifth. (On screen every amplitude is multiplied by the same number, 4/π, so that the finished wave sits neatly between −1 and +1; the proportions 1 : ⅓ : ⅕ are what matter.) The little overshoot that refuses to disappear at each jump is real — it is called the Gibbs phenomenon.

Going backwards. The clever part is finding the radii and starting angles for a shape you have drawn. The computer measures your curve at 512 equally spaced points (spaced by distance along the curve, not by time), then works out how much of each frequency it contains — this calculation is called the discrete Fourier transform. The circles are then sorted biggest first, so the first few already give the rough shape and the later, tiny ones add the corners and detail. With all 512 the copy is exact.

Try this. Choose Square wave and set the slider to 1: one circle gives a pure sine curve. Step up to 2, 3, 4 circles and watch the flat top appear — the wave is nearly square with only 5 harmonics, even though its bar chart says the newest one is only ⅑ as tall as the first. Now switch to Letter M with 3 circles (a blurry blob), then 10, then 40, and notice that the corners are the last thing to arrive: sharp corners need high frequencies. Finally press Draw your own, draw your initial in one stroke, and find the smallest number of circles at which you can still read it.

Controls: drag inside the picture to draw a shape, use the slider for the number of circles, space to play or pause.