CHAPTER 05.04: LAGRANGE METHOD: Quadratic Interpolation: Example: Part 1 of 2
In this segment, we're going to talk about Lagrangian interpolation. We're going to take an example, and this example will fall under the category of quadratic interpolation. So we are given the following data points for the upward velocity of a rocket as a function of time, time is given in seconds, velocity is given in meters per second, and the times which are given to us are as follows, 0, 10, 15, 20, 22.5, and 30, and the corresponding velocities are given as 0, 227.04, 362.78, 517.35, 602.97, 901.67. So these are the velocities which are given to us, and we are asked to do Lagrangian interpolation. So we're asked to do quadratic interpolation by using the Lagrangian interpolant form to find the value of velocity at 16. So that's the example statement here. So let's go ahead and look at see what the solution is. Now, since we are trying to find the value of the velocity at 16, what that means is that we have to be sure that we choose the closest values to 16, but at the same time, those values of time have to bracket this particular point, 16. So we're surely going to choose 15 and 20, because those bracket 16 the closest, and then we have to make a decision about whether we're going to choose 10 or 22.5. In this case we're going to choose 10, because 10 is only 6 away in magnitude from 16, and 22.5 is 6.5 away in magnitude from 16. So we're going to choose 10, 15, and 20, so those are the three data points which we're going to choose for conducting the quadratic interpolation. So let's go ahead and see that what we're going to do with this. So we know that, according to the Lagrangian interpolation, that the velocity profile now will be summation i equal to 0 to n, n is 2, because it's a quadratic interpolant, it is a second-order polynomial, times the weighting functions Li t times the value of the velocities at the three data points, because i equal to 0, 1, 2, 0, 1, 2, three data points which we have chosen. So if we expand this, we're going to get L0 of t v of 10, plus L1 of t times v of t1, plus L2 of t v of t2. So that's what the interpolant is going to be. We already know what the velocities at these three data points are. We need to find out what these three weighting functions are so that we can calculate the value of the velocity at 16. So based on that, we already know that t0 is 10, the corresponding value of the velocity at t0 is 227.04, we know that t0 is . . . t1 is 15 . . . t1 is 15, the corresponding value of the velocity at t1 is 362.78, we already know that t2 is 20, and the value of the velocity at t2 is 517.35. So those are the corresponding values of t0, t1, t2, and the corresponding velocities which we're going to substitute into this expression, and also in finding out what these weighting . . . these three weighting functions are. So let's go ahead and find out each of these weighting functions. Let's go ahead and find L0 of t. So L0 of t is given by by the product of j going from 0 to n, where n is 2 here, j not equal to i, so it cannot be same as 0, t minus tj, divided by t0 minus tj, okay? Again, I'm going to write down the general formula on the right side here so that you know where it's coming from. It's coming from the general formula for Li t, that is for any weighting function Li t, is given by the product going, of j equal to 0, j not equal to i, and this will be n, t minus tj, divided by ti minus tj, and since i is 0, that's why we have have t0 here, and since it's a second-order polynomial, that's why I have 2 here, and that's how we are generating those . . . these weighting functions throughout. So if you look at this one here, since i is equal to 0, that means that the first term is not going to be written, because j is not equal to i, so we're not going to write the terms where j and i are the same. So we'll have to write these products for j equal to 1 and j equal to 2, because this product goes from j equal to 0, 1, 2, and 0 is not written because it is 0 here, so I'll have to substitute for j, 1 in the first part, and the second multiple, I'll have to substitute j equal to 2, so t minus t2, divided by t0 minus t2. So that becomes L0 t. Let's go for the next step here. L1 of t is equal to now the product of j equal to 0 to 2, j not equal to i, in this case keep in mind i is 1, t minus tj, divided by t1 minus tj. So in this case, this will become, j will take the value of 0, so that's what I get from the first term, the second term, I can't write it, because j is equal to i, because j is equal to 1, and the third one is j is equal to 2, so it'll be t minus t2, divided by t1 minus t2. So that's what L1 t will be. And similarly, we're going to find L2 of t, which is the second weighting function, and it's going from j equal to 0 to 2 again, j is not equal to i, t minus tj, divided by t2 minus tj, and this is the difference, because it's i equal to 2. Again, j will go from 0 to 2, that means j takes the value of 0, 1, and 2, but we're not going to pay attention to j equal to 2, because that's the same value as i, j is not equal to i, so we'll have j equal to 0, and j equal to 1, that's what you're going to have. So we have been able to find out what all these weighting functions are in terms of the values of t0, t1, and t2, and of course it will be a function of the independent variable, t. So let's go ahead and write these down, and we'll be in business for finding the value of the velocity at 16. So we already know that the value of the velocity as a function of time is going to be written as L0 of t v of t0, plus L1 of t times v of t1, plus L2 of t times v of t2. And L0 will be t minus t1, times t minus t2, which we have just derived, divided by t0 minus t1, times t0 minus t2, so that's L1 . . . sorry, L0 times v of t0. The second term is L1, L1 will be t minus t0, times t minus t2, keep in mind, see what has happened is t minus t0, t minus t1 is missing, because it is corresponding to i, and then always the first one will be whatever the i is, it will be t1 minus t0, times t1 minus t2, so again, t1 minus t1 is missing, that's from the j not equal to i part, so that's the way to write down these weighting functions, times v of t1. Let's try that again, L of t2 was t minus t0, times t minus t1, and see that how t2 is missing from the top, because j is not equal to i, because i is equal to 2 here, and here i is 2, so you're going to start with t2 here and a t2 here, and you're going to subtract every other t which is available to you, which is t0 and t1, but not t2, because j is not equal to i, times the value of the velocity at t2.