[General boards] [Winter 2019 courses] [Fall 2018 courses] [Summer 2018 courses] [Older or newer terms] # Notes 5 pp Matlab Question

#1

Can someone explain to me how the answer was obtained for the matlab question of the Piecewise polynomial interpolation slides? I have attached a copy of the question and answers as reference

From my understanding they created 2 sets of evenly spaced data points x, and xi. Then they interpolated (xi,yi) with a knot a knot cubic spline interpolant and stored it in x? I am unsure about the last part of storing it in x and what the max absolute value calculates, i.e. what exactly they are trying to find.

Edit: I figured out what the code is doing in the first part, however I do not know how to arrive at 8.8818e-016
or how to arrive at the answer for the second question

Edit 2: For those who are wondering how they did part 2, I figured it out boys.

We can see that the code follows this remark. Since we increased from 10 to 19 data points we are essentially doubling n and halving the step sizes since linspace gives an evenly distributed set of points increasing n would half the step size.

Following this logic we can see that if we divide the given 1.6541 by 16 it is roughly 1.0337.

Edit 3: After much debate we have concluded that we know nothing, why is it 19 and not 20. Because its not exactly double we are not sure how to calculate the exact output.

#2

Im not sure but
The function being interpolated was x^3 - a polynomial of degree 3
So we expect the interpolant to be the function itself and the error be 0
The 8.8818e-016 is very small, order of machine epsilon, close ish to 0
I think there were some small errors in constructing and evaluating the cubic spline so it wasn’t exactly 0

#3

linspace(,, n) gives n points, not n+1.
So linspace(,, 10) gives 9 subintervals
and linspace(,, 19) gives 18 subintervals.
All the above, including the (correct) answer by fellow student
about the epsilon, were explained in class.