# Fourier cosine series

• Jan 17th 2009, 01:40 PM
BenWong
Fourier cosine series
Can someone help me with the following: (I'm getting lost with the integrals and I can't really type them here)

f(x) = x(a-x), 0<= x <= a Find this in a Fourier cosine series.

I have the answers, I'm just having trouble computing it.

• Jan 17th 2009, 02:45 PM
DeMath
Quote:

Originally Posted by BenWong
Can someone help me with the following: (I'm getting lost with the integrals and I can't really type them here)

f(x) = x(a-x), 0<= x <= a Find this in a Fourier cosine series.

I have the answers, I'm just having trouble computing it.

You need to use these formulas:

$f\left( x \right) = {a_0} + \sum\limits_{n = 1}^\infty {{a_n}\cos \left( {\frac{{\pi nx}}{l}} \right)} {\text{ }}\left( {{\text{0}} \leqslant x \leqslant l} \right)$,

where ${a_0} = \frac{1}{l}\int\limits_0^l {f\left( x \right)} dx$ and ${a_n} = \frac{2}{l}\int\limits_0^l {f\left( x \right)\cos \left( {\frac{{\pi nx}}{l}} \right)} dx{\text{ }}\left( {n \geqslant 1} \right)$.

In your case (problem) $l = a$.

What you can not?
• Jan 17th 2009, 03:06 PM
BenWong
Yeah, how do you integrate

x(a-x)cos(pi*n*x/a) dx?
• Jan 17th 2009, 03:39 PM
skamoni
Quote:

Originally Posted by DeMath
${a_0} = \frac{1}{l}\int\limits_0^l {f\left( x \right)} dx$

Surely it's:

${a_0} = \frac{2}{l}\int\limits_0^l {f\left( x \right)} dx$?
• Jan 17th 2009, 04:18 PM
DeMath
Quote:

Originally Posted by skamoni
Surely it's:

${a_0} = \frac{2}{l}\int\limits_0^l {f\left( x \right)} dx$?

Look at it again carefully

$f\left( x \right) = {a_0} + \sum\limits_{n = 1}^\infty {{a_n}\cos \left( {\frac{{\pi nx}}{l}} \right)} {\text{ }}\left( {{\text{0}} \leqslant x \leqslant l} \right)$

${\text{where }}{a_0} = \frac{1}{l}\int\limits_0^l {f\left( x \right)} dx{\text{ and }}{a_n} = \frac{2}{l}\int\limits_0^l {f\left( x \right)\cos \left( {\frac{{\pi nx}}{l}} \right)} dx{\text{ }}\left( {n \geqslant 1} \right)
$

(Nod)
• Jan 17th 2009, 04:21 PM
skamoni
Sorry. Should have read that more carefully.

I would suggest Integrating by parts, i'm guessing you know how to if you're studying Fourier series.
• Jan 17th 2009, 05:35 PM
DeMath
Quote:

Originally Posted by BenWong
Can someone help me with the following: (I'm getting lost with the integrals and I can't really type them here)

f(x) = x(a-x), 0<= x <= a Find this in a Fourier cosine series.

I have the answers, I'm just having trouble computing it.

So, Find a Fourier cosine series for $f\left( x \right) = x\left( {a - x} \right)$, $0 \leqslant x \leqslant a$.

$f\left( x \right) = {a_0} + \sum\limits_{n = 1}^\infty {{a_n}\cos \left( {\frac{{\pi nx}}{l}} \right)} {\text{ }}\left( {{\text{0}} \leqslant x \leqslant l} \right)$,

where ${a_0} = \frac{1}{l}\int\limits_0^l {f\left( x \right)} dx{\text{ and }}{a_n} = \frac{2}{l}\int\limits_0^l {f\left( x \right)\cos \left( {\frac{{\pi nx}}{l}} \right)} dx{\text{ }}\left( {n \geqslant 1} \right).$

In your case (problem) $l = a$.

${a_0} = \frac{1}{a}\int\limits_0^a {x\left( {a - x} \right)} dx = \frac{1}{a}\left. {\left( {\frac{{a{x^2}}}{2} - \frac{{{x^3}}}{3}} \right)} \right|_0^a = \frac{{{a^2}}}{2} - \frac{{{a^2}}}{3} = \frac{{{a^2}}}{6}.$

