Closed rules for equally spaced nodes that include the endpoints: trapezoid, Simpson 1/3, Simpson 3/8, Milne and their errors.
Simple rules
Closed rules interpolate using equally spaced nodes that include a and b. More nodes can give a higher degree of exactness, but sensitivity also increases if the function oscillates.
In each row, h is the spacing between the nodes of that simple rule.
Composite trapezoid
To reduce the error, [a,b] is split into n subintervals and the trapezoid rule is applied on each one. Interior nodes appear twice, so they receive weight 2.
The composite trapezoid rule sums simple trapezoids. Each interior node is the right endpoint of one subinterval and the left endpoint of the next.
Derivation for n subintervals
Split the interval with xi=a+ih and h=(b−a)/n.
a=x0<x1<⋯<xn=b
Apply the simple trapezoid rule on each subinterval [xi,xi+1]:
Ti=2h[f(xi)+f(xi+1)]
Sum all trapezoids. After expanding the sum, interior nodes appear twice:
The global error comes from summing the local errors −h3f′′(ξi)/12 and applying the mean value theorem:
ET=−12h3i=0∑n−1f′′(ξi)=−12b−ah2f′′(ξ)
I≈2h[f(x0)+2i=1∑n−1f(xi)+f(xn)],h=nb−a
ET=−12b−ah2f′′(ξ)
Global error of the composite trapezoid rule.
Composite Simpson
Simpson 1/3 groups subintervals in pairs, so n must be even. The weights alternate 4 and 2: odd nodes are midpoints of each parabola, while interior even nodes connect consecutive blocks.
We want to approximate ∫abf(x)dx using only the values of the function at the endpoints. Replace the curve by the line through (a,f(a)) and (b,f(b)), then integrate that line.
The curve is replaced by the interpolating line. The area under that line is the trapezoid approximation.
Derivation with Lagrange
Take the endpoint nodes x0=a and x1=b, with h=b−a. The linear Lagrange bases equal 1 at their node and 0 at the other one:
L0(x)=a−bx−b,L1(x)=b−ax−a
The linear interpolant is the combination of the known values:
p1(x)=f(a)L0(x)+f(b)L1(x)
Approximate the integral of f by the integral of p1. The weights of the formula are the integrals of the bases:
I≈f(a)∫abL0(x)dx+f(b)∫abL1(x)dx
Compute the first weight with the change s=x−a. Then x−b=s−h, a−b=−h, dx=ds, and the limits x=a,b become s=0,h: