Lecture 20: Quadrature

1.Numerical integration

Numerical integration proceeds along the same lines as numerical differentiation

fp,

with a different operator

f=abω(t)f(t)dt,

with :C([a,b]\Z) with Z a set of measure zero, e.g., Z= for a function continuous at all points in [a,b]. It is often useful to explicitly identify a weight function ω(t) that can attribute higher significance to subsets of [a,b]. In the integration case, the approximation basis choice can be combined with decomposition of the domain into m subintervals [ak,bk) such that k=1m[ak,bk)=[a,b) through

abω(t)f(t)dt=k=1makbkω(t)f(t)dt,

with

a=a1<b1=a2<b2=a3<<bm=b.

Monomial basis.
As for numerical differentiation, an integration operator can be obtained from the polynomial interpolant of f based upon data 𝒟={(xi,yi=f(xi)),i=0,,n},

p(t)=[ 1 t t2 tn ]𝒄,𝒄=𝑴-1𝒚,
𝑴=[ 𝟏 𝒙 𝒙2 𝒙n ],𝒙k=[ x0k xnk ]T,𝒚=[ y0 yn ]T.

Integration of f for ω(t)=1 is approximated as

abf(t)dt(f)=abp(t)dt=[ b-a 12(b2-a2) 13(b3-a3) 1n+1(bn+1-an+1) ]𝑴-1𝒚.

As for numerical differentation, the computational effort in the above formulation can be reduced through alternative basis choices.

Lagrange basis.
Assume n=dm in the data set 𝒟={(xi,yi=f(xi)),i=0,,n}, and construct an interpolant of degree d in each subinterval [ak,bk)=[xd(k-1),xdk). As highlighted by the approximation of the Runge function, the degree d should be small, typically d{1,2,3}.

Trapezoid formula

For d=1, a linear approximant is defined over each subinterval [xk-1,xk], stated in Lagrange form as

pk(t)=k-1(t)yk-1+k(t)yk=t-xkxk-1-xkyk-1+t-xk-1xk-xk-1yk.

The resulting integral approximation

(f)=xk-1xkf(t)dt(p)=xk-1xkpk(t)dt=(xk-xk-1)yk-1+yk2.

The approximation error results from the known polynomial interpolation error formula

f(t)-p(t)=f''(ξt)2(t-xk)(t-xk-1),

that gives

ek(t)=|xk-1xk[f(t)-p(t)]dt|||f''||(xk-xk-1)312.

Using an equidistant partition xk=a+kh, h=(b-a)/n, over the entire [a,b] interval gives the composite trapezoid formula

abf(t)dt=k=1nxk-1xkf(t)dtk=1nxk-1xkpk(t)dt=h(y02+k=1nyk+yn2).

The overall approximation error is bounded by the error over each subinterval

ek=1nek||f''||nh312=(b-a)h2||f''||12,

and the trapezoid formula exhibits quadratic convergence, e=𝒪(h2).

Simpson formula

A more accurate, quadratic approximant is obtained for d=2 using sample points xk-2, xk-1,xk

pk(t)=k-2(t)yk-2+k-1(t)yk-1+k(t)yk,
pk(t)=(t-xk-1)(t-xk)(xk-2-xk-1)(xk-2-xk)yk-2+(t-xk-2)(t-xk)(xk-1-xk-2)(xk-1-xk)yk-1+(t-xk-2)(t-xk-1)(xk-xk-2)(xk-xk-1)yk.

Assuming n=2m, xk=a+kh, h=(b-a)/n, over a subinterval the Simpson approximation is

xk-2xkf(t)dtxk-2xkpk(t)dt=h3(yk-2+4yk-1+yk).

Integration of the interpolation error

f(t)-pk(t)=f(3)(ξt)3!(t-xk-2)(t-xk-1)(t-xk),

leads to calculation of

xk-2xk(t-xk-2)(t-xk-1)(t-xk)dt=-hh(τ-h)τ(τ+h)dτ=0. (1)

This null result is a feature of even-degree interpolants d=2r. Note that the interpolation error formula contains an evaluation of f(3)(ξt) at some point ξt[xk-2,xk] that depends on t, so the integral

xk-2xkf(3)(ξt)3!(t-xk-2)(t-xk-1)(t-xk)dt

is not necessarily equal to zero. To obtain an error estimate, rewrite the interpolating polynomial in Newton form

pk(t)=yk-1+[yk-1,yk-2](t-xk-2)+[yk,yk-1,yk-2](t-xk-2)(t-xk-1),

The next higher degree interpolant would be

qk(t)=pk(t)+ck(t-xk-2)(t-xk-1)(t-xk),

and (1) implies that the integral of qk is equal to that of pk

xk-2xkqk(t)dt=xk-2xkpk(t)dt,

hence the Simpson formula based on a quadratic interpolation is as accurate as that based on a cubic interpolation. The error can now be estimated using

ek=|xk-2xk[f(t)-qk(t)]dt|||f(iv)||4!xk-2xk(t-xk-2)(t-xk-1)(t-xk)(t-zk)dt,

