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 builtin 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.
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 builtin
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 lessfamiliar 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 sinecosine 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 (sinecosine series)
(See below)
(See below)
(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 .
 (1) 



To change the index, use the subs command.
 (2) 



For some expansions, it is possible to get a "closed form" for the partial sum.
 (3) 



The full formal expansion:
 (4) 



For some formal expansions, a closedform of the sum can be obtained.
 (5) 



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:
 (6) 



The Hartley form of the series:
 (7) 





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.
 (8) 



The coefficient integrals can be evaluated numerically with the following syntax. Note that the number of terms must be finite.
 (9) 



To change the number of digits from the default (6) to, say, 10, use the evalfIntoptions parameter.
 (10) 





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.
 (11) 



Thus, the FourierSeries command avoids the trap that catches the student who simply evaluates
=
at and gets a divisionbyzero error at . In a partial sum, this subtlety can go unnoticed:
 (12) 





Example 4


Apply the FourierSeries command to the function .



Obtain a sine series with a fixed number of terms:
 (13) 



In this instance, a general expression for the coefficients can be inferred from the following inert representation.
 (14) 



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
 (15) 



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
 (16) 
 (17) 



To simplify the display of the zeros of , execute the following alias command.
The formal expansion now becomes
 (18) 



If, for example, and , the following partial sum of the Bessel series expansion can be obtained.
 (19) 



Interestingly enough, Maple is able to evaluate the integrals
in terms of the StruveH functions . Use of the numeric option leads to
 (20) 



suggesting the graph in Figure 1.

Figure 1 Graph of a 20term 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 noncommercial, nonprofit use only. Contact Maplesoft for permission if you wish to use this application in forprofit activities.
