I believe you lost a term in evaluating the second term integral in this:
(x^2)(sin mx / m)  2 [integral] (sin mx / m) (x) .
If you differentiate your final result,
(x^2)(sin mx / m) + 2 (cos mx / m) + c ,
you don't cancel out the additional terms beyond the original integrand...
