Numerical quadrature
Contents
Numerical quadrature#
One application of interpolation is the numerical integration (or quadrature) of functions. Given a complicated function \(f\) in an interval \([a,b]\). Instead of evaluating
we evaluate
where \(p_n\) interpolates \(f\) at a given set of points.
Newton-Cotes formulae#
We now describe the derivation of Newton-Cotes integration formulae. Define
with \(h=\frac{b-a}{n}\).
We interpolate \(f\) using a Lagrange interpolation polynomial of the form
We obtain
where the \(\omega_k:=\int_a^bL_k(x)dx\) are called integration weights. They are independent of the function to integrate and can be precomputed and tabulated.
We note two simple observations for Newton-Cotes rules:
The sum of the weights \(\omega_k\) is always \(b - a\). This follows from integrating the constant function \(1\).
The weights are symmetric in the sense that \(\omega_j = \omega_{n-j}\). This follows from the symmetry of the \(L_k\) with respect to the middle of the interval \([a,b]\).
Two particular examples of Newton-Cotes rules are:
Trapezoid Rule (n=1): \(\int_a^bf(x)dx\approx \frac{b-a}{2}\left[f(a)+f(b)\right]\).
Simpson’s Rule (n=2): \(\int_a^bf(x)dx\approx \frac{b-a}{6}\left[f(a)+4f((a+b)/2)+f(b)\right]\)
Error estimates#
The error \(E_n\) of a quadrature formula is defined as \(E_n(f):=\int_a^bf(x)dx-\sum_{k=0}^n\omega_kf(x_k)\). We now have
The last integral can be estimated as
where \(M_{n+1}=\max_{\xi\in[a,b]}|f^{(n+1)}(\xi)|\).
Runge phenomenon for Newton-Cotes rules#
If we increase the order of the Newton-Cotes rule then apart from special cases we will encounter the Runge phenomenon. Hence, in order to achieve high accuracy we need to do something else. In practice one often uses so-called composite rules. The idea is that we split \([a,b]\) into \(m\) subintervals \([\tau_i,\tau_{i+1}]\) with \(\tau_i=a+\frac{i}{m}(b-a)\), \(i=0,\dots,m-1\), and apply a low-order Newton-Cotes rule in each subinterval.