.
In this segment, we're going to take an example of how to numerically find
higher order derivatives of a function.|So we're given a
continuous function, and we're going to find out what the second derivative
is, let's suppose, of a function, so we're going to take an example here.
So, let's suppose somebody gives you the value of the function to be . . . or the function to be 2 e to the
power 1.5 x, and somebody says, hey, can you calculate the
second derivative of the function at 3, numerically?
So, let's go ahead and see how we can go about doing that.|So we know that
f double-prime of x
is approximately equal to, this is the central divided difference formula, is
f of x plus h, minus 2 times f of x, plus f of x minus h,
divided by h squared.|And
that's the second . . . that's the central divided difference scheme for the second derivative
of the function.|So I do need the value of h, which is my step size, in order to be able to
calculate the second derivative of the function at 3.|So, let's suppose somebody
tells me, hey, go ahead and use h equal to 0.1.|So, in that case,
what I'll have is that f double-prime of 3, which is the second derivative of the function
which I want to calculate at x equal to 3, because that's what my problem statement is,
will be the value of the function at 3 plus 0.1, minus 2
times the value of the function at 3, plus the value of the function at 3
minus 0.1, divided by h, which is 0.1,
0.1 squared.|So h is 0.1,
so x is plus 0.1, and . . . sorry, h is 0.1,
x is 3, so you simply substitute the value of x equal to 3, h equal to 0.1, and
you are able to get all the arguments filled in there.
So . . . this should be approximately equal to . . . this should be approximately equal to,
because it doesn't have all the . . . all the terms of the Taylor series in there.
So f double-prime of 3 is approximately then equal to
the value of the function at 3.1, minus 2 times the value of the function
at 3, plus the value of the function at 2.9, divided
by 0.1 squared.
So, what is the value of the function at 3.1?|It is 2 e to the power 1.5 times
3.1, minus 2 times the value of the function at 3, which is 2 e to the
power 1.5 times 3, plus the value of the function at 2.9,
which is 2 e to the power 1.5 times 2.9, and then
this whole thing is divided by 0.1 squared.
So, this one here turns out to
be 405.84.|So that is the approximate
value of the derivative of the function which you are getting at 3.|Let's go ahead and see that
how good this answer is by comparing with the exact answer.|So,
we are given f of x is equal to 2 e to the power 1.5
x, so we know that the derivative of the . . . first derivative of the function will be
2 times 1.5 e to the power 1.5 x,
because that's from your differential calculus, that d by dx of e to the power a x, where
a is a constant, is nothing but a e to the power a x.
So using that from your differential equation . . . sorry, differential
calculus class, a, where a is a constant, then the derivative of e to the power a x,
a e to the power a x, so I get this, so I get 3 e to the power 1.5 x,
but I want to find out the second derivative, the second derivative will be also f double-prime
of x times 3 times 1.5 e to the power 1.5 x, using the
same formula from your differential calculus class, so I get 4.5
e to the power 1.5 x.|So that's what I get as
the second derivative of the function at any point x.
Now, since I am comparing it with the value of the function at 3, so f double-prime of 3
is exactly equal to 4.5 e to the power 1.5
times 3, and this value here turns out to be 405.08,
that's the exact value of the derivative of the function at 3, up to
five significant digits.|So, in order to be able to find out what the relative true error is,
I need to know what the true value is, which is 405.08,
I need to know what the approximate formula is, which I have found by using my central divided difference
formula for the second derivative function, we know to be 405.84,
divided by the exact value, which is 405.08
times 100, and this value here turns out to be
0.1876 percent.|So the relative true error, absolute relative
true error between what we obtained exactly and what we obtained approximately
is less than 0.2 percent difference.
And that's the end of this segment.
.