Approximates a definite integral using the midpoint rule