CHAPTER 02.03: DIFFERENTIATION OF DISCRETE FUNCTIONS: Polynomial Interpolation Method   In this segment, we're going to talk about how to differentiate discrete functions. So, we are given the value of the function at only certain specific points, finite number of points, not as a continuous function, and we want to be able to find out what the value of the derivative of the function is, and the method which we're going to talk about here is the polynomial interpolation method. And what this will be based on is that you're going to interpolate the data which is given to you, and then find its derivative, we all know how to calculate the derivatives of a polynomial. So, what we're going to do is we're going to take it through an example, that might be the best thing to do.   So let's suppose somebody gives you location of an aircraft landing, so this is an aircraft landing, where you can imagine this is emergency aircraft landing, and you are given the value of time in seconds, the location of the aircraft is given in meters.  And given 0 . . . at 0 it's 20, at 0.4 it is 71, at 1 it is 110, at 1.75 it is given as 161, and at 2.5 it is given as 178.  So what we want to be able to do is to be able to use polynomial interpolation to find out what the velocity at 1.75 is. So that's our goal, that somebody's giving you the location of the aircraft at these different times, and wants you to find out what the velocity of the . . . of the aircraft is at 1.75.  So, one of the things which I can do is I'm going to go ahead and take these three data points to find out the value of the velocity at 1.75. So I have been given the location 110 at 1, 1.75 and 2.5, and what I want to do is I want to take these three data points and use a second-order polynomial interpolation to relate my location of the aircraft as a function of time, and then I will take the derivative, and find out what the velocity at 1.75 is.  So, this is what I'm going to do, so if I look at it from a graphical point of view.  I've got location right here, I've got time here, I have these three data points which have been given to me as x as a function of time, I'm going to draw a second-order polynomial through it, which will be, let's suppose, a0 plus a1 t plus a2 t squared, and I'm going to find out what that polynomial is, find the derivative of that polynomial, and plug in the value of 1.75 to find out what the velocity is. So let's go ahead and see how we can do that, so I'm going to write down the expression for x, which is a0 plus a1 t plus a2 t squared, and this expression will be valid from time equal to 1 to 2.5.  The reason why this expression will be valid between 1 and 2.5 is because I know the value of x at 1 is 110, and the value of x at 1.75 is 161, and the value of x at 2.5 is 178, and so the expression will be valid between 1 and 2.5.  So that makes it a0 plus a1 times 1 plus a2 times 1 squared. And then 1.75 is a0 plus a1 at 1.75 plus a2 times 1.75 squared. And, again, the location is given at 2.5, and our expression is a0 plus a1 times t, which is 2.5, plus a2 times t squared, which is 2.5 squared right there.  So you are finding out what these coefficients of a0, a1, and a2 are, by equating it to the locations at these . . . those three different times, and you're going to get three equations, three unknowns, that's what you're going to get, you're going to get three equations and three unknowns, and I'm going to write down those three equations and three unknowns.  So, the three unknowns are a0, a1, and a2, which are the coefficients of the second-order polynomial. And the coefficients are, from the first equation here, will be 1, 1, and 1, so I'll get 1, 1, and 1.  The coefficient here will be, a0 is 1, a1 is 1.75, a2 is 1.75 squared, which is 3.0625. Then, again, the last equation, the coefficient of a0 is 1, the coefficient of a1 is 2.5, the coefficient of a2 is 2.5 squared, which is 6.25, and the right-hand side is basically these location points, 110, 161, and 178. So I have basically three equations, three unknowns, three simultaneous linear equations and three unknowns, and I'm going to solve them by using any of the numerical methods which I have learned or I am going to learn, such as Gauss elimination, LU decomposition, or Gauss-Seidel method, or just use plain high school algebra of subtracting and adding and substitution and things like that, and from there I'm going to get a0, a1, and a2, and this is what I'm going to get for a0, a0 turns out to be equal to -10.9, a1 turns out to be 151.1, and a2 turns out to be -30.22.  So those are the values of the coefficients which I get by using that second-order polynomial and solving those three equations, three unknowns.  So what that tells me is that the location as a function of time is given as -10.9 plus 151.1 t minus 30.22 t squared, and this is going from 1 less than equal to t less than 2.5. Whenever you're going to write an interpolant, it's very important for you to write down the domain in which that interpolant is valid.  That's an extremely important part of interpolation, because if you are going outside of the domain, then that is not called interpolation, that's called extrapolation. I want to now find out what the velocity is.  The velocity will be nothing but the derivative of the location with respect to time.  So I'm going to take the derivative of this expression right here, and I'm going to get 151.1 minus 60.44 t, that's what I'm going to get as the derivative, because the derivative of -10.9 is 0, derivative of t is 1, and the derivative of t squared is 2, and that's why I get minus 60.44 t there.  But what am I interested in?  I'm interested in finding out what the velocity at 1.75 is, so the value of the velocity at 1.75 is simply substituting 7 . . . 1.75 in the equation, and I get 45.30 meters per second.  So that is the approximate value of the velocity at 1.75 by using the polynomial interpolation method, that you find the interpolant for the given data, and then depending on whether you have to take derivatives of that or things like that to be able to find out what you are looking for.  And that's the end of this segment.