Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In python please! In this homework we will use various methods to approximate the line of duck's back from your textbook. Data for the marked
In python please!
In this homework we will use various methods to approximate the line of duck's back from your textbook. Data for the marked sample points are in the file 'duck.dat'. It is a text file with two columns; first contains the xn-x-coordinates; second, fn- y coordinates. A summary of various interpolation ideas that we discussed in class is outlined in the end of this file. You do not need to program your own solver for linear systems for this assignment and should use the built-in facilities in your programming environment f (x) 4 1 2 3 4 10 11 12 13x Least Squares. In order to find the best-fitting tn-th degree polynomial, pm (x) = a0 +a1x + first construct the matrix +anKm X2X2 Then solve the least squares problem, where the unknown vector a contains the coefficients ak, k = 0, , m; and vector f contains the y- coordinates of the data. Plot your approximations for m = 5, 10, 15, 20 (use the same plot and display the original data points as well) Interpolating Polynomials. The least squares approximation with m = 20 is, in fact, the exact interpo- lating polynomial which passes through all the data points. Verify that you get the same approxima- tion using Lagrange interpolation (as in the previous assignment). In your opinion, does it provide a good approximation? Cubic Splines. Construct cubic splines for the same data and plot the resulting approximation. Use the natural splines with free boundary conditions, i.e., the second derivatives of the constructed func- tion must vanish at the end points. The outline below contains some of the theory behind the cubic spline approximation, however it does not have the two equations coming from the vanishing second derivative condition at the end points, x1 and xx. Part of your task is to carry your own. out this derivation onStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started