Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

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 Marketing The Ultimate Marketing Tool

Authors: Edward L. Nash

1st Edition

0070460639, 978-0070460638

More Books

Students also viewed these Databases questions

Question

What wildcards are available in MySQL , and what do they represent?

Answered: 1 week ago

Question

6. Explain the strengths of a dialectical approach.

Answered: 1 week ago