Question: Write the program in Python! I will report Incorrect Answers!!! Consider the function f: x [-1, 1] rightarrow f(x) = 1/1 + 25 x^2 Let

 Write the program in Python! I will report Incorrect Answers!!! Consider

Write the program in Python! I will report Incorrect Answers!!!

Consider the function f: x [-1, 1] rightarrow f(x) = 1/1 + 25 x^2 Let P_2n(x) (for n greaterthanorequalto 1) be the interpolation polynomial that interpolates f at the 2n +1 equally spaced data points {(x_i, f(x_i)): i = -n, -(n - 1), ..., -1, 0.1, ..., n - 1, n}, where x_i = i Write a function in Python or C (or C++, etc.), with parameters n, x, that returns P_2n(x). We assume n is an integer and x is a real number in double precision. Use the Newton interpolation algorithm (not the Lagrange formula). Hand in your program with comments. Note that in the Newton method it is inefficient to remember the entire (2-dimensional) triangular table; just use one current divided-difference column and the x_i-column (and some index information) to compute the next column. Also, recursion is inefficient here; avoid it. [This program Is not obvious; avoid needless complications, and add comments where needed. You can verify correctness by plugging in the interpolation points, and checking whether P_2n(i) = f(i).] Consider the function f: x [-1, 1] rightarrow f(x) = 1/1 + 25 x^2 Let P_2n(x) (for n greaterthanorequalto 1) be the interpolation polynomial that interpolates f at the 2n +1 equally spaced data points {(x_i, f(x_i)): i = -n, -(n - 1), ..., -1, 0.1, ..., n - 1, n}, where x_i = i Write a function in Python or C (or C++, etc.), with parameters n, x, that returns P_2n(x). We assume n is an integer and x is a real number in double precision. Use the Newton interpolation algorithm (not the Lagrange formula). Hand in your program with comments. Note that in the Newton method it is inefficient to remember the entire (2-dimensional) triangular table; just use one current divided-difference column and the x_i-column (and some index information) to compute the next column. Also, recursion is inefficient here; avoid it. [This program Is not obvious; avoid needless complications, and add comments where needed. You can verify correctness by plugging in the interpolation points, and checking whether P_2n(i) = f(i).]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!