Fourier Series for a piecewise function help

dinospamoni
Messages
90
Reaction score
0

Homework Statement



I'm trying to find a Fourier series for the piecewise function where f(x)=

0 \in -\pi \leq x \leq 0
-1 \in 0 \leq x \leq \frac{\pi}{2}
1 \in \frac{\pi}{2} \leq x \leq \pi

Homework Equations



a_{n} = \frac{1}{\pi} \int_{0}^{2\pi}\cos(nx)y(x)\,dx
b_{n} = \frac{1}{\pi} \int_{0}^{2\pi}\sin(nx)y(x)\,dx

The Attempt at a Solution



I found the pattern that every even a is 0, so that becomes
a_{m} = \sum_{m=1}^{\infty}\frac{(-1)^{m}2}{(2m-1)\pi}

and the b coefficients are 0 when n is odd and 0 for every other even n, so that becomes
b_{m} = \sum_{m=1}^{\infty}\frac{-2}{\frac{4m-2}{2}\pi}

however when I plot this, the plot between -pi and -pi/2 is switched with the plot between pi/2 and pi

I attached a picture for reference along with a plot of f(x)

Any ideas of where i went wrong?
 

Attachments

  • Screen capture00000000000000000 2013-04-24 at 4.01.46 PM.JPG
    Screen capture00000000000000000 2013-04-24 at 4.01.46 PM.JPG
    17.1 KB · Views: 516
  • Screen capture00000000000000000 2013-04-24 at 4.02.58 PM.JPG
    Screen capture00000000000000000 2013-04-24 at 4.02.58 PM.JPG
    8 KB · Views: 428
Last edited:
Physics news on Phys.org
dinospamoni said:
Any ideas of where i went wrong?
Not really since you didn't show your work. Just posting your final, probably wrong answer isn't very helpful.
 
Whoops sorry, I forgot I didn't do this all in mathematica:

a_{0} = 0

a_{1} = \frac{-2}{\pi}

a_{2} = 0

a_{3} = \frac{2}{3\pi}

a_{4} = 0

a_{5} = \frac{-2}{5\pi}

a_{6} = 0b_{1} = 0

b_{2} = \frac{-2}{\pi}

b_{3} = 0

b_{4} = 0

b_{5} = 0

b_{6} =\frac{-2}{3\pi}

b_{7} = 0

b_{8} = 0

b_{9} = 0

b_{10} =\frac{-2}{5\pi}

b_{11} = 0

b_{12} = 0

b_{13} = 0

b_{14} = \frac{-2}{7\pi}
 
Last edited:
And I figured out the summations from just looking at these in terms of n:

a_{n} = \sum\frac{(-1)^{n}2}{n\pi}

b_{n} = \sum\frac{-2}{\frac{n}{2}\pi}

and then to get rid of the 0s I made it in terms of m:

a_{m} = \sum\frac{(-1)^{m}2}{(2m-1)\pi}

b_{m} = \sum\frac{-2}{\frac{4m-2}{2}\pi}

The function is then:

g(x) = \sum_{m=1}^{\infty} a_m Cos((2m-1)x) + \sum_{m=1}^{\infty} b_m Sin((2m-1)x)
 
Last edited:
I figured out what I did wrong, but thanks!
 
There are two things I don't understand about this problem. First, when finding the nth root of a number, there should in theory be n solutions. However, the formula produces n+1 roots. Here is how. The first root is simply ##\left(r\right)^{\left(\frac{1}{n}\right)}##. Then you multiply this first root by n additional expressions given by the formula, as you go through k=0,1,...n-1. So you end up with n+1 roots, which cannot be correct. Let me illustrate what I mean. For this...
Back
Top