Consider again the function in Example 1 and its Fourier series (20).
f(x)=1-{\frac{8}{\pi^{2}}}\Biggl(\cos\biggl({\frac{\pi x}{2}}\biggr)+{\frac{1}{3^{2}}}\cos\biggl({\frac{3\pi x}{2}}\biggr)+{\frac{1}{5^{2}}}\cos\biggl({\frac{5\pi x}{2}}\biggr)+\cdots\Biggr)\\=1-\frac{8}{\pi^{2}}\sum_{m=1,3,5,…}^{\infty}\frac{1}{m^{2}}\cos\left(\frac{m\pi x}{2}\right)\\=1-\frac{8}{\pi^{2}}\sum_{n=1}^{\infty}\frac{1}{(2n-1)^{2}}\cos\biggl(\frac{(2n-1)\pi x}{2}\biggr). (20)
Investigate the speed with which the series converges. In particular, determine how many terms are needed so that the error is no greater than 0.01 for all x.
The m^{th} partial sum in this series
s_{m}(x)=1-{\frac{8}{\pi^{2}}}\sum_{n=1}^{m}{\frac{1}{(2n-1)^{2}}}\cos\left({\frac{(2n-1)\pi x}{2}}\right) (27)
can be used to approximate the function f . The coefficients diminish as (2n-1)^{-2}, so the series converges fairly rapidly. This is borne out by Figure 10.2.4, where the partial sums for m = 1 (dotted blue) and m = 2 (dashed red) are plotted. To investigate the convergence in more detail, we can consider the error e_{m}(x) = f(x) −s_{m}(x). Figure 10.2.5 shows a plot of |e_{6}(x)| versus x for 0 ≤ x ≤ 2. Observe that |e_{6}(x)| is greatest at the points x = 0 and x = 2, where the graph of f(x) has corners. It is more difficult for the series to approximate the function near these points, resulting in a larger error there for a given m. Similar graphs are obtained for other values of m.
Once you realize that the maximum error always occurs at x = 0 or x = 2, you can obtain a uniform error bound for each m simply by evaluating |e_{m}(x)| at one of these points. For example, for m = 6 we have e_{6}(2) = 0.03370, so |e_{6}(x)| < 0.034 for 0 ≤ x ≤ 2 and, consequently, for all x. Table 10.2.1 shows corresponding data for other values of m; these data are plotted in Figure 10.2.6. From this information you can begin to estimate the number of terms that are needed in the series in order to achieve a given level of accuracy in the approximation. From Table 10.2.1, we see that the maximum error drops below 0.01 somewhere between m = 20 and m = 25. In fact, to guarantee that |e_{m}(x)| ≤ 0.01, we need to choose m = 21, for which the error is e_{21}(2) = 0.00965.
T A B L E 10.2.1 | Values of the Error e_{m}(2) for the Triangular Wave |
m | e_{m}(2) |
2 | 0.09937 |
4 | 0.05040 |
6 | 0.03370 |
10 | 0.02025 |
15 | 0.01350 |
20 | 0.01013 |
55 | 0.00810 |