17.7 KB · commit a9602da
In the preceding sections, we have derived interpolation formulae of utmost importance and discussed their practical use in some detail. But, as is well known, they possess the disadvantage of requiring the values of the independent variable to be equally spaced. It is therefore desirable to have interpolation formulae with unequally spaced values of the argument. We discuss, in the present section and the next, four such formulae: (i) Lagrange's interpolation formula which uses only the function values, (ii) Hermite's interpolation formula which is similar to Lagrange's formula, (iii) Newton's general interpolation formula which uses what are called divided differences and (iv) Aitken's method of interpolation by iteration.
Let y(x) be continuous and differentiable (n+1) times in the interval (a,b). Given the (n+1) points (x0,y0), (x1,y1), ..., (xn,yn) where the values of x need not necessarily be equally spaced, we wish to find a polynomial of degree n, say Ln(x), such that Ln(xi)=y(xi)=yi,i=0,1,…,n(3.28)
Before deriving the general formula, we first consider a simpler case, viz., the equation of a straight line (a linear polynomial) passing through two points (x0,y0) and (x1,y1). Such a polynomial, say L1(x), is easily seen to be
L1(x)=x0−x1x−x1y0+x1−x0x−x0y1=l0(x)y0+l1(x)y1=i=0∑1li(x)yi,(3.29)where l0(x)=x0−x1x−x1andl1(x)=x1−x0x−x0.(3.30)
From Eq. (3.30), it is seen that l0(x0)=1,l0(x1)=0,l1(x0)=0,l1(x1)=1. These relations can be expressed in a more convenient form as li(xj)={1,0,if i=jif i=j.(3.31)
The li(x) in Eq. (3.29) also have the property i=0∑1li(x)=l0(x)+l1(x)=x0−x1x−x1+x1−x0x−x0=1.(3.32)
Equation (3.29) is the Lagrange polynomial of degree one passing through two points (x0,y0) and (x1,y1). In a similar way, the Lagrange polynomial of degree two passing through three points (x0,y0), (x1,y1) and (x2,y2) is written as
L2(x)=i=0∑2li(x)yi=(x0−x1)(x0−x2)(x−x1)(x−x2)y0+(x1−x0)(x1−x2)(x−x0)(x−x2)y1+(x2−x0)(x2−x1)(x−x0)(x−x1)y2,(3.33)where the li(x) satisfy the conditions given in Eqs. (3.31) and (3.32).
To derive the general formula, let Ln(x)=a0+a1x+a2x2+⋯+anxn(3.34) be the desired polynomial of the nth degree such that conditions given in Eq. (3.28) (called the interpolatory conditions) are satisfied. Substituting these conditions in Eq. (3.34), we obtain the system of equations
y0y1y2yn=a0+a1x0+a2x02+⋯+anx0n=a0+a1x1+a2x12+⋯+anx1n=a0+a1x2+a2x22+⋯+anx2n⋮=a0+a1xn+a2xn2+⋯+anxnn.⎭⎬⎫(3.35)The set of Eqs. (3.35) will have a solution if
11⋮1x0x1⋮xnx02x12⋮xn2………x0nx1n⋮xnn=0.(3.36)The value of this determinant, called Vandermonde's determinant, is (x0−x1)(x0−x2)…(x0−xn)(x1−x2)…(x1−xn)…(xn−1−xn). Eliminating a0,a1,…,an from Eqs. (3.34) and (3.35), we obtain
Ln(x)y0y1⋮yn111⋮1xx0x1⋮xnx2x02x12⋮xn2…………xnx0nx1n⋮xnn=0,(3.37)which shows that Ln(x) is a linear combination of y0,y1,y2,…,yn. Hence we write Ln(x)=i=0∑nli(x)yi,(3.38) where li(x) are polynomials in x of degree n. Since Ln(xj)=yj for j=0,1,2,…,n, Eq. (3.32) gives
li(xj)lj(xj)=0if i=j=1for all j},which are the same as Eq. (3.31). Hence li(x) may be written as li(x)=(xi−x0)(xi−x1)…(xi−xi−1)(xi−xi+1)…(xi−xn)(x−x0)(x−x1)…(x−xi−1)(x−xi+1)…(x−xn),(3.39) which obviously satisfies the conditions (3.31).
If we now set Πn+1(x)=(x−x0)(x−x1)…(x−xi−1)(x−xi)(x−xi+1)…(x−xn),(3.40) then
Πn+1′(xi)=[dxd[Πn+1(x)]]x=xi=(xi−x0)(xi−x1)…(xi−xi−1)(xi−xi+1)…(xi−xn)(3.41)so that Eq. (3.39) becomes li(x)=(x−xi)Πn+1′(xi)Πn+1(x).(3.42) Hence Eq. (3.38) gives Ln(x)=i=0∑n(x−xi)Πn+1′(xi)Πn+1(x)yi,(3.43) which is called Lagrange's interpolation formula. The coefficients li(x), defined in Eq. (3.39), are called Lagrange interpolation coefficients. Interchanging x and y in Eq. (3.43), we obtain the formula Ln(y)=i=0∑n(y−yi)Πn+1′(yi)Πn+1(y)xi,(3.44) which is useful for inverse interpolation.
It is trivial to show that the Lagrange interpolating polynomial is unique. To prove this, we assume the contrary. Let Lˉn(x) be a polynomial, distinct from Ln(x), of degree not exceeding n and such that Lˉn(xi)=yi,i=0,1,2,…,n. Then the polynomial defined by M(x), where M(x)=Ln(x)−Lˉn(x) vanishes at the (n+1) points xi, i=0,1,…,n. Hence we have Mn(x)≡0, which shows that Ln(x) and Lˉn(x) are identical. ■
A major advantage of this formula is that the coefficients in Eq. (3.44) are easily determined. Further, it is more general in that it is applicable to either equal or unequal intervals and the abscissae x0,x1,…,xn need not be in order. Using this formula it is, however, inconvenient to pass from one interpolation polynomial to another of degree one greater.
The following examples illustrate the use of Lagrange's formula.
Hence the required polynomial approximation to y(x) is given by y(x)=(x−1)(x2−5x+12). ◀
Equation (3.7) can be used to estimate the error of the Lagrange interpolation formula for the class of functions which have continuous derivatives of order up to (n+1) on [a,b]. We, therefore, have y(x)−Ln(x)=Rn(x)=(n+1)!Πn+1(x)y(n+1)(ξ),a<ξ<b(3.45) and the quantity EL, where EL=[a,b]max∣Rn(x)∣(3.46) may be taken as an estimate of error. Further, if we assume that ∣y(n+1)(ξ)∣≤Mn+1,a≤ξ≤b(3.47) then EL≤(n+1)!Mn+1[a,b]max∣Πn+1(x)∣(3.48)
The following examples illustrate the computation of the error.
Hence ∣y′′′(ξ)∣<1.
When x=π/6, ∣Rn(x)∣≤6(π/6−0)(π/6−π/4)(π/6−π/2)=616π12π3π=0.02392, which agrees with the actual error in the solution obtained in Example 3.16. ◀
The interpolation formulae so far considered make use of only a certain number of function values. We now derive an interpolation formula in which both the function and its first derivative values are to be assigned at each point of interpolation. This is referred to as Hermite's interpolation formula. The interpolation problem is then defined as follows: Given the set of data points (xi,yi,yi′), i=0,1,…,n, it is required to determine a polynomial of the least degree, say H2n+1(x), such that H2n+1(xi)=yiandH2n+1′(xi)=yi′;i=0,1,…,n,(3.49) where the primes denote differentiation with respect to x. The polynomial H2n+1(x) is called Hermite's interpolation polynomial. We have here (2n+2) conditions and therefore the number of coefficients to be determined is (2n+2) and the degree of the polynomial is (2n+1). In analogy with the Lagrange interpolation formula (3.43), we seek a representation of the form H2n+1(x)=i=0∑nui(x)yi+i=0∑nvi(x)yi′,(3.50) where ui(x) and vi(x) are polynomials in x of degree (2n+1). Using conditions (3.49), we obtain
ui(xj)ui′(x)={1,0,if i=jif i=j;=0, for all i;vi(x)vi′(xj)=0, for all i={1,0,if i=jif i=j.⎭⎬⎫(3.51)Since ui(x) and vi(x) are polynomials in x of degree (2n+1), we write ui(x)=Ai(x)[li(x)]2andvi(x)=Bi(x)[li(x)]2,(3.52) where li(x) are given by Eq. (3.42). It is easy to see that Ai(x) and Bi(x) are both linear functions in x. We therefore write ui(x)=(aix+bi)[li(x)]2andvi(x)=(cix+di)[li(x)]2(3.53)
Using conditions Eq. (3.51) in Eq. (3.53), we obtain
aixi+bicixi+di=1=0}(3.54a)and
ai+2li′(xi)ci=0=1.}(3.54b)From Eq. (3.54), we deduce
aici=−2li′(xi),=1,bidi=1+2xili′(xi)=−xi.}(3.55)Hence Eq. (3.53) become
ui(x)=[−2xli′(xi)+1+2xili′(xi)][li(x)]2=[1−2(x−xi)li′(xi)][li(x)]2(3.56a)and vi(x)=(x−xi)[li(x)]2.(3.56b) Using the above expressions for ui(x) and vi(x) in Eq. (3.50), we obtain finally H2n+1(x)=i=0∑n[1−2(x−xi)li′(xi)][li(x)]2yi+i=0∑n(x−xi)[li(x)]2yi′,(3.57) which is the required Hermite interpolation formula.
The following examples demonstrate the application of Hermite's formula.
Then, Eq. (i) simplifies to
H3(x)=[1+h12(x−x0)]h12(x1−x)2y0+[1+h12(x1−x)]h12(x−x0)2y1+(x−x0)h12(x1−x)2y0′+(x−x1)h12(x−x0)2y1′,(ii)which is the required Hermite formula. ◀
Putting x=2.7 and simplifying, we obtain ln(2.7)≈H5(2.7)=0.993252, which is correct to six decimal places. This is therefore a more accurate result than that obtained by using the Lagrange interpolation formula. ◀