MATH 300 -- Directed Readings: RAAA II
February 1 -- A Fourier Series Example

Example 1)

For the function
[Maple Math] on the interval [Maple Math]
we saw that the Fourier coefficients were
[Maple Math] , and

[Maple Math] if [Maple Math]
using
[Maple Math] and [Maple Math] for integral m!

Because Maple will not assume that [Maple Math] is an integer unless we

tell it to, let's start by doing that:

> assume(m,integer);

Then we compute the value of the Fourier coefficient [Maple Math] using the

int (integrate) command:

> a[m] := (1/Pi)*int(x^2*cos(m*x),x=-Pi..Pi);

[Maple Math]

Similarly,

> b[m] := (1/Pi)*int(x^2*sin(m*x),x=-Pi..Pi);

[Maple Math]

Here is the partial sum of the series for m = 0..k :

> FS := k -> Pi^2/3 + sum(a[m]*cos(m*x),m=1..k);

[Maple Math]

(This is set up in Maple as function that takes the integer k to the k th partial

sum.)

Plots of the partial sums of the Fourier series, together with
[Maple Math]

> plot({x^2,FS(2)},x=-Pi..Pi);

> plot({x^2,FS(5)},x=-Pi..Pi);

> plot({x^2,FS(10)},x=-Pi..Pi);

The absolute error if we approximate [Maple Math] by the partial sum of the Fourier series:

[Maple Math]

> plot(abs(x^2 - FS(10)),x=-Pi..Pi);

This shows good agreement! (The absolute error is always less than .4).