HOME

TheInfoList



OR:

In
numerical integration In analysis, numerical integration comprises a broad family of algorithms for calculating the numerical value of a definite integral. The term numerical quadrature (often abbreviated to quadrature) is more or less a synonym for "numerical integr ...
, Simpson's rules are several
approximation An approximation is anything that is intentionally similar but not exactly equal to something else. Etymology and usage The word ''approximation'' is derived from Latin ''approximatus'', from ''proximus'' meaning ''very near'' and the prefix ...
s for
definite integral In mathematics, an integral is the continuous analog of a sum, which is used to calculate areas, volumes, and their generalizations. Integration, the process of computing an integral, is one of the two fundamental operations of calculus,Int ...
s, named after Thomas Simpson (1710–1761). The most basic of these rules, called Simpson's 1/3 rule, or just Simpson's rule, reads \int_a^b f(x) \, dx \approx \frac \left (a) + 4f\left(\frac\right) + f(b)\right In German and some other languages, it is named after
Johannes Kepler Johannes Kepler (27 December 1571 – 15 November 1630) was a German astronomer, mathematician, astrologer, Natural philosophy, natural philosopher and writer on music. He is a key figure in the 17th-century Scientific Revolution, best know ...
, who derived it in 1615 after seeing it used for wine barrels (barrel rule, ). The approximate equality in the rule becomes exact if is a polynomial up to and including 3rd degree. If the 1/3 rule is applied to ''n'' equal subdivisions of the integration range 'a'', ''b'' one obtains the composite Simpson's 1/3 rule. Points inside the integration range are given alternating weights 4/3 and 2/3. Simpson's 3/8 rule, also called Simpson's second rule, requires one more function evaluation inside the integration range and gives lower error bounds, but does not improve the order of the error. If the 3/8 rule is applied to ''n'' equal subdivisions of the integration range 'a'', ''b'' one obtains the composite Simpson's 3/8 rule. Simpson's 1/3 and 3/8 rules are two special cases of closed Newton–Cotes formulas. In naval architecture and ship stability estimation, there also exists ''Simpson's third rule'', which has no special importance in general
numerical analysis Numerical analysis is the study of algorithms that use numerical approximation (as opposed to symbolic computation, symbolic manipulations) for the problems of mathematical analysis (as distinguished from discrete mathematics). It is the study of ...
, see Simpson's rules (ship stability).


Simpson's 1/3 rule

Simpson's 1/3 rule, also simply called Simpson's rule, is a method for numerical integration proposed by Thomas Simpson. It is based upon a quadratic interpolation and is the composite Simpson's 1/3 rule evaluated for n = 2. Simpson's 1/3 rule is as follows: \begin \int_a^b f(x)\, dx &\approx \frac \left (a) + 4f\left(\frac\right) + f(b)\right\ &= \frac h\left (a) + 4f\left(a + h\right) + f(b)\right \end where h = (b - a)/n is the step size for n = 2. The error in approximating an integral by Simpson's rule for n = 2 is -\frac h^5f^(\xi) = -\frac f^(\xi), where \xi (the Greek letter xi) is some number between a and b. The error is asymptotically proportional to (b - a)^5. However, the above derivations suggest an error proportional to (b - a)^4. Simpson's rule gains an extra order because the points at which the integrand is evaluated are distributed symmetrically in the interval ,\ b/math>. Since the error term is proportional to the fourth derivative of f at \xi, this shows that Simpson's rule provides exact results for any polynomial f of degree three or less, since the fourth derivative of such a polynomial is zero at all points. Another way to see this result is to note that any interpolating
cubic polynomial In mathematics, a cubic function is a function (mathematics), function of the form f(x)=ax^3+bx^2+cx+d, that is, a polynomial function of degree three. In many texts, the ''coefficients'' , , , and are supposed to be real numbers, and the func ...
can be expressed as the sum of the unique interpolating quadratic polynomial plus an arbitrarily scaled cubic polynomial that vanishes at all three points in the interval, and the integral of this second term vanishes because it is odd within the interval. If the second derivative f'' exists and is
convex Convex or convexity may refer to: Science and technology * Convex lens, in optics Mathematics * Convex set, containing the whole line segment that joins points ** Convex polygon, a polygon which encloses a convex set of points ** Convex polytop ...
in the interval (a,\ b), then (b - a) f\left(\frac\right) + \frac \left(\frac\right)^3 f''\left(\frac\right) \leq \int_a^b f(x)\, dx \leq \frac \left (a) + 4f\left(\frac\right) + f(b)\right


Derivations


Quadratic interpolation

