Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Interpolate Polynomials in Python 3! Compute: Generating Polynomial Interpolants 10 points For this problem, interpolate f)2 1252 with Pn (z), where pn (z) has the

Interpolate Polynomials in Python 3!

image text in transcribed

Compute: Generating Polynomial Interpolants 10 points For this problem, interpolate f)2 1252 with Pn (z), where pn (z) has the form: Construct pn (z) for n 3, 5, 15. For nodes of interpolation, use evenly spaced points from -1 to 1 (including the end-points). Setup the corresponding Vandermonde matrix and solve for the coefficients c of the nterpolant. You should return the coefficients in three different 1d numpy arrays namely coefficients 3, coefficients 5 and coefficients 15 corresponding to the degree of the interpolant, the ordering should be such that the coefficient c corresponds to the i-th index of the array. Plot the exact function (f(x)) and the interpolants in a single figure. Use numpy.polyval and numpy. linspace to generate 50 evenly spaced points for plotting the interpolants and the exact function. Include a title and a legend. NOTE When you use numpy.polyval, you will need to reverse the order of your coefficients. You can use numpy.linalg. solve() to get the solutions for the linear systems .You are NO T allowed to use numpy.polyfit(), numpy.vander() or any other library functions that constructs the system or gets the interpolants. OUTPUT .coefficients_3: 1d numpy array .coefficients 5: 1d numpy array coefficients 15 1d numpy array A plot containing the interpolants and f()

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

More Books

Students also viewed these Databases questions