# Thread: Fourier series

1. ## Fourier series

hello

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

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

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

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

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

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

in this case$\displaystyle L = \pi$ so:
$\displaystyle 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$

$\displaystyle + \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.

2. Originally Posted by parallel
hello

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

$\displaystyle f(x) = |x-\frac{\pi}{2}| - \frac{\pi}{2}.$
Okay you have, (shown below)
$\displaystyle f(x)=|x-\pi/2|-\pi/2$ for $\displaystyle -\pi<x\leq \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,
$\displaystyle \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,
$\displaystyle \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,
$\displaystyle -\frac{1}{8}\pi^2+\frac{1}{2}\pi^2+\frac{1}{2}\pi^2-\pi^2=-\frac{1}{8}\pi^2$
Thus,
$\displaystyle 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.

3. Originally Posted by ThePerfectHacker
Okay you have, (shown below)
$\displaystyle f(x)=|x-\pi/2|-\pi/2$ for $\displaystyle -\pi<x\leq \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:

$\displaystyle 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

4. Originally Posted by parallel
hello

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

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

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

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

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

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

in this case$\displaystyle L = \pi$ so:
$\displaystyle 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$

$\displaystyle + \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 $\displaystyle b_n$?

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

$\displaystyle 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

5. 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.

6. 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

7. 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 .