Errors in Numerical Computations: Dr. Gokul K. C
Errors in Numerical Computations: Dr. Gokul K. C
Dr. Gokul K. C.
Department of Mathematics,
School of Science,
Kathmandu University, Nepal
Email: [email protected]
1 / 19
Numbers
Exact numbers
Exact numbers are the numbers without uncertainty. For example: There
are 60 students in CE batch 2018. This 60 is an exact number. Generally
counting numbers and ratios are exact numbers.
Approximate numbers
Approximate numbers are the numbers with uncertainty. Approximate
numbers arise from measurement or calculation.
One plumber measures the diameter of a pipe to fit appropriate socket.
He found 0.99cm in first attempt and 1.01cm in second attempt. Finally, he
concluded that the diameter is 1cm.
Exact diameter of pipe is 1cm, however, the measurement ranges from 0.99
to 1.01cm are approximate numbers.
2 / 19
In calculating area of circle for given radius, we use the formula A = πr 2 .
The value of π is used according to our problem’s precision. Like:
3, 3.1, 3.14, 3.141, 3.1415, 22
7 etc.
10
The solution of equation 3x − 10 = 0 is x = 3 or x = 3.3333 · · ·
The solution x = 10
3 is an exact solution whereas x = 3.3333 · · · is an
approximate solution.
√
The solutions of equation x 2 − 2 = 0 are x = ± 2 or x = ±1.4142 · · ·
p
The solutions x = ± (2) are exact whereas x = ±1.4142 · · · are
approximate solutions.
3 / 19
Error means the difference between exact value and approximate value.
Error (E) = Exact value (X) - Approximate value (X1)
Errors can be expressed in three ways:
(a) Absolute error (EA )
The absolute value of the error (E) is called the absolute error.
Absolute error = |Error | EA = |E | = |Exactvalue(X ) − Approximatevalue(X 1)|
(b) Relative error (ER )
The relative error is the ratio of the absolute error to the exact value(X) or
approximate value(X1).
Absoluteerror (EA )
Relative error = |Exactvalue(X )|or |Approximatevalue(X 1)|
EA
ER = |X |or |X 1|
Example
√
Let 3 is approximated by 1.7. If the precision of calculation is 4 decimal
places, find ablsolute, relative and percentage errors.
5 / 19
Sources of error in numerical computation
In any numerical computations, we come across the following types of
errors.
Round off error
Because of the limitation in the number of digits, we may round off the
numbers some times. The error due to rounding off the number is called
round off error.
Truncation error
When the results are evaluated using computer, the results are truncated
to the required number of digits. For example, 1.8234516 may be
truncated as 1.823451. Truncation means cutting off the other digits (No
rounding off). The error due to truncation is called truncation error.
Inherent error
In a numerical method calculations, we may have some basic mathematical
assumptions for the simplifying the problem. Due to this assumption some
error is possible at the beginning of the process itself. This error is called
inherent error.
6 / 19
Round off errors
Round off or simply round a number is a process to retain a certain
number of digits, counted from the left and drop the others.
Sum
If EA be the absolute error of the sum a + b then
EA = Exact sum - Approximate sum
EA = [(a + EA1 ) + (b + EA2 )] − (a + b)
EA = EA1 + EA2
Product
If EA be the absolute error of the product ab then
EA = [(a + EA1 )(b + EA2 )] − ab
EA = (ab + aEA2 + bEA1 + EA1 EA2 ) − ab
EA = aEA2 + bEA1 + EA1 EA2
EA = aEA2 + bEA1
Since, the product EA1 EA2 is very small compare to the products aEA2 and bEA1
10 / 19
Quotient
a
If EA be the absolute error of the quotient b then
a+EA1 a
EA = b+EA2
− b
bEA1 −aEA2
EA = b(b+EA2 )
bEA1 −aEA2 EA2
EA = E2
Since, the quotient b is very small compare to 1.
b 2 (1+ bA )
bEA1 −aEA2
EA = b2
EA1 EA2
EA = ba ( a − b )
Two numbers 3.1425 and 34.2851 are rounded to 2 decimal places. Find
the error in sum, product and quotient.
Solution: 3.1425 rounded to 3.14 → EA1 = 0.0025
34.2851 rounded to 34.29 → EA2 = 0.0049.
EA (Sum) = 0.0025 + 0.0049 = 0.0074
EA (Product) = 0.0025 × 34.29 + 0.0049 × 3.14 = 0.1011
EA (Quotient) = (34.29 × 0.0025 − 3.14 × 0.0049)/(34.292 ) = 0.0000598
Two numbers π and e are rounded to 2 decimal places. Find the error in
sum, product and quotient. 11 / 19
Upper limiting error of an approximate number
The upper limiting error of an approximate number denoted by ∆X of an
exact number X is any number not less than the absolute error EA of that
number. That is, EA = |X − X 1| < ∆X
∆X = 0.5 × 0.01
1
∆X = 2 × 0.01
∆X = 1
2 × 10−2
Theorem
General formula for ∆X :
∆X = 1
2 × 10−N
13 / 19
Arithmetic Operations
Addition/Subtraction
When adding/subtracting, round the result to least number of decimal
places among them.
4. 35
|{z} + 35.
| 32657
{z } = |39.
{z68}
Correct to 2 decimal places Correct to 5 decimal places Rounded to 2 decimal places
Multiplication/Division
When multiplying/dividing, round the result to least number of significant
digits among them.
|0. 0045
{z } + |35.{z326} = 0. 16
|{z}
Correct to 2 significant digits Correct to 5 significant digits Rounded to 2 significant digits
14 / 19
Arithmetic Operations
Example
1.625(10.21−7.5431)
Simplify: 47
Example
Simplify: 16.25(37.513+2.34689)
3.2(12.4234−3.73)
Solution:23.
15 / 19
A general error formula
16 / 19
n
X ∂f
u + ∆u = f (x1 , x2 , x3 , · · · , xn ) + ∆xi + terms involving (∆xi )2 . (3)
∂xi
i=1
n
X ∂f ∂f ∂f ∂f
∆u = ∆xi = ∆x1 + ∆x2 + · · · + ∆xn (5)
∂xi ∂x1 ∂x2 ∂xn
i=1
Clearly,
n
X ∂f ∂f ∂f ∂f
(∆u)max = ∂xi ∆xi = ∂x1 ∆x1 + ∂x2 ∆x2 + · · · + ∂xn ∆xn (6)
i=1
and,
|∆u| (∆u)max
ER = , (ER )max = (7)
|u| |u|
17 / 19
2 2
Find the maximum relative error of the function u = 10xy 2 z at
x = 2.47, y = 34.26 and z = 13.65 correct to 2 decimal places.
19 / 19