.
In this segment
we're going to talk about the accuracy
of the divided difference formulas.
.
So, let me take an example and show you
what kind of numbers I get for the different divided difference formulas.|So let's suppose if I have a function like
f of x equal to 2 e to the power 1.5 x, and
what I want to be able to do is to find out what the value of the function f prime of 3 is.
So, in this case, what I'll have to choose is different values of delta x to
be able to figure out what the value of the derivative is.|So, I made a table here,
in which I'm going to show you what kind of values I get
for different values of delta x by the three different divided different schemes
which we are familiar with.|So, one is the forward divided difference
formula, then this is the backward divided difference formula, and then we have
the central divided difference formula.|So, I'm going to take
different delta xs, and if I choose delta x equal to 0.1,
0.05, 0.025, let's suppose.
The forward divided difference numbers which I get is 291.3,
280.4, and 275.1.
Backward difference numbers which I get are 250.7,
260.1, and 265.0,
so those are the values which I get for the backward divided difference
formula, that's what BDD stands for.|Now, for the central divided difference formula, I get
numbers like 271.06, 270.3
.
and 270.1.|And the exact value, which you can find
by your differential calculus class, turns out to be 270.0.
So you can very well see that what is happening in the forward divided difference
formula and the backward divided difference formula numbers which you are getting, they are quite a bit away
from the exact value.|However, the numbers which you are getting in the central divided difference formula,
they are very close to the exact value.|So the question is that,
why is . . . just by looking at this example you might, not conclude,
but at least maybe develop a hypothesis that the central divided difference scheme
is more accurate than the forward and backward divided difference scheme, because you're getting
more accurate answers with the central divided difference scheme, for the same value of delta x, as opposed
to the forward divided difference scheme and the backward divided difference scheme.
So the question arises, why is central divided difference scheme more accurate than backward
divided difference, and the central . . . and the forward divided difference?|So, let's go ahead and
see why that is so.|In order to be able to do that, we need to understand something about
Taylor series.|This is something which you must have done in your calculus
series classes, so you have taken calculus 1, 2, and 3, before you are taking this class,
so in one of those classes you must have surely talked about the Taylor series.|So, I'm going to
just recap a little bit here.|What Taylor series tells us that you can find the
value of the function at any other point, in this case being x plus delta x,
if you know the value of the function at this point, the starting point, x,
let's suppose, and you know the value of the derivative of the function,
then you also know the value of the second derivative of the function at
that particular point, and then you also know the
value of the third derivative of the function at that particular point,
and so on and so forth.|So what I'm basically trying to tell you is
that Taylor . . . what Taylor series is all about is that, can I find out the value of the
function, or maybe I should put it this way, give me the value of the function at a particular point,
x, give me the value of the derivative of the function at that particular point, x.
Keep in mind that I'm not talking about giving you the expression for the derivative of the function,
but the value of the derivative of the function at x.|Give me the value of the second derivative
the function at x, give me the value of the third derivative of the function at x, and all the other derivatives
which are possible for that function, and I can give you the value of the function at any other
point, in this case being x plus delta x.|Now, keep in mind that delta x does not have to be small.
It's a common myth that whenever you're going to use Taylor series, that delta x is a small number.|The only reason
why people choose delta x to be a small number whenever they apply a Taylor series is because then
you can take finite number of terms to get a very accurate answer, because if delta x is small,
these delta x squared terms will become smaller, delta x cubed will be even smaller, so hence,
you may only need to use a few terms of the Taylor series to be able to calculate the value of the function at some other
point.|So, if you want to calculate the value of the function at some point which is very far, far away,
the only restriction is that all these derivatives which you are seeking
here, at this particular point, x, they have to be continuous and defined between x
and x plus delta x.|If that's the case, then you can find the value of the function at any other point.
Now what does this have to do with our forward divided difference and backward divided
difference, and so on and so forth, and its accuracy?|Now, what I can do is, I can say that, hey,
I got this function which I want to calculate x plus delta x, it will be equal to
f of x, plus f prime of x times delta x, plus
the other terms are simply of the order of delta x squared, this means order,
okay, that symbol stands for order, not for zero.
So, what you have is that, since because this is delta x squared, this is delta x cubed, these terms are going to become
smaller for delta x to be small, we can bundle all these terms into this single term,
we say that, hey, the order of the remaining terms is of the order of delta x squared.
Now what I can do is I can take f of x to be
left-hand side, and I get f prime of x times delta x,
plus order of delta x squared, and then I take it this way,
I get f of x plus delta x, minus f of x, divided by
delta x is equal to f prime of x plus order of delta x
now, because I'm dividing by delta x both side . . . I'm dividing
delta x both sides, so this order of delta x squared term is going to become just order of
delta x.|So what that means is that f prime of x is equal to
f of x plus delta x, minus f of x, divided
by delta x, plus the order of delta x terms.|And
this formula here, which you are seeing here, is nothing but the forward divided difference
formula.|So this forward divided difference formula is basically telling you that the terms which you are
neglecting in calculating f prime of x, from the Taylor series, are
of the order of delta x.|That's why, what happens is that if you make delta x to be half
of what it was before, your error is also going to get approximately halved, it isn't exactly halved,
because the error term is of the order of delta x.|So, that
gives you some impression of that what is happening with the accuracy of the forward
divided difference formula.|Let's go ahead and see that is the central divided difference scheme
formula of similar error, or is it of smaller or larger error?|Maybe that's what will explain
why central divided difference scheme is giving us a better answer.
.