Compare trapezoidal, Simpson's and midpoint rules side-by-side for a given integral.
Compares three numerical integration methods on the same integral: • Trapezoidal rule: O(h²) error, linear interpolation between points • Midpoint rule: O(h²) error, uses center of each subinterval • Simpson's rule: O(h⁴) error, quadratic interpolation through triplets Simpson's is generally the most accurate for the same n, but all converge to the true integral as n increases.
Error orders
Trapezoid: O(h²), Midpoint: O(h²), Simpson: O(h⁴)
Simpson's rule gives the best accuracy for smooth functions. The trapezoidal rule excels for periodic functions over a full period. Midpoint is simple and robust.
Compare results at n and 2n. For Simpson's rule, the difference divided by 15 approximates the error (Richardson extrapolation).