Numerical Integration
Simpson's Rule
Simpson's rule approximates a definite integral using three equally-spaced points with h=(b-a)/2: S = (h/3)(f(a) + 4f(a+h) + f(b)). Example: f(x)=x⁴, [0,2], h=1 gives S=20/3; true=32/5, error=4/15.
Simpson's rule is exact for polynomials of degree ≤ 3.
simpsons-rule
For three equally-spaced points x0,x1,x2 with h=x1-x0=x2-x1: S = (h/3)(f(x0) + 4*f(x1) + f(x2))