# Newton–Cotes formulas

(Redirected from Newton-Cotes 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

$\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

$\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

$\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.

## Closed Newton–Cotes formulae

This table lists some of the Newton–Cotes formulae of the closed type. The notation $f_i$ is a shorthand for $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 $\frac{b-a}{2} (f_0 + f_1)$ $-\frac{(b-a)^3}{12}\,f^{(2)}(\xi)$
2 Simpson's rule $\frac{b-a}{6} (f_0 + 4 f_1 + f_2)$ $-\frac{(b-a)^5}{2880}\,f^{(4)}(\xi)$
3 Simpson's 3/8 rule $\frac{b-a}{8} (f_0 + 3 f_1 + 3 f_2 + f_3)$ $-\frac{(b-a)^5}{6480}\,f^{(4)}(\xi)$
4 Boole's rule $\frac{b-a}{90} (7 f_0 + 32 f_1 + 12 f_2 + 32 f_3 + 7 f_4)$ $-\frac{(b-a)^7}{1935360}\,f^{(6)}(\xi)$

Boole's rule is sometimes mistakenly called Bode's rule due to propagation of a typo in Abramowitz and Stegun, an early reference book.[1]

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 $\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
$\frac{b-a}{2}$ $(b-a) f_1\,$ $\frac{(b-a)^3}{24}\,f^{(2)}(\xi)$ 2
Trapezoid method $\frac{b-a}{3}$ $\frac{b-a}{2} (f_1 + f_2)$ $\frac{(b-a)^3}{36}\,f^{(2)}(\xi)$ 3
Milne's rule $\frac{b-a}{4}$ $\frac{b-a}{3} (2 f_1 - f_2 + 2 f_3)$ $\frac{7(b-a)^5}{23040}f^{(4)}(\xi)$ 4
No Name $\frac{b-a}{5}$ $\frac{b-a}{24} (11 f_1 + f_2 + f_3 + 11 f_4)$ $\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 $[a, b]$ must be small itself, which is not true most of the time. For this reason, one usually performs numerical integration by splitting $[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.