${a_n} = \frac{2}{a}\int\limits_0^a {x\left( {a - x} \right)\cos \left( {\frac{{\pi nx}}{a}} \right)} dx =$

$= 2\int\limits_0^a x \cos \left( {\frac{{\pi nx}}{a}} \right)dx - \frac{2}{a}\int\limits_0^a {{x^2}} \cos \left( {\frac{{\pi nx}}{a}} \right)dx = {I_1} - {I_2}.$

${I_1} = 2\int\limits_0^a x \cos \left( {\frac{{\pi nx}}{a}} \right)dx = \frac{{2a}}{{\pi n}}\int\limits_0^a x d\left( {\sin \left( {\frac{{\pi nx}}{a}} \right)} \right) =$

$= \left. {\frac{{2ax}}{{\pi n}}\sin \left( {\frac{{\pi nx}}{a}} \right)} \right|_0^a - \frac{{2a}}{{\pi n}}\int\limits_0^a {\sin \left( {\frac{{\pi nx}}{a}} \right)dx} =$

$= \left. {\frac{{2ax}}{{\pi n}}\sin \left( {\frac{{\pi nx}}{a}} \right)} \right|_0^a - \frac{{2{a^2}}}{{{\pi ^2}{n^2}}}\int\limits_0^a {\sin \left( {\frac{{\pi nx}}{a}} \right)d} \left( {\frac{{\pi nx}}{a}} \right) =$

$= \left. {\left[ {\frac{{2ax}}{{\pi n}}\sin \left( {\frac{{\pi nx}}{a}} \right) + \frac{{2{a^2}}}{{{\pi ^2}{n^2}}}\cos \left( {\frac{{\pi nx}}{a}} \right)} \right]} \right|_0^a =$

$= \frac{{2{a^2}}}{{\pi n}}\sin \left( {\pi n} \right) + \frac{{2{a^2}}}{{{\pi ^2}{n^2}}}\cos \left( {\pi n} \right) - \frac{{2{a^2}}}{{{\pi ^2}{n^2}}} =$

$= \frac{{2{a^2}}}{{{\pi ^2}{n^2}}}{\left( { - 1} \right)^n} - \frac{{2{a^2}}}{{{\pi ^2}{n^2}}} = \frac{{2{a^2}}}{{{\pi ^2}{n^2}}}\left[ {{{\left( { - 1} \right)}^n} - 1} \right].$

${I_2} = \frac{2}{a}\int\limits_0^a {{x^2}} \cos \left( {\frac{{\pi nx}}{a}} \right)dx = \frac{2}{{\pi n}}\int\limits_0^a {{x^2}d\left( {\sin \left( {\frac{{\pi nx}}{a}} \right)} \right)} =$

$= \left. {\frac{{2{x^2}}}{{\pi n}}\sin \left( {\frac{{\pi nx}}{a}} \right)} \right|_0^a - \frac{4}{{\pi n}}\int\limits_0^a {x\sin \left( {\frac{{\pi nx}}{a}} \right)dx} =$

$= \left. {\frac{{2{x^2}}}{{\pi n}}\sin \left( {\frac{{\pi nx}}{a}} \right)} \right|_0^a + \frac{{4a}}{{{\pi ^2}{n^2}}}\int\limits_0^a {xd\left( {\cos \left( {\frac{{\pi nx}}{a}} \right)} \right)} =$

$= \left. {\left[ {\frac{{2{x^2}}}{{\pi n}}\sin \left( {\frac{{\pi nx}}{a}} \right) + \frac{{4ax}}{{{\pi ^2}{n^2}}}\cos \left( {\frac{{\pi nx}}{a}} \right)} \right]} \right|_0^a - \frac{{4a}}{{{\pi ^2}{n^2}}}\int\limits_0^a {\cos \left( {\frac{{\pi nx}}{a}} \right)} dx =$

$= \left. {\left[ {\frac{{2{x^2}}}{{\pi n}}\sin \left( {\frac{{\pi nx}}{a}} \right) + \frac{{4ax}}{{{\pi ^2}{n^2}}}\cos \left( {\frac{{\pi nx}}{a}} \right)} \right]} \right|_0^a - \frac{{4{a^2}}}{{{\pi ^3}{n^3}}}\int\limits_0^a {\cos \left( {\frac{{\pi nx}}{a}} \right)} d\left( {\frac{{\pi nx}}
{a}} \right) =$

