Sie sind auf Seite 1von 10

Chapter 3

Approximations and Round-Off Errors


For many engineering problems, we cannot obtain analytical
solutions.
Numerical methods yield approximate results, results that are
close to the exact analytical solution. We cannot exactly
compute the errors associated with numerical methods.
Only rarely given data are exact, since they originate from
measurements. Therefore there is probably error in the input
information.
Algorithm itself usually introduces errors as well, e.g., unavoidable
round-offs, etc
The output information will then contain error from both of these
sources.

How confident we are in our approximate result?


The question is how much error is present in our calculation
and is it tolerable?

Accuracy. How close is a


computed or measured value to
the true value
Precision (or reproducibility).
How close is a computed or
measured value to previously
computed or measured values.
Inaccuracy (or bias). A systematic
deviation from the actual value.
Imprecision (or uncertainty).
Magnitude of scatter.

Significant Figures
Number of significant figures indicates precision. Significant digits of a
number are those that can be used with confidence, e.g., the number of
certain digits plus one estimated digit.

53,800 How many significant figures?


5.38 x 104
3
5.380 x 104
4
5.3800 x 104
5

0.00001753
0.0001753
0.001753

4
4
4

Error Definitions
True Value = Approximation + Error
Et (True error) = True value Approximation (+/-)

True fractional relative error

true error
true value

True percent relative error, t

true error
100%
true value

For numerical methods, the true value will be known only when we deal
with functions that can be solved analytically (simple systems). In real
world applications, we usually do not know the answer a priori. Then

Approximat e error
100%
Approximat ion

(Percent Relative Error)

Iterative approach, example Newtons method

Current approximat ion - Previous approximat ion


100%
Current approximat ion

(+ / -)

Computations are repeated until stopping criterion is satisfied.


(Use absolute value of relative error)

a s
If the following criterion is met

Pre-specified % tolerance based on the


knowledge of your solution

s (0.5 10(2-n) )%
you can be sure that the result is correct to at least n significant figures.
4

Round-off Errors
Numbers such as p, e, or 7 cannot be expressed by a fixed number of
significant figures.
Computers use a base-2 representation, they cannot precisely
represent certain exact base-10 numbers.

Fractional quantities are typically represented in computer using


floating point form, e.g.,
Integer part

mantissa

m be

exponent
Base of the number system
used

156.78

0.15678x103 in a floating point base-10 system

1
0.029411765
34
Suppose only 4
1
0.0294100
m 1 decimal places to be stored
b
Normalized to remove the leading zeroes. Multiply the mantissa by 10 and
lower the exponent by 1
0.2941 x 10-1
Additional significant figure is retained

for a base-10 system 0.1 m<1


for a base-2 system
0.5 m<1
Floating point representation allows both fractions and very large
numbers to be expressed on the computer. However,
Floating point numbers take up more room.
Take longer to process than integer numbers.
Round-off errors are introduced because mantissa holds only a finite number
of significant figures.
6

Example

+ + e e m m m value
---------------------------------0 1 1 1 1 0 0 0.062500
0 1 1 1 1 0 1 0.078125
0 1 1 1 1 1 0 0.093750
0 1 1 1 1 1 1 0.109375
0 1 1 0 1 0 0 0.125000
0 1 1 0 1 0 1 0.156250
0 1 1 0 1 1 0 0.187500
0 1 1 0 1 1 1 0.218750
0 1 0 1 1 0 0 0.250000
0 1 0 1 1 0 1 0.312500
0 1 0 1 1 1 0 0.375000
0 1 0 1 1 1 1 0.437500
0 1 0 0 1 0 0 0.500000
0 1 0 0 1 0 1 0.625000
0 1 0 0 1 1 0 0.750000
0 1 0 0 1 1 1 0.875000

What is the smallest positive number a


7-bit word expression can represent?
0
0
0
0
0
0
0
0
0
0
0
0

0
0
0
0
0
0
0
0
0
0
0
0

01100
01101
01110
01111
10100
10101
10110
10111
11100
11101
11110
11111

1.000000
1.250000
1.500000
1.750000
2.000000
2.500000
3.000000
3.500000
4.000000
5.000000
6.000000
7.000000 which is the max. number
that can be represented by
this floating number.

How about 7.5? Overflow!


If you have one more mantissa digit, then
7.5 can be expressed as 0 0 1 1 1 1 1 1
7

The intervals are not uniform in the Base-2, 7-bit floating number
representation. Actually, the interval increases as the numbers grow in
magnitude.

Overflow: Any number larger than the largest number that can be
expressed on a computer will result in an overflow.

Underflow : Any positive number smaller than the smallest number that
can be represented on a computer will result an underflow.
Example

The minimal number stored = 0.0625


The maximal number stored = 7
8

Chopping
Example:
p=3.14159265358 to be stored on a base-10 system carrying 7
significant digits.
p=3.141592 chopping error
Et=0.00000065
If rounded
p=3.141593
Et=0.00000035
Some machines use chopping, because rounding adds to the
computational overhead. Since number of significant figures is
large enough, resulting chopping error is negligible.

Machine Epsilon
We observe that the interval between each digit increases as the numbers grow.
To avoid ambiguity due to the interval non-uniformity, a normalized error estimate
is defined by , where x represents an interval, and x is a digital number.

The rounding error can be estimated by a machine-dependent number, called the


machine epsilon E, per the relation:

The machine epsilon can be related to the number of significant digits (t) by:
E = b1-t
where b is the number base.
10

Das könnte Ihnen auch gefallen