added trapezoidal integration