In this segment, we'll talk about how we can numerically differentiate discrete functions
by using the divided difference methods. We will
limit our discussion to the first derivative of these discrete functions.
So, let's suppose somebody's saying that hey y is a function of x and what they are telling you
is that hey, they are giving you this function f only at discrete data points. So, let's suppose
somebody's giving you only (x1,y1) (x2,y2) and all the way up to (xn,yn) and somebody says hey find
dy by dx an approximation of it of course uh at x equal to x_i. How do we go about finding the
first derivative of this function y which is only given to us at discrete data points? So, if I was
going to let's suppose show a plot of y versus x, I will have these n data points given to me and
let's suppose if this data point here is (x_i,y_i) and that's what I’m interested in finding the
approximation of the slope at that particular point. So, this point here then becomes x_i
minus 1, y_i minus 1 and this point right here becomes x_i plus 1,
y_i plus 1. So, what that simply implies is that now we can use the divided difference methods to
be able to find what the slope of the function at this particular point is by maybe using this
point right here or using this point here. So, if we use this point and this point then that's
called backward divided difference method. So, that will be the slope of this line.
So, that will be from the backward divided difference method as we have talked about for
the continuous functions. If we find the slope of this line then that will be the slope as per the
finite divided difference methods and if we use this slope where we're going to join a point which
is on the left and on the right of the point at which we're interested to find the slope,
then that is the central divided difference scheme. Of course, you have to remember that
if we're going to use the central divided difference scheme, that the spacing between
this point and this point has to be the same as the spacing between this point and this point
so far as the x value is concerned. So, that's extremely important to remember. So, if we talk
about hey what is the derivative of the function f which is same as y at x_i we can say; hey it is
f of x_i plus 1 minus f of x_i divided by x_i plus 1 minus x_i because keep in mind that y is f of x,
so it doesn't really matter whether we can; we can also put it as y_i plus 1 minus y_i divided by x_i
plus minus x_i. So, since we are using the point ahead in order to be able to find the value of
the derivative of the function, this formula will then be the forward divided difference formula.
Now, similarly if we want to look at the backward divided difference formula,
that means that we are taking a point behind it then in that case f prime of x_i
will be approximately equal to the value of the function here.
So, that is the same as saying that hey is y_i minus the y at the value of x_i minus 1
divided by x_i minus x_i minus 1. So that is the backward divided difference formula. Now, if we
want to look at hey what is the central divided difference formula for the same thing then it will
be simply f prime of x_i is approximately equal to the value of the function at x_i plus 1 and
subtract from that the value of the function x_i minus 1 and then in that case the run will be
x_i plus 1 minus x_i minus 1. But here what we have to make sure that when we are
looking at the central divided difference scheme, we got to make sure that x_i plus 1
minus x_i has to be equal to x_i minus x_i minus 1. So, we should say provided this is the case.
If this is not the case, if the two points are not equally spaced,
if the two points are not equally spaced then we cannot use the central divided difference scheme.
So, that's one thing which we have to keep track of.
So, let's go and take an example and see how the three divided difference
methods which you have learnt; the forward divided difference method,
the backward divided difference method and the central divided difference method
for finding the value of the first derivative, approximate value of course and we're going to
see that hey which estimate is the most accurate. We'll have to determine that. So, the first
procedure we're going to talk about is forward divide difference method. So, if we want to find
the value of the velocity at 1.75, that implies that hey do we have a data point available
ahead of it? Which it is true because we have a data point available 2.51. So, in that case the
velocity at 1.75 will be equal to whatever is the location at 2.51 minus the location at 1.75
divided by the differences of these two times which is 2.51 minus 1.75. So, based on that
what we'll be able to do is, we just simply substitute the values. We get 274 minus 262;
and that turns out to be 15.789 meters per second. So, that is the approximation which we get
by using the forward divided difference method. Let's go and see what happens when we use
backward divided difference method. So, we have the same data, the problem statement is the same.
So, if we have the backward divided difference method, now what we have to see is that hey we
are trying to find the velocity at 1.75 seconds, is there a point available before it? Yes, we have
0.99 available which is the closest point to 1.75 behind it. So, in this case the velocity at 1.75
would be approximately equal to whatever is the location at 1.75
minus whatever is the location at 0.99, we divided by 262 minus 211.
No, we divided by 1.75 minus 0.99.
So, in this case we have uh the value at x at 1.75 is 262. The value at x at 0.99 is 211
and this number here turns out to be 67.10
meter per second. So, that is the backward divided difference method we get. Let's see what we get by
using the central divided difference scheme. So, in the central divided difference scheme
now what we have to think about is that hey we are trying to find the velocity at 1.75 seconds,
so we got to have a point behind and we've got to have a point front so that is there, but,
we also have to make sure that the distance between these points is equidistant. So,
we have 0.99 here and 2.51 here on the time domain. The difference between these two times
is 0.76, the difference between these two times is also 0.76. So, we are good there. So, we can apply
the central divided difference scheme; in which case the velocity at 1.75 will be approximately
equal to the value of the velocity at 2.51 minus the velocity at 0.99, divided by 2.51 minus
0.99. So, here we get 274 minus 211 divided by 2.51 minus 0.99. So, that is 63 divided by
this quantity right here and we get 41.44
meters per second. So, if you look at the four or three values which we have got from
first from the forward divide difference scheme, for the velocity and the backward divided
difference and the central divided difference. So, I'm just going to write those down, we got 15.789,
we got 67.10 meters per second here and we got 41.44 meters per second here.
So, what you're basically seeing here is that
this is the order of accuracy of h - the step size. This is our order of accuracy of
the step size again. However, this particular value is order of the accuracy of the square
of the step size proportional to it. So, what we know is that hey that the central divided
difference scheme answers which we have here is the most accurate out of the three
which we obtained by using our divided difference scheme and that is the end of this segment.