1. Introduction to Numerical Methods
• Second-order polynomial equation:
analytical solution:
• For higher order polynomial, analytical solution
does not exist.
• Then the iterative, or numerical, approach must
be used.
0
2
c
bx
ax
a
ac
b
b
x 2
/
4
2
2021/22 Eyob A. 3- 1
2. Characteristics of Numerical Methods
1. The solution procedure is iterative, with the
accuracy of the solution improving with each
iteration.
2. The solution procedure provides only an
approximation to the true, but unknown, solution.
3. An initial estimate of the solution may be
required.
4. The algorithm is simple and can be easily
programmed.
5. The solution procedure may occasionally diverge
from rather than converge to the true solution.
2021/22 Eyob A. 3- 2
3. Example: Square Root
• To find the value of x
i
i
i
i
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
2
ng,
Generalizi
2
error
:
estimate
initial
:
2
1
0
1
0
2
0
0
0
2021/22 Eyob A. 3- 3
4. • Assume x=150. Because 122=144, let x0=12.
25
.
0
)
12
(
2
12
150
2
2
0
2
0
x
x
x
x
5
2
2
2
2
10
12861
.
0
)
24745
.
12
(
2
)
24745
.
12
(
150
2
x
x
x
x
00255
.
0
)
25
.
12
(
2
)
25
.
12
(
150
2
2
1
2
1
x
x
x
x
24744871
.
12
150
:
solution
true
2021/22 Eyob A. 3- 4
5. Accuracy, Precision and Bias
• Four shooting results:
• A is successful.
• B : holes agree with each other (consistency or
precision), but they deviate considerably from
where the shooter was aiming (no correctness)
2021/22 Eyob A. 3- 5
6. • B lacks correctness (exactness).
• C lacks both correctness and consistency.
• D lacks consistency (precision).
• The shooters of targets C and D were imprecise.
• Precision: The ability to give multiple estimates that
are near to each other (a measure of random
deviations).
• Bias: The difference between the center of the holes
and the center of the target (a systematic deviation
of values from the true value).
• Accuracy: The degree to which the measurements
deviate from the true value.
2021/22 Eyob A. 3- 6
7. Summary of Bias, Precision and
Accuracy
Target Bias Precision Accuracy
A
None
(unbiased)
High High
B High High Low
C
None
(unbiased)
Low Low
D Moderate Low Low
2021/22 Eyob A. 3- 7
8. Significant Figures
• The digits from 1 to 9 are always significant.
• Zero being significant where it is not being used
to set the position of the decimal point.
• 2410, 2.41, 0.00241: three significant digits
(0 in 2410 is only used to set the decimal place.)
• Scientific notation can be used to avoid confusion:
2.41×103: three significant digits
2.410×103: four significant digits
2021/22 Eyob A. 8
9. • Computation : Any mathematical operation using an
imprecise digit is imprecise.
• Example: 3 significant digits (underline indicates
an imprecise digit.)
result)
(product
Total
7414
35.
6
4.2
times
8
8
34.0
6
4.2
times
0.3
8
1.27
6
4.2
times
9
0.0
3834
0.
number
starting
9
8.3
number
starting
6
2
.
4
2021/22 Eyob A. 9
10. x
Y 9860
.
1
587
.
11
ˆ
digits
t
significan
three
99
.
1
6
.
11
ˆ
3 x
Y
Table: Rounding Numerical Calculations
1 13.59 13.576 13.573
20 51.40 51.310 51.307
40 91.20 91.030 91.027
100 210.60 210.19 210.187
x 3
ˆ
Y 4
ˆ
Y 5
Ŷ
digits
t
significan
four
986
.
1
59
.
11
ˆ4 x
Y
digits
t
significan
five
9860
.
1
587
.
11
ˆ
5 x
Y
• Example: Compute
Rounding should be made at the end of computation,
not at intermediate calculation
2021/22 Eyob A. 10
11. • Example: Arithmetic Operations and Significant
Digits. To compute the area of a triangle:
base=12.3 3 significant digits
height=17.2 3 significant digits
area A=0.5bh=0.5(12.3)(17.2)=106
(If we ignore the concept of significant digits,
A=105.78)
The true value is expected to lie between
0.5(12.25)(17.15)=105.04375
and
0.5(12.35)(17.25)=106.51875
Note that 0.5 is an exact value, though it has only one
significant digit.
2021/22 Eyob A. 11
12. Error Definitions
True Value = Approximation + Error
Et = True value – Approximation (+/-)
value
true
error
true
error
relative
fractional
True
%
100
value
true
error
true
error,
relative
percent
True t
2021/22 Eyob A.
True error
12
13. • 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
• Iterative approach, example Newton’s method
%
100
ion
Approximat
error
e
Approximat
a
%
100
ion
approximat
Current
ion
approximat
Previous
-
ion
approximat
Current
a
2021/22 Eyob A.
(+ / -)
13
14. • Use absolute value.
• Computations are repeated until stopping criterion is
satisfied.
• If the following criterion is met
you can be sure that the result is correct to at least
n significant figures.
s
a
)%
10
(0.5 n)
-
(2
s
2021/22 Eyob A.
Pre-specified %
tolerance based on the
knowledge of your
solution
14
15. Error Types
• In general, errors can be classified based on their
sources as non-numerical and numerical errors.
• Non-numerical errors:
(1) modeling errors: generated by assumptions and
limitations.
(2) blunders and mistakes: human errors
(3) uncertainty in information and data
2021/22 Eyob A. 15
16. • Numerical errors:
(1) round-off errors: due to a limited number of
significant digits
(2) truncation errors: due to the truncated terms
e.g. infinite Taylor series
(3) propagation errors: due to a sequence of
operations. It can be reduced with a good
computational order. e.g.
In summing several values, we can rank the
values in ascending order before performing
the summation.
(4) mathematical-approximation errors:
e.g. To use a linear model for representing a
nonlinear expression.
2021/22 Eyob A. 16
17. Round-off Errors
• Numbers such as p, e, or 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.,
7
e
m.b
2021/22 Eyob A.
expon
ent
Base of the
number system
used
mantis
sa
Integer
part
17
21. 156.78 0.15678x103 in a floating
point base-10 system
• Normalized to remove the leading zeroes.
• Multiply the mantissa by 10 and lower the exponent by
1
0.2941 x 10-1
1
2
1
10
0294
.
0
029411765
.
0
34
1
0
m
2021/22 Eyob A.
Additional significant figure is
retained
Suppose only 4 decimal places
to be stored
21
22. 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.
1
1
m
b
2021/22 Eyob A. 22
23. 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.
2021/22 Eyob A. 23
24. Measurement and Truncation
Errors
• error(e): the difference between the
computed (xc) and true (xt) values of a
number x
• The relative true error (er) :
t
c x
x
e
t
t
t
c
r
x
e
x
x
x
e
2021/22 Eyob A. 24
25. • Example: Truncation Error in Atomic Weight
The weight of oxygen is 15.9994.
If we round the atomic weight of oxygen to 16,
the error is
e = 16 - 15.9994 - 0.0006
The relative true error:
4
10
4
.
0
9994
.
15
0006
.
0
r
e
2021/22 Eyob A. 25
26. Error Analysis in Numerical Solutions
• In practice, the true value is not known, so we
cannot get the relative true error.
• ei = xi – xt
where ei is the error in x at iteration i, and xi is
the computed value of x.
• ei+1 = xi+1 – xt
• Relative error:
• is used to measure the error.
i
i
t
i
t
i
i
i
i x
x
x
x
x
x
e
e
e
1
1
1 )
(
)
(
i
e
2021/22 Eyob A. 26
27. • Example: Numerical Errors Analysis
The initial estimate x0 = 2
error:
See the table on the next page.
0
3
6
3 2
3
x
x
x
x
x
x
8
6
3
828427
.
2
8
6
3
0
0
1
x
x
x
828427
.
0
0
1
x
x
e
2021/22 Eyob A. 27
28. Table: Error Analysis with xt =4
Trail
0 2.000000 - 2.000000
1 2.828427 0.828427 1.171573
2 3.414214 0.582786 0.585786
3 3.728203 0.313989 0.271797
4 3.877989 0.149787 0.122011
5 3.946016 0.068027 0.053984
6 3.976265 0.030249 0.023735
7 3.989594 0.013328 0.010406
8 3.995443 0.005849 0.004557
9 3.998005
0000256
3
0.001995
i
x i
e
i
t x
x
i
2021/22 Eyob A. 28