Skip to article frontmatterSkip to article content

8.6Newton-Cotes integration

from pylab import *
from scipy.integrate import newton_cotes

The Trapezoidal and Simpson rules were based on integrating a polynomial approximation. Such methods are called Newton-Cotes integration methods. If we choose n+1n+1 distinct points in [a,b][a,b] and approximate the function f:[a,b]Rf : [a,b] \to \re by interpolation

pn(x)=j=0nf(xj,n)j,n(x),x[a,b]p_n(x) = \sum_{j=0}^n f(x_{j,n}) \ell_{j,n}(x), \qquad x \in [a,b]

the integral can be approximated by

In(f)=abpn(x)dx=j=0nf(xj,n)abj,n(x)dx=j=0nwj,nf(xj,n)I_n(f) = \int_a^b p_n(x) \ud x = \sum_{j=0}^n f(x_{j,n}) \clr{red}{ \int_a^b \ell_{j,n}(x) \ud x } = \sum_{j=0}^n \clr{red}{w_{j,n}} f(x_{j,n})

where the weights are given by

wj,n=abj,n(x)dxw_{j,n} = \int_a^b \ell_{j,n}(x) \ud x

As an example for n=3n=3 and using uniformly spaced points, we interpolate by a cubic polynomial and the integral is approximated as

I3(f)=3h8[f0+3f1+3f2+f3]I_3(f) = \frac{3h}{8}[f_0 + 3 f_1 + 3 f_2 + f_3]

For general nn, we can state the following error estimates.

The accuracy of a quadrature formula can be characterized by the largest set of polynomials which it can integrate exactly.

We now look at necessary and sufficient conditions for a numerical integration formula to converge.

Note that for an integration formula

j=0nwj,n=ba\sum_{j=0}^n w_{j,n} = b - a
References
  1. Atkinson, K. E. (2004). An Introduction to Numerical Analysis (2nd ed.). Wiley.