articleAINumerics
The Gibbs overshoot never shrinks
Add more terms to the Fourier series of a square wave and the wiggle at the jump gets narrower, never shorter. It overshoots by 8.95% of the jump however many terms you take, and the number comes from an integral.
Open in the workbenchDownload .vivOutputs below are from the site build’s run; Run all runs it again in your browser.
Look inside this program
- Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
Take the square wave that is on and on . Its Fourier series is : odd harmonics only, falling off like . Sum the first five and you get a wobbly approximation. Sum eighty and the wobble has all but gone — except right next to the jump, where a spike of the same height as ever has moved in toward and thinned.
Where the height comes from
The sum of the first odd harmonics has its first peak at exactly , where the derivative first vanishes. Evaluate the sum there and it is a Riemann sum, with panels, for . So the height of the first peak tends to a number that has nothing to do with : , against a wave of height 1. The overshoot is , which is of the jump from to .
Why more terms cannot help
The peak sits at and is about that wide, so as grows it carries less and less area. In the mean-square sense the series converges: the integral of the squared error goes to zero. But at the peak itself the error stays for every . That is the difference between convergence in and uniform convergence, and a square wave, being discontinuous, has the first without the second. A smoothing filter (Fejér, Lanczos) trades the spike for a slower approach to the wave; nothing that keeps the partial sums as they are removes it.
What the program checks
The program checks three things. The peak of a thousand harmonics, summed directly, matches the integral computed by Simpson's rule with 2000 panels to a millionth. The peaks of ten and of a hundred harmonics are both above , so adding terms does not lower the peak. And the overshoot is of the jump, to four places.
Printed
Tests 4 of 4 pass
- the peak of a thousand harmonics matches the integral (2/pi) Si(pi) (passes)
- ten harmonics already overshoot by nearly as much: more terms do not help (passes)
- the peak rises 0.179 above the wave (passes)
- the overshoot is 8.95% of the jump (passes)