Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Would like to request for Question 3 to be written in Python. Prefer Python but if you can only write C++, Java that is perfectly

Would like to request for Question 3 to be written in Python. Prefer Python but if you can only write C++, Java that is perfectly fine. Please ignore the last statement where to compare to Question 2. Thank You

image text in transcribed
3. The Runge Example. Let f(x) = 1 + x2: TE [-5, 5]. (1) "All course materials (class lectures and discussions, handouts, homework assignments, examinations, web ma- terials) and the intellectual content of the course itself are protected by United States Federal Copyright Law, the California Civil Code. The UC Policy 102.23 expressly prohibits students (and all other persons) from recording lectures or discussions and from distributing or selling lectures notes and all other course materials without the prior written permission of Prof. Hector D. Ceniceros. Using your Barycentric Formula code (Prob. 3) and (2) and (3) below, evaluate and plot the interpolating polynomial of f(x) corresponding to (a) the equidistributed nodes r; = -5 + j(10), j =0, ...,n for n = 4, 8, and 12. (b) the nodes r; = 5 cos(- ), j = 0, ..., n for n = 4, 8, 12, and 100. (c) Repeat (a) for f(x) = e-x /5 for x e [-5, 5] and comment on the result. Remark 1. It can be shown that for equidistributed nodes one can use the barycentric weights 1,7 ) = (-1)' (" ), j= 0,...,n, (2) where (") is the binomial coefficient (nchoosek(n,j) in Matlab). It can be shown that for the nodes xj = 120 atb + 5," cos( )" ), j = 0, ...,n, in [a, b], one can use (m ) = =(-1) for j = 0 or j =n ( (-1) (3) for j = 1, ..., n - 1. Make sure to employ (2) and (3) in your Barycentric Formula code for this problem. To plot the corresponding Pr(x) evaluate Pn(x) at a large number of points i to have a good plotting resolution, e.g. Th = -5+ k(10e), k = 0, ..., ne with ne = 5000. Note that your Barycentric Formula cannot be used to evaluate Pr(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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Derivatives Markets

Authors: Robert McDonald

3rd Edition

978-9332536746, 9789332536746

Students also viewed these Mathematics questions