Problem 2

Find the Fourier Sine series for the function, [Maple Math] on the interval [Maple Math] and [Maple Math] .

First, clear the workspace and define [Maple Math] .

> restart: f := x -> x*(Pi - x);

[Maple Math]

Next compute the general coefficient, [Maple Math] .

> b[k] := (2/Pi)*int(f(x)*sin(k*x),x=0..Pi);

[Maple Math]

Note that if [Maple Math] is an integer, then the term involving [Maple Math] will be zero. Also, [Maple Math] .

To use this coefficient expression in the series, we need to make it a function of [Maple Math] .

> coef := unapply(b[k],k);

[Maple Math]

It is easy to see the pattern for the coefficients.

> b[1] := coef(1);b[2] := coef(2);b[3] := coef(3);b[4] := coef(4);b[5] := coef(5);b[6] := coef(6);

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Math]

The series - actually an arbitrary partial sum of the series - can be simply defined by

> SF := (x,N) -> sum(coef(k)*sin(k*x),k=1..N);

[Maple Math]

We can verify the convergence of the series by looking a the first few approximations.

> plot([f(x),SF(x,1),SF(x,3),SF(x,5)],x=0..Pi);

[Maple Plot]

A more informative plot for higher order approximations is a plot of the error.

> plot((f(x)-SF(x,25)),x=0..Pi);

[Maple Plot]

One immediate observation is that the Sine series converges much more quickly than the Cosine series.

The maximum error is almost 100 times smaller with only half as many terms. This is because the function and

the first derivative are continuous under the odd extension.