Application Center - Maplesoft

App Preview:

Maple in Mathematics Education II: Fourier Series & Wave Equation, 1-D Wave Equation Solutions

You can switch back to the summary page by clicking here.

Learn about Maple
Download Application


 

Maple in Mathematics Education II:
Fourier Series & Wave Equation, 1-D Wave Equation Solutions

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 solutions to the (one-dimensional) Wave Equation (using partial sums [Maple Math] ).

:

[Maple Math] , 0 < x < L

Introduction: Setting up the Worksheet

> restart;

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

Section I: General Definitions for Wave Equation

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

Wave Equation: general definitions
first define terms and partial sum of series solution in terms of Xn & Tn

> unassign('X0','T0','Xn','Tn','n','N');

> u0 := X0 * T0;

[Maple Math]

> un := Xn * Tn;

[Maple Math]

> u := u0 + 'sum( un, n=1..N )';

[Maple Math]

> vel := X0 * 'diff(T0,t)' + 'sum( Xn * diff(Tn,t), n=1..N )';

[Maple Math]

>

Section II: Define Eigenfunctions from Boundary Conditions

come back and redo this section for each different pair of Boundary Conditions

>

You have four choices; execute only one :

Section IIa: Either fixed-fixed: X(0) = X(L) = 0

> unassign('A0','B0','t','x','n','L','An','Bn','c','kn');

> X0 := 0;

[Maple Math]

> Xn := sin(kn*x);

[Maple Math]

> Tn := An*cos(kn*c*t) + Bn*sin(kn*c*t);

[Maple Math]

> kn := n*Pi/L;

[Maple Math]

define period of oscillation

> per := 2*L/c;

[Maple Math]

Now jump down to define particular Fourier Series

>

Section IIb: Or, free-free: X'(0) = X'(L) = 0

> unassign('A0','B0','t','x','n','L','An','Bn','c','kn');

> X0 := 1/2;

> T0 := A0 + B0*t;

> Xn := cos(kn*x);

> Tn := An*cos(kn*c*t) + Bn*sin(kn*c*t);

> kn := n*Pi/L;

define period of oscillation

> per := 2*L/c;

Now jump down to define particular Fourier Series

>

Section IIc: Or, fixed-free: X(0) = X'(L) = 0

> unassign('A0','B0','t','x','n','L','An','Bn','c','kn');

> X0 := 0;

> Xn := sin(kn*x);

> Tn := An*cos(kn*c*t) + Bn*sin(kn*c*t);

> kn := (n-1/2)*Pi/L;

define period of oscillation

> per := 4*L/c;

Now jump down to define particular Fourier Series

>

Section IId: Or, free-fixed: X'(0) = X(L) = 0

> unassign('A0','B0','t','x','n','L','An','Bn','c','kn');

> X0 := 0;

> Xn := cos(kn*x);

> Tn := An*cos(kn*c*t) + Bn*sin(kn*c*t);

> kn := (n-1/2)*Pi/L;

define period of oscillation

> per := 4*L/c;

Now jump down to define particular Fourier Series

Section III: Define Particular Fourier Series from Initial Conditions

come back and redo this section for each different Fourier Series

You have two choices :

If you know the functions f and g , use the first subsection

If you know the coefficients , use the second subsection

If you know f and g, and the coeffiecients, use either subsection

but do not do both !

Section IIIa: Either Calculate Coefficients by Integrals

If you know the function f and choose L, c

you can calculate the coefficients: [Maple Math] [Maple Math] [Maple Math] [Maple Math]

using the integral formulas

define particular function f
(default example is from text)
modify this definition for other series

> f := piecewise(x<1,x,2-x);

[Maple Math]

> g := 0;

[Maple Math]

choose L

> L := 2;
c := 1;

[Maple Math]

[Maple Math]

Now evaluate the integrals to find the coefficients

Note: these steps must be done in order

> 2 / L * Int( f, x=0..L );

[Maple Math]

> value(%);

[Maple Math]

> A0 := %;

[Maple Math]

> 2 / L * Int( f * Xn, x=0..L );

[Maple Math]

> value(%);

[Maple Math]

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

[Maple Math]

> An := %;

[Maple Math]

> 2 / L * Int( g, x=0..L ) ;

[Maple Math]

> value(%);

[Maple Math]

> B0 := %;

[Maple Math]

> 2 / (kn*c*L) * Int( g * Xn, x=0..L );

[Maple Math]

> value(%);

[Maple Math]

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

[Maple Math]

> Bn := %;

[Maple Math]

>

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

Section IIIb: Or, Specify Coefficients: [Maple Math] [Maple Math] & 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, c
modify these definitions to plot other series

> L := 2;
c := 1;

> A0 := 0;

> An := 8*sin(n*Pi/2)/(n*Pi)^2;

> B0 := 0;

> Bn := 0;

define particular functions f and g (sum of series)
modify this definition for other series

Note: if do not know f or g, set to 0;

> f := piecewise(x<1,x,2-x);
g := 0;

>

At this point, have defined the series, so go on to the plots

Section IV: Plot Partial Sum [Maple Math] and/or Terms of Series

try changing the parameters on any or all of these

choose N, check initial displacement:

> unassign('x'); t := 0;
N := 10;
plot( {u,f}, x=0 .. L);

[Maple Math]

[Maple Math]

[Maple Plot]

choose N, check initial velocity:

> unassign('x','t');
N := 10;
plot( subs(t=0,{vel,g}), x=0 .. L);

[Maple Math]

[Maple Plot]

choose N, t to plot the partial sum u at some particular time (can use multiples of the period)

> unassign('x');
N := 10;
t := per/3;
plot( u, x=0 .. L);

[Maple Math]

[Maple Math]

[Maple Plot]

choose N, t to plot the partial sum for velocity at some particular time

> unassign('x','t');
N := 10;
plot( subs(t=per/3,vel), x=0 .. L);

[Maple Math]

[Maple Plot]

choose N, t to plot the partial sum u over time at some position

> unassign('t');
N := 10;
x := L/3;
plot( u, t=0 .. per);

[Maple Math]

[Maple Math]

[Maple Plot]

choose N, x to plot the partial sum for velocity over time at some position

> unassign('t');
N := 10;
x := L/3;
plot( vel, t=0 .. per);

[Maple Math]

[Maple Math]

[Maple Plot]

>

Section V: Animate the Vibrating String

choose N, nf (# frames) to animate the partial sum u

> unassign('x','t');
N := 10;
nf := 12; # choose number of frames per period

> animate( u, x=0..L, t=0..(1-1/nf)*per, frames=nf );

[Maple Math]

[Maple Math]

[Maple Plot]

choose N, nf (# frames) to animate the partial sum for velocity

> unassign('x','t');
N := 10;
nf := 12; # choose number of frames per period

> animate( vel, x=0..L, t=0..(1-1/nf)*per, frames=nf );

[Maple Math]

[Maple Math]

[Maple Plot]

choose N, nf (# frames) to animate the partial sum u and the terms

> unassign('x','t');
N := 3;
nf := 24; # choose number of frames per period

> animate( {u, u0, seq(un,n=1..N)}, x=0..L, t=0..(1-1/nf)*per, frames=nf, axes=boxed ); unassign('n'):

[Maple Math]

[Maple Math]

[Maple Plot]

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.