A single-panel rule approximates a whole interval by one low-degree polynomial. A composite rule partitions the interval and applies that same low-degree construction locally. Accuracy improves by refining the mesh instead of raising a global interpolation degree.

Use the convention in lecture note Section 5.6: nn is the number of small intervals and there are n+1n+1 grid nodes:

xi=a+ih,h=b−an,I=∫abf(x) dx.x_i=a+ih,\qquad h=\frac{b-a}{n},\qquad I=\int_a^b f(x)\,dx.

Errors are always I−QI-Q. We derive global constants from the single-panel theorem, keeping the grid width distinct from the Simpson panel width [1][1] S. Rojas, “Lecture Notes on Computational Mathematics,” 2025. Course lecture note distributed with MTH2051; local source course-lecture-notes.pdf., [2][2] M. U. School of Mathematics, “MTH2051: Introduction to Computational Mathematics: Course Lecture Notes and Study Workbooks,” 2026. Monash University course materials and study workbooks, Semester 2, 2026., [3][3] R. L. Burden and J. D. Faires, Numerical Analysis, 9th ed. Brooks/Cole, Cengage Learning, 2011..

Three composite rules

DefinitionComposite trapezoidal and midpoint rules

For n≥1n\geq1, define

Tn=h[f(a)+f(b)2+∑i=1n−1f(xi)],T_n=h\left[\frac{f(a)+f(b)}2+\sum_{i=1}^{n-1}f(x_i)\right],Mn=h∑i=0n−1f ⁣(xi+h2).M_n=h\sum_{i=0}^{n-1}f\!\left(x_i+\frac h2\right).
DefinitionComposite Simpson rule

Require a positive even nn. Each Simpson panel covers two grid intervals and has width 2h2h:

Sn=h3[f(a)+f(b)+4∑1≤i<ni oddf(xi)+2∑2≤i<ni evenf(xi)].S_n=\frac h3\left[f(a)+f(b) +4\sum_{\substack{1\leq i<n\\i\ \mathrm{odd}}}f(x_i) +2\sum_{\substack{2\leq i<n\\i\ \mathrm{even}}}f(x_i)\right].
ProofAssembling weights

Sum the panel formulas. An interior trapezoidal node receives h/2h/2 from each adjacent panel, giving total weight hh. Each Simpson panel has weights (h/3,4h/3,h/3)(h/3,4h/3,h/3). Odd-index nodes are panel midpoints; even interior nodes join two panels; endpoints appear once. This yields the pattern 1,4,2,4,…,2,4,11,4,2,4,\ldots,2,4,1. Each midpoint sample belongs to exactly one small interval.

Four grid intervals and two Simpson panels

Four grid intervals and two Simpson panels

From local to global error

TheoremComposite error constants

For f∈C2[a,b]f\in C^2[a,b], there are points ξT,ξM∈[a,b]\xi_T,\xi_M\in[a,b] such that

I−Tn=−b−a12h2f′′(ξT),I-T_n=-\frac{b-a}{12}h^2f''(\xi_T),I−Mn=b−a24h2f′′(ξM).I-M_n=\frac{b-a}{24}h^2f''(\xi_M).

For f∈C4[a,b]f\in C^4[a,b] and even nn, there is ξS∈[a,b]\xi_S\in[a,b] with

I−Sn=−b−a180h4f(4)(ξS).I-S_n=-\frac{b-a}{180}h^4f^{(4)}(\xi_S).
Proof

Each trapezoidal panel has error −h3f′′(ξi)/12-h^3f''(\xi_i)/12. Sum the errors, identify the average of the nn derivative values with a value of the continuous derivative using the intermediate value theorem, and use nh=b−anh=b-a. Midpoint panels have constant h3/24h^3/24, giving their result in exactly the same way.

There are n/2n/2 Simpson panels, each of width 2h2h and error

−(2h)52880f(4)(ξi)=−h590f(4)(ξi).-\frac{(2h)^5}{2880}f^{(4)}(\xi_i) =-\frac{h^5}{90}f^{(4)}(\xi_i).

Average their derivative values and sum the n/2n/2 terms. The result is −nh5f(4)(ξS)/180-nh^5f^{(4)}(\xi_S)/180, as claimed.

Trapezoidal and midpoint rules have global order two, whereas Simpson has global order four. A local O(h3)O(h^3) error is summed over order 1/h1/h panels and becomes O(h2)O(h^2). Local and global orders cannot be interchanged. These orders describe bounds; a vanishing leading coefficient can give a higher observed order or exactness for a particular function.

Let

Br=max⁡x∈[a,b]∣f(r)(x)∣.B_r=\max_{x\in[a,b]}|f^{(r)}(x)|.

Replacing the remainder derivative by BrB_r gives explicit bounds. A sufficient Simpson condition for tolerance tol>0\mathrm{tol}>0 is

