Author-reviewedEvidence: highv1.0.0

Simpson Rule

Simpson rule is a closed Newton-Cotes numerical integration formula that approximates a definite integral over pairs of equal subintervals by integrating quadratic interpolants through successive triples of function values.

Last reviewed byDr Darrin Baines

Concept Architecture

Simpson Rule: Concept Architecture

Orientation and learning roadmap

Simpson rule converts sampled function values into an approximation of the area under a curve by fitting local quadratics. This page develops the single-panel and composite formulas, grid requirements, polynomial exactness, error behavior, worked calculations, irregular-data limitations, and implementation checks. It then shows where the rule helps in health-economic models and where survival steps, discontinuities, or noisy observations require another approach.

Numerical integration estimates an area from finite information

A definite integral represents accumulated quantity across a continuous interval, but an analytic antiderivative may be unavailable or the function may be known only at sampled points. Numerical quadrature replaces the integral with a weighted sum of function values. Simpson rule is one member of the closed Newton-Cotes family because it includes values at both ends of each panel.

One panel uses three equally spaced points

Let (a), (m=(a+b)/2), and (b) be three equally spaced points. Simpson's 1/3 rule fits the quadratic interpolant through (f(a)), (f(m)), and (f(b)), then integrates that polynomial exactly. The resulting approximation is:

[ \int_a^b f(x),dx \approx \frac{b-a}{6}\left[f(a)+4f!\left(\frac{a+b}{2}\right)+f(b)\right]. ]

If (h=(b-a)/2) is the spacing between adjacent points, the same rule is (h[f(a)+4f(a+h)+f(b)]/3). The familiar weights (1,4,1) apply to one two-subinterval panel.

Composite Simpson rule repeats the panel

Longer intervals are divided into an even number (n) of equal subintervals with width (h=(b-a)/n). Adjacent pairs of subintervals form panels, and the shared endpoints combine into alternating weights. The composite formula is:

[ \int_a^b f(x),dx \approx \frac{h}{3}\left[ f(x_0) +4\sum_{\substack{i=1\i\ \mathrm{odd}}}^{n-1}f(x_i) +2\sum_{\substack{i=2\i\ \mathrm{even}}}^{n-2}f(x_i) +f(x_n) \right]. ]

The endpoint weights are 1, interior odd-index weights are 4, and interior even-index weights are 2. The indices refer to position on the ordered grid rather than whether an (x)-value itself is numerically odd or even.

The standard composite rule needs an even number of subintervals

Every Simpson 1/3 panel consumes two adjacent subintervals, so (n) must be positive and even. Equivalently, the data must contain an odd number (n+1) of equally spaced points. Confusing the number of points with the number of subintervals is a common source of shifted weights and incomplete panels.

Equal spacing is part of the standard formula

The (1,4,2,\ldots,4,1) weight pattern assumes one constant spacing (h). Applying that pattern to irregular observation times does not implement the standard composite rule and can give incorrect results. Generalized formulas can integrate local quadratic interpolants on unequal grids, but their weights and exactness differ and should be implemented by a verified routine.

Quadratic fitting explains the weights

Across each panel, a quadratic polynomial is determined by the three sampled values. Integrating that interpolant produces the (1,4,1) weighted average, with the midpoint receiving the greatest weight. The geometric description helps explain the rule but does not mean the true function is assumed to be globally quadratic.

The rule is exact through cubic polynomials on an equal grid

Although each panel uses a quadratic interpolant, symmetry cancels the leading cubic interpolation error over an equally spaced panel. Simpson rule therefore integrates every polynomial of degree three or less exactly, apart from floating-point effects. Exactness for cubics does not extend to arbitrary irregular spacing, where the corresponding sampled-data formula is generally exact only through degree two.

A cubic verification example

For (f(x)=x^3) on ([0,4]), use (n=4) subintervals and (h=1). The sampled values are (0,1,8,27,64). The weighted calculation follows.

[ \frac{1}{3}\left[0+4(1)+2(8)+4(27)+64\right] =\frac{192}{3}=64. ]

The analytic integral is (\int_0^4 x^3,dx=4^4/4=64). Agreement is expected because the integrand is cubic and the grid satisfies the rule's spacing and panel conditions.

A fourth-degree worked example reveals approximation error

For (f(x)=x^4) on the same grid, the sampled values are (0,1,16,81,256). The weighted calculation now gives an approximation rather than an exact integral.

