trarily distributed nodes x x n you need to write a function or script that

# Trarily distributed nodes x x n you need to write a

• 3

This preview shows page 2 - 3 out of 3 pages.

trarily distributed nodesx0, ..., xn; you need to write a function or script that computesthe barycentric weightsλ(n)j= 1/Πk6=j(xj-xk) 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.70710.501.00000.750.70711.25-0.70711.50-1.0000Use your code in (a) to findP5(2) as an approximation off(2).4.The Runge Example.Letf(x) =11 +x2,x[-5,5].(4)Using your Barycentric Formula code (Prob. 3) and (5) and (6) below, evaluate and plot theinterpolating polynomial off(x) corresponding to(a) the equidistributed nodesxj=-5 +j(10/n),j= 0, ..., nforn= 4, 8, and 12.(b) the nodesxj= 5 cos(n),j= 0, ..., nforn= 4, 8, 12, and 100.(c) Repeat (a) forf(x) =e-x2/5forx[-5,5] and comment on the result. 2
resolution, e.g. ¯ x k = - 5+ k (10 /n e ) , k = 0 , ..., n e with n e = 5000 . Note that your Barycentric Formula cannot be used to evaluate P n ( x ) when x coincides with an interpolating node! Plot also f for comparison. Compare (a) and (b) and comment on the result in view of what you observed in Prob. 2. 3