Don Stephenson Don Stephenson

Fourier Series

Every periodic signal is a chord of sine waves

Watch the epicycle stack trace the curve — showing how f(t) = Σ Aₙ·sin(nωt + φₙ) builds a waveform one spinning circle at a time. Drag a spectrum stem to set amplitude, rotate its handle to set phase, or load a preset (square, sawtooth, AM, FM…) to see the frequency-domain signature behind each shape.

Fourier Series

f(t) = Σ Aₙ·sin(nωt + φₙ)  ·  each circle is one term, stacked tip-to-tail
Frequency domain — amplitude spectrum |Aₙ| vs ω drag stem ↕ = amplitude (circle radius) · drag ○ handle ⟳ = phase (start angle) · position = frequency (spin rate)
Reference notes — DFT · modulation · where this shows up in AI

DFT — the inverse of this app

This page does synthesis: you pick the spectrum, it builds the wave. The Discrete Fourier Transform does analysis: given N samples x[k], it recovers each stem via X[n] = Σₖ x[k]·e^(−i2πnk/N). |X[n]| is the stem height, arg X[n] is the handle angle. The FFT is just a fast (O(N log N)) way to compute it. Synthesis and analysis are exact inverses — nothing is lost either way.

Modulation — AM vs FM

AM multiplies a carrier by the message: multiplication in time = shifting in frequency, so the message reappears as two mirror sidebands at ωc±ωm (3 lines total). FM wobbles the carrier's frequency instead: even one sine message spawns an infinite Bessel-weighted comb Jₙ(β) of sidebands. That's why FM needs more bandwidth but keeps a constant envelope — noise that clips amplitude doesn't touch the information.

Where AI uses this

Convolution theorem: convolution in time = multiplication in frequency — the trick behind fast CNN layers and why filters are "frequency selectors". Transformer positional encoding is literally this app: position t is encoded as sin/cos(ωₙt) at geometrically spaced ωₙ, a Fourier basis for "where am I in the sequence". Fourier features / SIREN nets use sin(Wx+φ) activations so networks can learn high-frequency detail — a learned Fourier series. And spectral decay ⇄ smoothness (square vs triangle here) is the same idea as spectral bias: neural nets learn low frequencies first.
y(t) = 0.000   t = 0.00 rad
Power — computed two ways
Time domain  ⟨y(t)²⟩
0.0000
=
Frequency domain  Σ ½Aₙ²
0.0000
✓ match
RMS0.0000
Peak0.0000
Crest factor—
Power by harmonic
Presets
DRAG THE SPECTRUM STEM FOR AMPLITUDE · DRAG THE HANDLE FOR PHASE

This tool does synthesis, not analysis: you set an amplitude and phase for each harmonic, and it sums them into a waveform in real time with a hand-rolled canvas renderer — no charting library. The sections below build up the math the stage and spectrum panels are actually showing; the "Reference notes" accordion inside the Explorer tab covers the DFT, AM/FM modulation, and where this shows up in AI, so that ground isn't repeated here.

1. A Fourier series is a sum of harmonically-related circles

Any periodic signal $f(t)$ with period $T$ (fundamental frequency $\omega = 2\pi/T$) can be written as a sum of sines and cosines at integer multiples of $\omega$: $$f(t) = A_0 + \sum_{n=1}^{\infty} A_n\sin(n\omega t + \varphi_n)$$ Each term is called a harmonic: $n=1$ is the fundamental (same frequency as the signal itself), $n=2$ is the first overtone at double the frequency, and so on. This tool lets you build that sum by hand, one generator at a time, and watch the partial sum converge toward whatever shape you're targeting as you add more harmonics.

2. Each term is the Unit Circle Explorer, spinning

A single term $A_n\sin(n\omega t+\varphi_n)$ is exactly the $y$-coordinate of a point going around a circle of radius $A_n$ at angular speed $n\omega$, starting at phase $\varphi_n$ — the same $(\cos\theta,\sin\theta)$ construction as the Unit Circle Explorer, just with the angle now advancing over time instead of being dragged by hand. Stacking generators tip-to-tail (each circle's center riding on the tip of the previous one) is the classical "epicycle" picture, and it's a literal drawing of the sum in the formula above, not just an animation trick.

3. Two equivalent descriptions of the same signal

The stage plots $y(t)$ against time — the time domain. The spectrum plots $|A_n|$ against frequency $n\omega$ — the frequency domain. Both fully determine the signal; neither carries more information than the other. Dragging a spectrum stem up or down changes that harmonic's radius $A_n$; rotating its handle changes its starting phase $\varphi_n$. Every one of those edits shows up immediately in the time-domain stage, because the stage is nothing more than the spectrum, summed.

4. Power splits by harmonic (Parseval's theorem)

The "Power computed two ways" readout is Parseval's theorem made visible: the average power of the signal, measured directly in the time domain, equals the sum of each harmonic's own power measured in the frequency domain: $$\langle y(t)^2 \rangle = \sum_n \tfrac{1}{2}A_n^2$$ That's why the two numbers in the tool always agree — they're the same total, computed two different ways. It also means the "Power by harmonic" bar chart is a literal breakdown of where the signal's energy lives, harmonic by harmonic, with nothing double-counted or left over.

5. Sharp corners need infinitely many harmonics

A perfectly smooth wave (a single sine) needs exactly one harmonic. A signal with a sharp corner or jump — the square wave and sawtooth presets — needs infinitely many, because no finite sum of smooth sine waves can reproduce a true discontinuity exactly. Truncating the sum still overshoots the jump by a fixed fraction no matter how many harmonics you add (the Gibbs phenomenon); you can see the ripples this leaves behind by adding generators to the square-wave preset one at a time. The rate the harmonic amplitudes decay with $n$ is a direct readout of smoothness: a sharp corner decays slowly ($1/n$), while a signal with no corners at all decays much faster.

6. Pedagogical flow

  1. Load "Pure sine" and confirm there's exactly one generator, one spectrum stem, and the two power numbers already match.
  2. Load "Square wave" and add generators one at a time: watch the corners sharpen but never quite settle, and watch the power-by-harmonic bars fall off slowly.
  3. Drag one stem's phase handle a quarter turn and watch the time-domain stage shift — the amplitude spectrum alone never tells the whole story.
  4. Compare "Square wave" against "Triangle": the triangle's corners are gentler (continuous, but not smooth), and its harmonics decay noticeably faster.