[ S=\frac{1}{3}\left[0+4(1)+2(16)+4(81)+256\right] =\frac{616}{3} =205.333333\ldots ]

The exact integral is (4^5/5=204.8), so (S-I=0.533333\ldots). This nonzero difference appears because a fourth-degree polynomial lies beyond the rule's degree of exactness.

The error depends on the fourth derivative

If (f) has a continuous fourth derivative on ([a,b]), the composite error can be written for some (\xi\in(a,b)). This expression shows fourth-order global convergence as the equal step size decreases. Using (I) for the exact integral and (S_n) for the Simpson approximation:

[ I-S_n=-\frac{b-a}{180}h^4 f^{(4)}(\xi). ]

For (f(x)=x^4), (f^{(4)}(x)=24), (b-a=4), and (h=1), giving (I-S_n=-8/15=-0.533333\ldots). The sign matches the worked result because Simpson rule overestimates this integral.

Fourth-order convergence can be checked by refinement

For a sufficiently smooth function, halving (h) should reduce the leading composite error by approximately (2^4=16). The ratio is an asymptotic diagnostic rather than a guarantee on a coarse grid or near a singularity. Roundoff, noisy data, discontinuities, and higher-order terms can prevent the expected pattern.

Richardson comparison estimates residual error

If (S_h) and (S_{h/2}) are composite Simpson results on nested equal grids, their difference can estimate the remaining leading error. Under fourth-order behavior, an improved estimate is (S_{h/2}+(S_{h/2}-S_h)/15), and the correction magnitude is (|S_{h/2}-S_h|/15). This estimate is unreliable unless the grid is in the convergence regime and both calculations represent the same integrand and interval.

Simpson rule and the trapezoidal rule make different local assumptions

The trapezoidal rule integrates straight-line interpolants between adjacent points and works naturally with any number of subintervals. Simpson rule uses quadratic information across pairs and is usually more accurate for a smooth function on an appropriate grid. The higher nominal order does not guarantee a better answer for discontinuous, irregular, or noisy data.

Simpson's 3/8 rule is a different formula

Simpson's 3/8 rule integrates a cubic interpolant across three equal subintervals and uses weights (1,3,3,1). It can handle a remainder of three subintervals when a larger composite grid is not divisible into pairs. It should not be confused with the 1/3 rule or inserted without documenting how the interval was partitioned.

[ \int_{x_0}^{x_3} f(x),dx \approx \frac{3h}{8}\left[f(x_0)+3f(x_1)+3f(x_2)+f(x_3)\right]. ]

An unmatched final interval needs an explicit policy

When the data contain an odd number of subintervals, the standard composite 1/3 rule cannot cover the whole range. A documented implementation may combine Simpson 1/3 with a final trapezoid, use a 3/8 panel where suitable, obtain another point, or use a routine designed for the grid. Silently dropping the final observation or changing weights makes the reported integral irreproducible.

Irregular grids require more than substituting local widths

Replacing (h) in the standard weight formula with an average spacing does not correct irregular sampling. Unequal-grid quadratic integration uses weights derived from the actual coordinates and can become numerically sensitive when spacings are very uneven. A reliable implementation should check ordered coordinates, duplicates, local spacing ratios, and the exact behavior of the selected software.

Discontinuities should define panel boundaries

Simpson rule assumes enough smoothness for a quadratic approximation and fourth-derivative error argument. Known jumps, policy changes, treatment starts, or piecewise definitions should split the integral so that no panel straddles a discontinuity. Integrating smooth pieces separately prevents the interpolant from creating values that the underlying process never takes.

Noisy observations change the problem

For sampled empirical data, a smaller spacing does not necessarily create a more accurate integral if measurement error dominates. Simpson's alternating weights can respond differently to noise than trapezoidal integration, and polynomial interpolation can exaggerate local fluctuations. Uncertainty in the observations should be propagated separately from numerical quadrature error.

Units follow from the axes

If (f(x)) has units (U) and (x) has units (T), the integral has units (U\times T). This simple check detects missing time conversions, such as combining daily rates with annual intervals. Every implementation should document the time unit, ordinate unit, and any scaling or discounting applied before integration.

Discounting can be integrated continuously

