Answered step by step
Verified Expert Solution
Question
1 Approved Answer
using python please 3. In Newton's form of the interpolation polynomial we need to compute the coefficients, co = f[20], C1 = f(10,21], ..., Cn
using python please
3. In Newton's form of the interpolation polynomial we need to compute the coefficients, co = f[20], C1 = f(10,21], ..., Cn = f(20, 21, ..., In]. In the table of divided differences we proceed column by column and the needed coefficients are in the uppermost diagonal. A simple 1D array, c of size n +1, can be used to store and compute these values. We just have to compute them from bottom to top to avoid losing values we have already computed. The following pseudocode does precisely this: for j=0,1,..., n do *All course materials (class lectures and discussions, handouts, homework assignments, examinations, web ma- rials) and the intellectual content of the course itself are protected by United States Federal Copyright Law, the alifornia Civil Code. The UC Policy 102.23 expressly prohibits students and all other persons) from recording ctures or discussions and from distributing or selling lectures notes and all other course materials without the prior ritten permission of Prof. Hector D. Ceniceros. Cj = fi end for for k= 1, ..., n do for j =n, n - 1, ..., k do Cj = (ej Cj-1)/(x; Xj-k) end for end for The evaluation of the interpolation polynomial in Newton's form can be then done with the Horner-like scheme: p=cn for j =n, n-1,...,0 do p=Cj + (1 - Ij)p end for (a) Write computer codes to compute the coefficients co, C1, ..., Cn and to evaluate the corre- sponding interpolation polynomial at an arbitrary point r. Test your codes and turn in a run of your test. (b) Consider the function f(x) = e- for 3 (-1,1) and the nodes Ij = -1 + (2/10), j=0,1,..., 10. Use your code in (a) to evaluate P10(x) at the points j = -1+(2/100), j=0,1,..., 100 and plot the error f(x) - P10(x). 3. In Newton's form of the interpolation polynomial we need to compute the coefficients, co = f[20], C1 = f(10,21], ..., Cn = f(20, 21, ..., In]. In the table of divided differences we proceed column by column and the needed coefficients are in the uppermost diagonal. A simple 1D array, c of size n +1, can be used to store and compute these values. We just have to compute them from bottom to top to avoid losing values we have already computed. The following pseudocode does precisely this: for j=0,1,..., n do *All course materials (class lectures and discussions, handouts, homework assignments, examinations, web ma- rials) and the intellectual content of the course itself are protected by United States Federal Copyright Law, the alifornia Civil Code. The UC Policy 102.23 expressly prohibits students and all other persons) from recording ctures or discussions and from distributing or selling lectures notes and all other course materials without the prior ritten permission of Prof. Hector D. Ceniceros. Cj = fi end for for k= 1, ..., n do for j =n, n - 1, ..., k do Cj = (ej Cj-1)/(x; Xj-k) end for end for The evaluation of the interpolation polynomial in Newton's form can be then done with the Horner-like scheme: p=cn for j =n, n-1,...,0 do p=Cj + (1 - Ij)p end for (a) Write computer codes to compute the coefficients co, C1, ..., Cn and to evaluate the corre- sponding interpolation polynomial at an arbitrary point r. Test your codes and turn in a run of your test. (b) Consider the function f(x) = e- for 3 (-1,1) and the nodes Ij = -1 + (2/10), j=0,1,..., 10. Use your code in (a) to evaluate P10(x) at the points j = -1+(2/100), j=0,1,..., 100 and plot the error f(x) - P10(x)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started