Classroom Tips and Techniques: Fourier Series and an Orthogonal Expansions Package
Robert J. Lopez
Emeritus Professor of Mathematics and Maple Fellow
Maplesoft
Introduction
Starting in December of 2006, and for the next three months of the new year, the Tips and Techniques articles in the Maple Reporter looked at the task of creating and visualizing Fourier series expansions. The first article showed how this could be done with built-in Maple functionalities; the remaining three explored three packages written by different users to make this task simpler. Table 1 provides links to these four articles.
December 2006
Teaching Fourier Series with Maple
January 2007
Teaching Fourier Series with Maple - Part 2
February 2007
Teaching Fourier Series with Maple - Part 3
March 2007
Teaching Fourier Series with Maple - Part 4
Table 1 Links to previous articles on Fourier series in Maple
Just recently, I became aware of the OrthogonalExpansions package contributed to the Applications Center by Dr. Sergey Moiseev. This package, with its 18 commands for expanding functions in orthonormal bases (see Table 2), is more general than the built-in OrthogonalSeries package that manipulates expansions in a selected class of orthogonal polynomials.
BesselSeries
HarmonicWaveletSeries
RectSeries
ChebyshevTSeries
HermiteSeries
SincSeries
ChebyshevUSeries
JacobiSeries
SincWaveletSeries
FourierSeries
LaguerreSeries
SphericalSeries
GegenbauerSeries
LegendreSeries
WalshSeries
HaarSeries
RationalSeries
ZernikeSeries
Table 2 Orthogonal series commands in the OrthogonalExpansions package
Bessel functions, the sines and cosines of a Fourier series, and wavelets are not polynomial functions. But the OrthogonalExpansions package is more than a generalization of the OrthogonalSeries package. Expansions in the OrthogonalSeries package are created from known coefficients - the package has no facility to determine the sequence of coefficients needed to represent a function in a given basis. But the 18 commands in the OrthogonalExpansions package will compute these coefficients, and then provide either a complete formal expansion or a designated partial sum.
The FourierSeries command is examined below, with four different examples being considered. Then, by way of contrast, the BesselSeries command is explored to see how well the paradigms in the FourierSeries command are preserved for a less-familiar class of orthogonal functions.
Fourier Series
The FourierSeries Command
The simplest calling sequence for applying the FourierSeries command to is
where , the number of terms, can be "infinity". This command would return a Fourier sine-cosine series. If is a finite number, then a partial sum of the series would be returned; otherwise a formal sum to is returned.
A more general form of this command would be
where 'CoefficientName' is the name of a variable to which will be assigned the coefficients of the returned series, and options are equations detailed in Table 3.
Option Name
Option Value
Option Effect
output =
inert
symbolic
numeric
Returns a formal sum
Default
Coefficients obtained via numeric integration
series =
trigonometric
exponential
polar
hartley
cosine
sine
Default (sine-cosine series)
(See below)
Cosine series
Sine series
constant =
true
false
Default (Maple computes , the coefficient)
Coefficient is assumed to be zero
intoptions =
[...]
Default is ['AllSolutions']
evalfIntoptions =
Default is [digits=6, maxintervals = 10 000]
Table 3 Options available for the FourierSeries command applied to
The default (trigonometric) form of the Fourier series for is , where . Since
the trig form of the Fourier series is equivalent to the polar form
The basis functions in the exponential option are , whereas for the hartley option they are
and
Example 1
Apply the FourierSeries command to .
First, let the number of terms be the indeterminate . The default index in the OrthogonalExpansions package is .
To change the index, use the subs command.
For some expansions, it is possible to get a "closed form" for the partial sum.
The full formal expansion:
For some formal expansions, a closed-form of the sum can be obtained.
Since the full formal sum does not reduce to , obtain its graph.
The formal sum converges to the periodic extension of , except at the jump discontinuities, where it converges to the midpoint of the jump. This is the correct limit of a Fourier series.
The exponential form of the series:
The Hartley form of the series:
Example 2
Use the FourierSeries command to obtain a sine series for .
No general representation for the coefficients can be found, so Maple returns the unevaluated integrals that determine these coefficients.
The coefficient integrals can be evaluated numerically with the following syntax. Note that the number of terms must be finite.
To change the number of digits from the default (6) to, say, 10, use the evalfIntoptions parameter.
Example 3
Obtain a sine series for , by means of the FourierSeries command.
By default, integrals include the option "AllSolutions" so that all the coefficients are obtained from just the integration.
Thus, the FourierSeries command avoids the trap that catches the student who simply evaluates
=
at and gets a division-by-zero error at . In a partial sum, this subtlety can go unnoticed:
Example 4
Apply the FourierSeries command to the function .
Obtain a sine series with a fixed number of terms:
In this instance, a general expression for the coefficients can be inferred from the following inert representation.
The product symbol represents terms of the form . When is even, the sine factor is zero, so only terms with odd are nonzero. That implies the coefficients are for odd.
Bessel Series
The BesselSeries Command
For on , a formal Bessel expansion in terms of is obtained with
By switching to the extended typesetting mode with
Maple will display the requisite Bessel functions with the more standard notation . Thus, the formal expansion becomes
To simplify the display of the zeros of , execute the following alias command.
The formal expansion now becomes
If, for example, and , the following partial sum of the Bessel series expansion can be obtained.
Interestingly enough, Maple is able to evaluate the integrals
in terms of the StruveH functions . Use of the numeric option leads to
suggesting the graph in Figure 1.
Figure 1 Graph of a 20-term partial sum of the Bessel series for
Legal Notice: © Maplesoft, a division of Waterloo Maple Inc. 2012. Maplesoft and Maple are trademarks of Waterloo Maple Inc. This application may contain errors and Maplesoft is not liable for any damages resulting from the use of this material. This application is intended for non-commercial, non-profit use only. Contact Maplesoft for permission if you wish to use this application in for-profit activities.