Fourier series - unsure if I'm on the right track I got
$$ f(x)=\begin{cases}-\dfrac{\pi}{2},& -\pi<x\le-\dfrac{\pi}{2}\\[1ex]
\phantom{-} x,&-\dfrac{\pi}{2}<x\le\dfrac{\pi}{2} \\[1ex]
\phantom{-}\dfrac\pi2,&\phantom{-}\dfrac{\pi}{2}<x\le\pi\end{cases}$$
Period is $2\pi$, which means $L$ is $\pi.$
Since this is an odd function, I need to find $b_n$, multiply that with $\sin\left(\frac{n\pi x}L\right)$ and that should be my series.
But I'm not sure if what I got is correct. I can't seem to be able to paste it into WolframAlpha with more than a few terms, either. The function itself is pretty straight forward, so you guys can probably see where I've gone wrong if I have!
Fourier series for an odd function should be $\sum\limits_{n=1}^\infty b_n \sin\left(\frac{n\pi x}L\right)$.
$$\sum_{n=1}^\infty \left(\frac{\sin\left(\frac{n\pi}2\right)}{n^2}-\frac{\pi\cos\left(\frac{n\pi}{2}\right)}{2n}+\frac{(-1)^n \pi}{2n}-\frac{\pi\cos\left(\frac{n\pi}{2}\right)}{2n} \right) \sin\left(\frac{n\pi x}\pi\right)$$
So, any fast math guys that can tell me where I should end up?
 A: $$\begin{align}
b_n&=\frac1\pi\int_{-\pi}^\pi f(x)\sin(nx)\,\mathrm dx\\[1ex]
&=-\frac12\int_{-\pi}^{-\frac\pi2}\sin(nx)\,\mathrm dx+\frac1\pi\int_{-\frac\pi2}^{\frac\pi2}x\sin(nx)\,\mathrm dx+\frac12\int_{\frac\pi2}^\pi\sin(nx)\,\mathrm dx\\[1ex]
&=\frac1\pi\int_{-\frac\pi2}^{\frac\pi2}x\sin(nx)\,\mathrm dx+\int_{\frac\pi2}^\pi\sin(nx)\,\mathrm dx\\[1ex]
&=\frac{2\sin\left(\frac{n\pi}2\right)-n\pi \cos\left(\frac{n\pi}2\right)}{n^2\pi}+\frac{\cos\left(\frac{n\pi}2\right)-\cos(n\pi)}n\\[1ex]
&=\frac{2\sin\left(\frac{n\pi}2\right)}{n^2\pi}-\frac{\cos(n\pi)}n\\[1ex]
&=\frac{2\sin\left(\frac{n\pi}2\right)}{n^2\pi}-\frac{(-1)^n}n\\[1ex]
&=\begin{cases}\dfrac{2\sin\left(\frac{2k\pi}2\right)}{(2k)^2\pi}-\dfrac{(-1)^{2k}}{2k}&n=2k\\[1ex]
\dfrac{2\sin\left(\frac{(2k-1)\pi}2\right)}{(2k-1)^2\pi}-\dfrac{(-1)^{2k-1}}{2k-1}&n=2k-1\end{cases}\\[1ex]
&=\begin{cases}-\dfrac1{2k}&n=2k\\[1ex]
\dfrac{2(-1)^{k+1}}{(2k-1)^2\pi}+\dfrac1{2k-1}&n=2k-1\end{cases}
\end{align}$$
where $k\ge1$ is a positive integer.
