The trapezoidal rule approximates the integral of the function f(x) on the interval [a, b] as

(trapezoidal rule) (b-a)(f(a)+f(b))/2

Simpson's rule uses a second order interpolation to approximate that integral as

(Simpson's rule) (b-a)(f(a) + 4f((a+b)/2) + f(b))/6

In regions where the first derivative is not substantially constant, Simpson's rule will give better error performance at the expense of an additional evaluation of the function in each interval.

(trapezoidal rule) (b-a)(f(a)+f(b))/2

Simpson's rule uses a second order interpolation to approximate that integral as

(Simpson's rule) (b-a)(f(a) + 4f((a+b)/2) + f(b))/6

In regions where the first derivative is not substantially constant, Simpson's rule will give better error performance at the expense of an additional evaluation of the function in each interval.