Composite midpoint, trapezoid, and Simpson calculations

In the equal-panel composite rules used here, the interval is divided into equal pieces and a local rule is applied on each piece. The sample locations and weights depend on the rule. These estimates need not equal the exact integral.

Panels and samples

A panel is one subinterval, so nn equal panels on [a,b][a,b] have panel width h=(b−a)/nh=(b-a)/n. The endpoint nodes are x0=a,x1,…,xn=bx_0=a,x_1,\ldots,x_n=b: there are n+1n+1 of them. Midpoint samples instead lie halfway across the panels, giving exactly nn sample locations.


For a composite rule, check the interval length, the panel count, and the locations where the function was measured before inserting values.


If xx has units of time and f(x)f(x) has units of rate per time, multiplying a weighted sum of rates by hh gives the corresponding accumulated quantity. The rule's weighted sum alone does not have those integral units.

Choosing and weighting a rule

The composite trapezoid rule uses endpoint samples: Tn=h[f0/2+f1+⋯+fn−1+fn/2]T_n=h[f_0/2+f_1+\cdots+f_{n-1}+f_n/2]. Each shared interior node gets full weight in this collapsed expression because it contributes half an endpoint weight from each adjacent panel. Only the two outer endpoints are halved.


The composite midpoint rule uses one midpoint value per panel: Mn=h∑i=1nf(mi)M_n=h\sum_{i=1}^{n}f(m_i), where mim_i is the midpoint of panel ii. The composite Simpson rule uses endpoint nodes but needs an even panel count: Sn=h3[f0+4f1+2f2+⋯+4fn−1+fn]S_n=\frac{h}{3}[f_0+4f_1+2f_2+\cdots+4f_{n-1}+f_n]. Its odd-indexed nodes have coefficient 44; its shared interior even-indexed nodes have coefficient 22.

Worked example

Suppose two panels span [0,4][0,4], with endpoint values f(0)=1f(0)=1, f(2)=3f(2)=3, and f(4)=9f(4)=9. The width is h=(4−0)/2=2h=(4-0)/2=2, so the composite trapezoid estimate is T2=2[1/2+3+9/2]=16T_2=2[1/2+3+9/2]=16. The middle sample is counted fully, while the two outer samples each contribute half their value inside the bracket.


For the midpoint rule on these same panels, endpoint values alone are insufficient: it would need f(1)f(1) and f(3)f(3). Simpson can use the three stated endpoint values because two panels form one complete pair. Different rules may give different estimates from the same underlying function.



For four equal panels of width 0.5, sampled endpoint values are 2, 4, 6, 8, 10. What is the composite trapezoid estimate?

Choose an answer

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

Three equal panels cover [0,6], and f at their midpoints 1,3,5 is 2,5,8. What is the composite midpoint estimate?

Choose an answer

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

A table gives f at five equally spaced nodes x₀ through x₄. Which weighting is the composite Simpson estimate for four panels of width h?

Choose an answer

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors