Fourier Epicycles
Draw anything with rotating circles — the DFT in real time
Presets (keys 15):
Keyboard: Space Play/Pause | S Step | R Reset | C Circles | T Trace | D Draw | 1–5 Presets | F Fullscreen
The Mathematics of Fourier Epicycles
Any closed periodic path in the plane can be decomposed into a sum of rotating circles. This is the geometric interpretation of the Discrete Fourier Transform (DFT): each circle corresponds to one complex Fourier coefficient, spinning at a different frequency.
Discrete Fourier Transform
Each coefficient Xₖ is a phasor: radius = |Xₖ| (amplitude), initial angle = arg(Xₖ) (phase), angular speed ∝ k (frequency). The phasors are sorted by amplitude so the largest circles are drawn first.
⚪ Circle Radius = Amplitude
The radius of each rotating circle equals |Xₖ| — the magnitude of the k-th Fourier coefficient. Large circles capture broad, low-frequency features. Tiny circles add fine detail and sharp corners.
↺ Rotation Speed = Frequency
Circle k completes k full rotations per period. The zero-frequency circle (k=0) represents the centroid — it doesn’t rotate at all. Higher k means faster spinning.
🔎 Sorting by Amplitude
This simulator sorts components by amplitude (largest first). This is purely cosmetic — the sum is the same in any order — but it ensures the first few circles give the best approximation.
≈ Convergence
With N components you get the original N-point path exactly. With fewer, you get the best N-term approximation in the least-squares sense. Try reducing N from 256 to 10 to see convergence in action.
⚠ The Gibbs Phenomenon
When approximating a function with a jump discontinuity (like the Square preset), the Fourier series always overshoots by about 8.9% near the jump, no matter how many terms you add. More terms push the overshoot closer to the discontinuity, but never eliminate it. This was first noticed by Henry Wilbraham (1848) and rediscovered by J. Willard Gibbs (1899). It has practical consequences in signal processing: ringing artefacts in JPEG images and "ghosting" in audio compression are both manifestations of the Gibbs phenomenon.
From Ptolemy to Fourier
The idea of circles on circles is ancient. Claudius Ptolemy (~150 AD) described planetary motion as points moving on epicycles — circles whose centres themselves travelled along larger circles. The model was geocentric and physically wrong, but it predicted planetary positions with remarkable accuracy because any periodic motion can be decomposed into circular motions.
In 1807, Joseph Fourier proved that any periodic function can be written as an infinite sum of sines and cosines. For complex-valued (plane-curve) paths, each sine/cosine pair corresponds to one rotating circle. The Ptolemaic epicycles were thus unknowingly computing a Fourier series — just with far fewer terms than needed for high accuracy.
Applications of the Fourier Transform
🎵 Audio & MP3 Compression
MP3 files use the Modified Discrete Cosine Transform (MDCT), a variant of the DFT, to decompose audio into frequency components. Inaudible frequencies are discarded, reducing file size by 90% with minimal perceived quality loss.
📷 JPEG Image Compression
JPEG divides images into 8×8 pixel blocks and applies the 2D Discrete Cosine Transform (DCT). High-frequency components (fine texture) are quantised aggressively. The Gibbs phenomenon causes the compression artefacts visible at low quality settings.
🩺 MRI Brain Scanning
Magnetic resonance imaging collects data as Fourier coefficients in k-space. The 2D inverse DFT converts this raw frequency-domain data into the familiar anatomical image. The spatial resolution depends on how many k-space lines are collected.
📶 WiFi & 5G (OFDM)
Orthogonal Frequency-Division Multiplexing (OFDM) — the core of WiFi, 4G LTE, and 5G — uses the inverse DFT to encode data onto dozens of orthogonal sub-carriers simultaneously. The FFT algorithm makes this computationally feasible in real time.
🔭 Astronomy
Radio telescopes use Fourier synthesis to reconstruct images from baseline measurements. VLBI (Very Long Baseline Interferometry) combines signals from telescopes thousands of kilometres apart, achieving angular resolutions far beyond any optical telescope.
⚔ Quantum Mechanics
The momentum-space wavefunction is the Fourier transform of the position-space wavefunction. Heisenberg’s uncertainty principle Δx · Δp ≥ ℏ/2 is directly a consequence of the bandwidth theorem for Fourier pairs.
The Fast Fourier Transform (FFT)
The naïve DFT requires O(N²) operations. For N = 1,000,000 that’s 1012 multiplications — far too slow for real-time use. In 1965, James Cooley and John Tukey published the Cooley-Tukey FFT algorithm which computes the DFT in O(N log N) time by exploiting the recursive structure of the DFT when N is a power of 2. This 20× speedup (for N = 1024) to 60× (N = 65536) made real-time digital signal processing feasible, and is widely regarded as one of the most important algorithms of the 20th century.
This simulator uses a direct O(N²) DFT for clarity (N ≤ 512), but production applications from audio to MRI always use FFT variants.
Keyboard Shortcuts
⏯ Playback
Space Play / Pause • S Step one frame • R Reset time
🗃 Display
C Toggle circles • T Toggle trace • F Fullscreen • D Draw mode
📌 Presets
1 Heart • 2 Star • 3 Trefoil • 4 Square • 5 Infinity (∞)
Related Simulations
📖 Recommended Reading
🔒 Premium Feature
Unlock HD PNG/GIF export, higher resolution DFT (N up to 4096), save/load paths, and all 32 simulations with MySimulator Premium.
Key Equations
| Concept | Formula | Notes |
|---|---|---|
| Fourier series | f(t) = a0/2 + Σ ancos(nωt) + bnsin(nωt) | Decomposes any periodic function into harmonics |
| Fourier coefficients (cos) | an = (2/T)∫ f(t)cos(nωt) dt | ω = 2π/T; T: period |
| Fourier coefficients (sin) | bn = (2/T)∫ f(t)sin(nωt) dt | n = 1, 2, 3… harmonics |
| Complex form (DFT) | X[k] = Σn x[n] e−i2πkn/N | Discrete Fourier Transform of N-sample signal |
| Epicycle radius | |X[k]| = amplitude of kth harmonic | Circle radius in epicycle visualisation |
| Epicycle phase | ∠X[k] = arg(X[k]) | Initial angle of kth epicycle |
Curriculum Relevance
| Level | Topic | Relevance |
|---|---|---|
| A-Level Maths | Trigonometry, series | Periodic functions, sinusoidal models |
| IB / AP Calculus | Integration, sequences | Fourier coefficient integrals, convergence |
| Undergraduate Maths | Real/complex analysis, PDEs | Fourier analysis, Parseval’s theorem, heat equation |
| Engineering / Physics | Signal processing | FFT, spectral analysis, filtering, audio engineering |
💫 Epicycles & Ptolemy
Before Copernicus, Ptolemaic astronomy described planetary motion using nested circular orbits called epicycles. Remarkably, Fourier analysis reveals that any smooth closed curve can be drawn exactly by a sufficient chain of rotating circles epicycles. The DFT computes the radius and phase of each circle from the path data, connecting ancient astronomy to modern signal processing.
🔊 Applications of FFT
The Fast Fourier Transform (FFT) reduces DFT computation from O(N²) to O(N log N), making it practical for audio compression (MP3), image compression (JPEG), telecommunications, MRI reconstruction, and solving partial differential equations. Understanding Fourier series is foundational for any engineering or physical science discipline.