Fact-checked by Grok 2 weeks ago

Simpson's rule

Simpson's rule is a technique used to approximate the definite of a over a finite by fitting polynomials—specifically parabolas—to sets of three equally spaced points along the curve, thereby estimating the area under the with greater accuracy than linear approximations like the . This method requires the integration to be divided into an even number of subintervals to pair them effectively, and it achieves an error bound proportional to the fourth derivative of the , making it particularly suitable for where higher-order is needed without excessive computational cost. Although commonly attributed to the 18th-century English mathematician Thomas Simpson (1710–1761), who described it in his 1743 treatise A New Treatise of Fluxions, the rule actually predates him and was employed earlier by figures such as in the early 17th century for astronomical calculations and in the mid-17th century in the context of indivisibles. Simpson's formulation popularized the technique in , building on prior work by James Gregory and , and it became a standard tool in due to its balance of simplicity and accuracy. The basic formula for Simpson's rule over a single pair of subintervals from a to c, with midpoint b = (a + c)/2, approximates \int_a^c f(x) \, dx \approx \frac{h}{3} [f(a) + 4f(b) + f(c)], where h = (c - a)/2 is the subinterval width; for the composite version over n (even) subintervals of width h, the approximation is \int_a^b f(x) \, dx \approx \frac{h}{3} [f(x_0) + 4\sum_{i=1}^{n/2} f(x_{2i-1}) + 2\sum_{i=1}^{n/2 - 1} f(x_{2i}) + f(x_n)]. This weighted sum—emphasizing the odd-indexed points with a factor of 4 and even-indexed interior points with 2—derives from integrating the unique polynomial interpolating the three points, ensuring exactness for polynomials up to degree 2. In practice, Simpson's rule excels for applications in physics, engineering, and computational science, such as estimating volumes, work done by variable forces, or solutions to differential equations, often outperforming the trapezoidal rule by a factor related to the second derivative while remaining computationally efficient with O(n) evaluations. The error term for the composite rule is -\frac{(b-a)h^4}{180} f^{(4)}(\xi) for some \xi \in [a, b], highlighting its fourth-order accuracy, though it assumes sufficient smoothness of f and even n to avoid inconsistencies at boundaries. Extensions like Simpson's 3/8 rule address odd numbers of subintervals, but the standard form remains foundational in numerical quadrature libraries and educational curricula.

Overview

Definition and Purpose

Simpson's rule is a method in for approximating the definite of a over an by interpolating the function with or cubic polynomials across subintervals, thereby estimating the area under the more precisely than simpler linear methods. This approach divides the integration domain into smaller segments and fits higher-degree polynomials to sampled values, making it particularly effective for smooth, continuous functions where exact antiderivatives are unavailable or computationally intensive. The primary purpose of Simpson's rule is to enhance the accuracy of compared to the , which relies on linear approximations; by using parabolic or cubic fits, it better captures the of the integrand, reducing approximation errors for non-linear functions. In practice, the rule computes the integral approximation through weighted sums of function evaluations at interval endpoints and interior points, such as midpoints, providing a balance between computational simplicity and precision. Originally developed to approximate areas under curves, Simpson's rule finds widespread use in physics and for tasks like computing work done by forces, determining volumes of of , and modeling periodic phenomena where integrals represent accumulated quantities. Its key advantage lies in the : the standard 1/3 variant achieves fourth-order convergence with an error term of O(h^4), exact for polynomials up to degree three, while the 3/8 variant similarly yields O(h^4) error, outperforming the second-order O(h^2) accuracy of trapezoidal approximations for sufficiently smooth functions.

Historical Background

The method underlying Simpson's rule traces its origins to the , used by German mathematician and astronomer in 1615 for approximating volumes of wine barrels in astronomical calculations, with an early version appearing in the work of Italian mathematician around 1639 as part of his contributions to techniques for approximating areas under curves. Scottish mathematician James Gregory further developed and published an algebraic formulation of the rule in 1668 in his treatise Geometriae Pars Universalis, where it was presented as a practical tool for . English mathematician employed a similar approach in his quadrature methods during the late 17th century, integrating it into his broader framework of fluxions and fluents for solving problems in . Thomas Simpson, an English mathematician, popularized the rule through its explicit presentation in his 1737 book A New Treatise of Fluxions, though he acknowledged deriving it from Newton's earlier ideas rather than inventing it anew. The attribution to Simpson persists due to his effective dissemination and application of the method in numerical contexts, sparking ongoing debate about its true origins. During the 19th century, Simpson's rule gained widespread adoption in the construction of mathematical tables for functions like logarithms and trigonometric values, serving as a reliable tool for scientists and engineers in fields such as astronomy and . This period saw its integration into standard practices, as highlighted in historical surveys of computational techniques. With the rise of electronic computers in the mid-20th century, the rule was adapted into algorithmic implementations, enhancing its utility in early scientific computing for tasks including orbital calculations and designs.

Basic Simpson's Rules

Simpson's 1/3 Rule

Simpson's 1/3 rule provides a numerical approximation for the definite of a f(x) over an [a, b] by interpolating f with a at three equally spaced points within the interval. This method divides the into two equal subintervals of length h = (b - a)/2, evaluating f at the endpoints a and b, and at the m = (a + b)/2. The approximating formula is given by \int_a^b f(x) \, dx \approx \frac{b - a}{6} \left[ f(a) + 4f\left( \frac{a + b}{2} \right) + f(b) \right], where the coefficients $1/6 for the values and $4/6 for the value arise from integrating the corresponding Lagrange basis polynomials in the quadratic interpolation. These weights ensure the approximation is exact for any quadratic polynomial, capturing the parabolic shape that best fits the three points. For the method to provide reliable accuracy guarantees, the function f is assumed to be twice continuously differentiable over the interval. Visually, the rule fits a parabola through the points (a, f(a)), (m, f(m)), and (b, f(b)), and the is estimated as the area under this parabolic arc, which closely hugs the curve of f when f behaves . The rule originates from Lagrange and extends to composite forms for broader intervals requiring an even number of subintervals.

