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.