Fourier Cosine Series

M.M. Yovanovich

FOURCOS.MWS

Fourier Cosine Series.

The coefficients [Maple Math] and [Maple Math] for [Maple Math] of the Fourier cosine series: [Maple Math] on the interval from [Maple Math] to [Maple Math] are obtained from the relationships: [Maple Math] and [Maple Math] where [Maple Math] is some arbitrary function defined on the interval.

In this worksheet Fourier cosine coefficients will be obtained for several functions:

1. [Maple Math] ,

2. [Maple Math] ,

3. [Maple Math] ,

4. [Maple Math] where [Maple Math] is a constant.

The last example illustrates how the Fourier cosine series can be usded to approximate the saw-tooth function.

> restart:

nth Fourier coefficient for arbitrary f(x).

> An:= n-> if (n = 0) then int(f(x), x = 0..L)/L else 2/L*int(f(x)*cos(n*Pi*x/L),
x = 0..L) fi;

[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]

Fourier coefficients for f(x) = 1.

> An1:= n-> subs(f(x) = 1, An(n));

[Maple Math]

> An1vals:= [seq(eval(An1(n)), n = 0..10)];

[Maple Math]

All Fourier coefficients are zero except for the first one.

Fourier coefficients for f(x) = x/L.

> An2:= n-> subs(f(x) = x/L, An(n));

[Maple Math]

> An2vals:= [seq(eval(An2(n)), n = 0..10)];

[Maple Math]

For [Maple Math] , [Maple Math] , [Maple Math] is negative for all even integers and [Maple Math] for all odd integers.

Fourier coefficients for f(x) = x/L*(1 - x/L).

> An3:= n-> subs(f(x) = x/L*(1 - x/L), An(n));

[Maple Math]

> An3vals:= [seq(eval(An3(n)), n = 0..10)];

[Maple Math]

For [Maple Math] , [Maple Math] , [Maple Math] is negative for all odd integers and [Maple Math] for all even integers.

Fourier coefficients for f(x) = a*(1 - x/L)^2.

> assume(a>0):
An4:= n-> subs(f(x) = a*(1 - x/L)^2, An(n));

[Maple Math]

> An4vals:= [seq(simplify(eval(An4(n))), n = 0..10)];

[Maple Math]

> an4vals:= evalf(subs(a = 1, %));

[Maple Math]
[Maple Math]

Fourier coefficients for sawtooth profile.

> An5:= n-> 2/L*int(x/L*cos(n*Pi*x/L),x = 0..L/2) +
2/L*int((1-x/L)*cos(n*Pi*x/L), x = L/2..L);

[Maple Math]

> An5vals:= [seq(simplify(eval(An5(n))), n = 1..20)];

[Maple Math]

> A05:= 1/L*Int(x/L, x = 0..L/2) + 1/L*Int((1 - x/L), x = L/2..L);

[Maple Math]

> A05:= value(%);

[Maple Math]

Sawtooth profile with 40 terms of the Fourier cosine series.

> An5vals:= [seq(simplify(eval(An5(n))), n = 1..40)]:

> terms:= [seq(An5vals[n]*cos(n*Pi*x/L), n = 1..40)]:

> sawprofile:= A05 + sum(terms[n], n = 1..40);

[Maple Math]
[Maple Math]

> with(plots):

> plot(subs(L = 1, sawprofile), x = 0..1);

[Maple Plot]

40 terms of the Fourier cosine series provide a reasonable approximation of the saw-tooth profile.