 Application Center - Maplesoft

# Classroom Tips and Techniques: Teaching Fourier Series with Maple - Part 2

You can switch back to the summary page by clicking here. Classroom Tips and Techniques: Teaching Fourier Series with Maple - Part 2

Robert J. Lopez

Emeritus Professor of Mathematics and Maple Fellow

Maplesoft

Introduction

The first article in this series on Teaching Fourier Series with Maple described how to implement the relevant calculations and graphs directly in Maple.  Because these computations require a certain amount of Maple syntax, several faculty members have written dedicated packages that simplify using Maple for teaching and implementing Fourier series.  The most recent such package added to the Maple Application Center is the FourierSeries package by Amir Khanshan, announced at the 2006 Maple Conference in Waterloo, Ontario, Canada, and written up in its Proceedings (ISBN 1-897310-13-7).  Similar in functionality to the FourierSeries package by Wilhelm Werner (to be detailed in our next article), it does not, however, have a provision for creating the odd and even extensions of a function.  This is counterbalanced by the greater simplicity with which a partial sum of the trigonometric series can be obtained in the Khanshan package.  Graphs and animations are somewhat easier in Werner's package, but analytic representations of coefficients and partial sums are easier to obtain in Khanshan's package.

The basic working command of Khanshan's package is the fs command, which computes Fourier coefficients as functions, for both the trigonometric and exponential forms of the series.

In the trigonometric case, the command has the option of returning an additional function that generates partial sums.  The fs command writes the formal series by default, a setting that can be changed with the showfs variable.  The rept command draws the periodic extension of a function defined on a finite interval, and the decompose command modifies the representation of the Fourier coefficients.

Unfortunately, there are no help pages in this package, but its functionality is well documented in an accompanying worksheet prepared by Professor Khanshan.  The package itself was initially made available to the author by Professor Khanshan, but is now available on the Maple Application Center (www.mapleapps.com).  The package code and instructions for installing it are available at the end of the link provided.  In this article, we will assume access to the package, but readers will have to install the package themselves if they want to reproduce the calculations given here.

 >

The FourierSeries Package by Amir Khanshan

Initializations

 > > >

Analytic Calculations

Given the function

 >  (2.2.1)

 >

defined on the trigonometric Fourier series would be generated by the fs command as follows.

 >    (2.2.2)

 >

The Fourier coefficients and are now available as functions of the index , as we see from the experiment

 >    (2.2.3)

 >

The decompose command applied to modifies its representation, taking into account the odd-even cycle produced by in the numerator.  Thus, we have

 >  (2.2.4)

 >

where, of course, the user has to know the appropriate integer (here 2) to include as a parameter.

The fs command assigns to the rule for generating partial sums of the Fourier series.  For example, we have

 >  (2.2.5)

 >

a display considerably improved with

 >  (2.2.6)

 >

Thus, the argument 3 provides the partial sum The exponential form of the Fourier series for is obtained with

 >   (2.2.7)

 >

where now, the coefficients are provided as a function.  For example, we have

 >  (2.2.8)

 >

and, again, the form of the coefficients can be modified by the decompose command, to

 >  (2.2.9)

 >

Unfortunately, with the parameter exp, the fs command does not provide a function that generates partial sums.  A partial sum of the exponential series has to be constructed from primitives, as per the following.

 >  (2.2.10)

 >

Conversion to trigonometric form, and comparison with the corresponding partial sum from the trigonometric series is accomplished with either of the two commands

 >    (2.2.11)

 >

The fs command displays the formal Fourier series as part of its output.  This can be suppressed by assigning the variable showfs the value false.  Thus, the assignment

 > >

 >  (2.2.12)

 >

and

 >  (2.2.13)

 >

Graphical Considerations

Graphing Fourier series created with the fs command relies on Maple's plot command.  That is how the graph of the partial sum

 >  (2.3.1)

 >

appearing in Figure 1 is obtained.

 >  Figure 1 Graph of partial sum of Fourier series for >

The rept command in the package creates a data structure that permits Maple's plot command to draw the periodic extension of a function The periodic extension of

 >  (2.3.2)

 >

a function whose domain is appears in Figure 2.

 >   Figure 2   Periodic extension based on rept command

 >

The graph of a periodic extension and partial sum, seen in Figure 3, is constructed with the Maple display command from the plots package.

 >   Figure 3   Partial sum and periodic extension superimposed

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. 