Fourier decomposition of a square wave

Any enough regular periodic function can be written as an infinite sum of sinusoidal functions, thanks to the Fourier's Theorem. In this app you can see five sinusoidal functions (in various colours) with appropriate amplitude and frequency that sum up to form a square wave (in dark green). A sum of up to 100 sinusoidal functions is shown in dark orange below.
Fourier decomposition of a square wave
Switch on and off terms in the sum acting on checkboxes to see what is the effect of summing terms on the dark green wave. Choose the maximum number of terms in the sum acting on the slider and observe what happens to the dark orange function, whose equation is given below the slider.

Information: Fourier decomposition of a square wave