Fastest method to calculate the integral: $\int^\pi_0 t^2 \cos(nt) dt$ Fastest method to calculate the integral: $\int^\pi_0 t^2 \cos(nt)dt$.
Now I am aware that this is done by doing parts twice, however from inspection I see that terms cancel in the method, is there therefore a straight forward formula I can use for integrals of this form (ie period/composition) which would allow me to calculate this faster?
Kind Regards,

In the same vein as Olivier Oloa's answer and tired's comment, you can start with
$$I(n) = -\int_0^\pi \cos (nt) \,dt = -\left[\frac{\sin(nt)}{n}\right]_0^\pi = -\frac{\sin(n\pi)}{n}$$
and take the derivative with respect to $n$ twice to get
$$I''(n) = \int_0^\pi t^2 \cos (nt) \,dt = \frac{n^2\pi^2 \sin(n\pi) + 2n\pi\cos(n\pi) - 2\sin(n\pi)}{n^3}$$
