Mathematics 173 -- Applied Mathematics 1

November 11, 1999

Fourier Sine and Cosine Series

Consider the function [Maple Math] on the interval [0,3]

(This could represent something like an initial temperature distribution in a heat

conduction problem.)

> f := x -> piecewise(x < 3/2, x + 1, x >= 3/2, exp(-x));

[Maple Math]

In our work on BVP for the heat equation, we would expand functions like this in series

using the appropriate eigenfunctions for the problem at hand. Two particular cases

were the Fourier sine series:

[Maple Math]

where [Maple Math]

and the Fourier cosine series

[Maple Math]

where

[Maple Math] and [Maple Math] if [Maple Math]

Both of these are examples of general Fourier series.

The Fourier Sine series of f converges to the odd extension of f on [-3,3]

at points of continuity, and to the average of the one-sided limits at jumps:

>

> B := n -> 2*evalf(Int(f(x)*sin(n*Pi*x/3),x=0..3))/3;

[Maple Math]

> ss := (k,x) -> add(B(n)*sin(n*Pi*x/3),n=1..k);

Warning, `n` in call to `add` is not local

[Maple Math]

> with(plots):

> FP:=plot(f(x),x=0..3,color=blue,discont=true):

> SP:=plot(ss(20,x),x=-3..3,color=red):

> display({FP,SP});

On the other hand, the Fourier cosine series for f converges to the even extension of f on [-3,3]

at points of continuity, and to the average of the one-sided limits at jumps:

> A0 := evalf(Int(f(x),x=0..3))/3;

[Maple Math]

> A := n -> 2*evalf(Int(f(x)*cos(n*Pi*x/3),x=0..3))/3;

[Maple Math]

> sc := (k, x) -> A0 + add(A(n)*cos(n*Pi*x/3),n=1..k);

Warning, `n` in call to `add` is not local

[Maple Math]

> CP := plot(sc(20,x),x=-3..3):

> display({FP,CP});

On larger intervals, the sine and cosine series converge to the periodic extensions of the odd and even

extensions, respectively.