Section 16.8 Fourier Series: Worked Example
Make sure to complete the activity in Section 16.2 before attempting this one.
In this section, we will use the formulas in Section 16.5 to work out an example, the Fourier series for the function \(f(x)=-\frac12+\sin(2\pi x)\sin(4\pi x)\text{.}\) Then you will plot the individual terms in the Fourier series and their partials sums using an applet.
The formula for the first coefficient \(a_0\) is given in (16.5.3). You can use the Sage code below to calculate the value of this integral.
Using the applet in Figure 16.5, set the \(a_0/2\) slider to correspond to the value you just calcuated. Compare your approximate Fourier series, containing just one term (shown in green), to the actual function (shown in blue).
You should notice that \(\frac12 a_0\) is just the average value of the function. Because the given function is symmetric vertically, this zeroth-order approximation (green) runs across the middle of the graph of the function (blue). In general, the integral in (16.5.3) defines what you mean by “the middle”.
Now you can alter the Sage code above to compute the other coefficients, using (16.5.2) and (16.5.4) in Section 16.5. After each calculation, move the corresponding slider to the value you obtain, and compare the approximation to the given function.
If you move the sliders one by one, resetting the others to zero, you will see how much each individual term contributes to the Fourier series.
If you don't reset the other sliders, but instead combine the contributions from each slider, the applet plots the sum of the corresponding terms (in green), representing an approximation to the actual function (in blue). In the given example, you should obtain an exact match when you include all of the terms with \(m=0,1,2,3\) (most of which will be \(0\)). In general, there are an infinite number of nonzero terms in the Fourier series; your approximation will get better and better as you include more terms.