3 a Implement the Barycentric Formula for evaluating the interpolating

3 a implement the barycentric formula for evaluating

This preview shows page 54 - 61 out of 67 pages.

3. (a) Implement the Barycentric Formula for evaluating the interpolating polynomial forarbitrarily distributed nodesx0, . . . , xn; you need to write a function or script that com-putes the barycentric weightsλj,j= 0,1, . . . , n, first and another code to use these valuesin the Barycentric Formula. Make sure to test your implementation.(b) Consider the following table of dataxjf(xj)0.000.00000.250.70700.521.00000.740.70711.28-0.70741.50-1.0000Use your code in (a) to findP5(2) as an approximation off(2).4.The Runge Example. Letf(x) =11 + 25x2x2[-1,1].(3)Using your Barycentric Formula code (Prob. 3) and (4) and (5) below, evaluate and plotthe interpolating polynomialpnoffcorresponding to(a) The equidistributed nodesxj=-1 +j(2/n),j= 0, . . . , nforn= 4, 8, and 12.(b) the Chebyshev nodesxj= cos(jn),j= 0, . . . , nforn= 4, 8, 12, and 100.As seen in class, for equidistributed nodes one can use the barycentric weightsλj= (-1)jnjj= 0, . . . , n,(4)and for the Chebyshev nodes we can useλj=(12(-1)jforj= 0 orj=n,(-1)jj= 1, . . . , n-1.(5)2
Make sure to employ (4) and (5) in your Barycentric Formula code for this problem.To plot the correspondingpnevaluate this at sufficiently large number of pointsneas in Prob. 2.Note that your Barycentric Formula cannot be used to evaluatepnwhenxcoincides with an interpolating node! Plot alsoffor comparison.(c) Plot the erroren=f-pnfor (a) and (b) and comment on the results.(d) Repeat (a) forf(x) =e-x2forx2[-1,1] and comment on the result.5. (a) Equating the leading coefficient of the Lagrange form of the interpolation polynomialpn(x) with that of the Newton’s form deduce thatf[x0, x1, . . . , xn] =nXj=0f(xj)nQk=0k6=j(xj-xk).(6)(b) Use (6) to conclude that divided dierences are symmetric functions of their argu-ments, i.e. any permutation ofx0, x1, . . . , xnleaves the corresponding divided dierenceunchanged.6.Inverse Interpolation. Suppose that we want to solve the equationf(x) = 0, for somefunctionfwhich has an inversef-1. If we have two approximationsx0andx1of a zero ¯xoffthen we can use interpolation to find a better approximation, ¯xf-1(0), as follows.Lety0=f(x0) andy1=f(x1).yj=f(xj)xjy0x0y1x1f-1[y0, y1]andp1(0) =x0+f-1[y0, y1](0-y0) =x0-y0f-1[y0, y1]. We could now definex2=p1(0),evaluatefat this point to gety2=f(x2), and then add one more row to our table to getf-1[y0, y1, y2]. Once this is computed we can evaluatep2(0) to get an improved approx-imation ¯x, etc. Letf(x) =x-e-xusing the valuesf(0.5) =-0.106530659712633 andf(0.6) = 0.051188363905973 find an approximate value for the zero ¯xoffby evaluatingp1(0).3
This study resource wasshared via CourseHero.com
This study resource wasshared via CourseHero.com
This study resource wasshared via CourseHero.com
This study resource wasshared via CourseHero.comPowered by TCPDF ()
Math 104A - MidtermName:Perm#:Directions: You must show all your work to receive full credit.If you need ex-

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture