using trapezoidal rule to integrate x^2 cos(2 x) from 0 to pi using 3 intervals