from pylab import *
8.7.1Single interval¶
The trapezoidal rule approximates the integral as the area below the straight line approximation
Another approximation to the area is to use the function value at the mid-point
which is the area of the rectangle.

Let . Using Taylor formula
Integrating both sides
Using integral mean value theorem, the error is
8.7.2Composite rule¶
Let us partition into intervals each of width . The mid-points of these intervals are
The integral is given by
where
and the error is
8.7.3Integral error estimate¶
Using Taylor formula around with integral remainder term
The error in mid-point rule is
By change of order of integration
Using this estimate, the error of the composite rule is