(b−a)5B4180n4≤tol.\frac{(b-a)^5B_4}{180n^4}\leq\mathrm{tol}.

Choose the smallest positive even integer at least ((b−a)5B4/(180tol))1/4((b-a)^5B_4/(180\mathrm{tol}))^{1/4}. This requires an actual derivative bound; agreement between two computed meshes alone does not provide the same guarantee.

Convexity, bounds and cost

When f′′≥0f''\geq0, the error signs give Mn≤I≤TnM_n\leq I\leq T_n. Convexity gives a direct proof too: on each panel the graph lies below its endpoint chord, so its integral lies below the trapezoid. The average of symmetric function values about the midpoint is at least the midpoint value; integrate that inequality to obtain the midpoint lower bound.

A direct evaluation requires n+1n+1 function calls for trapezoidal, nn for midpoint, and n+1n+1 for Simpson. Simpson requires an even nn. Comparing equal mesh counts and equal evaluation costs are distinct comparisons. Error constants involve derivatives of different orders, so there is no universal ranking for all integrands.

PropositionExact combination identities

On a shared coarse mesh,

T2n=Tn+Mn2,S2n=Tn+2Mn3=4T2n−Tn3.T_{2n}=\frac{T_n+M_n}{2},\qquad S_{2n}=\frac{T_n+2M_n}{3} =\frac{4T_{2n}-T_n}{3}.
Proof

The fine trapezoidal mesh adds precisely the coarse-panel midpoints. Separating old and new nodes gives Tn/2T_n/2 and Mn/2M_n/2. For S2nS_{2n}, old interior nodes have weight h/3h/3, endpoints h/6h/6, and new midpoint nodes 2h/32h/3. These are the weights of Tn/3+2Mn/3T_n/3+2M_n/3. Substitute the first identity to obtain the final expression.

These are algebraic identities for arbitrary sampled values and need no smoothness. Their fourth-order error interpretation still requires the earlier hypotheses. The last identity is also the first Richardson extrapolation of trapezoidal values.

Observed order and failed smoothness

If the error has a nonzero leading term I−Q(h)=Chp+o(hp)I-Q(h)=Ch^p+o(h^p), then

∣I−Q(h)∣∣I−Q(h/2)∣⟶2p,pobs=log⁡2∣I−Q(h)∣∣I−Q(h/2)∣⟶p.\frac{|I-Q(h)|}{|I-Q(h/2)|}\longrightarrow2^p, \qquad p_{\mathrm{obs}}=\log_2\frac{|I-Q(h)|}{|I-Q(h/2)|}\longrightarrow p.

Divide numerator and denominator by hph^p and take limits. The nonzero CC ensures a nonzero denominator eventually. A bound O(hp)O(h^p) alone does not imply that the ratio tends to 2p2^p.

For f(x)=xf(x)=\sqrt{x}, endpoint derivatives are unbounded, so neither the usual second-order nor fourth-order theorem applies. Avoiding endpoint samples does not restore smoothness. In fact its composite midpoint absolute error is Θ(h3/2)\Theta(h^{3/2}): the first panel error is (2/3−1/2)h3/2(2/3-1/\sqrt2)h^{3/2}, and concavity makes all panel errors negative. For panel i≥1i\geq1, the local second-derivative bound gives magnitude at most h3/2/(96i3/2)h^{3/2}/(96i^{3/2}). Summing the convergent series gives an upper bound of the same order, while the nonzero first panel gives a lower bound.

Experiment and executable example

This interactive figure needs JavaScript.

Begin with the exponential to inspect error ratios, then switch to the square root to see smoothness fail. The narrow-peak example shows how small differences on coarse meshes can simply mean that the important region has not been sampled.

This implementation uses the same weights as the experiment, with nn counting small intervals:

def composite_simpson(f, a, b, n):
if not isinstance(n, int) or not a < b or n < 2 or n % 2:
raise ValueError("require a < b and positive even n")
h = (b - a) / n
total = f(a) + f(b)
for i in range(1, n):
total += (4 if i % 2 else 2) * f(a + i * h)
return h * total / 3

For x4x^4 on [0,1][0,1], the error is exactly −2h4/15-2h^4/15, since the fourth derivative is constantly 2424. This example simultaneously checks weights, error sign, and the definition of mesh width.

References

  1. [1] S. Rojas, “Lecture Notes on Computational Mathematics,” 2025. Course lecture note distributed with MTH2051; local source course-lecture-notes.pdf. ↩
  2. [2] M. U. School of Mathematics, “MTH2051: Introduction to Computational Mathematics: Course Lecture Notes and Study Workbooks,” 2026. Monash University course materials and study workbooks, Semester 2, 2026. ↩
  3. [3] R. L. Burden and J. D. Faires, Numerical Analysis, 9th ed. Brooks/Cole, Cengage Learning, 2011. ↩