This site is version 0.0.1. Most of the code on this site is drafted by an agent and needs review. I apologize for the AI-speak, we are working on rewriting it!
viv-lang.org

Notebooks · posts/gibbs-overshoot

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.

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.

Look inside this program

  • Atlas

    The program’s map: every function and which calls which.

  • There’s no recorded run of this program yet.

Shift+Enter in a cell runs it and moves to the next. Running a cell runs every cell above it too, as one program.

[1]lines 45–137