CHAPTER 01.02: MEASURING ERRORS : Approximate Error

 

In this segment we're going to talk about approximate errors. And the reason why we need to talk about approximate errors is because we won't have the luxury of knowing what the true values are, so somehow we have to calculate what the approximate errors are.   So let's go ahead and first define what approximate error is, and then we will talk about how to use that in an example. So the approximate error is defined as, it's denoted by Ea, and is defined as the present approximation minus the previous approximation. So because when you are going to use numerical methods you won't have the privilege of knowing the exact value, otherwise you wouldn't be using numerical methods. So there has to be some mechanism of having approximations from present and from previous to be able to gauge how much error you are getting.   Only then you'll be able to tell people how good or bad your answer is, but you will have to depend on your numerical results themselves.  So let's go ahead and take an example that will make it clear what we mean by approximate errors, and there are many, many examples which you can take about that, so let's go ahead and take an example here.

 

Let's suppose we have, somebody tells me, hey, I want you to use this approximate formula to calculate the derivative of a function. And we know that delta x has to approach 0 if we want to calculate the exact value, but if we want to calculate the approximate value, we have to choose delta x to be a finite number.  And they want you to use this for this particular function: f of x is 7 e to the power 0.5 x, they want you to calculate the derivative of the function at 2. And what they do is they want you to use delta x equal to 0.3, and then they want you to use delta x equal to 0.15.   And this is what is going to give you the present approximation and the previous approximation, so if you had know knowledge of what the exact value of the derivative of this function is, and you are totally depending on a formula like this one to calculate the derivative of a function, what you would have to do is you will have to choose some value of delta x.  In this case what we are doing is we are choosing a value of delta x equal to 0.3 as our previous approximation, then we're going to halve the step size from 0.3 to 0.15, and calculate our f prime of 2 with that step size, and that's what's going to give us the current approximation and the previous approximation, and allow us to find out what Ea is, or what our approximate error is.   So I will show you for one of the delta xs and then we can, I can ask you to do the other one by yourself.  So if I wanted to calculate f prime of 2, it will be approximately equal to the value of the function at 2 plus delta x minus the value of the function at x, divided by delta x.   And since in this first case we are taking delta x equal to 0.3, f prime of 2 will be approximately equal to f at 2 plus 0.3 minus f of 2, divided by 0.3. So that will give you f at 2.3 minus f at 2, divided by 0.3. And we just substitute the value of the function at those particular points, we get 7 e to the power 0.5 times 2.3 minus 7 e to the power 0.5 times 2, divided by 0.3, and this number here turns out to be 10.265.   So this is the value of the derivative of the function you're getting at x equal to 2 by using a step size of 0.3.   You can repeat the whole process for delta x equal to 0.15. In that case, you'll get f prime of 2 to be approximately equal to the value of the function at 2 plus delta x, which is 0.15, minus the value of the function at 2, divided by 0.15. and that gives you the value of the function as calculated at 2.15 minus the value of the function at 2, divided by 0.15. In order to go further in calculations, I need to substitute the value of x, which is 2.15 in this first case, and it is 2 for the second term, divided by 0.15. And this number here turns out to be 9.8799.   So you're getting a different number for the approximation of the derivative of the function when you choose a different step size, which is 0.15 in this case.   But this is what's going to allow us to now judge how much error we're getting, because we will get the approximate error to be the present approximation minus the previous approximation. Sometimes people call the present approximation the current approximation, so it's the same thing.   So the present approximation is something which we got by using a delta x equal to 0.15, and the previous approximation is what I got by using delta x equal to 0.3, and if I subtract the two, I get -0.348474, so that's the approximate error which I get.   So that's how you are able to calculate approximate errors, and this is a way to judge how much error you have in a calculation, without having to have a knowledge of the true values, because you're not going to have a knowledge of the true values in numerical methods. And that is the end of this segment.