Simpson's 3/8 Rule

Simpson's 3/8 rule is a method that approximates the definite of a f(x) over an [a, b] by fitting a cubic to four equally spaced points within that . This approach divides the into three equal subintervals, using points x_0 = a, x_1 = a + h, x_2 = a + 2h, and x_3 = b = a + 3h, where h = (b - a)/3. The cubic ensures exact for polynomials up to degree three, providing higher accuracy for functions exhibiting cubic behavior compared to quadratic approximations. The formula for Simpson's 3/8 rule is derived from integrating the interpolating cubic polynomial and simplifies to: \int_{a}^{b} f(x) \, dx \approx \frac{3h}{8} \left[ f(x_0) + 3f(x_1) + 3f(x_2) + f(x_3) \right], where the weights emphasize the interior points with coefficients of 3 relative to the endpoints' coefficient of 1. Normalizing these weights by the total interval width b - a = 3h yields effective coefficients of \frac{1}{8}, \frac{3}{8}, \frac{3}{8}, and \frac{1}{8} for f(a), f(a + h), f(a + 2h), and f(b), respectively, highlighting the rule's balanced emphasis on interior evaluations for improved precision on higher-degree variations. This rule is particularly suitable for functions with significant cubic components, as it achieves exact results for such cases, though it is less commonly applied than Simpson's 1/3 rule due to the requirement of four function evaluations per . In composite numerical schemes, Simpson's 3/8 rule serves as a refinement for panels with an odd number of subintervals, complementing the 1/3 rule to maintain consistent accuracy across the domain.

Derivations

Derivation of Simpson's 1/3 Rule

Simpson's 1/3 rule approximates the definite integral \int_a^b f(x) \, dx by fitting a to the function values at three equally spaced points: a, the m = \frac{a+b}{2}, and b. To derive this, consider the Lagrange interpolating P_2(x) of degree at most 2 that passes through the points (a, f(a)), (m, f(m)), and (b, f(b)). The is given by P_2(x) = f(a) \cdot \frac{(x - m)(x - b)}{(a - m)(a - b)} + f(m) \cdot \frac{(x - a)(x - b)}{(m - a)(m - b)} + f(b) \cdot \frac{(x - a)(x - m)}{(b - a)(b - m)}. Since m - a = b - m = h = \frac{b - a}{2}, the denominators simplify: (a - m)(a - b) = (-h)(-2h) = 2h^2, (m - a)(m - b) = h(-h) = -h^2, and (b - a)(b - m) = 2h \cdot h = 2h^2. Integrating P_2(x) exactly from a to b yields the approximation \int_a^b P_2(x) \, dx = \frac{b - a}{6} \left[ f(a) + 4 f(m) + f(b) \right], which is Simpson's 1/3 rule, exact for any quadratic polynomial. An alternative derivation expresses Simpson's 1/3 rule as a weighted average of the trapezoidal rule and the midpoint rule, chosen to cancel their leading-order error terms. For convenience, shift and scale the interval to [-h, h] where $2h = b - a, so the integral is \int_{-h}^h f(x) \, dx. The trapezoidal rule approximation is h [f(-h) + f(h)], while the midpoint rule (evaluated at 0) is $2h f(0). The weighted combination \frac{1}{3} times the trapezoidal plus \frac{2}{3} times the midpoint gives \frac{1}{3} \cdot h [f(-h) + f(h)] + \frac{2}{3} \cdot 2h f(0) = \frac{h}{3} [f(-h) + 4 f(0) + f(h)], matching the interpolation result. The trapezoidal error is -\frac{(2h)^3}{12} f''(\xi) = -\frac{2 h^3}{3} f''(\xi) for some \xi \in (-h, h), and the midpoint error is \frac{(2h)^3}{24} f''(\eta) = \frac{h^3}{3} f''(\eta) for some \eta. The weights ensure the O(h^3) errors cancel, yielding exactness for quadratics. A third method employs undetermined coefficients to determine weights that make the quadrature exact for the basis polynomials $1, x, and x^2 over [-h, h]. Assume the form \int_{-h}^h f(x) \, dx \approx A f(-h) + B f(0) + C f(h). For f(x) = 1, \int_{-h}^h 1 \, dx = 2h = A + B + C. For f(x) = x, \int_{-h}^h x \, dx = 0 = -A h + C h, implying A = C. For f(x) = x^2, \int_{-h}^h x^2 \, dx = \frac{2 h^3}{3} = A h^2 + C h^2 = 2 A h^2, so A = \frac{h}{3} and C = \frac{h}{3}. Substituting into the first equation gives B = 2h - \frac{2h}{3} = \frac{4h}{3}. Thus, the approximation is \frac{h}{3} [f(-h) + 4 f(0) + f(h)], confirming the rule. This approach assumes familiarity with and basic rules like the trapezoidal and midpoint methods.

Derivation of Simpson's 3/8 Rule

