The value 1.57 is an approximation to the value of π/2 and therefore
it has error assocatied with it. How close is 1.57 to π/2 and how
can we measure that closeness? In Matlab, if you use this value to
calculate sin-1(sin(1.57)), you do not get the exact value
back:
>> sinpi2 = sin( 1.57 )
sinpi2 = 0.999999682931835
>> asin( sinpi2 )
ans = 1.56999999999999
>> x = 1.57
An error has been introduced not from the approximation of π/2, but
rather as a result of a numeric computation.
Before we can discuss numeric error, we must first define a number of
terms which we can use to discuss error mathematically:
- We will differentiate between giving a large
number of digits to approximate a value and actually
having a correct value (precision and accuracy, respectively).
- We will define the absolute and relative errors
of an approximation, and
- We will give an approximation of Topic 2.2 by referring to
the number of digits of to which an approximation is correct.
Terminology
Given any mathematical expression, it follows that if the variables have
error, then the result will have an associated error, as well. This passing
of error from variables to the result is termed error propagation. It
is possible for computations to magnify this error, however, the amount the
error is magnified depends on the operation:
Example 1
Consider two values 3.54 and 1.22, where 3.54 represents any
number in the range from 3.535 to 3.545 and 1.22 represents any number
in the range 1.215 to 1.225. Thus, when we add the numbers together,
3.54 + 1.22 = 4.76 could represent any number in the range 4.75 to 4.77
because at one extreme, 3.535 + 1.215 = 4.75, and at the other extreme,
3.545 + 1.225 = 4.77. The width of the first two intervals
was 0.01, while the width of the result is 0.02 . In this section,
we will give exact definitions to describe this width of error.
Example 2
At the other extreme, suppose the two values 3.55 and 3.54 represent
numbers in the ranges 3.545 to 3.555 and 3.535 to 3.545, respectively.
If we calculate 3.55 - 3.54 = 0.01, the actual value could be anywhere
in the range 0 to 0.02. Thus while we are reporting that the difference
is positive, the actual difference may be zero (or, if the error widths were slightly
larger, the difference may be negative). Consider, for example, the potential damage
reporting that electric current is flowing in one direction when in fact the current is zero,
or possibly flowing in the opposite direction.
We will give definitions to these errors and this course will
focus on methods which try to minimize the accumulation and propagation of
this error.