Professional Documents
Culture Documents
Ch-1 Computational Method 2022
Ch-1 Computational Method 2022
(EPCE 2204)
Credit: 3 Hrs (Lecture: 2 Hr Lab: 3 Hr)
__________________________________________
Chapter-One
Number System and Numerical Error Analysis
Outline:
1. Introduction
2. Significant figures
3. Representation of Integers and Fractions
4. Number Representation in Computers
5. Error problems
◼ Types of error
6. Algorithm for Conversion from one base to another
7. Computational Problems and Algorithms
8. Computational Efficiency Tamiru Getahun (MSc)
9. Computational Methods for Error Estimation ASTU
Number System and Numerical Error Analysis
Introduction
Why we do Numerical analysis ?
x0 \ f (x0 ) = 0.
◼ Roots of equations :
◼ We will be interested in methods for
solving
◼ These methods are very useful in
◼ Optimization:
◼ Ordinary differential
equations :
◼ Integration:
b
I = f ( x)dx
a
◼ Determine the area f(x)
below a given curve.
Integral
◼ It has many applications
in engineering. Calculus
of centers of gravity.
Calculus of areas,
volumes, etc.
a b x
◼ It can also be used to
solve differential
equations.
◼ Partial differential
equations:
2u 2u
+ = f ( x, y )
2 2
x y
y
◼ Used for characterizing
engineering problems
where the behavior of
the physical magnitude
can be expressed in
terms of speed change
with respect to two or
more variables.
◼ Approximation by finite x
differences or the finite
element method.
Hexadecimal 0 1 2 3 4 5 6 7 8 9 A B C D E F
Decimal 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
(anan-1...a1a0.b1b2..bk..)q =anqn+an-1qn-1+...+a1q+a0q0+b1q-1+b2q-2+...
Example:
(1011.01)2=1x23+0x22+1x2+1x20+0x2-1+1x2-2=11.25
Example:
(26.1)10=(11010.00011)2
The 'bin2dec' built-in function converts a binary number string to a decimal number.
Example:
bin_nr ='110101';
dec = bin2dec(bin_nr)
The result is dec = 53.
bin_str = 101011110101
= 3.14159265...
17 = 4.123105...
Accuracy: closeness of measured/computed values to the "true" value (vs.
inaccuracy or bias)
Precision: closeness of measured/computed values with each other (spread
or scatter), relates to the number of significant figures (vs.
imprecision or uncertainty)
m * be
1
m1
b
1.3 Errors
◼
Relative Error
◼ Error definitions:
◼ True value = approximation + absolute error.
absolute error
t = 100%
true value
◼ In real cases not always one can know the true value, thus:
aproximate error
a = 100%
approximate value
a s
s = prefixed percent tolerance
◼ It is conveniente to relate the Errors with the number of significan
figures. If the following relation holds, one can be sure that at least n
significant figures are correct.
s = (0.5 * 102−n )%
Solution:
• First, the prespecified tolerance eqn. can be employed to determine the
error criterion that ensures a result that is correct to at least three
significant figures:
• Note that the true value is e 0.5 = 1.648721 . . . . Add terms until the
absolute value of the approximate error estimate εa falls below a
prespecified error criterion εs conforming to three significant figures.
• The first estimate is simply with a single term. Thus, the first estimate is
equal to 1.
• The second estimate is then generated by adding the second term as in
a s
• we would continue the computation by adding another term, x2/2!, and
repeating the error calculations. The process is continued until |εa| < εs .
The entire computation can be summarized as
• The function is passed the value to be evaluated (x) along with a stopping
error criterion (es) and a maximum allowable number of iterations (maxit).
• If the user omits either of the latter two parameters, the function assigns
default values.
dv mg − cv 2
= ; c( Kg / s )
dt m
c
v(ti+1 ) = v(ti ) + g − v(ti )2(ti+1 − ti )
m
V (m/sec)
40
6 35,678 39,896213 37,615198 Exact
8 41,137 44,870026 42,893056 30
solution
10 44,919 48,017917 46,411195
Numerical
12 47,539 50,010194 48,756333 20
T (sec)
4 1 -4 0 9 9 3 5 8 9
Integer N to be
converted to base two Input(N)10
i=0
i=i+1 ai=R
No
Is Q=o ?
Yes
n=i
(N)10 = (an…a0)2
Stop
Fraction F to be converted
to binary format Input(F)10
i=-1
i=i-1
ai=S
No
Is T=o ?
Yes
n=i
(F)10=(a-1…an)2
Stop
Questions?