Professional Documents
Culture Documents
ENEE604020 – 2 SKS
Dr. Aries Subiantoro
aries.Subiantoro@ui.ac.id
DTE
ko m n u m
(1) Errors
Outline
Sources
Presentation based on material from:
• Chapra chapter 4
7
Approximate Error
• E and ε are subscripted with a t to signify that the error is based on the true value
8
Iterative Computation
• 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 :
9
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.
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
10
Example
11
Example
12
Round-off Errors
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, called ill-conditioned
14
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
exponent
s x be
mantissa
Base of the number system used
15
Number Base
Integer representation
Range of integer number on a 16-bit
computer -32,768 to +32,767
16
Floating Point Representation
17
Round-Off Errors
156.78 0.15678x103 in a floating point base-10 system
• Suppose only 4 decimal places to be stored
1
0.029411765
34
1
0.0294 10 0 m 1
10
• 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
18
Round-Off Errors
• 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
19
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.
20
20
Truncation Errors
Truncation Errors: The Taylor Series
f xi 1 f xi
x df
x
2
d2 f
x
n
dn f
1! dx xi 2! dx 2 xi
n! dx n xi
Zero-order approximation
f xi 1 f xi
First-order approximation
x df
f xi 1 f xi
1! dx xi
22
Truncation Errors: Example
3 5 7 9
Taylor’s series expansion: sin( x) x x x x x
3! 5! 7! 9!
The exact value: sin 0.5
6
The Zero-order approximation; sin 0.5235988
6 6
23
Truncation Errors: Example
x3 x5 x7 x9
Taylor’s series expansion: sin( x) x
3! 5! 7! 9!
The exact value: sin 0.5
6
The first-order approximation; sin
6
0.4996742
6 6 3!
24
The Taylor Series
• nth order approximation
f
f ( xi 1 ) f ( xi ) f ( xi )( xi 1 xi ) ( xi 1 xi ) 2
2!
f (n)
( xi 1 xi ) n Rn
n!
(xi+1-xi)= h step size (define first)
f ( n1) (e ) ( n1)
Rn h
(n 1)!
• Reminder term Rn accounts for all terms from (n+1) to infinity.
25
The Taylor Series
approximation
f x 0.1x 4 0.15 x 3 0.5 x 2 0.25 x 1.2
26
The Taylor Series
• e is not known exactly, lies somewhere between xi+1 > e > xi .
• Need to determine fn+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.
27
The Remainder for the Taylor Series Expansion
28
The Remainder for the Taylor Series Expansion
29
29
Example
Page 97
problem 4.5.
Determine
truncation
errors
30
Example
31
Example II
Page 87-
Example 4.4
problem 4.5.
32
32
Finite Differencing
33 2/15/2022 Optimality criteria Line search methods One variable minimization Trust region methods Gradient & Hessian
Example II
Page 87-
Example 4.4
problem 4.5.
34
34
Example II
35
35
Homework
DTE
ko m n u m
36
Terima Kasih
37