2 as an approximation of f 2 4 The Runge Example Let f x 1 1 25 x 2 x 1 1 3

# 2 as an approximation of f 2 4 the runge example let

• Homework Help
• 3
• 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(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 of 2
points n e as in Prob. 2. Note that your Barycentric Formula cannot be used to evaluate p n when x coincides with an interpolating node ! Plot also f for compar- ison. (c) Plot the error e n = f - p n for (a) and (b) and comment on the results. (d) Repeat (a) for f ( x ) = e - x 2 for x [ - 1 , 1] and comment on the result. 3