The Simpson's 3/8 rule approximates the definite \int_a^b f(x) \, dx over an [a, b] where b - a = 3h, by integrating a cubic that interpolates f(x) at the four equally spaced points x_0 = a, x_1 = a + h, x_2 = a + 2h, and x_3 = b. This approach assumes the function f is sufficiently smooth to justify the and that the points are equally spaced with step size h > 0. The rule is exact for any of degree at most 3. To derive the formula, construct the Lagrange interpolating polynomial P_3(x) of degree at most 3 passing through the points (x_i, f(x_i)) for i = 0, 1, 2, 3: P_3(x) = \sum_{i=0}^3 f(x_i) \ell_i(x), where the Lagrange basis polynomials are \ell_i(x) = \prod_{\substack{j=0 \\ j \neq i}}^3 \frac{x - x_j}{x_i - x_j}. The approximation is then \int_a^b f(x) \, dx \approx \int_a^b P_3(x) \, dx. For computational convenience, substitute t = (x - a)/h, so x = a + h t, dx = h \, dt, and t ranges from 0 to 3. The points become t_0 = 0, t_1 = 1, t_2 = 2, t_3 = 3, and the integral transforms to h \int_0^3 P_3(a + h t) \, dt. The basis polynomials in terms of t are \ell_0(t) = \frac{(t-1)(t-2)(t-3)}{(-1)(-2)(-3)} = -\frac{1}{6}(t-1)(t-2)(t-3), \ell_1(t) = \frac{t(t-2)(t-3)}{(1-0)(1-2)(1-3)} = \frac{1}{2} t (t-2)(t-3), \ell_2(t) = \frac{t(t-1)(t-3)}{(2-0)(2-1)(2-3)} = -\frac{1}{2} t (t-1)(t-3), \ell_3(t) = \frac{t(t-1)(t-2)}{(3-0)(3-1)(3-2)} = \frac{1}{6} t (t-1)(t-2). Integrating each \ell_i(t) from 0 to 3 yields \int_0^3 \ell_0(t) \, dt = 3/8, \int_0^3 \ell_1(t) \, dt = 9/8, \int_0^3 \ell_2(t) \, dt = 9/8, and \int_0^3 \ell_3(t) \, dt = 3/8. Thus, the approximation is \int_a^b f(x) \, dx \approx h \left[ \frac{3}{8} f(x_0) + \frac{9}{8} f(x_1) + \frac{9}{8} f(x_2) + \frac{3}{8} f(x_3) \right] = \frac{3h}{8} \left[ f(x_0) + 3 f(x_1) + 3 f(x_2) + f(x_3) \right]. This confirms the standard form of Simpson's 3/8 rule. An alternative derivation uses the method of undetermined coefficients. Assume the integral over [0, 3h] (without loss of generality, by shifting and scaling) is approximated as h (c_0 f(0) + c_1 f(h) + c_2 f(2h) + c_3 f(3h)), where the coefficients c_i are chosen to make the formula exact for the basis functions $1, x, x^2, x^3. Setting h = 1 for simplicity (and scaling later), the system of equations is obtained by integrating these monomials from 0 to 3:
  • For f(x) = 1: \int_0^3 1 \, dx = 3 = c_0 + c_1 + c_2 + c_3,
  • For f(x) = x: \int_0^3 x \, dx = \frac{9}{2} = c_1 + 2 c_2 + 3 c_3,
  • For f(x) = x^2: \int_0^3 x^2 \, dx = 9 = c_1 + 4 c_2 + 9 c_3,
  • For f(x) = x^3: \int_0^3 x^3 \, dx = \frac{81}{4} = c_1 + 8 c_2 + 27 c_3.
Solving this yields c_0 = 3/8, c_1 = 9/8, c_2 = 9/8, c_3 = 3/8. Restoring the general h gives the same formula as above. This method directly enforces exactness for polynomials up to degree 3 under the equal-spacing assumption. Although Simpson's 3/8 rule can also be obtained by combining two applications of Simpson's 1/3 rule over the subintervals with a corrective adjustment, the cubic or undetermined coefficients approaches provide a more direct path to the formula.

Composite Rules

Composite Simpson's 1/3 Rule

The composite Simpson's 1/3 rule extends the basic Simpson's 1/3 rule to approximate the definite \int_a^b f(x) \, dx over a larger by partitioning it into multiple subintervals. The [a, b] is divided into n = 2m subintervals, where m is a positive and n must be even to maintain in the quadratic approximations; each subinterval has width h = (b - a)/n. The overall approximation is \int_a^b f(x) \, dx \approx \frac{h}{3} \left[ f(x_0) + 4 \sum_{i=1}^{m} f(x_{2i-1}) + 2 \sum_{i=1}^{m-1} f(x_{2i}) + f(x_n) \right], where the points are x_i = a + i h for i = 0, 1, \dots, n. This method applies the basic Simpson's 1/3 rule to each pair of adjacent subintervals (forming parabolic panels over two subintervals each) and sums the individual approximations to obtain the total integral estimate. By composing these panels, the rule efficiently handles wider intervals that exceed the scope of a single basic application, providing better accuracy for smooth functions over larger domains. To implement the rule, first evaluate f at the n+1 equally spaced points x_0, x_1, \dots, x_n. Then, compute the weighted sum using coefficients of 1 for the endpoints f(x_0) and f(x_n), 4 for the odd-indexed interior points f(x_1), f(x_3), \dots, f(x_{n-1}), and 2 for the even-indexed interior points f(x_2), f(x_4), \dots, f(x_{n-2}), finally multiplying by h/3. The algorithm requires O(n) function evaluations, which scales linearly with the number of subintervals, rendering it computationally efficient and readily adaptable to software libraries for numerical integration. As a building block extension of the basic Simpson's 1/3 rule, it achieves global error scaling with O(h^4).

Composite Simpson's 3/8 Rule

The composite Simpson's 3/8 rule extends the basic Simpson's 3/8 rule to approximate the definite integral \int_a^b f(x) \, dx over an interval divided into n = 3m equal subintervals, where m is a positive and each subinterval has width h = (b - a)/n. This method applies the basic 3/8 rule—derived from interpolating f(x) with a cubic over three subintervals—to each consecutive group of three subintervals and sums the results, with overlapping endpoint weights combined appropriately. The formula for the composite Simpson's 3/8 rule is \int_a^b f(x) \, dx \approx \frac{3h}{8} \left[ f(x_0) + 3 \sum_{j=1}^m \left( f(x_{3j-2}) + f(x_{3j-1}) \right) + 2 \sum_{j=1}^{m-1} f(x_{3j}) + f(x_n) \right], where x_i = a + i h for i = 0, 1, \dots, n. This expression arises from evaluating the basic rule on each panel [x_{3k}, x_{3k+3}] for k = 0 to m-1, resulting in weights of 1 at the endpoints of each panel, 3 at the interior points of each panel, and 2 at the shared endpoints between adjacent panels. In implementation, the weight pattern repeats every three subintervals as 1 (start), 3, 3, 2 (junction), with the pattern continuing until the final 1 at x_n, scaled overall by $3h/8. This grouping ensures efficient computation by leveraging the local cubic approximations while maintaining global consistency across the interval. The method requires the number of subintervals n to be a multiple of 3 to form complete panels without . The composite Simpson's 3/8 rule is particularly useful in hybrid schemes where the total number of subintervals is odd or not evenly divisible by 2, allowing it to complement the composite Simpson's 1/3 rule (which requires even n) by handling groups of three when pairing into twos is infeasible. For instance, when n \equiv 3 \pmod{6}, one 3/8 panel can cover the remainder after applying 1/3 panels to the rest, improving flexibility without sacrificing the higher-order accuracy of polynomial-based approximations.

