Obtained via a straight line interpolation between each two points on the grid.
Obtained via a parabolic interpolation between each three points on the grid.
Here is a Maple derivation of the formula.
Exercise: Use the Trapezoidal and Simpson rules to integrate a known function over an easy domain, i.e., sin(x) over half the period, and calculate the error when compared to the exact answer. Plot this error versus the lattice spacing. Deduce the order of the methods.
The order of a method can often be established analytically as well. This is done for the Trapezoidal rule, trapezoidal_error.mw, and the Simpson rule, Simpson_error.mw, using Taylor series expansions.