# 3 and 4 and 5 below evaluate and plot the

• Notes
• 2

This preview shows page 2 out of 2 pages.

Using your Barycentric Formula code (Prob. 3) and (4) and (5) below, evaluate andplot the interpolating polynomialpnoffcorresponding to(a) The equidistributed nodesxj=-1 +j(2/n),j= 0, . . . , nforn= 4, 8, and 12.(b) the Chebyshev nodesxj= cos(n),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)Make sure to employ (4) and (5) in your Barycentric Formula code for this prob-lem.To plot the correspondingpnevaluate this at sufficiently large number ofpointsneas in Prob. 2.Note that your Barycentric Formula cannot be used toevaluatepnwhenxcoincides with an interpolating node! Plot alsoffor compar-ison.(c) Plot the erroren=f-pnfor (a) and (b) and comment on the results.(d) Repeat (a) forf(x) =e-x2forx[-1,1] and comment on the result.2