← Back to experiments

Interactive experiment · Harmonic analysis

Fourier series and a square wave

Move the slider to increase the number of odd-frequency sine waves in the approximation.

Consider the partial sum

\[S_N(x)=\frac{4}{\pi}\sum_{k=0}^{N-1}\frac{\sin((2k+1)x)}{2k+1},\qquad -\pi\leq x\leq \pi.\]

As \(N\) increases, this approaches the square wave at its points of continuity. Near its jumps, the persistent overshoot is an example of the Gibbs phenomenon.

Partial sums

INTERACTIVE
5

Solid line: partial sum · Dashed line: limiting square wave (away from the jump points).

What to notice

The approximation rapidly becomes almost constant away from the discontinuities, but the overshoot near each jump does not simply disappear as more terms are added. Instead, it becomes localized into a smaller neighborhood.