# Newton–Cotes formulas

(Redirected from Quadrature formulas)
Newton–Cotes formula for n = 2

In numerical analysis, the Newton–Cotes formulae, also called the Newton–Cotes quadrature rules or simply Newton–Cotes rules, are a group of formulae for numerical integration (also called quadrature) based on evaluating the integrand at equally spaced points. They are named after Isaac Newton and Roger Cotes.

Newton–Cotes formulae can be useful if the value of the integrand at equally spaced points is given. If it is possible to change the points at which the integrand is evaluated, then other methods such as Gaussian quadrature and Clenshaw–Curtis quadrature are probably more suitable.

## Description

It is assumed that the value of a function ƒ defined on [ab] is known at equally spaced points xi, for i = 0, …, n, where x0 = a and xn = b. There are two types of Newton–Cotes formulae, the "closed" type which uses the function value at all points, and the "open" type which does not use the function values at the endpoints. The closed Newton–Cotes formula of degree n is stated as

${\displaystyle \int _{a}^{b}f(x)\,dx\approx \sum _{i=0}^{n}w_{i}\,f(x_{i})}$

where xi = h i + x0, with h (called the step size) equal to (xnx0) / n = (ba) / n. The wi are called weights.

As can be seen in the following derivation the weights are derived from the Lagrange basis polynomials. They depend only on the xi and not on the function ƒ. Let L(x) be the interpolation polynomial in the Lagrange form for the given data points (x0, ƒ(x0) ), …, (xn, ƒ(xn) ), then

${\displaystyle \int _{a}^{b}f(x)\,dx\approx \int _{a}^{b}L(x)\,dx=\int _{a}^{b}{\bigl (}\sum _{i=0}^{n}f(x_{i})\,l_{i}(x){\bigr )}\,dx=\sum _{i=0}^{n}f(x_{i})\underbrace {\int _{a}^{b}l_{i}(x)\,dx} _{w_{i}}.}$

The open Newton–Cotes formula of degree n is stated as

${\displaystyle \int _{a}^{b}f(x)\,dx\approx \sum _{i=1}^{n-1}w_{i}\,f(x_{i}).}$

The weights are found in a manner similar to the closed formula.

## Instability for high degree

A Newton–Cotes formula of any degree n can be constructed. However, for large n a Newton–Cotes rule can sometimes suffer from catastrophic Runge's phenomenon where the error grows exponentially for large n. Methods such as Gaussian quadrature and Clenshaw–Curtis quadrature with unequally spaced points (clustered at the endpoints of the integration interval) are stable and much more accurate, and are normally preferred to Newton–Cotes. If these methods cannot be used, because the integrand is only given at the fixed equidistributed grid, then Runge's phenomenon can be avoided by using a composite rule, as explained below.

Alternatively, stable Newton–Cotes formulas can be constructed using least-squares approximation instead of interpolation. This allows building numerically stable formulas even for high degrees.[1][2]

## Closed Newton–Cotes formulae

This table lists some of the Newton–Cotes formulae of the closed type. The notation ${\displaystyle f_{i}}$ is a shorthand for ${\displaystyle f(x_{i})}$, with xi = a + i (ba) / n, and n the degree.

Closed Newton–Cotes Formulae
Degree Common name Formula Error term
1 Trapezoid rule ${\displaystyle {\frac {b-a}{2}}(f_{0}+f_{1})}$ ${\displaystyle -{\frac {(b-a)^{3}}{12}}\,f^{(2)}(\xi )}$
2 Simpson's rule ${\displaystyle {\frac {b-a}{6}}(f_{0}+4f_{1}+f_{2})}$ ${\displaystyle -{\frac {(b-a)^{5}}{2880}}\,f^{(4)}(\xi )}$
3 Simpson's 3/8 rule ${\displaystyle {\frac {(b-a)}{8}}(f_{0}+3f_{1}+3f_{2}+f_{3})}$ ${\displaystyle -{\frac {(b-a)^{5}}{6480}}\,f^{(4)}(\xi )}$
4 Boole's rule ${\displaystyle {\frac {b-a}{90}}(7f_{0}+32f_{1}+12f_{2}+32f_{3}+7f_{4})}$ ${\displaystyle -{\frac {(b-a)^{7}}{1935360}}\,f^{(6)}(\xi )}$

Boole's rule is sometimes mistakenly called Bode's rule, as a result of the propagation of a typographical error in Abramowitz and Stegun, an early reference book.[3]

The exponent of the segment size b − a in the error term shows the rate at which the approximation error decreases. The derivative of ƒ in the error term shows which polynomials can be integrated exactly (i.e., with error equal to zero). Note that the derivative of ƒ in the error term increases by 2 for every other rule. The number ${\displaystyle \xi }$ is between a and b.

## Open Newton–Cotes formulae

This table lists some of the Newton–Cotes formulae of the open type. Again, ƒi is a shorthand for ƒ(xi), with xi = a + i (ba) / n, and n the degree.

Open Newton–Cotes Formulae
Common name step size Formula Error term Degree
Rectangle rule, or
midpoint rule
${\displaystyle {\frac {b-a}{2}}}$ ${\displaystyle (b-a)f_{1}\,}$ ${\displaystyle {\frac {(b-a)^{3}}{24}}\,f^{(2)}(\xi )}$ 2
Trapezoid method ${\displaystyle {\frac {b-a}{3}}}$ ${\displaystyle {\frac {b-a}{2}}(f_{1}+f_{2})}$ ${\displaystyle {\frac {(b-a)^{3}}{36}}\,f^{(2)}(\xi )}$ 3
Milne's rule ${\displaystyle {\frac {b-a}{4}}}$ ${\displaystyle {\frac {b-a}{3}}(2f_{1}-f_{2}+2f_{3})}$ ${\displaystyle {\frac {7(b-a)^{5}}{23040}}f^{(4)}(\xi )}$ 4
Gillenator method ${\displaystyle {\frac {b-a}{5}}}$ ${\displaystyle {\frac {b-a}{24}}(11f_{1}+f_{2}+f_{3}+11f_{4})}$ ${\displaystyle {\frac {19(b-a)^{5}}{90000}}f^{(4)}(\xi )}$ 5

## Composite rules

For the Newton–Cotes rules to be accurate, the step size h needs to be small, which means that the interval of integration ${\displaystyle [a,b]}$ must be small itself, which is not true most of the time. For this reason, one usually performs numerical integration by splitting ${\displaystyle [a,b]}$ into smaller subintervals, applying a Newton–Cotes rule on each subinterval, and adding up the results. This is called a composite rule. See Numerical integration.