You will probably be able to do it with Maple. Can you LaTeX (LaTeX - Wikipedia, the free encyclopedia) the integrals that you want?

My guess is

$\displaystyle \frac{1}{L}\left( \int_{-L}^0\left( a_{1}x^2+a_{2}x+a_{3}\right) \cos\left( \frac{n \pi x}{L}\right)dx +\int_{0}^{L}\left(b_{1}x^2+b_{2}x+b_{3} \right)\cos\left( \frac{n \pi x}{L}\right)dx \right)$

To do that integral I will first re-scale $\displaystyle x$ to $\displaystyle u_{n}=\frac{n \pi x}{L}$ and then integrate by parts two times in order to lower the grade of the polynomial. A little of brute force but it works just fine.