Lecture 19: Derivative Approximation

Having introduced approximations of elements of vector spaces, a natural question is the approximation of transformations of such objects or operator approximation. An operator is understood here as a mapping from a domain vector space 𝒰=(U,S,+,) to a co-domain vector space 𝒱=(V,S,+,), and the operator :UV is said to be linear if for any scalars c1,c2S and vectors u1,u2U,

(c1u1+c2u2)=c1(u1)+c2(u2),

i.e., the image of a linear combination is the linear combination of the images. Linear algebra considers the case of finite dimensional vector spaces, such as U=m, V=n, in which case a linear operator is represented by a matrix 𝑳m×n, and satisfies

𝑳(c1𝒖1+c2𝒖2)=c1𝑳𝒖1+c2𝑳𝒖2.

In contrast, the focus here is on infinite-dimensional function spaces such as Cr() (cf. Tab. 1, L18), the space of functions with continuous derivatives up to order r. Common linear operator examples include:

Differentiation

f=kf/tk, :Cr()Cr-k().

Riemann integration

f=abω(t)f(t)dt, :C(\Δ), where Δ is a set of measure zero.

Linear differential equation

y=j=0kaj(t)y(j)=f(t), :Cr()Cr-k().

1.Numerical differentiation based upon polynomial interpolation

A general approach to operator approximation is to simply introduce an approximation of the function the operator acts upon, fp,

fp.

Monomial basis.
As an example consider the polynomial interpolant of f based upon data 𝒟={(xi,yi=f(xi)),i=0,,n},

p(t)=[ 1 t t2 tn ]𝒄,

with coeffcients 𝒄 determined as the solution of the interpolation conditions

𝑴𝒄=𝒚,

with notations

𝑴=[ 𝟏 𝒙 𝒙2 𝒙n ],𝒙k=[ x0k xnk ]T,𝒚=[ y0 yn ]T.

Differentiation of f (=d/dt) can be approximated as

ddtfddtp=[ 0 1 2t ntn-1 ]𝒄.

It is often of interest to express the result of applying an operator directly in terms of known information on f. Formally, in the case of differentiation,

ddtf[ 0 1 2t ntn-1 ]𝑴-1𝒚,

allowing the identification of a differentiation approximation operator 𝒟

ddtf𝒟(𝒚),𝒟=[ 0 1 2t ntn-1 ]𝑴-1.

This formulation explicitly includes the inversion of the sampled basis matrix 𝑴, and is hence not computationally efficient. Alternative formulations can be constructed that carry out some of the steps in computing 𝑴-1 analytically.

Newton basis (finite difference calculus).
An especially useful formulation for numerical differentiation arises from the Newton interpolant of data 𝒟={(xi=ih,yi=f(xi)),i=0,,n}, f:, fC(n+1)(),

f(t)p(t)=[y0]+[y1,y0](t-x0)++[yn,yn-1,,y0](t-x0)(t-x1)(t-xn-1).

For equidistant sample points xi=ih, the Newton interpolant can be expressed as an operator acting upon the data. Introduce the translation operator

Ef(t)=f(t+h).

Repeated application of the translation operator leads to

Ekf(t)=E(Ek-1f(t))==f(t+kh),

and the identity operator is given by

If(t)=f(t)=E0f(t)I=E0.

Finite differences of the function values are expressed through the forward, backward and central operators

Δ=E-I,=I-E,δ=E1/2-E-1/2,

leading to the formulas

Δf(t)=f(t+h)-f(t),f(t)=f(t)-f(t-h),δf(t)=f(t+h/2)-f(t-h/2).

Applying the above to the data set 𝒟 leads to

Δyi=yi+1-yi,yi=yi-yi-1,δyi=yi+1/2-yi-1/2.

The divided differences arising in the Newton can be expressed in terms of finite difference operators,

[y1,y0]=y1-y0h=1hΔy0,[y2,y1,y0]=[y2,y1]-[y1,y0]2h=Δy1-Δy02h2=Δ2y02h2,

or in general

[yk,,y1,y0]=Δkk!hky0.

Using the above and rescaling the variable t in the Newton basis 𝒩={1,t-x0,(t-x0)(t-x1),} in units of the step size t=αh+x0 leads to

p(t(α))=P(α)=(I+αΔ1!+α(α-1)Δ22!++α(α-1)(α-1+n)Δnn!)y0. (1)

The generalized binomial series states

(1+x)α=k=0( α k )xk, (2)

with

( α k )=α(α-1)(α-k+1)k!

the generalized binomial coefficient. The operator acting upon y0 in (1) can be interpreted as the truncation at order n

P(α)(I+Δ)αy0=αy0,

of the operator (I+Δ)α defined through (2) by the substitutions 1I, xΔ. The operator α=(I+Δ)αcan be interpreted as the interpolation operator with equidistant sampling points, with P(α) its truncation to order n. Reversing the order of the sampling points leads to the Newton interpolant

p(t)=[yn]+[yn-1,yn](t-xn)++[y0,y1,,yn](t-xn)(t-xn-1)(t-x1).

The divided differences can be expressed in terms of the backward operator as

[yn-1,yn]=yn-1-ynh=-1hyn,[yn-2,yn-1,yn]=[yn-2,yn-1]-[yn-1,yn]2h=-yn-1-yn2h2=2yn2h2,