One derivation replaces the integrand f(x) by the
quadratic polynomial In mathematics, a quadratic function of a single variable is a function of the form :f(x)=ax^2+bx+c,\quad a \ne 0, where is its variable, and , , and are coefficients. The expression , especially when treated as an object in itself rather tha ...
(i.e. parabola) P(x) that takes the same values as f(x) at the end points a and b and the midpoint a+h, where h = (b - a)/2. One can use Lagrange polynomial interpolation to find an expression for this polynomial, P(x) = f(a) \frac + f(a+h) \frac + f(b) \frac. Define: A_(x) = f(a) \frac, A_(x) = f(a+h) \frac, and A_(x) = f(b) \frac. By making the substitution u = x - a - h, one can calculate: \begin \int_a^b A_(x)\, dx = &\int_^A_(u)\, du\\ &= f(a)\left(\int_^\frac\, du\right) \\ &= \frac\left(\int_^u^2 - hu\, du\right) \\ &= \frac\left fracu^3 - \frachu^2 \right^ \\ &= \frac\left left(\frach^3 - \frach^3 \right) - \left(-\frach^3 - \frach^3 \right) \right\\ &= \frac\left(\frach^3 - \frach^3 + \frach^3 + \frach^3 \right) \\ &= \frac\left(\frach^3\right) \\ &= \fracf(a). \end \begin \int_a^b A_(x)\, dx = &\int_^A_(u)\, du\\ &= f(a+h)\left(\int_^\frac\, du\right)\\ &= f(a+h)\left(\int_^\frac\, du\right) \\ &= - \frac\left(\int_^u^2 - h^2\, du\right) \\ &= - \frac\left fracu^3 - h^2u \right^ \\ &= - \frac\left frach^3 - h^3 - \left(- \frach^3 + h^3 \right) \right \\ &= - \frac\left(-\frach^3 + \frach^3 - h^3 \right) \\ &= - \frac\left(\frach^3\right) \\ &= \fracf(a + h). \end \begin \int_a^b A_(x)\, dx = &\int_^A_(u)\, du\\ &= f(b)\left(\int_^\frac\, du\right)\\ &= f(b)\left(\int_^\frac\, du\right)\\ &= \frac\left(\int_^u^2 + hu\, du\right)\\ &= \frac\left fracu^3 + \frachu^2 \right^\\ &= \frac\left frach^3 + \frach^3 - \left(-\frach^3 + \frach^3 \right) \right\\ &= \frac\left(\frach^3 - \frach^3 \right) \\ &= \frac\left(\frach^3\right)\\ &= \fracf(b). \end Therefore, \begin \int_a^b f(x)\, dx \approx&\int_a^b P(x)\, dx\\ &= \int_a^b A_(x)\, dx + \int_a^b A_(x)\, dx + \int_a^b A_(x)\, dx\\ &= \fracf(a) + \fracf(a + h) + \fracf(b)\\ &= \frach\left (a) + 4f(a + h ) + f(b)\right \end Because of the 1/3 factor, Simpson's rule is also referred to as "Simpson's 1/3 rule" (see below for generalization).


Averaging the midpoint and the trapezoidal rules

Another derivation constructs Simpson's rule from two simpler approximations: the midpoint rule M = (b - a)f\left(\frac\right) and the trapezoidal rule T = \frac (b - a)\big(f(a) + f(b)\big). The errors in these approximations are \frac (b - a)^3 f''(a) + O\big((b - a)^4\big) and -\frac (b - a)^3 f''(a) + O\big((b - a)^4\big) respectively, where O\big((b - a)^4\big) denotes a term asymptotically proportional to (b - a)^4. The two O\big((b - a)^4\big) terms are not equal; see
Big O notation Big ''O'' notation is a mathematical notation that describes the asymptotic analysis, limiting behavior of a function (mathematics), function when the Argument of a function, argument tends towards a particular value or infinity. Big O is a memb ...
for more details. It follows from the above formulas for the errors of the midpoint and trapezoidal rule that the leading error term vanishes if we take the weighted average \frac. This weighted average is exactly Simpson's rule. Using another approximation (for example, the trapezoidal rule with twice as many points), it is possible to take a suitable weighted average and eliminate another error term. This is Romberg's method.


Undetermined coefficients

