CHAPTER 05.02: DIRECT METHOD OF INTERPOLATION: Cubic Interpolation: Part 1 of 2

 

In this segment, we'll talk about cubic interpolation.  Again, the cubic interpolation we're going to be doing will be under the direct method. So in this case, cubic interpolation, again you might be given several data points, tens, or hundreds, but in cubic interpolation what you're going to do you're going to choose four data points.  You're going to choose four data points like this, and then draw the cubic interpolant there.  So through these four data points you are choosing a cubic interpolant, which will be, let's suppose f3 of x, and the form of that will be a0, plus a1 x, plus a2 x squared, plus a3 x cubed. So the bottom line about cubic interpolation is to find out what these four coefficients are, and those four coefficients will be found out from the values which you will have at these four data points, and then you can find out the value of the interpolant at any point between the lowest value and the highest value of x which you have for those four data points. So let's go ahead and take an example and see how this all works. Let's suppose somebody gives me the upward velocity of a rocket as a function of time. So they've given me six data points, 0, 0, 10, 227.04, 15, 362.78, 20, 517.35, 22.5, 602.97, 30, 901.67. So we're given six data points, and what we want to do is we want to be able to find out what the value of the velocity at 16 is by using cubic interpolation.  So if you are trying to find the value of the velocity at, you've got to first choose four data points to be able to find the interpolant, so you want to choose the closest data points which are to 16.  So 15 is 1 away, 20 is 4 away, 22.5 is 6.5 away, and 10 is 6 away, so what you have to do is you have to choose the four closest points to 16 on this time column, and this is 6 away, 1 away, 4 away, and 6.5 away, the other ones are further away, so you're not going to choose those, and at the same time, this number 16 has to be bracketed between 10, 15, 20, and 22.5, which it is, because 16 is between 15 and 20. So what you're going to do is you're going to take these four values here to find your cubic interpolant.  So if you have your velocity now given as a0, plus a1 t, plus a2 t squared, plus a3 t cubed now, so you've got a cubic interpolant now. So you're going to put the value of the velocity at 10, which is a0, plus a1 times 10, plus a2 times 10 squared, plus a3 times 10 cubed. Then you've got the value of the velocity at 15. Then we've got the value of the velocity at 20, which is 517.35, which will be a0, plus a1 times the value at 20, plus a2 20 squared, plus a3 20 cubed, so that gives you the third equation.  Now, the fourth equation is going to come from the value of the velocity at 22.5. So all you are doing is substituting the value of time in the cubic expression, you're substituting the value of time in this cubic expression at these different times of 10, 15, 20, and 22.5, and setting up the equations.  So this is going to give you four equations, four unknowns.  And as homework, what I will ask you to do is go ahead and set it up in the matrix form.  Set it up in the matrix form.  I'm not going to show you how to set it up in the matrix form in this segment, but go ahead and set it up the matrix form, and then go ahead and solve it by using Gauss elimination, or LU decomposition method, or just simply your high school algebra method. And what's going to happen is when you have four equations, four unknowns, you'll be able to find out what the values of a0, a1, a2, and a3 are.  So this is what I get after I solve these four equations, four unknowns, I get a0 equal to -4.3810, a1 equal to 21.289, a2 equal to 0.13065, and a3 equal to 0.0054606. So those are the values of the constants I get from my third-order interpolant there, which basically means is that I can substitute these values in the coefficients of the third-order polynomial, which is a0, plus a1 t, plus as t squared, plus a3 t cubed.  So that means it is -4.3810, plus a1, which is 21.289 times t, plus 0.13065 times t squared, plus a3, which is 0.0054606 t cubed. And keep in mind that this particular interpolant is now valid between the values of time, t equal to 10 and 22.5, because those are the lowest value of t and the highest value of t which you used to . . . which you used to calculate this third-order interpolant. interpolant.  However, we are interested in calculating the value of the velocity at 16.  When I substitute the value of the velocity at 16 there, I'm going to get 392.06 meters per second.  All I'm doing is substituting the value of time equal to 16 here, 16 squared here, 16 cubed here, and I'll get 392.06 meters per second.  Now, how do I know how many significant I can trust in this solution, and that should be based on what I got from the previous interpolation. So I'm going to write that down, the value of the velocity at 16, which I got from quadratic interpolation, was 392.19, that's what I got from quadratic interpolation, and the value of the velocity at 16 I got to be 392.06, and this is what I got from cubic interpolation.  So I can, in order to be able to calculate my relative approximate error, I can choose this as my present approximation and this as my previous approximation. So in that case, what I do is I get the relative approximate error to be the current approximation, which is from the cubic interpolation, minus 392.16, which is from my quadratic interpolation, divided by 392.06, which is from the cubic interpolation, and I multiply it by 100 in order to get the value in terms of percentages, and this value here turns out to be 0.033 percent. So what does this tell me?  It is that it is less than or equal to 5 percent, it is less than or equal to 0.5 percent, and it's also less than or equal to 0.05 percent, so 0.05 percent.  I cannot go beyond that, I cannot go to 0.005 percent.  So this tells me that since this is 0.05 percent, at least three significant digits are correct. So it's telling me that at least three significant digits are correct, so in the number 392.06, I can trust 3, I can trust 9, and I can trust 2, those are the three significant digits which I can trust in that solution.  And that's the end of this segment.