Error Analysis

Error Bounds for Basic Rules

The error bounds for the basic Simpson's rules are derived from the in the underlying each method, typically using expansions of the integrand f(x) around key points within the interval [a, b]. For the Simpson's 1/3 rule, which approximates the over [a, b] using a interpolant through points at a, the (a+b)/2, and b, the term arises from the in the Taylor expansion up to the third order, leaving a contribution from the fourth . Assuming f is four times continuously differentiable on [a, b], the exact is E = -\frac{(b-a)^5}{2880} f^{(4)}(\xi) for some \xi \in [a, b]. The bound on the absolute is then |E| \leq \frac{(b-a)^5}{2880} \max_{t \in [a,b]} |f^{(4)}(t)|. To sketch the derivation, expand f(x) in around the midpoint m = (a+b)/2 (or equivalently around endpoints), substitute the expansions for f(a), f(m), and f(b) into the approximation formula \int_a^b f(x) \, dx \approx \frac{b-a}{6} [f(a) + 4f(m) + f(b)], and integrate term by term. The terms up to the cubic order cancel exactly with the integral of the interpolating , while the fourth-order terms yield the , which can be expressed using the form of the Taylor or Peano kernel , resulting in the O((b-a)^5) error involving f^{(4)}(\xi). For the Simpson's 3/8 rule, which fits a cubic polynomial through four equispaced points over [a, b] (divided into three subintervals of width (b-a)/3), the error analysis follows a similar Taylor expansion approach but accounts for the higher-degree fit, leading to a tighter bound despite also terminating at the fourth derivative. Under the same smoothness assumption that f \in C^4[a, b], the error is E = -\frac{(b-a)^5}{6480} f^{(4)}(\xi) for some \xi \in [a, b]. The absolute error bound is |E| \leq \frac{(b-a)^5}{6480} \max_{t \in [a,b]} |f^{(4)}(t)|. The derivation involves expanding f at the four points a, a + (b-a)/3, a + 2(b-a)/3, and b, integrating the series, and showing that the cubic terms integrate exactly while the fourth-order remainder integrates to the stated coefficient. Both rules exhibit local truncation error of order O(h^5), where h = b - a, reflecting their exactness for polynomials up to degree 3 (despite the 1/3 rule's quadratic basis). In composite applications, these local errors accumulate to yield a global error of O(h^4). Unlike the trapezoidal rule's O(h^3) local error, the higher order of Simpson's rules makes them more accurate for smooth functions even with fewer evaluations.

Error in Composite Applications

In composite applications of Simpson's rule, the total error arises from summing the local truncation errors across multiple panels, resulting in a global error bound that scales with the fourth power of the step size h. For the composite Simpson's 1/3 rule applied over an interval [a, b] divided into $2m equal subintervals of width h = (b-a)/(2m), the total error is E = -\frac{(b-a) h^4}{180} f^{(4)}(\xi) for some \xi \in [a, b], where f^{(4)} denotes the fourth of the integrand f. This formula is obtained by aggregating the local error -\frac{(2h)^5}{2880} f^{(4)}(\eta) = -\frac{h^5}{90} f^{(4)}(\eta) over each pair of subintervals and applying the to combine terms. Similarly, for the composite Simpson's 3/8 rule, which divides [a, b] into $3m subintervals of width h = (b-a)/(3m), the total is E = -\frac{(b-a) h^4}{80} f^{(4)}(\xi) for some \xi \in [a, b]. Although the basic 3/8 rule has a local term involving h^5 over an of length $3h, the composite form yields the same O(h^4) global order as the 1/3 rule due to the aggregation of m such panels, differing only in the leading constant. Both rules exhibit fourth-order accuracy, which helps mitigate issues like the Runge phenomenon observed in high-degree , as the piecewise remains stable for functions. Several factors influence the practical error in these composite rules. The dependence on h^4 implies rapid convergence as h decreases, but the error also grows with the magnitude of |f^{(4)}(\xi)|, which can be large for functions with significant curvature. Additionally, round-off errors accumulate with increasing numbers of function evaluations, particularly in finite-precision arithmetic, though Simpson's rules are relatively stable compared to higher-order Newton-Cotes formulas. To mitigate truncation errors, adaptive quadrature strategies refine h locally where |f^{(4)}| is estimated to be large, often by recursively subdividing panels and comparing approximations at different levels. Hybrid approaches combine the 1/3 and 3/8 rules to handle cases where the number of subintervals is not a multiple of 2 or 3, applying 1/3 over even segments and 3/8 over the remainder to maintain accuracy without excessive refinement. In modern software implementations, such as MATLAB's legacy quad function, an adaptive version of Simpson's rule incorporates error estimation via Richardson extrapolation, balancing truncation and rounding errors while achieving high precision for a wide range of integrands. These methods ensure reliable performance in computational applications, with the global h^4 scaling preserved under adaptive refinement.

Extensions and Variations

Alternative Extended Simpson's Rule

