Fourier's original application - watch heat diffuse
Fourier invented his series to answer a practical question: how does heat spread through a metal bar? The answer is that sharp hot spots fade fast and broad warmth lingers, and you can watch it happen mode by mode.
Pick a starting profile, or drag across the top panel to paint your own, and press play. The bar glows with its temperature, the 3D surface grows back in time behind it, and the bars underneath are the Fourier modes of the profile, each shrinking at its own rate. Watch the right-hand end of the spectrum vanish first. Then switch the ends from ice baths to insulation and run it again.
Exact spectral solution: the painted profile is projected onto 64 sine modes and each is multiplied by its decay factor. No time steps, so scrubbing backwards is exact. At t = 0 the 64-term sum shows Gibbs ripples at sharp edges; they are the first thing to cool away.
In one dimension, the temperature u(x, t) along the bar obeys
where α is the thermal diffusivity (the slider). The rate of change at a point is proportional to how curved the profile is there: a peak curves downwards, so it cools; a valley curves upwards, so it warms. Heat flows downhill.
Fourier's insight was that sine waves are the shapes this equation leaves alone. Differentiate sin(nπx/L) twice and you get the same sine back, multiplied by −(nπ/L)². So a single sine mode never changes shape; it only shrinks, by the factor e−α n²π² t / L². Write the starting profile as a sum of modes,
and the whole future follows at once:
That formula is exactly what the demo evaluates. Nothing is stepped forward in time, which is why the scrub slider can run backwards without any loss.
The decay rate grows with the square of the mode number. Mode 10 cools 100 times faster than mode 1, and mode 30 cools 900 times faster. A sharp spike is built from many high modes, so its sharpness is gone almost before the animation starts, leaving a smooth hump made of the few lowest modes.
Physically, a narrow hot spot has steep temperature gradients on both sides, so heat pours away from it quickly. A broad warm region has gentle gradients and drains slowly: a hot spot on a stove fades in seconds, a warm room takes hours.
The surface uses a square-root time axis because of this. On a linear axis the first fraction of a second, where all the high modes die, would be a sliver at the front.
The ends of the bar decide which waves are allowed. With both ends held in ice at 0°, every mode must be zero at x = 0 and x = L, and the modes that do that are the sines sin(nπx/L). Heat leaks out through the ends, so the total heat falls and the bar eventually goes cold everywhere.
With insulated ends no heat can cross them, so the temperature profile must arrive flat (∂u/∂x = 0). The modes that do that are the cosines cos(nπx/L), and they include n = 0, the constant. That constant term never decays: it is the average temperature, and the bar settles to it while the total heat stays at 100%.
The same equation, usually called the diffusion equation, describes dye spreading in water, chemicals moving through cells, and, after a change of variables, the Black-Scholes equation for pricing options. Gaussian blur in image editing is diffusion run on pixel values: it smooths the image by damping high spatial frequencies, just as the bar damps its high modes.
Fourier presented this method in 1807 and published it in 1822 as "Théorie analytique de la chaleur" (The Analytical Theory of Heat). It was controversial: Lagrange objected that a discontinuous profile, like the step preset, could not possibly be a sum of smooth sine waves.
Making sense of that question took decades and produced much of modern analysis: precise ideas of convergence, Dirichlet's conditions, and eventually Lebesgue's integral. The Gibbs ripples you can see at t = 0 on the step are part of the answer: the series converges, but not uniformly near a jump.
Spot a mistake or have an idea?