$= \left. {\left[ {\frac{{2{x^2}}}{{\pi n}}\sin \left( {\frac{{\pi nx}}
{a}} \right) + \frac{{4ax}}{{{\pi ^2}{n^2}}}\cos \left( {\frac{{\pi nx}}
{a}} \right) - \frac{{4{a^2}}}{{{\pi ^3}{n^3}}}\sin \left( {\frac{{\pi nx}}
{a}} \right)} \right]} \right|_0^a =$

$= \frac{{2{a^2}}}{{\pi n}}\sin \left( {\pi n} \right) + \frac{{4{a^2}}}{{{\pi ^2}{n^2}}}\cos \left( {\pi n} \right) - \frac{{4{a^2}}}{{{\pi ^3}{n^3}}}\sin \left( {\pi n} \right) = \frac{{4{a^2}}}{{{\pi ^2}{n^2}}}{\left( { - 1} \right)^n}.$

So, we have

${a_n} = \frac{{2{a^2}}}{{{\pi ^2}{n^2}}}\left[ {{{\left( { - 1} \right)}^n} - 1} \right] - \frac{{4{a^2}}}{{{\pi ^2}{n^2}}}{\left( { - 1} \right)^n} = \frac{{2{a^2}}}{{{\pi ^2}{n^2}}}\left[ {{{\left( { - 1} \right)}^{n + 1}} - 1} \right].$

${a_1} = 0,{\text{ }}{a_2} = - \frac{{4{a^2}}}{{4{\pi ^2}}},{\text{ }}{a_3} = 0,{\text{ }}{a_4} = - \frac{{4{a^2}}}{{16{\pi ^2}}},{\text{ }} \ldots ,{\text{ }}{a_{2k - 1}} = 0,{\text{ }}{a_{2k}} = - \frac{{4{a^2}}}{{{{\left( {2k} \right)}^2}{\pi ^2}}}{\text{.}}$

Finally, we have

$f\left( x \right) = \frac{{{a^2}}}{6} - \frac{{4{a^2}}}{{{\pi ^2}}}\sum\limits_{k = 1}^\infty {\frac{1}{{{{\left( {2k} \right)}^2}}}\cos \left( {\frac{{2\pi kx}}{a}} \right)} {\text{ }}\left( {0 \leqslant x \leqslant a} \right).$
• Jan 18th 2009, 10:24 AM
Jester
Quote:

Originally Posted by DeMath
You need to use these formulas:

$f\left( x \right) = {a_0} + \sum\limits_{n = 1}^\infty {{a_n}\cos \left( {\frac{{\pi nx}}{l}} \right)} {\text{ }}\left( {{\text{0}} \leqslant x \leqslant l} \right)$,

where ${a_0} = \frac{1}{l}\int\limits_0^l {f\left( x \right)} dx$ and ${a_n} = \frac{2}{l}\int\limits_0^l {f\left( x \right)\cos \left( {\frac{{\pi nx}}{l}} \right)} dx{\text{ }}\left( {n \geqslant 1} \right)$.

In your case (problem) $l = a$.

What you can not?

If you define your Fourier cosine sereis as

$f\left( x \right) = \frac{a_0}{2} + \sum\limits_{n = 1}^\infty {{a_n}\cos \left( {\frac{{\pi nx}}{l}} \right)} {\text{ }}\left( {{\text{0}} \leqslant x \leqslant l} \right)$,

then ${a_n} = \frac{2}{l}\int\limits_0^l {f\left( x \right)\cos \left( {\frac{{\pi nx}}{l}} \right)} dx{\text{ }} n = 0, 1, 2, \cdots$.

Just one integral formula to remember.
• Jan 18th 2009, 10:39 AM
DeMath
Quote:

Originally Posted by danny arrigo
If you define your Fourier cosine sereis as

$f\left( x \right) = \frac{a_0}{2} + \sum\limits_{n = 1}^\infty {{a_n}\cos \left( {\frac{{\pi nx}}{l}} \right)} {\text{ }}\left( {{\text{0}} \leqslant x \leqslant l} \right)$,

then ${a_n} = \frac{2}{l}\int\limits_0^l {f\left( x \right)\cos \left( {\frac{{\pi nx}}{l}} \right)} dx{\text{ }} n = 0, 1, 2, \cdots$.

Just one integral formula to remember.

I understood you.
This is the same, just in a more general way.(Nod)