leading to an analogous expression of the interpolation operator in terms backward finite differences

p(t(α))=P(α)=(I-α1!h+α(α-1)22!h2++(-1)nα(α-1)(α-1+n)nn!hn)yn(I-)αyn=αyn.

Differentiation of the interpolation expressed in terms of forward finite differences gives

f'(t)ddtP(α)=dαdtP'(α)1hddααy0=1h[ln(I+Δ)](I+Δ)ay01hln(I+Δ)P(α).

The particular interpolant P(α) is irrelevant, leading to the operator identity

ddt1hln(I+Δ).

For |x|<1, the power series expansions are

ddxln(1+x)=11+x=1-x+x2-ln(1+x)=x-x22+x33-+(-1)k+1xkk+,

are uniformly convergent, leading to the expression

ddt1h(Δ-12Δ2+13Δ3-+(-1)k1kΔk+),

stating that the (continuum) differentiation operator can be approximated by an infinite series of finite difference operations, recovered exactly in the h0 limit. Denote by Dk+ the truncation at term k of the above operator series such that

f'(x0)Dk+(f)(x0)=1h(Δ-12Δ2+13Δ3-+(-1)k1kΔk)y0.

Truncation at k=1,2,3 leads to the expressions

D1+(f)=f(h+t)-f(t)h,D2+(f)=4f(h+t)-f(2h+t)-3f(t)2h,D3+(f)=18f(h+t)-9f(2h+t)+2f(3h+t)-11f(t)6h.

The h0 limit of divided differences is given by

limh0[yk,yk-1,,y0]=limh0(1k!hkΔky0)=1k!f(k)(x0),

such that for small finite h>0,

Δky0hkf(k)(x0).

The resulting derivative approximation error is of order k,

ek+(t)=Dk+(f)(t)-f'(t)=(-1)k+1hkk+1f(k+1)(t)=𝒪(hk).

The analogous expression for backward differences is

ddt-1hln(I-)=1h(+122+133++1kk+),

and the first few truncations are

D1-(f)=f(t-h)-f(t)h,D2-(f)=-f(t-2h)+4f(t-h)-3f(t)2h,D3-(f)=2f(t-3h)-9f(t-2h)+18f(t-h)-11f(t)6h

with errors

ek-(t)=Dk-(f)(t)-f'(t)=hkkf(k+1)(t)=𝒪(hk).

The above operator identities can be inverted to obtain

Δ=E-I=exp(hddt)-I,=I-E-1=I-exp(-hddt),

leading to

E=exp(hddt)=1+hddt+12(hddt)2++1k!(hddt)k++

this time expressing the finite translation operator as an infinite series of continuum differentiation operations. This allows expressing the central difference operator as

δ=E1/2-E-1/2=exp(h2ddt)-exp(-h2ddt)=2sinh(h2ddt),

and approximations of the derivative based on centered differencing are obtained from

ddt2harcsinh(δ2)=1h(δ-δ324+3δ5640-5δ77168+35δ9294912-).

An advantage of the centered finite differences (surmised from the odd power series) is a higher order of accuracy

ek=Dkf(f)-f'(t)=𝒪(h2k).

Higher order derivative are obtained by repeated application of the operator series, e.g.,

d2dt2=ddtddt=1h2(Δ-12Δ2+13Δ3-)2=1h2(Δ2-Δ3+1112Δ4-)2.

2.Taylor series methods

An alternative derivation of the above finite difference formulas is to construct a linear combination of function values

Lmnf(t)=k=-mnckf(t+kh)=(k=-mnckEk)f(t),

and determine the coefficients ck such that the pth derivative is approximated to order q

f(p)(t)=Lmnf(t)+𝒪(hq).

For example, for m=0, n=1, carrying out Taylor series expansions gives

f(t+h) = f(t)+hf'(t)+12h2f''(t)+ f(t) = f(t).

Eliminating f(t) by multiplying the first equation by c1=1 and the second by c0=-1 recovers the forward finite difference formula

f'(t)=f(t+h)-f(t)h+𝒪(h).

3.Numerical differentiation based upon piecewise polynomial interpolation

B-spline basis.
The above example used a truncation of the monomial basis n(t)={1,t,,tn}. Analogous results are obtained when using a different basis. Consider the equidistant sample points xi=ih+x0, data 𝒟={(xi,yi=f(xi),i=0,1,,n)}and the first-degree B-spline basis

n,1(t)={B0,1(t),B1,1(t),,Bn,1(t)},

in which case the linear piecewise interpolant is expressed as

p(t)=i=0nyiBi,1(t),

and over interval [xi-1,xi] reduces to

pi(t)=yi-1Bi-1,1(t)+yiBi,1(t)=yi-1xi-txi-xi-1+yit-xi-1xi-xi-1.

Differentiation recovers the familiar slope expression

pi'(t)=yi-yi-1xi-xi-1=yi-yi-13h.

At the nodes, a piecewise linear spline is discontinuous, hence the derivative is not defined, though one could consider the one-sided limits. Evaluation of derivatives at midpoints ti=(xi-1+xi)/2=(i-1)h+h/2+x0, i=1,2,,n, leads to

𝒚'=[ y1' y2' yn' ]=p'(𝒕)=𝑫𝒙=1h[ -1 1 0 0 0 0 -1 1 0 0 -1 1 ][ x0 x1 xn ],

with 𝑫n×(n+1).