Quantifying Errors: True Error
|
So, before we go and talk about
true error what we need to figure out is that why do we need to talk about it.
So, in numerical methods you're going to get two sources of errors which are
going to come which are called truncation error and round off, error
truncation errors where you are approximating a formula, let's suppose, or
maybe taking only a few terms of a series uh because you're truncating a
mathematical procedure. While the round of error is coming from approximating
numbers. So those will be the source of the error so how do we so we have to
quantify those errors right and so what we need to figure out about errors is
that hey errors are not good and we need to figure out how much error we can
live with so the first thing which we have to do is do we have to identify
where the error is coming from, and that's something which you will see
throughout the course in terms of whenever we discuss the numerical procedure
and then second thing is that hey we need to quantify the errors. So, I want
to identify theirs we've got to quantify the errors and this quantification
of the errors comes in two forms one is called true error and the other one
is called approximate error. Approximate error we'll discuss in a different
segment, but in this segment, we're going to focus our attention on true
errors. And of course, we understand that hey what we're going to do is that
we will minimize the error as per our needs so that's how we're going to go
about dealing with errors. Now many people might say that hey why do we need
to how can we calculate true errors? Because we are using numerical methods
in the first place because either the exact values are not possible to find,
or exact values will take a long time for us to find. So, what is the benefit
of true error? The benefit of true error here is that hey if you are
developing a numerical method, let's suppose, and you want to test it out,
you may have an exact value for some special cases and that's how you're
going to test it out and see that hey whether your numerical method program
or the algorithm which you have developed is working or not. So, let's go and
concentrate on what the definition of the true error is and see, through an
example, and you'll be able to figure out the other parts of the flowchart
which is here in um as you go through the course. So, let's go and see how
true error is defined. So true error is denoted by the symbol E sub t,
uppercase e standing for error and this for t. And that is defined as a true
value minus the approximate value. Many times, this true value here which you
are seeing here is also being going to be called the exact value. That means exactly the same thing. So, whether the is a true value
there or exact value there means the same thing so it's just the difference
between what is the exact value and what you're getting as the approximate
value from our numerical methods. So that's the definition of true error as
simple as that and in the next slide we will look at an example to see how we
can calculate a true error. So, here's the example which we'll be taking but
we are being given an approximate definition of the derivative of the
function as follows. And then we are taking this function with a step size of
0.3, or the value of h, and we're going to find the approximate value of the
derivative of the function at 2, we're going to find this true value and
henceforth find the value of the true error. So, our definition for the
derivative of the function is given as f prime of x is approximately [f(x +
h) – f(x) ]/h . Our value of x is we're trying to find the derivative of the
function at 2, the step size ‘h’ is given to us as 0.3, so that gives us f
prime of 2 is approximately this. So that gives us that hey we have to calculate the value of the function at 2.3 and 2, and
the difference as we divide it by 0.3. So now all we have
to do is to substitute the value of the function at 2.3 and 2. Since
our function is 7e^0.5x, so in this case its 2.3, minus 7e^0.5x, but in this
case it’s 2, divided by 0.3. And this value here gives us 10.263. So that's
the approximate value of the function at 2. Now you know how to find the
exact value what is f prime of 2, and we have to
find the exact value. We start up with our knowledge of differential calculus
so f(x) = 7e^(0.5x), and we already know that from differential calculus that
the derivative of ce^(ax) for example, where c and
a are constants, is nothing ca*e^(ax), so both c and e are constants in this.
So that's what we get from differential calculus. So, we apply the same thing
here, where d/dx (7e^(0.5x)), and they will give us 7*0.5*e^(0.5*x), and that
gives us 3.5*e^(0.5x), and that is the exact value of the derivative of the
function. So, f prime of x is 3.5*e^(0.5x), so hence we get f’(2) =
3.5e^(0.5*2), x is 2 and that value
turns out to be equal to 9.5140. So that's the exact value up to 5
significant digits here and we in the earlier part we found out what the
approximate value is. So here what we're going to do is so we're being asked
to calculate the true error. The true error will be true value minus
approximate value. And the true value found from part b, which was 9.5140. The approximate value found from the first
part was 10.263. So, if we take the 2 and subtract, we get -0.749 as our true
error. And that's the end of this example here. But one of the things which
you're going to see here is that we're getting a true error of -0.749. How do
we know whether this true error is a small quantity or a large quantity? So,
for example, if our if f(x) was given as 7*e^(0.5x), that’s what was given in
the example, let's suppose uh instead we have f(x) = 7*10^-6 * e^(0.5x).
Let’s suppose the previous example the only thing which was changed was the
function; rather than being given as 7*e^(0.5x), it is given as f(x) =
7*10^-6 * e^(0.5x). If we repeat the problem, the true error would be -0.749*10^-6.
So suddenly, for the same problem just with a different function in terms of
the constant being uh a slightly different function in terms of the constant
being 7E-6 rather than 7, we get a true error which seems to be a very small
quantity. So same problem but we find out that in one the number looks very
small another one number looks reasonably large. So how do we distinguish
between the two is what comes in the picture because we have
to figure out whether the numerical method is working properly or not.
So, we might be calculating two errors based for trying to figure that out. So,
what we do have to define is something called the relative true error. Because
now what we're going to do is we're going to do is normalize our true error
by saying that hey it is the true error divided by the true value. So, this
basically gives us a proportion of it, and the relative true is denoted by
epsilon of t, so we had true error, which was denoted by e sub t, relative
true error denoted by um epsilon of t. So, let's go and take an example, same
example as we had before and see hey what do we get is the relative true
error. So here is the example which we are taking for the relative true
error, same as the first example but the only difference is that we are now
asking for the relative true error as opposed to the true error in the case
before. So, this is pretty straightforward in this
case because we will take the numbers from the previous example. We got true
error as -0.749, that’s from the previous example. We had the true value was
also from the previous example was 9.5140. So, what is the true error, the
relative true error? The relative true error will be the true error divided
by the true value, and that gives us -0.749/9.5140. And this number here is -0.078726.
That's what we get as the relative
true error. Now one of the things which you have to
think about is as follows. So, what we obtained so far is that the relative
true error, which we got was -0.078726. And sometimes people will say that
hey uh give us this number relative true error in terms of percentages, what
you're going to do then? Then in that case all you're going to do is you're
going to take the number and multiply by 100. That's all you're going to do.
And you’re going to get 7.8726%. So relative true error can be written as a
fraction, or as a percentage. And depending on how the question is asked if.
If it's not asked, then you can give the answer in either
terms. But if it is asked to be given as a percentage then you give it
as a percentage. If it's not, if it is asked to be given as a fraction then
you give it as a fraction. And that's how it will work. Now um let's uh also
sometimes what they will do is they will ask you to calculate absolute
relative true error. So, in that case what are you going to do? In that case
you should be going to the absolute value of the relative true error. So, in
this case is that that is just the positive, the magnitude of the number
turns out to be this, or if it is in terms of percentages, you would just
write it as this That's all there is to it Now going back to the example
which we're taking we said hey, the function given
in the example was 7e^(0.5x). Now
instead if the function was given in the example was given as 7*10^-6
*e^(0.5x) for the same example, what's going to happen is the true errors
which you will get for true errors you get for this problem and for this
function for the same problem they'll be different they'll differ by 10 to
the power minus 6 magnitude. However, so far as the relative true errors are
concerned, they will be the same. So that's the power of each of these
quantities which are defined whether you're defining true error or whether
you're defining relative true error. so relative true error gives you the
relative mechanism of seeing that hey how bad your error is. So that's the
end of this segment. |