Lab 25

Any shape at all, out of nothing but circles

Spin a circle and track a point on its rim, and you get a sine wave. Spin a second circle whose centre rides on the first, and a third on that, and keep going — and it turns out you can trace any closed curve you like, exactly, given enough circles. Draw something below and the page will work out which circles you need. Nothing here is pre-baked: it runs a real discrete Fourier transform on the points you drew.

Trace

1The circles that draw your shape

Each circle turns at a fixed whole-number rate — one turn per lap, two per lap, three, and so on — and each has a fixed size and starting angle. Those three numbers per circle are the entire description of the shape. Drag Circles used down to 3 and watch the drawing become a vague blob; drag it up and the detail returns, corner by corner.

What it is doing

Press Draw your own and sketch anything in one stroke — a letter, a face, your signature.

2One circle is one sine wave

Before the shapes: this is the whole idea in one picture. A point going round a circle at a steady rate, plotted against time, is a sine wave. The circle's size is the wave's amplitude and its speed is the wave's frequency. Everything else on this page is just adding these together.

3Adding waves makes corners

A square wave has flat tops and vertical sides, which no single smooth sine can manage. But add sines at 1, 3, 5, 7… times the base frequency, each a little weaker, and the sum flattens out and squares up. Watch the overshoot at each corner: it gets narrower as you add terms but it never gets shorter. That is the Gibbs phenomenon, and it never goes away.

Harmonics

4The recipe, as a list of frequencies

Here is your shape written as a spectrum: one bar per circle, height for how big that circle is. A smooth round shape needs only the first few. A shape with sharp corners needs a long tail of tiny high-frequency circles — and throwing that tail away is, almost exactly, what image and audio compression does.

Where you have already met this

The transform on this page is the same one running in four other labs here, and it is doing the same job each time: turning something that varies over time or space into a list of frequencies. Sound & Hearing uses it to find the pitch of a note. Speech Synthesis and Speech Recognition use it to build spectrograms. Light & Waves uses it to split light the way a prism does — which is where this site gets its name.

Outside these pages: JPEG keeps the low-frequency parts of an image and discards the rest. MP3 does the same to sound, guided by what your ear cannot hear anyway. An MRI machine measures the frequency components directly and transforms back to get the picture. And the fast algorithm that makes all of this practical — the FFT — was published in 1965 and quietly turned out to have been discovered by Gauss in 1805, a hundred and sixty years earlier.

Reference

Three things with the same name