solve integral by trapezoidal method implemented