where zk is some additional interpolation point within [xk-2,xk]. It is convenient to choose zk=xk-1, which corresponds to a Hermite interpolation condition at the midpoint. This is simply for the purpose of obtaining an error estimate, and does not affect the Simpson estimate of the integral. Carrying out the calculations gives

ek||f(4)||90h5.

When applied to the overall interval [a,b], the Simpson formula is stated as

abf(t)dtb-a6[f(a)+4f(a+b2)+f(b)],

with error

e||f(4)||2880(b-a)5.

The composite Simpson formula is

abf(t)dt=k=1mx2k-2x2kf(t)dtk=1mx2k-2x2kpk(t)dt=h3(y0+4k=1my2k-1+2k=1m-1y2k+yn),

with an overall error bound

ek=1mx2k-2x2k|f(t)-pk(t)|dt||f(4)||90h5n2=(b-a)180||f(4)||h4,

that shows fourth-order convergence e=𝒪(h4).

Moment method.
As in numerical differentiation, an alternative derivation is available. Numerical integration is stated as a quadrature formula

(f)=abω(t)f(t)dt𝒬(f)=i=0nwiyi,

using data 𝒟={(xi,yi=f(xi)),i=0,,n}. Once the sampling points are chosen, there remain n+1 weights wi to be determined. One approach is to enforce exact quadrature for the first n+1 monomials

(xk)=𝒬(xk)abω(t)tkdt=i=0nwixik,k=0,1,,n.

A Vandermonde system results whose solution furnishes the appropriate weights. Since the Vandermonde matrix is ill-conditioned, a solution is sought in exact arithmetic, using rational numbers as opposed to floating point approximations.

The principal utility of the moment method is construction of quadrature formulas for singular integrands. For example, in the integral

-01lntsintdt,

the lnt is an integrable singularity, and accurate quadrature rules can be constructed by the method of moments for

(f)=abω(t)f(t)dt,

with ω(t)=-lnt.

2.Gauss quadrature

Recall that the method of moments approach to numerical integration based upon sampling 𝒟={(xi,yi=f(xi)),i=0,,n},

abω(t)f(t)dt=i=0nwiyi+ei=0nwiyi,

imposes exact results for a finite number of members of a basis set {ϕ0,,ϕn,}

abω(t)ϕk(t)dt=i=0nwiϕk(xi),k=0,1,,n.

The trapezoid, Simpson formulas arise from the monomial basis set {1,t,t2,}, in which case

abω(t)tkdt=i=0nwixik,k=0,1,,n,

but any basis set can be chosen. Instead of prescribing the sampling points xi a priori, which typically leads to an error e=𝒪(ϕn+1(t)), the sampling points can be chosen to minimize the error e. For the monomial basis this leads to a system of 2(n+1) equations

abω(t)tkdt=i=0nwixik,k=0,1,,2n+1,

for the unknown n+1 quadrature weights wi and the n+1 sampling points xi. The system is nonlinear, but can be solved in an insightful manner exploiting the properties of orthogonal polynomials known as Gauss quadrature.

The basic idea is to consider a Hilbert function space with the scalar product

(f,g)=abω(t)f(t)g(t)dt,

and orthonormal basis set {ϕ0(t),ϕ1(t),ϕ2(t),,},

(ϕj,ϕk)=abω(t)ϕj(t)ϕk(t)dt=δjk.

Assume that ϕk(t) are polynomials of degree k. A polynomial p2n+1 of degree 2n+1 can be factored as

p2n+1(t)=qn(t)ϕn+1(t)+rn(t),

where qn(t) is the quotient polynomial of degree n, and rn is the remainder polynomial of degree n. The weighted integral of p2n+1 is therefore

abω(t)p2n+1(t)dt=abω(t)[qn(t)ϕn+1(t)+rn(t)]dt=(qn,ϕn+1)+abω(t)rn(t)dt.

Since {ϕ0,,ϕn+1} is an orthonormal set, (qn,ϕn+1)=0, and the integral becomes

abω(t)p2n+1(t)dt=abω(t)rn(t)dt.

The integral of the nth remainder polynomial can be exactly evaluated through an n+1 point quadrature

abω(t)rn(t)dt=i=0nwir(xi),

that however evaluates r(t) rather than the original integrand p2n+1(t). However, evaluation of the factorization (2) at the roots xi of ϕn+1, ϕn+1(xi)=0, i=0,1,,n, gives

p2n+1(xi)=qn(xi)ϕn+1(xi)+rn(xi)=rn(xi),

stating that the values of the remainder at these nodes are the same as those of the p2n+1 polynomial. This implies that

abω(t)p2n+1(t)dt=i=0nwip2n+1(xi),

is an exact quadrature of order 2n+1, e=𝒪(t2n+1). The weights wi can be determined through any of the previously outlined methods, e.g., method of moments

abω(t)tkdt=i=0nwixik,k=0,,n,

which is now a linear system that can be readily solved. Alternatively, the weights are also directly given as integrals of the Lagrange polynomials based upon the nodes that are roots of ϕn+1

wi=abω(t)i(t)dt.