arch2-LECTURE-ERROR ANALYSIS
arch2-LECTURE-ERROR ANALYSIS
NUMERICAL ERROR
ANALYSIS
Prof. Dr. H a s a n S A D I K O Ğ L U
Yıldız Technical Univers ity
Department of Chemical Engineering
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Numerical Methods
Numerical Methods:
Algorithms that are used to obtain numerical solutions
of a mathematical problem.
Why do we need them?
1. No analytical solution exists,
2. An analytical solution is difficult to obtain
or not practical.
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
What do we need?
Basic Needs in the Numerical Methods:
– Practical:
Can be computed in a reasonable amount of time.
– Accurate:
• Good approximate to the true value,
• Information about the approximation error
(Bounds, error order,… ).
CISE301_Topic1 3
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Outlines of the Course
• Taylor Theorem • Solution of linear
• Number Representation Equations
• Solution of nonlinear • Least Squares curve
Equations fitting
• Interpolation • Solution of ordinary
• Numerical Differentiation differential equations
• Numerical Integration • Solution of Partial
differential equations
CISE301_Topic1 4
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Error can arise from many sources, such as
data error, which accounts for error in any of the input
data to a numerical method, including error in
measurement or neglected components of a
mathematical model,
discretization error, which arises from approximating
continuous functions by sets of discrete data points,
truncation error, which arises from truncating a
sequence of approximations that is meant to converge to
the exact solution, to make computation possible, and
roundoff error, which is due to the fact that computers
represent real numbers approximately, in a fixed
amount of storage in memory.
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Approximations and Round-Off Errors
Chapter 3
7
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Fig. 3.2
8
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
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 10 4 3
5.380 x 10 4 4
5.3800 x 10 4 5
Zeros are sometimes used to locate the decimal point not significant
figures.
0.00001753 4
0.0001753 4
0.001753 4
Chapter 3 9
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Error Definitions
True Value = Approximation + Error
True error
true error
True fractional relative error
true value
true error
True percent relative error, t 100%
true value
Chapter 3 10
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
• 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 not know the
answer a priori. Then
Approximat e error
a 100%
Approximat ion
• Iterative approach, example Newton’s method
11
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
• Use absolute value.
• Computations are repeated until stopping criterion is
satisfied.
12
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
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
e exponent
m.b
mantissa Base of the number system
used
13
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Figure 3.3
14
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Figure 3.4
15
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
16
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
156.78 3
0.15678x10 in a floating
point base-10 system
1
0.029411765 Suppose only 4
34 decimal places to be stored
1
0.029410 0 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 Chapter 3 17
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
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.
Chapter 3 18
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Chopping
Example:
p=3.14159265358 to be stored on a base-10 system
carrying 7 significant digits.
p=3.141592 chopping error t=0.00000065
If rounded
p=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.
19
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.