The alternative extended Simpson's rule encompasses higher-order variants of Simpson's method designed to approximate definite integrals over subintervals where the total number is not necessarily even or a multiple of three, thereby extending the applicability of composite rules while preserving or enhancing accuracy. One practical formulation combines the composite , applied to pairs of subintervals forming even-numbered panels, with the to cover any remaining three subintervals at the end; this hybrid approach ensures fourth-order accuracy overall when the total number of subintervals is odd. For instance, with five subintervals, the first two pairs (four subintervals) are integrated using the 1/3 rule, and the final three using the 3/8 rule, avoiding the need to adjust spacing or revert to lower-order methods. Pure extended forms further generalize this by employing higher-degree Newton-Cotes formulas, such as , which integrates exactly over quartic polynomials using five equally spaced points (four subintervals). The formula for , with subinterval width h, is \int_{x_0}^{x_4} f(x) \, dx \approx \frac{2h}{45} \left[ 7f(x_0) + 32f(x_1) + 12f(x_2) + 32f(x_3) + 7f(x_4) \right], where the weights $7/90, $32/90, $12/90, $32/90, and $7/90 (normalized by the total interval length $4h) reflect the contributions scaled to achieve exactness for polynomials up to degree four. This rule maintains fifth-order accuracy in the sense of Newton-Cotes precision, outperforming the basic Simpson's rules for smooth functions without requiring interval adjustments. The purpose of these alternative extensions is to accommodate arbitrary subdivisions in schemes, particularly when the interval length does not divide evenly by 2 or 3, thus avoiding reduced accuracy from mismatched remainders or forced coarser grids while upholding high-order . They are derived via the method of undetermined coefficients, where weights are solved to interpolate a through the evaluation points, ensuring the is exact for all polynomials of degree less than or equal to the number of points minus one; for , this yields exact integration of cubics and quartics. In practice, these rules find application in adaptive integrators, such as those in scientific libraries, where dynamic refinement may produce non-standard subinterval counts; by selecting the appropriate extension, remainder errors are minimized, leading to more robust and efficient global approximations without sacrificing the O(h^4) or higher error scaling of the base Simpson's methods.

Simpson's Rule for Irregularly Spaced Data

Simpson's rule can be extended to irregularly spaced data points x_0 < x_1 < \cdots < x_n by applying interpolation locally over groups of three consecutive points. This involves fitting a to the values y_i = f(x_i), y_{i+1} = f(x_{i+1}), and y_{i+2} = f(x_{i+2}) using the formula, then the interpolating over the interval [x_i, x_{i+2}]. The resulting approximation for each local segment is a weighted sum of the values, where the weights ensure exact for polynomials up to degree 2. The general formula for the integral over [x_i, x_{i+2}] is given by \int_{x_i}^{x_{i+2}} f(x) \, dx \approx y_i w_0 + y_{i+1} w_1 + y_{i+2} w_2, where the weights w_k = \int_{x_i}^{x_{i+2}} l_k(x) \, dx for k = 0,1,2, and l_k(x) are the Lagrange basis polynomials defined as l_k(x) = \prod_{m=0, m \neq k}^{2} \frac{x - x_{i+m}}{x_{i+k} - x_{i+m}}. These weights are computed numerically for each segment based on the local spacings \Delta x_{i+1} = x_{i+1} - x_i and \Delta x_{i+2} = x_{i+2} - x_{i+1}, providing an exact representation for the quadratic interpolant. This generalization lacks the simple closed-form weights of the uniform-spacing case, such as h/3 \times (1, 4, 1), requiring evaluation of the integrals for each triple of points. The error term, analogous to the standard Simpson's rule, involves the fourth derivative of f but is influenced by variations in spacing, generally leading to reduced accuracy when intervals differ significantly from uniformity. One higher-order variant suitable for irregular data is the generalization of , a five-point Newton-Cotes originally for equal spacing, which can be adapted similarly via over five points to achieve exactness for cubics. Algorithms implementing these methods, such as the scipy.integrate.simpson function in Python's library, handle irregular grids by computing the piecewise weights automatically. These adaptations are essential for processing real-world datasets from experiments, such as measurements or surveys, where uniform sampling is often infeasible due to practical constraints like varying environmental conditions or limitations.

Adaptations for Narrow Peaks

Standard Simpson's rule underestimates the area under narrow peaks because its quadratic approximation imposes a smoothing effect that fails to capture the rapid rise and fall of sharp features, resulting in systematically lower estimates. This limitation arises from the method's reliance on low-order , which is inadequate for functions exhibiting high local derivatives characteristic of narrow peaks. In applications such as chromatographic analysis, where peaks can be extremely narrow relative to the overall , Simpson's rule requires approximately twice the number of sampling points compared to the to achieve comparable accuracy, such as 0.1% relative error for Gaussian peaks. A key adaptation involves subdividing the peak regions with a finer step size h, enabling the composite to resolve sharp variations more effectively by applying multiple segments locally. This refinement strategy is implemented in the adaptive Simpson's , which recursively bisects subintervals based on an derived from the difference between a coarse Simpson's (over the full subinterval) and a finer one (over halves), halting refinement when the estimated falls below a specified . Introduced by Kuncir in , this approach automatically concentrates computational effort near narrow peaks while using coarser grids elsewhere, making it efficient for functions with localized non-smoothness. Weighted extensions, such as Romberg integration, further enhance accuracy by using on approximations from successively finer grids to eliminate leading error terms and achieve higher-order convergence. Romberg integration, developed by Werner Romberg in 1955, builds upon the but produces approximations equivalent to higher-order Newton-Cotes methods like Simpson's at certain levels, which is particularly beneficial for narrow peaks where standard Simpson's error is dominated by fourth-derivative terms. This method can reduce the effective error by orders of magnitude with minimal additional evaluations, though it assumes even subdivision compatible with Simpson's even-number requirements. These adaptations reduce integration errors substantially in fields like and , where narrow peaks represent critical localized features such as spectral lines or drug concentration spikes, enabling precise quantification essential for . For instance, in chromatographic peak integration, they minimize underestimation to support reliable intensity measurements. The basic error bounds, which scale with the fourth , are particularly impacted by the high curvatures near peaks, underscoring the need for such targeted refinements. Modern numerical libraries, such as SciPy's integrate , implement adaptive versions of Simpson's rule to handle such cases efficiently.

