The midpoint rule computes an approximation to a definite integral,
made by finding the area of a collection of rectangles whose heights are determined by the values of the function.
Specifically, the interval over which the function is to be integrated is divided into equal subintervals of length.
The rectangles are then drawn.
The approximation to the integral is then calculated by adding up the areas (base multiplied by height) of the rectangles.