XKCD and Fourier

If you’ve done Fourier series approximations of functions, you had three reactions to today’s XKCD comic:

https://imgs.xkcd.com/comics/gravitational_square_wave.png

First, of course, was a smile of recognition. Then came a “wait a minute” as you realized that the Gibbs phenomenon doesn’t get smaller as you add more terms to the Fourier expansion; it just concentrates itself at the corners:

Gibbs phenomenon examples for square wave

That ringing never goes away. Here, for example, is the plot for

∑k=1,3,5,…994kπsin⁡(kπx)

Square wave approximation

Finally, you realized that thinking like this ruins the joke.