This demonstration illustrates the use of Fourier series to represent functions. There are two functions built in. One is a step function. The display starts with the exact function. The first time you click the "Add a term button" the first term in the Fourier expansion is plotted. Each successive time you click the "Add a term button", another term is added from the Fourier series and the resulting approximation is plotted. Notice that as you add terms the approximation gets better and better, though for the step function, the approximation is not so good near the discontinuity. This is known as the Gibbs phenomenon. To change functions, click the "Change functions" of course. You may also zoom the view by clicking the left mouse button anywhere on the plot. To return to the original scale, click the "Unzoom" button or click the right mouse button anywhere on the plot.
The demonstration below is an applet. Google Chrome, Firefox, Safari and Microsoft Edge no longer execute applets natively because of security issues with NPAPI plugins. However applets can be played in the Google Chrome browser by using the CheerpJ Applet Runner extension.