# Square Fourier

Wave · y = f(x, t)

`y = sin(x−t) + sin(3(x−t))/3 + sin(5(x−t))/5 + sin(7(x−t))/7`

[Open in the app](https://www.wavelace.com/app#p=5) · [This page](https://www.wavelace.com/presets/square-fourier)

### What it draws

Every term is a sine of the same quantity `x − t`, so the shape is rigid and slides right at exactly one unit per second at `Speed` 1. It repeats every `2π ≈ 6.28` units and, at a fixed point, every `6.28` seconds. What the four terms build is a square wave. The fundamental has wavenumber 1, then the third harmonic at a third the height, the fifth at a fifth, the seventh at a seventh, and no even harmonics at all. Each one steepens the rise and flattens the top a little further.

### Why the pattern

Taking the odd harmonics on for ever, `sin(u) + sin(3u)/3 + sin(5u)/5 + …` sums to exactly `π/4 ≈ 0.785` for every `u` between `0` and `π`, and to `−π/4` on the other half. That is a flat step which jumps at `x − t = 0` and `±π`. Four terms already give the flat stretches and the near-vertical sides, and the visible wobble on the plateau is the tail of the series that has been left out.

The dents and horns beside each jump are worth a look. The tallest ripple, just beside the step, reaches `0.930` against a plateau of `0.785`, an overshoot of eighteen per cent. Adding terms pushes that horn closer to the jump and makes it narrower, but never shorter: with six terms it still stands at `0.928`. This is the *Gibbs phenomenon*, and it is why a square pulse pushed through a filter comes out ringing.

### History

Fourier's claim that any shape is a sum of sines came with the heat theory he published in 1822. Henry Wilbraham noticed the overshoot in 1848. Josiah Willard Gibbs described it in a note to Nature in 1899, and Maxime Bôcher analysed it and gave it Gibbs's name in 1906.

### Try

- `Front` in the deck: the flat tops and the horns beside each jump read best straight on.
- Add the next harmonic, `sin(x − t) + sin(3(x − t))/3 + sin(5(x − t))/5 + sin(7(x − t))/7 + sin(9(x − t))/9`: flatter plateau, same horn.
- Go the other way with `sin(x − t) + sin(3(x − t))/3` and watch the square dissolve into a wobble.
- Halve `Speed` and the rigid shape crawls right without changing at all.
- Raise `Ribbon depth` until the ribbon's recent past covers a whole period, and its far edge repeats its near one.

### Read more

- [Square wave](https://en.wikipedia.org/wiki/Square_wave)
- [Fourier series](https://en.wikipedia.org/wiki/Fourier_series)
- [Gibbs phenomenon](https://en.wikipedia.org/wiki/Gibbs_phenomenon)
- [Henry Wilbraham](https://en.wikipedia.org/wiki/Henry_Wilbraham)
