Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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
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