Trigonometric series approximation of a square wave

An updated version of this demonstration, without Java, is available here.

This applet plots a square wave function with period one along with an approximating trigonometric series. If n terms are requested, the approximating series is

.