Fourier Cosine Series
M.M. Yovanovich
FOURCOS.MWS
Fourier Cosine Series.
The coefficients
and
for
of the Fourier cosine series:
on the interval from
to
are obtained from the relationships:
and
where
is some arbitrary function defined on the interval.
In this worksheet Fourier cosine coefficients will be obtained for several functions:
1.
,
2.
,
3.
,
4.
where
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;
Fourier coefficients for f(x) = 1.
> An1:= n-> subs(f(x) = 1, An(n));
> An1vals:= [seq(eval(An1(n)), n = 0..10)];
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));
> An2vals:= [seq(eval(An2(n)), n = 0..10)];
For
,
,
is negative for all even integers and
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));
> An3vals:= [seq(eval(An3(n)), n = 0..10)];
For
,
,
is negative for all odd integers and
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));
> An4vals:= [seq(simplify(eval(An4(n))), n = 0..10)];
> an4vals:= evalf(subs(a = 1, %));
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);
> An5vals:= [seq(simplify(eval(An5(n))), n = 1..20)];
> A05:= 1/L*Int(x/L, x = 0..L/2) + 1/L*Int((1 - x/L), x = L/2..L);
> A05:= value(%);
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);
> with(plots):
> plot(subs(L = 1, sawprofile), x = 0..1);
40 terms of the Fourier cosine series provide a reasonable approximation of the saw-tooth profile.