11.1 KB · commit a9602da
Given the set of (n+1) values, viz., (x0,y0), (x1,y1), (x2,y2), …, (xn,yn), of x and y, it is required to find yn(x), a polynomial of the nth degree such that y and yn(x) agree at the tabulated points. Let the values of x be equidistant, i.e. let xi=x0+ih,i=0,1,2,…,n. Since yn(x) is a polynomial of the nth degree, it may be written as
yn(x)=a0+a1(x−x0)+a2(x−x0)(x−x1)+a3(x−x0)(x−x1)(x−x2)+⋯+an(x−x0)(x−x1)(x−x2)…(x−xn−1).⎭⎬⎫(3.9)Imposing now the condition that y and yn(x) should agree at the set of tabulated points, we obtain a0=y0;a1=x1−x0y1−y0=hΔy0;a2=h22!Δ2y0;a3=h33!Δ3y0;…;an=hnn!Δny0. Setting x=x0+ph and substituting for a0,a1,…,an, Eq. (3.9) gives
which is Newton's forward difference interpolation formula and is useful for interpolation near the beginning of a set of tabular values.
To find the error committed in replacing the function y(x) by means of the polynomial yn(x), we use Eq. (3.7) to obtain y(x)−yn(x)=(n+1)!(x−x0)(x−x1)…(x−xn)y(n+1)(ξ),x0<ξ<xn(3.11) As remarked earlier we do not have any information concerning y(n+1)(x), and therefore, formula given in Eq. (3.11) is useless in practice. Nevertheless,
if y(n+1)(x) does not vary too rapidly in the interval, a useful estimate of the derivative can be obtained in the following way. Expanding y(x+h) by Taylor's series (see Theorem 1.4), we obtain y(x+h)=y(x)+hy′(x)+2!h2y′′(x)+⋯ Neglecting the terms containing h2 and higher powers of h, this gives y′(x)≈h1[y(x+h)−y(x)]≡h1Δy(x). Writing y′(x) as Dy(x) where D≡d/dx, the differentiation operator, the above equation gives the operator relation D≡h1Δand soDn+1≡hn+11Δn+1. We thus obtain y(n+1)(x)≈hn+11Δn+1y(x).(3.12) Equation (3.11) can, therefore, be written as y(x)−yn(x)=(n+1)!p(p−1)(p−2)…(p−n)Δn+1y(ξ)(3.13) in which form it is suitable for computation.
Instead of assuming yn(x) as in Eq. (3.9), if we choose it in the form
yn(x)=a0+a1(x−xn)+a2(x−xn)(x−xn−1)+a3(x−xn)(x−xn−1)(x−xn−2)+⋯+an(x−xn)(x−xn−1)…(x−x1).and then impose the condition that y and yn(x) should agree at the tabulated points xn,xn−1,…,x2,x1,x0, we obtain (after some simplification)
where p=(x−xn)/h.
This is Newton's backward difference interpolation formula and it uses tabular values to the left of yn. This formula is therefore useful for interpolation near the end of the tabular values.
It can be shown that the error in this formula may be written as y(x)−yn(x)=(n+1)!p(p+1)(p+2)…(p+n)∇n+1y(ξ),(3.15) where x0<x<xn and x=xn+ph.
The following examples illustrate the use of these formulae.
or ΔSn=(n+1)3.(i) It follows that
Δ2SnΔ3SnΔ4Sn=ΔSn+1−ΔSn=(n+2)3−(n+1)3=3n2+9n+7,=3(n+1)2+9n+7−(3n2+9n+7)=6n+12=6(n+1)+12−(6n+12)=6.Since Δ5Sn=Δ6Sn=⋯=0, Sn is a fourth-degree polynomial in n. Further, S1=1,ΔS1=8,Δ2S1=19,Δ3S1=18,Δ4S1=6. Equation (3.10) gives
Sn=1+(n−1)(8)+2(n−1)(n−2)(19)+6(n−1)(n−2)(n−3)(18)+24(n−1)(n−2)(n−3)(n−4)(6)=41n4+21n3+41n2=[2n(n+1)]2.◀
The difference table is
x sinx Δ Δ2 Δ3 Δ4 Δ5 15 0.2588190 0.0832011 20 0.3420201 −0.0026029 0.0805982 −0.0006136 25 0.4226183 −0.0032165 0.0000248 0.0773817 −0.0005888 0.0000041 30 0.5 −0.0038053 0.0000289 0.0735764 −0.0005599 35 0.5735764 −0.0043652 0.0692112 40 0.6427876 To find sin38∘, we use Newton's backward difference formula with xn=40 and x=38. This gives p=hx−xn=538−40=−52=−0.4. Hence, using Eq. (3.14), we obtain
y(38)=0.6427876−0.4(0.0692112)+2−0.4(−0.4+1)(−0.0043652)+6(−0.4)(−0.4+1)(−0.4+2)(−0.0005599)+24(−0.4)(−0.4+1)(−0.4+2)(−0.4+3)(0.0000289)+120(−0.4)(−0.4+1)(−0.4+2)(−0.4+3)(−0.4+4)(0.0000041)=0.6427876−0.02768448+0.00052382+0.00003583−0.00000120=0.6156614.◀
Since four points are given, the given data can be approximated by a third degree polynomial in x. Hence Δ4y0=0. Substituting Δ=E−1 and simplifying, we get E4y0−4E3y0+6E2y0−4Ey0+y0=0. Since Ery0=yr, the above equation becomes y4−4y3+6y2−4y1+y0=0. Substituting for y0,y1,y2 and y4 in the above, we obtain y3=31. The tabulated function is 3x and the exact value of y(3) is 27. The error is due to the fact that the exponential function 3x is approximated by means of a polynomial in x of degree 3. ◀
(b) To find tan(0.26), we have 0.26=0.30+p(0.05), which gives p=−0.8. Hence, Eq. (3.14) gives
tan(0.26)=0.3093−0.8(0.0540)+2−0.8(−0.8+1)(0.0014)+6−0.8(−0.8+1)(−0.8+2)(0.0004)+24−0.8(−0.8+1)(−0.8+2)(−0.8+3)(0.0002)=0.2662.Proceeding as in the case (i) above, we obtain (c) tan(0.40)=0.4241, and (d) tan(0.50)=0.5543. ◀
The actual values, correct to four decimal places, of tan(0.12), tan(0.26), tan(0.40) and tan(0.50) are respectively 0.1206, 0.2660, 0.4228 and 0.5463. Comparison of the computed and actual values shows that in the first-two cases (i.e. of interpolation) the results obtained are fairly accurate whereas in the last-two cases (i.e. of extrapolation) the errors are quite considerable. The example therefore demonstrates the important result that if a tabulated function is other than a polynomial, then extrapolation very far from the table limits would be dangerous—although interpolation can be carried out very accurately.