You are on page 1of 10

fourser.

html

Maple in Mathematics Education I:


Fourier Series & Wave Equation, Using Partial Sums
by David Canright, Math. Dept., Code MA/Ca, Naval Postgraduate School, Monterey, CA,
dcanright@nps.navy.mil, 2000 David Canright.
Note: This worksheet allows exploration & plotting of Fourier Series (using partial sums
educational setting.

Introduction: Setting up the Worksheet


> restart;
> with(plots): need "plots" package for animation below

Section I: General Definitions for Fourier Series


Note: do this section only once (before L, a0, etc. are ever defined)
term: one term (#n) in series
SN: partial sum (up to N) of series
> term := an*cos(n*Pi*x/L) + bn*sin(n*Pi*x/L);

> SN := a0/2 + 'sum( an*cos(n*Pi*x/L) + bn*sin(n*Pi*x/L), n=1..N )';

Section II: Define Particular Fourier Series

http://www.mapleapps.com/categories/engineering/engmathematics/html/fourser1.html (1 of 10)9/10/2004 10:29:10 AM

) in an

fourser.html

come back and redo this section for each different Fourier Series
>

You have two choices :


If you know the function f , use the first subsection
If you know the coefficients , use the second subsection
If you know f and the coeffiecients, use either subsection
but do not do both !

Section IIa: Either Calculate Coefficients by Integrals


If you know the function f and choose L,
you can calculate the coefficients:
using the integral formulas
define particular function f
(default example is for f(x)= {0 for -1<x<0 and x for 0<x<1})
modify this definition for other series
> f := piecewise(x>0,x);

choose L
> L := 2;

Now evaluate the integrals to find the coefficients


http://www.mapleapps.com/categories/engineering/engmathematics/html/fourser1.html (2 of 10)9/10/2004 10:29:10 AM

fourser.html

Note: these steps must be done in order


> Int( f, x=-L..L ) / L ;

> value(%);

> a0 := %;

> Int( f*cos(n*Pi*x/L), x=-L..L ) / L ;

> value(%);

> simplify(%,trig,assume=integer);

http://www.mapleapps.com/categories/engineering/engmathematics/html/fourser1.html (3 of 10)9/10/2004 10:29:10 AM

fourser.html

> an := %;

> Int( f*sin(n*Pi*x/L), x=-L..L ) / L ;

> value(%);

> simplify(%,trig,assume=integer);

> bn := %;

>
At this point, have defined the series, so skip down to the plots

http://www.mapleapps.com/categories/engineering/engmathematics/html/fourser1.html (4 of 10)9/10/2004 10:29:10 AM

fourser.html

Section 2b: or Specify Coefficients:

&L

come back and redo this section for each different Fourier Series
You must first know the formula for each coefficient
define particular series coefficients and L
(default example is from text pg. 24:

modify these definitions to plot other series


> L := Pi;
> a0 := 0;
> an := 1/n^2;
> bn := 0;
define particular function f (sum of series)
(default example: we don't know f, so set to 0 )
modify this definition for other series
Note: if do not know f, set f := 0;
> f := 0;
>
At this point, have defined the series, so go on to the plots

Section III: Plot Partial Sum

and/or Terms of Series

try changing N on any or all of these

http://www.mapleapps.com/categories/engineering/engmathematics/html/fourser1.html (5 of 10)9/10/2004 10:29:10 AM

fourser.html

choose N to plot the partial sum


> N := 3;
plot( SN, x=-L .. L);

choose N to plot term #N


> N := 3;
plot( subs(n=N,term), x=-L .. L);

http://www.mapleapps.com/categories/engineering/engmathematics/html/fourser1.html (6 of 10)9/10/2004 10:29:10 AM

fourser.html

choose N to plot a partial sum and all the terms up to N


> N := 3;
plot( { a0/2, seq(subs(n=i,term),i=1..N), SN }, x=-L .. L);

http://www.mapleapps.com/categories/engineering/engmathematics/html/fourser1.html (7 of 10)9/10/2004 10:29:10 AM

fourser.html

Section IV: Examine Convergence of Fourier Series


> plot( f, x=-L..L ); look at function over one period

http://www.mapleapps.com/categories/engineering/engmathematics/html/fourser1.html (8 of 10)9/10/2004 10:29:10 AM

fourser.html

choose N to compare the function f to the partial sum


> N := 5;
plot( [SN,f], x=-L .. L);

choose max N to animate the convergence of the partial sum

to f

> Nmax := 5;
display([seq(plot( [SN,f], x=-L .. L),N=0..Nmax)], insequence=true);

http://www.mapleapps.com/categories/engineering/engmathematics/html/fourser1.html (9 of 10)9/10/2004 10:29:10 AM

fourser.html

Conclusion: This worksheet clearly demonstrates Maple's ability to be used as an Educational tool
for advanced mathematical concepts.
Disclaimer: While every effort has been made to validate the solutions in this worksheet, Waterloo
Maple Inc. and the contributors are not responsible for any errors contained and are not liable for any
damages resulting from the use of this material.

http://www.mapleapps.com/categories/engineering/engmathematics/html/fourser1.html (10 of 10)9/10/2004 10:29:10 AM

You might also like