Classroom Tips and Techniques: Teaching Fourier Series with Maple - Part 4
Robert J. Lopez
Emeritus Professor of Mathematics and Maple Fellow
Maplesoft
Initializations
Once the files for the Fourier package by Karel Srot are in place, the following command will load its code.
The Fourier Package by Karel Srot
In this fourth (and final) article in a series devoted to Maple implementations of Fourier series calculations, we describe the Fourier package announced by Karel Srot in a post to MaplePrimes on August 21, 2006. Instructions for downloading and installing the package are available at www.math.muni.cz/~xsrot/frady. Although the author notes that this site is primarily in Czech, obtaining the code is straightforward. Installation instructions within the download are in English.
Although a significant portion of the functionality in this package is available elsewhere, the nuances of the commands make for a different feel to the package. In addition, there is a Fourier series Maplet that is worth considering. Recall that in the first article of this series, we detailed how to implement the calculations for Fourier series using just commands built into Maple. In the second, we detailed the FourierSeries package by Amir Khanshan. In the third article in this series, we described the FourierSeries package provided to the Maple Application Center by Wilhelm Werner.
Table of Commands
Table 1 summarizes the commands available in Karel Srot's Fourier package. Note that there are help pages for seven of the eight commands listed when the package is loaded via the with(Fourier) command. The LimitFunction command has no help page and appears to have been superceded by the PeriodicExtension command.
Command
Principal Argument
Usage
FSeriesOfFunction
Provides formal Fourier series
GetPartialSum
Series
Provides a partial sum of the Fourier series
FSeriesNthTerm
Provides term of the Fourier series
FourierCoeff
For specified , provides a list of the Fourier coefficients
AnimGraphOfFSeries
Provides sequence of partial sums graphed atop
PeriodicExtension
Provides graph of periodic extension of and optionally shows points at if is a point of discontinuity
DeviationOfPartialSums
Calculates and displays values of or of the differences at any specific
Table 1 Commands in Karel Srot's Fourier package. "Series" is the object returned by the FSeriesOfFunction command, whereas is the function whose Fourier series is computed.
Computing a Fourier Series
A Fourier series for a function is obtained with the FSeriesOfFunction command. For example, if the function is given by
on the interval its Fourier series is given by
Notice that the Fourier coefficients are not returned as separate entities, but are embedded in a formal representation of the resulting series.
A partial sum of the series is obtained with the GetPartialSum command. For example, the partial sum containing the terms
would be obtained with
where and
A graph of the periodic extension of visible in Figure 1, is obtained with the PeriodicExtension command.
Figure 1 Periodic extension of
Because at each the Fourier series converges to at discontinuities or at endpoints of intervals where initial and final values do not agree, the graph of the limit function for the Fourier series may not be identical to the graph of the periodic extension. Indeed, for given above, the limit function for the Fourier series is the function sketched in Figure 2.
Figure 2 Limit function for Fourier series of
At discontinuities, the series converges to the midpoint of the jump.
A graph of and a partial sum of its Fourier series can be obtained with the AnimGraphOfFSeries command. Figure 3 shows a graph of and the partial sum for which
Figure 3 In black, graph of and in red, partial sum for which
An animation of the convergence of a sequence of partial sums to the limit function appears in Figure 4.
Figure 4 Animation of the convergence of partial sums to limit function
The command FSeriesNthTerm provides a specific th term of the Fourier series expansion, whereas the FourierCoeff command provides the coefficient of the th term.
For example, the second term and the corresponding coefficient(s) of the series
are obtained with
and
respectively.
Bessel's Inequality
Although it can be generalized for arbitrary complete orthonormal sets of functions, Bessel's inequality for the Fourier series can be written as
In order to examine how close this inequality comes to being an equality, the Fourier package contains the DeviationOfPartialSums command, which computes
for given partial sums , and plots a bar-graph of the values of as a function of the index . For example, we would have Figure 5 if the command is applied to the function
Figure 5 Values of for
The numbers in the list above the graph are the value of . We can corroborate this claim by computing the directly, via
Notice that the DeviationOfPartialSums command returns when given the parameter .
The difference at a particular value of can also be obtained with the DeviationOfPartialSums command. In fact, both the values and a bar-graph of the values are available, as we see in Figure 6.
Figure 6 The difference for
That Figure 6 actually produces the differences claimed is verified by the following direct calculation of these differences.
Fourier Series Maplet
While not an integral component of the Fourier package written by Karel Srot, a Fourier series maplet based on the package is available. Its application is detailed in Figures 7-9. In Figure 20, we see the result of what is essentially the FSeriesOfFunction command. The tildes visible in the maplet window appear in Maple 10, but not in Maple 11.
Figure 7 Fourier series for generated by Maplet
Figure 8 shows a partial sum displayed in the window opened via the "Open window for computing partial sums" button on the left in the main maplet.
Figure 8
Partial sum generated by "Open window for computing partial sums" button
Figure 9 displays the partial sum one frame of an animation that shows the convergence of partial sums to the limit function for the Fourier series corresponding to the function .
Figure 9
Animation of convergence of partial sums to Visible is
Legal Notice: The copyright for this application is owned by Maplesoft. The application is intended to demonstrate the use of Maple to solve a particular problem. It has been made available for product evaluation purposes only and may not be used in any other context without the express permission of Maplesoft.