For a continuously accruing outcome rate (g(t)) with continuous discount rate (r), the present value over ([0,T]) may be written as an integral of (g(t)e^{-rt}). Simpson rule can approximate this integral when the discounted rate is evaluated on an adequate equal grid. The discount convention must match the model, because a continuous rate (r) is not numerically identical to applying an annual discrete discount factor without conversion.

[ \operatorname{PV}=\int_0^T g(t)e^{-rt},dt. ]

Area under a survival curve needs method-specific care

Mean survival over a horizon can be expressed as the integral of the survival function, and quality-adjusted survival can integrate survival multiplied by an appropriate utility process. Simpson rule can be suitable for a smooth parametric survival curve evaluated on a sufficiently fine equal grid. A Kaplan-Meier estimate is a step function, so its restricted mean should ordinarily be integrated according to its step convention rather than by imposing quadratic curvature across jumps.

QALYs require synchronized survival and utility values

A continuous-time QALY calculation may integrate (S(t)u(t)), where (S(t)) is survival and (u(t)) is expected utility among those represented at time (t). Both quantities must refer to the same population, timing convention, and grid. Multiplying values from mismatched intervals or applying utility after integrating survival can produce a different estimand.

[ \operatorname{QALYs}(T)=\int_0^T S(t)u(t),dt. ]

Dynamic models can integrate rates over time

Health-economic models may integrate prevalence, incidence, resource-use rates, cost rates, or health-loss rates to obtain cumulative outcomes. Simpson rule is useful when the rate trajectory is available at controlled grid points and is smooth between them. If an ODE solver already provides state integration or dense-output quadrature, duplicating the calculation on a coarse reporting grid can reduce accuracy.

Probability densities need mass and tail checks

Integrating a probability density over its support should produce total mass one, subject to truncation and numerical error. Simpson rule can approximate probabilities and expectations on a finite grid, but omitted tails and negative interpolated values can distort results. Normalization should not conceal inadequate support or a poorly resolved density.

Spreadsheet implementation should make every weight visible

For equally spaced (x)-values in column A and function values in column B, a weight column can assign 1 to the endpoints, 4 to odd interior positions, and 2 to even interior positions. The integral is then (h/3) times the sum of weight multiplied by function value. A spreadsheet should test equal spacing and an even number of intervals before returning the result.

Implementation checks should fail visibly

A robust implementation rejects missing values, duplicate or unordered coordinates, unequal spacing beyond a stated tolerance, and an invalid number of subintervals. It should also retain full precision and compare a refined calculation with the original where possible. Returning a plausible number despite a failed grid condition is more dangerous than returning an explicit error.

A disciplined Simpson-rule workflow

Reliable quadrature begins by matching the method to the data and integrand rather than by applying a familiar weight pattern. The workflow should preserve the full interval, units, grid, and error evidence. These steps provide a reproducible minimum.

  1. Define the integral. State the integrand, interval, units, and intended accumulated quantity.
  2. Inspect the function. Identify smooth regions, discontinuities, singularities, oscillations, and step behavior.
  3. Validate the grid. Confirm ordered points, equal spacing, an even number of subintervals, and complete endpoints.
  4. Evaluate consistently. Calculate every function value using the same definitions, precision, and timing convention.
  5. Apply the weights. Use endpoint, odd-interior, and even-interior weights according to grid position.
  6. Check units and totals. Confirm the output dimension and any conservation or probability identity.
  7. Refine the grid. Halve the spacing where possible and examine the expected convergence pattern.
  8. Compare methods. Use an analytic result, independent routine, or appropriate alternative quadrature as a benchmark.
  9. Trace decision impact. Determine whether numerical integration error could change costs, QALYs, net benefit, or ranking.
  10. Report reproducibly. Preserve the grid, values, formula, software behavior, remainder policy, and verification results.

Common errors and safeguards

Most Simpson-rule failures arise from invalid grids, misassigned weights, or applying a smooth-curve formula to data with different mathematical behavior. Strong safeguards make these conditions explicit before any result is accepted. They also separate integration error from uncertainty in the underlying data or model.

  • Using an odd number of subintervals leaves an unmatched interval for Simpson's 1/3 rule.
  • Treating an even number of data points as valid confuses points with subintervals.
  • Assigning weights by the numeric parity of (x) rather than its grid index can reverse the pattern.
  • Applying the equal-grid weights to irregular times does not implement standard composite Simpson rule.
  • Omitting the factor (h/3) or multiplying by (h) twice changes the scale of the integral.
  • Dropping the final point to force an even interval count changes the integration domain.
  • Mixing 1/3, 3/8, and trapezoidal panels without recording the partition prevents reproduction.
  • Integrating across a discontinuity can introduce interpolation values absent from the process.
  • Applying Simpson rule directly to Kaplan-Meier steps can distort restricted mean survival.
  • Treating a scenario of finer sampling as proof of accuracy can overlook noisy or biased observations.
  • Reporting fourth-order convergence without a refinement check can overstate precision.
  • Confusing quadrature error with parameter or sampling uncertainty can understate total uncertainty.

