Fourier Series — 5 Functions
About this app
Five classic periodic functions (square, triangle, half-sine, pulse 80/20, sawtooth) — slider for the partial-sum degree, magnitude spectrum and KaTeX coefficient formula.
Fourier series and the Gibbs phenomenon
A periodic function can be represented as a Fourier series of cosine and sine terms; the partial sum up to order N approximates it. Which coefficients vanish depends on the symmetry. The odd square wave with period 2π and values ±1 is a pure sine series with bₖ = 4/(π·k) for odd k. At jumps the Gibbs phenomenon appears: the partial sums overshoot by about 9 % of the jump height. This overshoot does not vanish as N → ∞; it only becomes narrower. Continuous functions such as the triangle or half-sine converge without Gibbs and much faster.
What the app shows
Five functions are available: square, triangle, half-sine, an 80 % pulse and sawtooth. A slider sets the order N from 1 to 40, and the curve and formula of the partial sum update immediately. Individual harmonics and the target function can be shown. The values panel lists the number of terms, the Gibbs overshoot, the maximum error |f − fₙ| and where the overshoot occurs. The spectrum panel shows the coefficients as bars, for the square wave with the formula bₖ = 4/(π·k).
Try it yourself
Choose the square wave and raise N slowly to 40. Watch the spikes at the jump get narrower while their height stays at about 9 % of the jump. Switch to the triangle: just a few terms give an almost perfect curve because the coefficients fall like 1/k². In the spectrum, compare how quickly the bars shrink for the different functions.
Frequently asked questions
- What is the Fourier series of a square wave?
- For the odd square wave with values ±1 and period 2π, f(x) = (4/π)·[sin x + sin(3x)/3 + sin(5x)/5 + …]. Only odd multiples of the fundamental appear, and the coefficients decay like 1/k.
- What is the Gibbs phenomenon?
- At a jump discontinuity the partial sums of a Fourier series overshoot the function by about 9 % of the jump height. As N grows the overshoot region gets narrower, but its height remains. It only occurs for discontinuous functions.
- Why does a triangle wave’s Fourier series converge faster than a square wave’s?
- The triangle is continuous with only corners, while the square wave jumps. The smoother a function, the faster its Fourier coefficients decay: like 1/k² for the triangle and 1/k for the square wave. So fewer terms are needed for the same accuracy.
- Which functions can I compare in the app?
- Square, triangle, half-sine, an 80 % pulse and sawtooth. For each you see the partial sum, formula, spectrum and maximum error up to N = 40.
Subject: Fourier analysis
More from Fourier analysis
- Ein Radio aus Mathematik: Koeffizienten herausfiltern
- Euler-Zwillinge: Kosinus und Sinus aus e^{iφ}
- Formel-Verwandler: von der reellen zur komplexen Fourier-Reihe
- Draw and Fourier
- Fourier epicycles (3D)
- Fourier Synthesis
- Gezupfte Saite: Wo man zupft, bestimmt den Klang
- Gibbs-Phänomen: wo die Reihe stolpert
A VisuApp by heyprof: interactive, free in your browser, no sign-up. What is a VisuApp? · All apps