# Fourier series

• Aug 27th 2006, 01:40 PM
parallel
Fourier series
hello

I need to find the fourier sine series for the odd function:
defined on $[0,\pi].$

$f(x) = |x-\frac{\pi}{2}| - \frac{\pi}{2}.$

$f(x)$ is periodic of period $2\pi$

I tried to define the function different(to get rid of the absolute value)

$f(x) = -x$ if $0<=x<=\frac{\pi}{2}$
$x-\pi$ if $\frac{\pi}{2}$

I set up the integral for $b_{n}$.

in this case $L = \pi$ so:
$b_{n} = \frac{2}{L}\int_{0}^{\pi}f(x)sin(\frac{{\pi}nx}{L} )dx =
\frac{2}{\pi}\int_{0}^\frac{\pi}{2}-xsin(nx)}dx$

$+ \frac{2}{\pi}\int_{\frac{\pi}{2}}^{\pi}(x-\pi)sin(nx)dx$

and the result I got was incorrect.
I went over and over this problem but couldn't find the mistake.

help would be appreciated.
• Aug 27th 2006, 06:31 PM
ThePerfectHacker
Quote:

Originally Posted by parallel
hello

I need to find the fourier sine series for the odd function:
defined on $[0,\pi].$

$f(x) = |x-\frac{\pi}{2}| - \frac{\pi}{2}.$

Okay you have, (shown below)
$f(x)=|x-\pi/2|-\pi/2$ for $-\pi
This is a strictly monotonic function whose discountinuity points are not replacable, therefore it can be represented as a fourier series.
---
The constant term,
$\pi a_0=\int_{-\pi}^{\pi} f(x) dx=\int_{-\pi}^{\pi/2}f(x)dx+\int_{\pi /2}^{\pi}f(x)dx$
Now these intervals the function behaves like,
$\int_{-\pi}^{\pi/2} -x dx +\int_{\pi/2}^{\pi} x-\pi dx=-\frac{1}{2}x^2 \big|^{\pi/2}_{-\pi}+\frac{1}{2}x^2-\pi x \big|^{\pi}_0$
Thus,
$-\frac{1}{8}\pi^2+\frac{1}{2}\pi^2+\frac{1}{2}\pi^2-\pi^2=-\frac{1}{8}\pi^2$
Thus,
$a_0=-\frac{1}{8}\pi^2$.

The same idea of spliting the function on the interval is used to find the sine and cosine coefficients. I just do not want to do that because I know how long these fourier computations can take.
• Aug 27th 2006, 10:44 PM
CaptainBlack
Quote:

Originally Posted by ThePerfectHacker
Okay you have, (shown below)
$f(x)=|x-\pi/2|-\pi/2$ for $-\pi
This is a strictly monotonic function whose discountinuity points are not replacable, therefore it can be represented as a fourier series.

The problem is to find the Fourier sin series for the odd function defined by:

$
f(x) = \left\{{|x-\frac{\pi}{2}| - \frac{\pi}{2}\ \ \ \ x \in [0,\pi) \atop
f(x)=-f(-x)\ \ \ \ \ x \in (-\pi, 0]\right{}
$

RonL
• Aug 27th 2006, 11:05 PM
CaptainBlack
Quote:

Originally Posted by parallel
hello

I need to find the fourier sine series for the odd function:
defined on $[0,\pi].$

$f(x) = |x-\frac{\pi}{2}| - \frac{\pi}{2}.$

$f(x)$ is periodic of period $2\pi$

I tried to define the function different(to get rid of the absolute value)

$f(x) = -x$ if $0<=x<=\frac{\pi}{2}$
$x-\pi$ if $\frac{\pi}{2}$

I set up the integral for $b_{n}$.

in this case $L = \pi$ so:
$b_{n} = \frac{2}{L}\int_{0}^{\pi}f(x)sin(\frac{{\pi}nx}{L} )dx =
\frac{2}{\pi}\int_{0}^\frac{\pi}{2}-xsin(nx)}dx$

$+ \frac{2}{\pi}\int_{\frac{\pi}{2}}^{\pi}(x-\pi)sin(nx)dx$

and the result I got was incorrect.
I went over and over this problem but couldn't find the mistake.

help would be appreciated.

What do you get for $b_n$?

Simply evaluating what you have here (which looks OK to me) I get:

$
b_n=-\ \frac{4 \sin(\pi\ n/2)}{\pi\ n^2}
$

That this is correct is illustrated by the attachment showing the partial
sums of the Fourier sin series with these coefficients for 2, 8, and 50
terms (together with the function itself).

RonL
• Aug 28th 2006, 06:35 AM
parallel
thanks alot CaptainBlack,I had the most stupid mistake ever(those are hard to find),I integrated cosine as cosine.

after correcting this mistake I got the same as you.

ThePerfectHacker:

thanks for your help too. :)
• Aug 28th 2006, 08:09 AM
CaptainBlack
Quote:

Originally Posted by parallel
thanks alot CaptainBlack,I had the most stupid mistake ever(those are hard to find),I integrated cosine as cosine.

after correcting this mistake I got the same as you.

ThePerfectHacker:

thanks for your help too. :)

Hi Parallel,

I hope you liked the plot of the partial sums of the series, I always find
these gob-smacking. I know that the series does converge to the give
function but am still amazed to see it.

RonL
• Aug 28th 2006, 06:04 PM
parallel
Yea I did like it.

You know, the first time I plotted the Fourier series graph(I'm kind of new to this),it really amazed me,so I know what you mean :).