The third derivation starts from the ''
ansatz In physics and mathematics, an ansatz (; , meaning: "initial placement of a tool at a work piece", plural ansatzes or, from German, ansätze ; ) is an educated guess or an additional assumption made to help solve a problem, and which may later be ...
'' \frac \int_a^b f(x)\, dx \approx \alpha f(a) + \beta f\left(\frac\right) + \gamma f(b). The coefficients , and can be fixed by requiring that this approximation be exact for all quadratic polynomials. This yields Simpson's rule. (This derivation is essentially a less rigorous version of the quadratic interpolation derivation, where one saves significant calculation effort by guessing the correct functional form.)


Composite Simpson's 1/3 rule

If the interval of integration , b/math> is in some sense "small", then Simpson's rule with n = 2 subintervals will provide an adequate approximation to the exact integral. By "small" we mean that the function being integrated is relatively smooth over the interval , b/math>. For such a function, a smooth quadratic interpolant like the one used in Simpson's rule will give good results. However, it is often the case that the function we are trying to integrate is not smooth over the interval. Typically, this means that either the function is highly oscillatory or lacks derivatives at certain points. In these cases, Simpson's rule may give very poor results. One common way of handling this problem is by breaking up the interval , b/math> into n > 2 small subintervals. Simpson's rule is then applied to each subinterval, with the results being summed to produce an approximation for the integral over the entire interval. This sort of approach is termed the ''composite Simpson's 1/3 rule'', or just ''composite Simpson's rule''. Suppose that the interval , b/math> is split up into n subintervals, with n an even number. Then, the composite Simpson's rule is given by Dividing the interval , b/math> into n subintervals of length h = (b - a)/n and introducing the points x_i = a + ih for 0 \leq i \leq n (in particular, x_0 = a and x_n = b), we have \begin \int_a^b f(x)\, dx &\approx \frac h\sum_^\big (x_) + 4f(x_) + f(x_)\big\ &= \frac h\big (x_0) + 4f(x_1) + 2f(x_2) + 4f(x_3) + 2f(x_4) + \dots + 2f(x_) + 4f(x_) + f(x_n)\big\ &= \frac h\left (x_0) + 4\sum_^ f(x_) + 2\sum_^ f(x_) + f(x_n)\right \end This composite rule with n = 2 corresponds with the regular Simpson's rule of the preceding section. The error committed by the composite Simpson's rule is -\frac h^4(b - a)f^(\xi), where \xi is some number between a and b, and h = (b - a)/n is the "step length". The error is bounded (in absolute value) by \frac h^4(b - a) \max_ \left, f^(\xi)\. This formulation splits the interval , b/math> in subintervals of equal length. In practice, it is often advantageous to use subintervals of different lengths and concentrate the efforts on the places where the integrand is less well-behaved. This leads to the adaptive Simpson's method.


Simpson's 3/8 rule

Simpson's 3/8 rule, also called Simpson's second rule, is another method for numerical integration proposed by Thomas Simpson. It is based upon a cubic interpolation rather than a quadratic interpolation. Simpson's 3/8 rule is as follows: \begin \int_a^b f(x)\, dx &\approx \frac \left (a) + 3f\left(\frac\right) + 3f\left(\frac\right) + f(b)\right\ &= \frac h\left (a) + 3f\left(a + h\right) + 3f\left(a + 2h\right) + f(b)\right \end where h = (b - a)/3 is the step size. The error of this method is -\frac h^5f^(\xi) = -\frac f^(\xi), where \xi is some number between a and b. Thus, the 3/8 rule is about twice as accurate as the standard method, but it uses one more function value. A composite 3/8 rule also exists, similarly as above. A further generalization of this concept for interpolation with arbitrary-degree polynomials are the Newton–Cotes formulas.


Composite Simpson's 3/8 rule

Dividing the interval , b/math> into n subintervals of length h = (b - a)/n and introducing the points x_i = a + ih for 0 \leq i \leq n (in particular, x_0 = a and x_n = b), we have \begin \int_a^b f(x)\, dx &\approx \frac h\sum_^ \big (x_) + 3f(x_) + 3f(x_) + f(x_)\big\ &= \frac h\big (x_0) + 3f(x_1) + 3f(x_2) + 2f(x_3) + 3f(x_4) + 3f(x_5) + 2f(x_6) + \dots \\&\qquad+ 2f(x_) + 3f(x_) + 3f(x_) + f(x_n)\big\ &= \frac h\left (x_0) + 3 \sum_^ f(x_i) + 2 \sum_^ f(x_) + f(x_n)\right \end While the remainder for the rule is shown as -\frac h^4(b - a)f^(\xi), we can only use this if n is a multiple of three. The 1/3 rule can be used for the remaining subintervals without changing the order of the error term (conversely, the 3/8 rule can be used with a composite 1/3 rule for odd-numbered subintervals).


