hapter 4 Interpolation and Polynomial Approximation 4. 3 Lagrange approximation
Chapter 4 Interpolation and Polynomial Approximation 4.3 Lagrange Approximation
Example 1.6. Consider the graph y(x) cos(x) over [0.0, 1.2]. (a) Use the nodes xo=0.0andx1=1.2 to construct linear interpolating polynomial Pi(). (b)Use the nodes xo 0.2 and x =1.0 to construct a linear approximating polynomial(). Using (1.22) with the abscissas =0.0 and x1= 1.2 and the ordinates yo cos(0.0) 1.000000 and y1 cos(1.2) 0.362358 produces x-1.2 x-0.0 P1)00000 +0.362358 0.0-1.2 1.2-0.0 =-0.83333(-1.2)+0.301965(-0.0) When the nodes=0.2andx1=1.0 with yo=cos(0.2)=0.980067and y1=cos(1.0)=0.54030 22 are used, the result is x-1.0 x-0.2 Q1(x)=0.980067 +0.540302 0.2-1.0 1.0-0.2 =-1.25083(-1.0)+0.675378(x-0.2)
y=f(x) y=f(x) °1x) Figure 1.11(a) Figure1. 11(b) Figure 1.11(a) The linear approximation of y= Pi(ar) where the nodes ro=0.0 and 1.2 are the end points of the interval [a, b.(b) The linear approximation of y=Q1(a) where the nodes To=0.2 and r1= 1.0 lie inside the interval ja
Table 1.6 Comparison of f(a)=cos(a)and the Linear Approximations Pi(c)and Q1(a) Tk f(ak)=cos(ak) P1(ak) f(ck)-Pi(ak) Q1()f(ck) AllIk 0.0 1.00000 1000000000001.090008 0.090008 0.1 0.995004 0.9468630.048141 10350370.040033 0.2 0.980067 0.8937260.086340 0.980067 0.000000 030.95533084058901147470.925060.030240 0.4 0.921061 0.787453 0.133608 0.870126 0.050935 0.5 0.877583 0.7343160.1432670.8151550.0602428 0.60.8253360.6811790.1441570.7601840.065151 0.7 0.764842 0.6280420.1368000.7052140.059628 0.696707 0.5449050.121802 0.650243 0.046463 09 0.621610 0.5217680.0998420.5952730.026337 0.540302 0.468631 0.0716710.5403020.00000 0.4535960415495008102048532101736 1.2 0.362358 0.362358 0.000000 0.430361 0.068003
The generalization of (1.25)is the construction of a polynomial of a polynomial PN(a)of degree at most N that passes through the N+1 points(co, 30), (31, g1), (N, JN) and has the form P()=∑9LNk( where LNk is the lagrange coefficient polynomial based on these nodes (x-x0)…(x-xk-1)(x-xk+1)…(x-rN) /Nk (xk=0)…(xk-xk-1)(xk-1k+1)…(xk=xN) It is understood that the terms(a-k)and(ck-ak do not appear on the right side of equation(1.27). It is approximate to introduce the product notation for (1.27) and we write 0,j≠k N, K k-a
he Lagrange quadratic interpolating polynomial through the three points(=o, yo) C1, 91), and(2, 92)IS -31(x I --c P2(x)=0 ),(x-0(x-r1) +y1 +y2 0-了1)(0 1-3 2-0)(2-1 131) he Lagrange cubic interpolating polynomial through the four points(ro, yo), (a1,g1) 2, 12), and(=3, 33)is (x-21x-2)(x-x3)(x-20(x-2)(x-x3) 3()=90 (x0-2x1)(0-22)x0-x23) +y1 (1-x0)(x1-2)(x1-23) +y2 (x-20)(x-2x1)(x-x3) +8x-2-(132) (x2-0)(x2-1)2-x3)"°(3-0(x3-1)(x3-
Example 1.7. Consider g=f(r)=cos(a)over(0.0, 1. 2) (a) Use the three nodes 00 =0.0, 1=0.6, and 2=1.2 to construct a quadratic interpolation polynomial P2(a) (b)Use the four nodes 20=0.0, 01=0.4, 22=0.8, and r=1. 2 to construct a cubic interpolation polynomial P3(a)
Using ro=0.0.,x1=0.6,m2=1.2 and yo=cos(0.0)=1,n=c0s(0.6)=0.825336, and 32=cos(1. 2)=0.362358 in equation(1.31) produces P2(x)=1.0 (x-0.6)(x-1.2) (0.0-0.6)0.0-1.2) +0.825336 (x-0.0)(x-1.2 (0.6-0.0)(0.61.2) +0.362358 x-00)(x-0.6) (12-0.0)(1.2-0.6 =1.38889(0-0.6)(x-1.2)-2292599x-00(x-1.2) +0.503275(x-0.00)(x-0.6)
USing To=0.0,1=0.4,x2=0.8,x3=1.2 and yo=cos(0.0)=1.0,=c0s(0.4 0.921061,2=c08(0.8)=0.696707,andy=cos(1.2)=0.362358 in equation(1.32) produces 3(x)=100000 (x-0.4(x-0.8)(x-1.2) 0.0-0.4)(0.0-0.8)(0.0-1.2 +0.921061 x-0.0)(x-0.8)(x-1.2) (0.4-0.0)(0.4-08)04-1.2) +0.696707 (x-0.0)(x-0.4)(x-1.2) (0.8-0.0)(0.8-0.4)(0.8-1.2 +0.362358 (x-0.0)(x-0.4)(x-08) 12-0.0)(1.2-0.4)(12-08 2604167(x-0.4)(x-0.8(x-1.2) +7195789(x-0.0)(x-0.8)(x-1.2) 543021(x-0.0(x-0.4)(x-1.2 +0.943641(x-0.0)(x-0.4)(x-0.8
y=P,(x) CE Figure 1.12(a) Figure 1. 12(b) Figure 1.12(a) The quadratic approximation polynomial y= P2(a) based on the nodes 20=0.0, 21=0.6, and x2=1.2. (b) The cubic approximation polynomial y= Pi(a)based on the nodes To=0.0, 1=0.4, 2=0.8, and =1.2