# Thread: Fourier series expansion, need help

1. ## Fourier series expansion, need help

Hi there. I have some trouble with this problem, it asks me to find the fourier expansion series for the function $f(t)=\begin{Bmatrix} 0 & \mbox{ if }& -\pi

So I've found the coefficients $a_0=\displaystyle\frac{1}{\pi}\displaystyle\int_{0 }^{\pi}t^2dt=\displaystyle\frac{\pi^2}{3}$

$a_n=\displaystyle\frac{1}{n^2}\cos(n\pi) \begin{Bmatrix} \displaystyle\frac{1}{n^2} & \mbox{ if }& \textsf{n even}\\\displaystyle\frac{-1}{n^2} & \mbox{if}& \textsf{n odd}\end{matrix}$

$b_n=-\displaystyle\frac{\pi\cos(n\pi)}{n}-\displaystyle\frac{4}{n^3\pi}$

Then the fourier series expansion:

$f(t)\sim{\displaystyle\frac{\pi^2}{6}+\sum_{n=1}^{ \infty}\displaystyle\frac{1}{n^2}\cos(n\pi)\cos(nt )- \left( \displaystyle\frac{\pi}{n}+ \displaystyle\frac{4}{n^3\pi}\right)\sin(nt)}$

When I plot this on mathematica I get something that doesn't look like what I'm looking for. I've tried many ways, I've done the integrals first by hand, then I did it with mathematica, the graph always seems the same, it doesn't get to zero in the interval zero to -pi as it should, and it isn't close to the plot of t^2, it doesn't even get to zero on the origin. I don't know what I'm doing wrong. I've looked at the equations carefully, I'm pretty much sure I've done things right. Whats happening?

I've also tried to make a distinction between the odd and even cases, but as I supposed it didn't affect at all, the equation as I wrote it includes both cases.

2. Solved. I had some mistakes in the integrals.