Professional Documents
Culture Documents
Error Analysis
Error Analysis
Department of Networks
College of Computing and Information Sciences
Makerere University
rashidah.namisanvu@mak.ac.ug
2 Introduction to Errors
3 Error Sources
e − x − x∗
Rounding
Occurs due to computing device’s inability to deal with inexact
numbers. π = π = 3.14159265 · · · can be rounded to four significant
digits as π = 3.142
Maximum error in rounding is 0.5 × 10−n . n is the number of rounded
places
Truncating
Occurs because some series (finite or infinite) is truncated/choped to a
fewer number of terms. e.g. A surd π = 3.14159265 · · · can be
truncated to four significant figures to π = 3.141
Maximum error in truncation is 1 × 10−n .
Proof.
Since δx1 and δx2 are ±, the possible combinations on addition are
(δx1 + δx2 ), (δx1 − δx2 ), (−δx1 + δx2 ) and (−δx1 − δx2 ). The extremes
are the first and last. Hence the sum ∈ ±(δx1 + δx2 )
Proof.
Same as addition
Rashidah Kasauli Namisanvu (Mak) Errors 10 / 22
Errors in Multiplication & Division
Proof.
Consider x1 ± δx1 and x2 ± δx2 . For multiplication, the absolute error is
(x1 + δx1 )(x2 + δx2 ) − x1 x2 = x1 δx2 + x2 δx1 (Note: δx1 δx2 tends to zero).
The relative error is x1 δxx21+x
x2
2 δx1
= δx 1 δx2
x1 + x2 . For division, the absolute
x2 −δx2 x2 δx1 −x1 δx2
error is xx12 +δx x1 x1 +δx1 x1
+δx2 − x2 ≡ x2 +δx2 × x2 −δx2 − x2 which simplifies to
1
x2
.
2
x2 δx1 −x1 δx2 x1
The relative error is x22
/ x2 which simplifies to
δx1 δx2 δx1 δx2
x1 − x2 ≡ x1 + x2 since errors are ±
power 100
If the error in x is δx, the error in x 100 can be got by (x + δx)100 − x 100 .
This can be rewritten as x 100 (1 + δxx )
100 − x 100 = x 100 ((1 + ( δx ))100 − 1).
x
Expanding to x 100 1 + 100( δx 100×99 δx 2 100×99×98 δx 3
x ) + 2! ( x ) + 3! ( x ) ··· − 1
and simplifying to x 100 × 100( δxx ) ≡ 100x δx
99
1 Numerical Analysis
Definition: Study of algorithms for the problems of continuous
mathematics.
We care about efficiency and accuracy of algorithms.
Sources of error:
truncation errors in mathematical models;
round-off error during calculations;
representation errors, e.g.:1/3 in decimal; 1/10 in binary.
We ask two important questions:
How sensitive is the output to changes in the input? – problem
conditioning
Do roundoff errors in an algorithm propagate? – algorithm stability
2 Floating point representation
Hardware supports single (32bit), double (64bit) and long double
(80bit) precision
Adding floating point numbers
0.1101 x 23
2 Perform the addition. + 0.001011 x 23
0.111111 x 23
3 Round the result: x + y = 1.0000x23 .
4 Normalize the result: x + y = 0.1000x24 .
Exercise 1: check the accuracy of the sum. Translate all operations into
our familiar decimal notation.
Rashidah Kasauli Namisanvu (Mak) Errors 16 / 22
Loss of Significance
|x − xb| 10−d
<
|x| 2
Example:
If x = 3.141592 and x̂ = 3.14, then |x − x̂|/|x| = 0.000507 < 10−2 /2.
Therefore, x̂ approximates x to two significant digits.
If y = 4, 000, 000 and ŷ = 000, 006, then
|y − ŷ |/|y | = 0.000004 < 10−5 /2. Therefore ŷ approximates y to five
significant digits.
If z = 0.000012 and ẑ = 0.000009, then |z − ẑ|/|z| = 0.25 < 100 /2.
Therefore ẑ approximates z to no significant digits.