Integration on Maple I have the following integration 
$\int_{-\pi}^{\pi} \frac{1} {\sqrt\pi} \sin (n\frac{(x+\pi)} {2})x^2 \frac{1} {\sqrt\pi} \sin (m\frac{(x+\pi)}{2}) dx$ $m$ and $n$ are integers,
and I used Maple to get the integration and the result is 
$\frac{(4(4(-1)^{n+m}nm+4nm)}{m^4-2m^2n^2+n^4}$ 
Actually, I'm not sure about the result, I dont know if there is any other way you can suggest to compute the integration rather than the integration by parts?
Thank you in advance..
 A: Working the antiderivative, you could start rewriting the product of the sines by the differences of cosines.
Doing it, you face two integrals looking like
$$\int \cos(a x+b)\,x^2\,dx$$ Now, assume that the result is of the form $P \cos(ax+b)+Q \sin(ax+b)$ where $P$ and $Q$ are polynomials.
So, differentiating both sides
$$\cos(a x+b)\,x^2=(a Q+P') \cos(ax+b)-(aP-Q')\sin(ax+b)$$ Because of the cosine term the degree cannot be larger than $2$ for $aQ+P'$ making as a maximum $Q_2$ and $P_3$. 
So, let $P=\sum_{i=0}^3 \alpha(i) x^i$ and $Q=\sum_{i=0}^2 \beta(i) x^i$ and replace.
The rhs will become
$$[(a \beta (0)+\alpha (1))+x (a \beta (1)+2 \alpha (2))+x^2 (a \beta (2)+3 \alpha
   (3))] \cos(a x+b)+$$ $$[(a \alpha (0)-\beta (1))+x (a \alpha (1)-2 \beta (2))+a \alpha (2) x^2+a \alpha (3)
   x^3] \sin(a x+b)$$ Now, identify to get the value of the coefficients and get
$$\left(
\begin{array}{ccc}
 i & \alpha_i &\beta_i \\
 0 & 0 & -\frac{2}{a^3} \\
 1 & \frac{2}{a^2} & 0 \\
 2 & 0 & \frac{1}{a} \\
 3 & 0 & 
\end{array}
\right)$$ making
$$\int \cos(a x+b)\,x^2\,dx=\frac{2 a x \cos (a x+b)+\left(a^2 x^2-2\right) \sin (a x+b)}{a^3}$$ 
