Question: To avoid starting from scratch, let's put some of our previous code into use. The instructions below walk you through how to save previously created

 To avoid starting from scratch, let's put some of our previous

To avoid starting from scratch, let's put some of our previous code into use. The instructions below walk you through how to save previously created functions for solving linear systems in a file so that the function definitions can be readily imported for re-use. 2a) Write a python function to construct the Vandermonde matrix that arises in the linear system to solve for coefficients in polynomial interpolation. (The matrix should be very similar to an example from class.) Your function's input should include an array of input values and an array of corresponding function values and the degree, n, of the desired polynomial. In general, the number of data points m can be larger than the number of coefficients in the polynomial, but for the remainder of this problem you can make the following specializations: i) Focus on the case m = n + 1 that produces a square matrix. ii) Choose the input array x to consist of m values equally spaced across the unit interval [0, 1]. iii) Choose the array of function values so that y[i] = x[i] + r[i] where r is an array of values selected from a uniform distribution on (-0.25, 0.25). (You should use a python library function to generate the random values.) - [ ]: 2b) Test out your function for m = 4. Form the appropriate Vandermonde system and compute the solution using your linear solver code. Plot the input data and the computed degree 3 polynomial. Does your polynomial interpolate the data points? - [ ]: To avoid starting from scratch, let's put some of our previous code into use. The instructions below walk you through how to save previously created functions for solving linear systems in a file so that the function definitions can be readily imported for re-use. 2a) Write a python function to construct the Vandermonde matrix that arises in the linear system to solve for coefficients in polynomial interpolation. (The matrix should be very similar to an example from class.) Your function's input should include an array of input values and an array of corresponding function values and the degree, n, of the desired polynomial. In general, the number of data points m can be larger than the number of coefficients in the polynomial, but for the remainder of this problem you can make the following specializations: i) Focus on the case m = n + 1 that produces a square matrix. ii) Choose the input array x to consist of m values equally spaced across the unit interval [0, 1]. iii) Choose the array of function values so that y[i] = x[i] + r[i] where r is an array of values selected from a uniform distribution on (-0.25, 0.25). (You should use a python library function to generate the random values.) - [ ]: 2b) Test out your function for m = 4. Form the appropriate Vandermonde system and compute the solution using your linear solver code. Plot the input data and the computed degree 3 polynomial. Does your polynomial interpolate the data points? - [ ]

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!