Roundoff and Truncation Errors
Dr. Abdul Muis, ST.MEng.
Dr. Ir. Feri Yusivar Meng.
ERRORS
The errors associated with both calculations and measurements
can be characterized with regard to their accuracy and precision
True value = approximation + error
Et = true value − approximation
the true error is commonly expressed as an
Et : the exact value of the error absolute value and referred to as the absolute
subscript t : true value error
Normalize the error to the true value:
True fractional relative error = true value − approximation
true value
The true percent relative error:
εt = true value − approximation 100%
true value
2
Approximate error
E and ε are subscripted with a t to signify that the error is
based on the true value
However, in actual situations such information is rarely available
The error is normalized to an approximate value
Percent relative error
3
Numerical methods use iteration to compute answers
when performing computations, we may not be concerned with the sign
of the error but are interested in whether the absolute value of the
percent relative error is lower than a prespecified tolerance εs
The computation is repeated until :
The result is correct to at least n significant figures:
(Scarborough, 1966)
4
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
Zeros are sometimes used to locate the decimal point not significant figures.
0.00001753 4
0.0001753 4
0.001753 4
5
6
7
ROUNDOFF ERRORS
Roundoff errors arise because digital computers cannot represent
some quantities exactly
In certain cases, they can actually lead to a calculation going
unstable and yielding obviously erroneous results
There are two major facets of roundoff errors involved in numerical
calculations:
1.Digital computers have magnitude and precision limits on their
ability to represent numbers.
2.Certain numerical manipulations are highly sensitive to roundoff
errors. This can result from both mathematical considerations as well
as from the way in which computers perform arithmetic operations.
8
Round-off Errors
• Numbers such as , 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
m.be exponent
mantissa Base of the number system
used
9
Figure 3.3
10
Figure 3.4
11
Figure 3.5
floating-point number is stored in an 8-byte word in IEEE
doubleprecision format
12
156.78 0.15678x103 in a floating
point base-10 system
1
0.029411765 Suppose only 4
34 decimal places to be stored
1
0.0294100 m 1
2
• 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
13
1
m 1
b
Therefore
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.
14
Chopping
Example:
=3.14159265358 to be stored on a base-10 system carrying 7
significant digits.
=3.141592 chopping error t=0.00000065
If rounded
=3.141593 t=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.
15
Truncation Errors and the Taylor Series
16
nth order approximation
f
f ( xi 1 ) f ( xi ) f ( xi )( xi 1 xi ) ( xi 1 xi ) 2
2!
f (n)
( xi 1 xi ) Rn
n
n!
(xi+1-xi)= h step size (define first)
f ( ) ( n 1)
( n 1)
Rn h
(n 1)!
• Reminder term, Rn, accounts for all terms
from (n+1) to infinity.
17
f (x) = −0.1x4 − 0.15x3 − 0.5x2 − 0.25x + 1.2 at x = 1 Fig 4.1
18
• is not known exactly, lies somewhere between
xi+1> >xi .
• Need to determine f n+1(x), to do this you need
f'(x).
• If we knew f(x), there wouldn’t be any need to
perform the Taylor series expansion.
• However, R=O(hn+1), (n+1)th order, the order of
truncation error is hn+1.
• O(h), halving the step size will halve the error.
• O(h2), halving the step size will quarter the error.
19
Fig 4.2
20
Fig 4.3
21
Page 97
problem 4.5.
Determine
truncation
errors…
22
Page 97
problem 4.5.
Determine
truncation
errors…
23
Fig 4.6
24
Page 87-
Example 4.4
problem 4.5.
25
Page 87-
Example 4.4
problem 4.5.
26
Bersambung …..
27
Homework
Chapter 4: no. 4.1 ; 4.8 ; 4.16
KUMPULKAN TUGAS VIA EMAS,
BATAS UPLOAD HARI KAMIS 4 Maret 2021, JAM 11:30 AM (SIANG)
FORMAT NAMA FILE DALAM PDF: NPM_NAMA_KONUM02SELASA
EMAS:
Komputasi Numerik – 02 Reguler ENEE604020- 648414 enrollment key: konum0221
Komputasi Numerik – 02 Paralel ENEE604020- 648415 enrollment key: konum02par
28
Bersambung …..
29