Applications and Examples

Numerical Example for Simpson's 1/3 Rule

To illustrate the composite Simpson's 1/3 rule, consider approximating the definite \int_0^\pi \sin(x) \, dx using n=4 equally spaced subintervals, so the step size is h = \pi/4 \approx 0.7854. The evaluation points are x_i = ih for i = 0, 1, 2, 3, 4, giving x_0 = 0, x_1 = \pi/4, x_2 = \pi/2, x_3 = 3\pi/4, and x_4 = \pi. The corresponding function values are f(x_i) = \sin(x_i). The following table lists the points and function values:
ix_if(x_i) = \sin(x_i)
000
1\pi/4\sqrt{2}/2 \approx 0.7071
2\pi/21
3$3\pi/4\sqrt{2}/2 \approx 0.7071
4\pi0
The composite Simpson's 1/3 rule approximation is given by \int_0^\pi \sin(x) \, dx \approx \frac{h}{3} \left[ f(x_0) + 4f(x_1) + 2f(x_2) + 4f(x_3) + f(x_4) \right]. Substituting the values yields \frac{\pi/4}{3} \left[ 0 + 4(\sqrt{2}/2) + 2(1) + 4(\sqrt{2}/2) + 0 \right] = \frac{\pi}{12} (4\sqrt{2} + 2) \approx 2.0046. The exact value of the integral is \int_0^\pi \sin(x) \, dx = [-\cos(x)]_0^\pi = 2, so the absolute error is approximately 0.0046, demonstrating high accuracy even with few subintervals, as \sin(x) is well-approximated by quadratics over [0, \pi]. To verify the computation, note that the weighted sum inside the brackets is $4\sqrt{2} + 2 \approx 7.6569, and multiplying by \pi/12 \approx 0.2618 confirms the approximation. Increasing n improves accuracy; for instance, with n=8, the approximation is about 2.0003, reducing the error to roughly 0.0003, consistent with the O(h^4) convergence of the method. For contrast, a brief application of the composite Simpson's 3/8 rule to the same integral using 3 subintervals (h = \pi/3) gives points x_0=0, x_1=\pi/3, x_2=2\pi/3, x_3=\pi with f(x_1) = f(x_2) = \sqrt{3}/2 \approx 0.8660, yielding an approximation of (3\pi/8)(\sqrt{3}) \approx 2.0413, with a larger error of about 0.0413 compared to the 1/3 rule for similar effort.

Comparison with Other Numerical Methods

Simpson's rule offers superior accuracy compared to the due to its higher-order approximation. While the approximates the integrand with linear functions and achieves a global of order O(h^2), Simpson's rule uses quadratic interpolation, yielding an of order O(h^4). This quadratic fitting allows Simpson's rule to require roughly half as many subintervals as the to attain comparable precision for smooth functions. For instance, in evaluating the \int_0^1 e^{-x^2} \, dx \approx 0.746824, which relates to the , the with 10 subintervals yields an overestimate with on the order of 0.002, whereas Simpson's rule with the same number of points achieves much higher precision with on the order of 10^{-5}, demonstrating the efficiency gain. Relative to the midpoint rule, Simpson's rule provides better performance for curved functions because it incorporates endpoint values in a weighted quadratic average, effectively combining aspects of the and trapezoidal approximations. The rule, like the trapezoidal, has an O(h^2) error but tends to underestimate concave-up functions, whereas Simpson's higher-order term reduces systematic bias for polynomials up to degree 3. This makes Simpson's rule preferable when the integrand exhibits moderate nonlinearity, as the 's simplicity comes at the cost of lower accuracy for non-linear cases. In contrast to , which is for polynomials of up to 2n-1 using n points and excels for highly analytic functions, Simpson's rule is simpler and more suitable for provided at equally spaced intervals, such as in experimental or tabular settings. Gaussian methods require precomputing specific nodes and weights, increasing setup , whereas Simpson's composite form uses straightforward equally spaced evaluations. However, Gaussian quadrature demands fewer function evaluations overall for high precision on integrands, making it ideal when the function form is known in advance. Simpson's rule, with its fixed O(h^4) , strikes a balance for general use without node optimization. Regarding computational cost, the composite Simpson's rule typically requires n+1 function evaluations for n even subintervals, offering predictable overhead suitable for fixed-grid applications. , while efficient in evaluations (e.g., 3 points for exact cubics), involves solving for optimal nodes, which can be more expensive for high dimensions or adaptive schemes. Adaptive variants of Simpson's rule can refine intervals dynamically, but fixed implementations favor it over Gaussian for non-smooth or uneven data. Simpson's rule is particularly advantageous for moderately functions on equally spaced grids, common in and physics simulations where arises from measurements. For example, it can approximate the work done by a variable force, such as in calculating W = \int_a^b F(x) \, dx from experimental force-displacement at equal intervals. It outperforms lower-order methods for such cases but shows limitations with highly oscillatory integrands, where specialized techniques like Filon may be needed to avoid errors. For irregular spacing or extreme , alternatives like Gaussian or spline-based methods are preferred.

