HELP!!!
How to find a fourier series for f(x)={(-π(pi)/4 when-π≤x<0)and π(pi)/4 when 0≤x≤π)
Also,assuming that Fourier series converges show that π/4=1-1/3+1/5-1/7...
General form of a fourier series:
$\displaystyle f(x)= \sum_{-\infty}^{\infty}c_{n}e^{in \pi x/L}$
$\displaystyle c_{n}= \frac{1}{2L}\int_{-L}^{L}f(x)e^{-in \pi x/L}dx$
Remember, 2L = length of the period, so L is half the length of the period.
Those n's are your series. Start with 0, then do 1, then -1, then 2, then -2, etc. You could do any order you want really... try it out to fit your convergence problem.
Note that the two f(x) are technically the same, but treated differently. You use your piecewise defined function to get the cn's. Then you use the cn's to get your series (the f(x) in the top equation).
You first solve for the cn's using a piecewise defined function. In your case, you'll split the integral in two:
$\displaystyle c_{n}= \frac{1}{2\pi}\int_{-\pi}^{0}(-\frac{\pi}{4})e^{-inx}dx + \frac{1}{2\pi}\int_{0}^{\pi}(\frac{\pi}{4})e^{-inx}dx$
$\displaystyle n = 0,\pm1, \pm2, ...$
These can be incredibly tedious, so I suggest using mathematica or something
i'll explain it more carefully. you see how we started with a piecewise defined function:
f(x) = -pi/4 -pi < x < 0
pi/4 0 < x < pi
Okay, you use this function to find your cn values. I'll do n = 0, n = 1, and n = -1:
$\displaystyle c_{0}= \frac{1}{2\pi}\int_{-\pi}^{0}(-\frac{\pi}{4})e^{0}dx + \frac{1}{2\pi}\int_{0}^{\pi}(\frac{\pi}{4})e^{0}dx$
= 0
$\displaystyle c_{1}= \frac{1}{2\pi}\int_{-\pi}^{0}(-\frac{\pi}{4})e^{-ix}dx + \frac{1}{2\pi}\int_{0}^{\pi}(\frac{\pi}{4})e^{-ix}dx$
= -i/2
$\displaystyle c_{-1}= \frac{1}{2\pi}\int_{-\pi}^{0}(-\frac{\pi}{4})e^{ix}dx + \frac{1}{2\pi}\int_{0}^{\pi}(\frac{\pi}{4})e^{ix}d x$
= i/2
So the first few terms in your series are:
0 + (-i/2)*e^(ix) + (i/2)*e^(-ix)
If you plot y = (-i/2)*e^(ix) + (i/2)*e^(-ix)
you'll already see a periodic function, but it needs a lot more terms to look good. You'll find that all the terms with n even are zero, this is because its an odd function and this is expected.
You can get mathematica to give you all the terms you want:
Sum[E^(I*n*x)*((1/(2*Pi))*
Integrate[(Pi/4)*E^(-I*n*y), {y, 0, Pi}] + (1/(2*Pi))*
Integrate[(-Pi/4)*E^(-I*n*y), {y, -Pi, 0}]), {n, -20, 20, 1}]
This will spit out all the terms from n = -20 to 20
No you dont have to use mathematica, its just easier. If you plug in that sum that I talked about, you'll get:
(I/2)/E^(I*x) - (I/2)*E^(I*x) + (I/6)/E^((3*I)*x) - (I/6)*E^((3*I)*x) +
(I/10)/E^((5*I)*x) - (I/10)*E^((5*I)*x) + (I/14)/E^((7*I)*x) -
(I/14)*E^((7*I)*x) + (I/18)/E^((9*I)*x) - (I/18)*E^((9*I)*x) +
(I/22)/E^((11*I)*x) - (I/22)*E^((11*I)*x) + (I/26)/E^((13*I)*x) -
(I/26)*E^((13*I)*x) + (I/30)/E^((15*I)*x) - (I/30)*E^((15*I)*x) +
(I/34)/E^((17*I)*x) - (I/34)*E^((17*I)*x) + (I/38)/E^((19*I)*x) -
(I/38)*E^((19*I)*x)
Notice that f(Pi/2) = Pi/4 by your piecewise defined function at the beginning.
Check out what happens if you plug Pi/2 in for x in the above equation, you'll get:
(I/2)/E^(I*x) - (I/2)*E^(I*x) = 1
(I/6)/E^((3*I)*x) - (I/6)*E^((3*I)*x) = -1/3
(I/10)/E^((5*I)*x) - (I/10)*E^((5*I)*x) = 1/5
(I/14)/E^((7*I)*x) - (I/14)*E^((7*I)*x) = -1/7
etc...
Notice also: I gave the general complex form of the fourier series. Your particular function is odd so you can just use a sine series. Its probably much easier to do so actually. Look into it.
i just want to clarify the formatting
$\displaystyle f(x)=\left\{\begin{array}{cc} \frac{-\pi}{4},&\mbox{ if }-\pi\leq x < 0\\ \frac{\pi}{4},& \mbox{ if } 0\leq x\leq \pi\end{array}\right.$
assuming that the fourier series converges show that
$\displaystyle \frac{\pi}{4}=1-\frac{1}{3}+\frac{1}{5}-\frac{1}{7}...$
For your verification, you should get: $\displaystyle f(x) = 1\sin x + \frac{1}{3}\sin (3x) + \frac{1}{5}\sin (5x) + \frac{1}{7}\sin (7x) + \cdots$
Consider $\displaystyle f\! \left(\frac{\pi}{2}\right)$ and it should be clear that: .$\displaystyle \frac{\pi}{4} = 1 - \frac{1}{3} + \frac{1}{5} - \frac{1}{7} + \cdots$
We've shown that: $\displaystyle f(x) = 1\sin x + \frac{1}{3}\sin (3x) + \frac{1}{5}\sin (5x) + \frac{1}{7}\sin (7x) + \cdots$
Now all you had to do is notice that $\displaystyle \sin \tfrac{n\pi}{2}$ for odd $\displaystyle n$ would give you +1 and -1's. Also, by definition $\displaystyle f(\tfrac{\pi}{2}) = \tfrac{\pi}{4}$ :
$\displaystyle f\! \left(\frac{\pi}{2}\right) = 1\sin \left(\frac{\pi}{2}\right) + \frac{1}{3}\sin \left[3\left(\frac{\pi}{2}\right)\right] + \frac{1}{5}\sin \left[5\left(\frac{\pi}{2}\right)\right] + \frac{1}{7}\sin \left[7\left(\frac{\pi}{2}\right)\right] + \cdots $
$\displaystyle \frac{\pi}{4} = 1(1) \ + \ \frac{1}{3}(-1) \ + \ \frac{1}{5}(1) \ + \ \frac{1}{7}(-1) \ + \ \cdots$
$\displaystyle \frac{\pi}{4} = 1 - \frac{1}{3} + \frac{1}{5} - \frac{1}{7} + \cdots$