Reproducible reporting preserves the numerical meaning

A complete report states the integrand, interval, units, grid coordinates, spacing, number of points and subintervals, Simpson variant, weights, remainder treatment, and software version. It also records whether data are analytic, modeled, or observed and how discontinuities, tails, missing values, and discounting were handled. Verification should include an exact polynomial test, an independently calculated worked example, a grid-refinement comparison, and a decision-impact check when the integral feeds a health-economic conclusion.

Library

Publications

1
  • BookFeatured

    Decision Modelling for Health Economic Evaluation — Briggs, Claxton & Sculpher, 1st Edition ed., 2006 (Oxford University Press)

    Foundational textbook on decision-analytic modelling for economic evaluation, covering decision trees, Markov models, handling parameter and structural uncertainty, probabilistic sensitivity analysis, and value of information. Volume 1 in the Handbooks in Health Economic Evaluation series.

Frequently Asked Questions (6)

  • What is Simpson's rule?

    A numerical integration technique approximating a definite integral by fitting a series of parabolic curves to the function being integrated.

    Source: Press et al. 2007

  • Who is Simpson's rule named after?

    The rule is named after Thomas Simpson, an English mathematician of the eighteenth century, although the underlying idea predates him. It approximates the area under a curve by covering it with a series of small parabolic arcs rather than straight lines, and summing the areas beneath them. Because a parabola follows a curved function more closely than a straight segment does, the method is accurate for smoothly curving functions. It is a standard technique for numerical integration. Press and colleagues (2007) describe it.

    Source: Press et al. 2007

  • How does Simpson's rule work?

    Simpson's rule works by dividing the integration interval into an even number of equal subintervals, then, over each pair of adjacent subintervals, fitting a parabola through the function's values at the two ends and the midpoint, and computing the area under that parabola. Summing these areas across all pairs approximates the integral. Because parabolas fit smooth curves better than straight lines, Simpson's rule achieves greater accuracy than the trapezoidal rule for the same number of points, provided the function is reasonably smooth.

    Source: Press et al. 2007

  • How does Simpson's rule compare with the trapezoidal rule?

    Simpson's rule and the trapezoidal rule are both numerical integration methods, but they differ in how they approximate the function. The trapezoidal rule uses straight-line segments between points, approximating the area by trapezoids, while Simpson's rule uses parabolas fitted over pairs of intervals. Because parabolas capture curvature that straight lines miss, Simpson's rule is generally more accurate than the trapezoidal rule for smooth functions with the same number of points, at the cost of slightly more computation per interval.

    Source: Press et al. 2007

  • When is Simpson's rule accurate?

    Simpson's rule is accurate for smooth functions that are well approximated by parabolas over each pair of intervals, and its accuracy improves as the number of subintervals increases. It is exact for polynomials up to the third degree. For functions with sharp features, discontinuities, or rapid changes, the parabolic approximation may be poor unless very many intervals are used. Its accuracy therefore depends on the smoothness of the function and the fineness of the subdivision, being well suited to smooth integrands.

    Source: Press et al. 2007

  • Where is Simpson's rule used?

    Simpson's rule is used to approximate definite integrals in statistics, modelling, and other computations where an analytical solution is unavailable and the function is smooth, such as integrating over a distribution, computing an expected value, or finding an area under a curve. It offers a good balance of accuracy and simplicity for one-dimensional integrals of well-behaved functions. In health economic and statistical calculations, it is one of the standard numerical integration methods chosen for its accuracy on smooth integrands.

    Source: Press et al. 2007

Trust Record

Verified by Dr Darrin Baines

British health economist

Professional identity: darrinbaines.org

Verification date: 25 Sep 2026

Content version: 1.0.0

Canonical Identity

Term code
HE-EM-DM-089

Stable URI · Machine-readable · Resolvable · CC BY 4.0