References

  1. [1]
    [PDF] Approximating Integrals • Simpson's Rule
    Simpson's Rule. Simpson's Rule is based on the fact that given any three points, you can find the equation of a quadratic through those points.
  2. [2]
    Calculus II - Approximating Definite Integrals
    Nov 16, 2022 · For Simpson's Rule we are going to approximate the function with a quadratic and we're going to require that the quadratic agree with three of ...
  3. [3]
    [PDF] 10. Numerical Integration - Galileo
    One common alternative to the “trapezoid rule” is called “Simp- son's rule”, named after 18th-Century British mathematician. Thomas Simpson. Instead of ...
  4. [4]
    1.11 Numerical Integration
    To derive Simpson's rule formula, we first find the equation of the parabola that passes through the three points , ( x 0 , f ( x 0 ) ) , ( x 1 , f ( x 1 ) ) ...
  5. [5]
    Simpson's Rule - Python Numerical Methods
    Simpson's Rule approximates the area under f(x) over these two subintervals by fitting a quadratic polynomial through the points (xi−1,f(xi−1)),(xi,f(xi)), and ...
  6. [6]
    8.6 Numerical Integration
    Ex 8.6. 11 Using Simpson's rule on a parabola f(x), even with just two subintervals, gives the exact value of the integral, because the parabolas used to ...
  7. [7]
    5.9 Numerical Integration
    Simpson's rule gives the best approximation of the distance traveled since it is a weighted average of the midpoint and trapezoid rules ...
  8. [8]
    [PDF] Simpson's 1/3 rule assumes 3 equispaced data/interpolation
    The integration rule is based on approximating using Lagrange quadratic (second degree) interpolation. • The sub-interval is defined as [xo ,x2] and the ...
  9. [9]
    Simpson's Rule - an overview | ScienceDirect Topics
    Simpson's rule is a numerical integration method that estimates area under a curve by fitting parabolas to sets of three points, more accurate than Trapezoidal ...<|control11|><|separator|>
  10. [10]
    [PDF] 4 Numerical Integration
    Simpson's Rule for Numerical Integration. Page 3. However, integration ... In physics and engineering applications, periodic functions frequently appear,.
  11. [11]
    [PDF] Section 4.3 Numerical Integration
    Remark: (1) Simpson's rule has degree of accuracy three. (2) The degree of precision of a quadrature formula is 𝑛𝑛 if and only if the error is zero for all ...
  12. [12]
    The Generalized Simpson's Rule - jstor
    However, Simpson was not the first to discover the rule; Bonaventura Cavalieri (1598-1647) found a version of it as early as 1639, and James Gregory (1638-1675) ...
  13. [13]
    Thomas Simpson (1710 - 1761) - Biography - MacTutor
    However the numerical method known today as "Simpson's rule", although it did appear in his work, was something he learned from Newton as Simpson himself ...
  14. [14]
    [PDF] Derivation of Simpson's Rule Math 129
    We will want to use three points in each subinterval of the partition for the. Riemann Sum, the left and right-hand endpoints, and the midpoint. To use.
  15. [15]
    [PDF] Simpson's Rule - MIT OpenCourseWare
    With Simpson's rule we match quadratics (i.e. parabolas), instead of straight or slanted lines, to the graph. When Δx is small this approximates the curve very ...
  16. [16]
    aejm | The Atlantic Electronic Journal of Mathematics
    The integrand is assumed to be twice continuously differentiable for ... Simpson's rule. Errors are estimated in terms of the uniform norm of second ...
  17. [17]
    Simpson's 3/8 Rule -- from Wolfram MathWorld
    Let the values of a function f(x) be tabulated at points x_i equally spaced by h=x_(i+1)-x_i , so f_1=f(x_1) , f_2=f(x_2) , ..., f_4=f(x_4) . Then Simpson's ...Missing: textbook | Show results with:textbook
  18. [18]
    [PDF] Numerical Integration and Differentiation
    Simpson's 3/8 Rule. If one fits a 3rd order Lagrange polynomial to 4 data points (3 intervals) and integrates,. Simpson's 3/8 Rule results: [. ]) (. ) (. 3. ) (.
  19. [19]
    [PDF] Simpson's Rule
    Jan 31, 2006 · 2 Deriving Simpson's Rule By Interpolation. Here, the idea is to replace the true function with an approximate one (a parabola) and integrate ...
  20. [20]
    [PDF] Simpson's Rule as the Weighted average of the Midpoint and ...
    Simpson's Rule as the Weighted average of the Midpoint and Trapezoidal Rules. To approximate NPa R(T) dT, Zet's partition the intervaZ [j,m]into 8 ...
  21. [21]
    [PDF] NumericalIntegration
    Simpson's 2n rule is the average of the Trapezoidal and Midpoint rules with n rectangles: S2 n=Tn+2 Mn. 3. Notice that we're adding two copies of the Midpoint ...
  22. [22]
    19. Definite Integrals, Part 3: The (Composite) Simpson's Rule and ...
    Appendix: Deriving Simpson's Rule by the Method of Undetermined Coefficients¶. We wish the determine the most accurate approximation of the form.
  23. [23]
    [PDF] 6 Numerical Integration - UMD MATH
    6.4.1 The method of undetermined coefficients. The methods of undetermined coefficients for deriving quadratures is the following: 1. Select the quadrature ...
  24. [24]
    [PDF] Chapter 07.08 Simpson 3/8 Rule for Integration
    Aug 7, 2011 · Use Simpson 3/8 multiple segments rule with six segments to estimate the vertical distance. Solution. In this example, one has (see Equation 14):.
  25. [25]
    [PDF] Chapter 07.03 Simpson's 1/3 Rule of Integration
    Mar 7, 2013 · The trapezoidal rule was based on approximating the integrand by a first order polynomial, and then integrating the polynomial over interval of ...Missing: physics | Show results with:physics
  26. [26]
    [PDF] Numerical Integration Formulas - Chapter 1
    Composite Simpson's 1/3 Rule. • Simpson's 1/3 rule can be used on a set of subintervals in much the same way the trapezoidal rule was, except there must be ...
  27. [27]
    MATH-305, Prof. Kevin TeBeest - Simpson's-1/3 Rule
    Now you will derive the composite formula for Simpson's–1/3 rule: First construct the Newton-Gregory interpolating polynomial P[0–2](x) containing points [0,1,2] ...Missing: derivation | Show results with:derivation
  28. [28]
    [PDF] 1. Composite Simpson's Rule: - SERC (Carleton)
    Composite Simpson's Rule: (Algorithm 4.4, Theorem 4.4) function integral = compsimp(a,b,n,f). % Approximate the integral of f from a to b.
  29. [29]
    [PDF] Composite Numerical Integration - MATH 375 Numerical Analysis
    Simpson's 3/8 Rule. Z x3 x0 f(x) dx = 3h. 8. [f(x0) + 3f(x1) + 3f(x2) + f(x3)] ... ▷ The numerical differentiation formulas were unstable with respect to round-off ...
  30. [30]
    [PDF] error bounds for numerical integration of functions of lower ... - AJMAA
    Dec 6, 2021 · ESTIMATION OF ERROR BOUNDS FOR SIMPSON'S 1/3 RULE. We now estimate the error bounds for the Simpson's 1/3 rule (which is a quadratic parabola).
  31. [31]
    [PDF] Assignment #4 SOLUTIONS
    C : 2. 3. = c0 + c2. Solving this system (e.g. using linear algebra methods, or ... Notice: this reproduces Simpson's Rule! So the degree of precision is ...
  32. [32]
    Difference between Simpson 's 1/3 rule and 3/8 rule - GeeksforGeeks
    Jul 23, 2025 · Simpson's 3/8 rule Formula · a, b are the interval of integration · h = (b - a )/ n · y₀ means the first term, and yₙ means the last term. · ( y₁ + ...
  33. [33]
    [PDF] 1 The Three Main Error Bound Theorems
    Nov 23, 2010 · Since Simpson's Rule is so accurate, it would make sense to ask if it's ever exact. Since Simpson's. Rule uses parabolas to approximate the ...
  34. [34]
    [PDF] Quadrature - MathWorks
    The Matlab function quad uses the extrapolated Simpson's rule in an adaptive recursive algorithm. Our textbook function quadtx is a simplified version of quad.
  35. [35]
  36. [36]
    Composite simpson's rule with odd intervals
    Nov 26, 2016 · A simple solution is to apply Simpson's (standard) rule to the first n−3 grid points, where n−3 is even for n odd, and cover the remaining three gridpoints via ...
  37. [37]
    [PDF] A Concise Introduction to Numerical Analysis Douglas N. Arnold
    For n = 4 we get Boole's rule with. 55. Page 62. 56. 2. NUMERICAL QUADRATURE weights 7/90, 32/90, 12/90, 32/90, 7/90. By construction the Newton-Cotes rule with ...
  38. [38]
    Boole's Rule -- from Wolfram MathWorld
    Let the values of a function f(x) be tabulated at points x_i equally spaced by h=x_(i+1)-x_i , so f_1=f(x_1) , f_2=f(x_2) , ..., f_5=f(x_5) . Then Boole's ...
  39. [39]
  40. [40]
    (PDF) Comparison on Trapezoidal and Simpson's Rule for Unequal ...
    Nov 30, 2019 · Trapezoidal and Simpson's rule are widely used to solve numerical integration problems. Our paper mainly concentrates on identifying the method which provides ...
  41. [41]
    simpson — SciPy v1.16.2 Manual
    Integrate y(x) using samples along the given axis and the composite Simpson's rule. If x is None, spacing of dx is assumed.Simpson · 1.12.0 · 1.10.1 · 1.13.1
  42. [42]
    [PDF] Simpson's Rule Integration with MS Excel and Irregularly-spaced Data
    A recent publication presented a method to numerically integrate irregularly- spaced data using Simpson's Rule. Unfortunately, this method is unsuitable for.
  43. [43]
    (PDF) Comparison of integration rules in the case of very narrow ...
    Jun 15, 2018 · The trapezium and Simpson's methods are widely used for numerical integration. In most circumstances, Simpson's method is more accurate than ...Missing: adaptations | Show results with:adaptations
  44. [44]
    [PDF] Increasing the Reliability of Adaptive Quadrature Using Explicit ...
    Jun 20, 2010 · 1962 Kuncir [Kuncir 1962] kicked-off the field2 with his adaptive Simpson's rule integrator, which uses – as the name suggests – Simpson's ...
  45. [45]
    A Pharmacokinetic Model Determination of Time Activity Curves in ...
    Simpson's rule is used to integrate the resultant curve to determine the TIA, where the TIA has units hrx % activity, where % activity can be converted to a ...
  46. [46]
    Demo on the Trapezoidal Rule and Simpson's Rule - UMD MATH
    The idea of Simpson's rule is to approximate a general curve by arcs of parabolas, like this. We illustrate with the problem of integrating sin(x) from 0 to pi.
  47. [47]
    Simpson's rule - BYJU'S
    Simpson's rule is one of the numerical methods which is used to evaluate the definite integral. Usually, to find the definite integral, we use the fundamental ...Missing: Isaac | Show results with:Isaac
  48. [48]
    3.6 Numerical Integration - Calculus Volume 2 | OpenStax
    Mar 30, 2016 · Figure 3.16 With Simpson's rule, we approximate a definite integral by integrating a piecewise quadratic function. To understand the formula ...
  49. [49]
    [PDF] Numerical Integration 1 Introduction 2 Midpoint Rule, Trapezoid ...
    For the composite midpoint rule with N subintervals we use N function evaluations. For the composite Simpson rule with N subintervals we use 2N +1 function ...Missing: average | Show results with:average
  50. [50]
    [PDF] Numerical Integration (Quadrature)
    Advantages/Disadvantages. 1. For functions that are smooth or ... – trapezoid rule, Simpson's rule, Gauss quadrature. • Quadrature formula. One ...<|separator|>
  51. [51]
    [PDF] Chapter 5 - Quadrature - Computer Science
    Classically, Simpson's rule is derived by using a parabola to interpolate f(x) at the two endpoints, a and b, and the midpoint, c = (a+b)/2 and integrating the ...Missing: Carl | Show results with:Carl
  52. [52]
    [PDF] 9 – Numerical Integration
    In the case of equal-sized panels, Simpson's 3/8 Rule has an error 2.25 times larger than Simpson's 1/3 Rule assuming the same value of the fourth derivative.
  53. [53]
    [PDF] Chapter 8 -- Numerical Integration and Differentiation
    which gives alternate derivation for Simpson's rule and estimate for its ... undetermined coefficients, but resulting system of moment equations that ...