100%(2)2 out of 2 people found this document helpful
This preview shows page 2 - 3 out of 3 pages.
(2) as an approximation off(2).4.The Runge Example. Letf(x) =11 + 25x2x∈[-1,1].(3)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(jπ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 of2
pointsneas 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.3