Question: TEST CODE Problem 4 (5 marks) Write a function interpolation which takes an input parameter y (a Python list or NumPy array of length N)
TEST CODE
Problem 4 (5 marks) Write a function interpolation which takes an input parameter y (a Python list or NumPy array of length N) and returns a NumPy array c of length len (y) consisting of the coefficients of the unique polynomial p(x) = co + cx + cx + [] # YOUR CODE HERE such that p(n) = yn for each n = 0,..., N - 1. Use the function scipy.linalg.solve to solve the corresponding linear system Ac = y arising form the interpolation equations. The function numpy.vander may be helpful. + Caxa For example, the following code will plot the data y and interpolant polynomial p(x) with coefficients c.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
