Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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

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

Step: 3

blur-text-image

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

Database Security XI Status And Prospects

Authors: T.Y. Lin, Shelly Qian

1st Edition

0412820900, 978-0412820908

More Books

Students also viewed these Databases questions

Question

Find and develop your own story

Answered: 1 week ago

Question

5. Discuss the key components of behavior modeling training.

Answered: 1 week ago