Problem 1

Find the Fourier Cosine 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 [Maple Math] .

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

[Maple Math]

Then compute the general coefficient, [Maple Math] .

> a[k] := (2/Pi)*int(f(x)*cos(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(a[k],k);

[Maple Math]

It is easy to see the pattern for the coefficients.

> a[1] := coef(1);a[2] := coef(2);a[3] := coef(3);a[4] := coef(4);a[5] := coef(5);a[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

> CF := (x,N) -> a[0]+sum(coef(k)*cos(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),CF(x,0),CF(x,2),CF(x,4),CF(x,6)],x=0..Pi);

[Maple Plot]

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

> plot((f(x)-CF(x,50)),x=0..Pi);

[Maple Plot]