.
In this segment, we're going to talk about the forward
divided difference
scheme,
or method, for finding a
derivative of a function, and in
this case, we are talking about continuous functions, so we want to use forward divided difference scheme
for finding the derivative of a function.|Now, let's go back, look at this
graphically here, so let's suppose if I have a function like this.
And this is
where I want to find out the derivative of the function, so I got my function, f of x, here,
and I got it as a function of x, and I want to find out what the derivative of the function here is.
So, basically what I'm trying to do is, first derivative, trying to find the slope of the function at that particular point.
And what I'm going to do is, I'm going to choose a point which is delta x
ahead, so that means that the distance between the two points
which I have is delta x, between this point and this point.
And the reason why I'm doing that is because I'm using my definition of f prime of x from my differential
calculus class, which is the limit of delta x approaching 0,
the value of the function at x plus delta x, minus f of x,
divided by delta x, that's the definition of the derivative of a function, which I learned from
my differential calculus class.|Now, what forward divided difference does is that it chooses a
point ahead, but it cannot use delta x approaching 0, because
if you're going to choose delta x approaching 0, you can always choose a smaller delta x, so what you are doing in
the forward divided difference scheme is that you're going to take the same definition, which you learned in your differential
calculus class, and saying that, hey, f prime of x I'm going to define approximately.
I'm going to define my f prime of x approximately by this, it's
the same thing without the limit, so what that means is that, once you take the limit out,
that you are choosing delta x to be a finite number,
as opposed to choosing delta x approaching 0, and that's the formula
for the forward divided difference scheme, so I call it FDD, FDD standing
for F for forward, D for divided, and D for difference, so that's the FDD formula
for the derivative of a function.|So you can very well see right there, you're going to get truncation
error, because your delta x is a finite number, as opposed to delta x approaching 0,
you are approximating a mathematical procedure by this particular formula.
Let's go ahead and see through an example how good we get as the numbers
by . . . for calculating the approximate value of this derivative here.
So I've chosen a simple function like f equal . . . f of x equal
to 2 e to the power 1.5 x.
And somebody's telling me hey, go ahead and calculate f
prime at 3, find out the
derivative of this function at x equal to 3.|And what I'm
being asked to do is that, what I'll have to do is I'll have to, if you look at the formula which I just
showed, so let me write down it again, f prime of x is approximately
equal to f of x plus delta x, minus f of x,
divided by delta x.|And I already know that
what x is, because x is 3, somebody's telling me to calculate the value of the function . . . derivative of the function
at 3, but I don't know what delta x is, and that's something, let's suppose it's either given to me,
or . . . or I choose is of my own accord.|So let me choose delta x
equal to 0.1.|So I'm going to choose delta x
equal to 0.1.|So let's go ahead and see that what kind of a derivative of the function I get,
f prime of 3 will be approximately equal to the value of the function,
x is 3, delta x is 0.1,
the value of the function x is 3, divided by delta x,
which is 0.1, so all these values are known to us, x is 3, delta x is
0.1, so that's what we need to do.|And this becomes the value of
the function at 3.1 minus the value of the function at 3, divided by
0.1.|So if you just look at this particular expression carefully,
all you are doing is calculating the value of the function at 3.1, calculating the value of the function at 3,
and dividing by 0.1, so, which is basically is the value of the function at these
two points, and the difference between the arguments of those two function values,
the argument here is 3.1, and the argument here is 3.
So what is the difference?|0.1, and that's what goes in the denominator, so it's rise over run, that's about it.
This is the rise of the function going from 3 to 3.1, and this is the run going from 3 to 3.1,
because what is this?|This is nothing but 3.1
minus 3, so if you want to write it in a different way, that's what it is, 3.1
minus 3, rise over run.|So all I have to do is now to calculate the
value of the function at 3.1, which is 2 e to the power 1.5 3.1,
minus 2 e to the power 1.5 times
3, divided by
0.1.|And this value here
turns out to be equal to 291.35.
So that's what I get as the approximate
value of the derivative of the function at 3, 291.35.
In order to be able to see that how good this method
of forward divided difference is working, let's go ahead and calculate the exact value from our differential calculus
knowledge, and then see what kind of true errors we are getting.|So if you look at
the function f of x, which we have, which is 2 e to the power
1.5 x, the f prime of x will be nothing but 2
times 1.5 e to the power 1.5 x.
This comes from the formula that the derivative of e to the power a x
is nothing but a e to the power a x, that's where that derivative
comes from, from your differential calculus class, so I get 3 e to the power
1.5 x.|I was interested in calculating the value of the function . . . derivative of the function
at x equal to 3, so I'm going to get 3 e to the power
1.5, x is 3, and this number here turns
out to be exactly equal to 270.05.
So that's the exact value of the derivative of the function at 3,
270.05, of course, that's only up to five significant digits, there are more digits there, but
that's what the exact value is up to five significant digits for f prime of 3.
You can see that there is a difference, so what I got for f prime
of 3, I got approximately equal to 291.35,
this was the delta x equal to 0.1, using the forward
divided difference scheme, and f prime of 3, exact value,
is 270.05, for delta x approaching 0,
that's from the definition of the derivative of a function, from your differential
calculus class.|So in this case the true error is the true value
minus approximate value, true value is 270.05,
and approximate value is 291.35, and
the difference between the two is -21.30.
So that's what you're getting as the true error for what you
obtained by using delta x equal to 0.1, and what you obtained exactly.
So I'm going to draw a table, what I did was I said, okay,
now we're getting a true error of 21.30, which is equivalent of
7.88 percent
as your relative . . . absolute relative true error.
.