There are a number of nice Wolfram Demonstrations on Fourier Series, but none quite what I seek. The closest I've found is this one, but it has several unnecessary features (e.g., colors) and missing features. Specifically, it addresses just one single target function (a square wave) and forces the user to scroll time forward and back.
What I seek is more closely demonstrated starting at 2:15 in this video. In brief, time keeps running and the graph scrolls to the right. There are multiple circles, each rotating at angular frequency $\omega$, $2 \omega$, ..., and appropriate phases, all added together to approximate the target function.
Specifically I seek a Manipulate with the following features:
- A pulldown menu with perhaps 10 leading periodic functions (sine, square, triangle, ramp left, ramp right, rectified sine, ...
- A selector button list for the number $n$ (from $n = 1$ to $n = 15$) of Fourier components to be included in the approximation
- a scrolling graph of the selected target function (sine, square, ...) and the trace of the Fourier series including just the first (selected) $n$ components
- a two-dimensional graph at the left showing the trajectory of the tip of the chain of rotating vectors. (All this should be clear from the video clip.)
You will need to know the Fourier series coefficients for each target function in order to create each graph. Ideally, these coefficients will be computed using FourierSeries or other appropriate function.
I started programming this and got bogged down in the graphics.
I realize this is real work, so I'll post a bounty at the earliest opportunity (tomorrow) and more.
Here Here is a start:
Manipulate[ Row[{Graphics[{Darker[Green], Circle[{0, 0}, 2], Black, Line[{{0, 0}, 2 {Cos[2 \[Pi] t], Sin[2 \[Pi] t]}}], Red, Line[{2 {Cos[2 \[Pi] t], Sin[2 \[Pi] t]}, {2, 2 Sin[2 \[Pi] t]}}]}, ImageSize -> 300], Plot[{-Sin[2 \[Pi] x], -SquareWave[x]}, {x, -t, -t + 1}, PlotStyle -> {Red, Blue}, Exclusions -> None, PlotRange -> {-1.1, 1.1}, AxesOrigin -> {-t, 0}, ImageSize -> 500]}], {t, 0, 20, AnimationRate -> .3, Appearance -> "Open"}, {{n, 1, "components"}, 1, 15, 1, ControlType -> SetterBar}, {{f, "sine", "function"}, {"sine", "square", "ramp left", "ramp right", "pulse train"}, ControlType -> PopupMenu}] I realize this is real work, so I'll post a bounty at the earliest opportunity (in a few hours).