In this segment we'll talk about numerical differentiation of continuous functions.
We'll talk about how to find the first derivative,
and the method which we are considering is the Forward Divided Difference method.
So, if you remember your differential calculus, you must have come across this
this expression here that if you want to find the derivative at a certain value of x
then f(x), f'(x) is simply defined by the limit of
let's suppose h approaching 0 of this expression right here.
So, what the Forward Divided Difference method does is simply says that hey I cannot choose h
approaching 0 so let me choose h approaching a finite number. So, what we do is we take a point
let's suppose x + h here so the distance between these two points is h. And what we do is we draw
a secant line between these two points. So, since that's the secant line and this coordinate will be
given by this. This coordinate here is this. And if we tend to find out what the slope of
the secant line is, that'll be this rise over this run, so we already know the run is h, what
is the rise? Rise is the difference between the function at x + h and the function at x. So, what
Forward Divided Difference method is simply taking the rise over run. That's about it. So,
the difference between the exact definition and the Forward Divided Difference definition
is just that h is a finite number. So that is the Forward Divided Difference method
let's go and take an example and see how we can find this approximate value of the derivative
and what this comparison will be with the true value and also see therefore
the effect of the step size h here is on the finding the derivative of the function.
So, this is an example we are taking. We are asked to find the derivative of this function at 3,
with a step size of 0.16, we’re supposed to find the approximate value,
we're supposed to find the true value, which is from your differential calculus class,
the true error will be the difference between the true value and the approximate value.
We're also supposed to discuss the trends in the true error as a function of the step size,
and also show that hey how is the absolute relative approximate error, which you're
going to calculate in this case related to the significant digits which are correct as the step
size is decreased. So, let's go ahead and solve each of these parts of the problem, one by one.
So, let's do part a. We already know that the approximate value of the derivative
function is given by this formula by the Forward Divided Difference method. Our x is
3, the step size which was supposed to take is 0.16, the function is given to us 7x^4.
So, in order to find the value of the function at the derivative of the function of 3, it'll be
substituting the value of x and h here, and now what we're going to do is, so this becomes
the value of the function at 3.16 minus the value of the function of 3 divided by 0.16.
And what is the value of the function at 3.16? It will be 7*x to the power 4,
and that simply gives us a value of 818.6591.
So that is the value approximate value of the derivative of the function x = 3.
Let's go and see what is the. So, if we want to find the true value f of x is given as 7 x to the
power 4, f prime of x will be given by 7 times 4 x to the power 3, that's the derivative x to the
power 4 is 4 x cubed, the 28 x cubed. Hey what is the value of the derivative of the function at 3,
it is 28 times 3 cubed, and that turns out to be exact value of 756.
So, if that is the exact value, what is the true error? The true error will be true value minus
approximate value. The true value we got was 756, approximate value which we got 818.6591.
And that gives us a true error of the following number which is -62.6591. So, if you look at in
relationship to the true value this true error is about eight percent error, or so.
The next one is asking us that, hey, can you show us what happens to true errors as the
step size is decreased? So, I can repeat the process, but I would like you to do it. So,
step size is h, let's suppose, and we are asked to find the approximate derivative of f prime of 3
then we are supposed to look at the true error. We just found out that for 0.16,
f’(3) is 818.6591. The true error is as follows.
Then what I’ll do is, let's suppose, if I have the step size and you repeat the same process
as I did before, we get this as our approximate value, and the true error is this much. If we
again have the step size, the approximate value which I get is this, and the true error is now
something like this. So, what you're finding out here is as the step size is decreased the
approximate value starts to become closer and closer to the exact value, which is 756.
And also, as we're calculating our true error which is the difference between the
exact value and the approximate value, you find out that the trend of the true error magnitude
is also decreasing. But one of the things which I would like you to observe here is
that what happens to the true error is it getting approximately halved. See about half of 62 is 31,
half of 30 is 15, so it's getting approximately half. And this is something which you should
recognize because later on we'll talk about what is the how does the error change as a
function of step size there's a separate lesson, but just an illustration here tells you that hey
we are feeling that the true error is getting is proportional to the step
size as I have the step size the true error is getting approximately halved.
Let's look at the last part where we are asked to say hey, can you tell us what can what happens to
the relative approximate error? So, in this case again although we have already shown it
for h = 0.16, you can do it for other step sizes as well which is the repetition of
the same process. So, we're finding f prime of 3, we will find what the approximate error is,
and then we're asked to find the absolute relative approximate error. So, we already know that
with a value of h = 0.16, we got f prime of 3 to be this quantity here.
And so, the approximation cannot be calculated at this point because we don't have a previous
approximation. So, we'll keep those blank. Now when I go to 0.08 step size,
this is the value which you'll get if you repeat the process as we did this in part a.
Then what is approximate error? Approximate error is the difference between this value
minus this value. Current approximation minus the previous approximation. And that turns out
to be this quantity right here. The relative approximate error will be the ratio between
the approximate error and the current approximation. And that turns out to be
4.0517%. If we have a step size of 0.04, and i repeat the process as in part a,
this is what I will get as my value of the function derivative at 3. The approximate
error will be the difference between the current approximation and the previous approximation which
turns out to be 15.5263. And the absolute relative approximate error turns out to be 2.0131%.
And the reason why we talk about this or why we have to discuss this is because
in real life we won't be privy to the exact value of the derivative of the function. So,
we'll have to make our judgment call of the errors based on the
absolute relative approximate error. So, for example in this case it turns out to 2.013%. So,
we know that 2.013% is less than or equal to five percent, but not less than or equal to 0.5%.
So, what that implies is that hey at least one significant digit is correct in our answer. So,
when you look at 771.2548 as the answer for our h = 0.04, that’s our f prime of 3, we can trust this
significant digit, which is the 7 right here, in that answer. And that is the end of this segment.