Alternative extended Simpson's rule

This is another formulation of a composite Simpson's rule: instead of applying Simpson's rule to disjoint segments of the integral to be approximated, Simpson's rule is applied to overlapping segments, yielding \begin \int_a^b f(x)\, dx \approx \frac h \bigg & 17f(x_0) + 59f(x_1) + 43f(x_2) + 49f(x_3) \\ +& 48 \sum_^ f(x_i) \\ +& 49f(x_) + 43f(x_) + 59f(x_) + 17f(x_n) \bigg\end The formula above is obtained by combining the composite Simpson's 1/3 rule with the one consisting of using Simpson's 3/8 rule in the extreme subintervals and Simpson's 1/3 rule in the remaining subintervals. The result is then obtained by taking the mean of the two formulas.


Simpson's rules in the case of narrow peaks

In the task of estimation of full area of narrow peak-like functions, Simpson's rules are much less efficient than trapezoidal rule. Namely, composite Simpson's 1/3 rule requires 1.8 times more points to achieve the same accuracy as trapezoidal rule. Composite Simpson's 3/8 rule is even less accurate. Integration by Simpson's 1/3 rule can be represented as a weighted average with 2/3 of the value coming from integration by the trapezoidal rule with step ''h'' and 1/3 of the value coming from integration by the rectangle rule with step 2''h''. The accuracy is governed by the second (2''h'' step) term. Averaging of Simpson's 1/3 rule composite sums with properly shifted frames produces the following rules: \int_a^b f(x)\, dx \approx \frac h\left f(x_) + 12f(x_0) + 25f(x_1) + 24\sum_^ f(x_i) + 25f(x_) + 12f(x_n) - f(x_)\right where two points outside of the integrated region are exploited, and \int_a^b f(x)\, dx \approx \frac h\left f(x_0) + 28f(x_1) + 23f(x_2) + 24\sum_^ f(x_i) + 23f(x_) + 28f(x_) + 9f(x_n)\right where only points within integration region are used. Application of the second rule to the region of 3 points generates 1/3 Simpson's rule, 4 points - 3/8 rule. These rules are very much similar to the alternative extended Simpson's rule. The coefficients within the major part of the region being integrated are one with non-unit coefficients only at the edges. These two rules can be associated with Euler–MacLaurin formula with the first derivative term and named First order Euler–MacLaurin integration rules. The two rules presented above differ only in the way how the first derivative at the region end is calculated. The first derivative term in the Euler–MacLaurin integration rules accounts for integral of the
second derivative In calculus, the second derivative, or the second-order derivative, of a function is the derivative of the derivative of . Informally, the second derivative can be phrased as "the rate of change of the rate of change"; for example, the secon ...
, which equals the difference of the first derivatives at the edges of the integration region. It is possible to generate higher order Euler–Maclaurin rules by adding a difference of 3rd, 5th, and so on derivatives with coefficients, as defined by Euler–MacLaurin formula.


Composite Simpson's rule for irregularly spaced data

For some applications, the integration interval I = , b/math> needs to be divided into uneven intervals – perhaps due to uneven sampling of data, or missing or corrupted data points. Suppose we divide the interval I into an even number N of subintervals of widths h_k. Then the composite Simpson's rule is given by \int_a^b f(x)\, dx \approx \sum_^ \frac \left left(2 - \frac\right) f_ + \frac f_ + \left(2 - \frac\right) f_\right where f_k = f\left(a + \sum_^ h_i\right) are the function values at the kth sampling point on the interval I. In case of an odd number N of subintervals, the above formula is used up to the second to last interval, and the last interval is handled separately by adding the following to the result: \alpha f_N + \beta f_ - \eta f_, where \begin \alpha &= \frac,\\ ex \beta &= \frac,\\ ex \eta &= \frac. \end


See also

* Newton–Cotes formulas *
Gaussian quadrature In numerical analysis, an -point Gaussian quadrature rule, named after Carl Friedrich Gauss, is a quadrature rule constructed to yield an exact result for polynomials of degree or less by a suitable choice of the nodes and weights for . Th ...


Notes


References

* * * * * * * *


External links

* *
Simpson's 1/3rd rule of integration — Notes, PPT, Mathcad, Matlab, Mathematica, Maple
a
Numerical Methods for STEM undergraduate
* A detailed description of a computer implementation is described by Dorai Sitaram in ''Teach Yourself Scheme in Fixnum Days''
Appendix C
{{DEFAULTSORT:Simpson's Rule Integral calculus Numerical integration Numerical analysis Articles with example Python (programming language) code Articles with example R code