0% found this document useful (0 votes)
165 views

Errors in Numerical Computations: Dr. Gokul K. C

1) Numbers can be divided into exact and approximate numbers. Approximate numbers have uncertainty arising from measurement or calculation. 2) Error is defined as the difference between the exact and approximate values. Absolute error is the magnitude of the error, relative error is the ratio of the absolute error to the exact value, and percentage error is the relative error expressed as a percentage. 3) Sources of error in numerical computation include round-off error from limiting decimal places, truncation error from cutting off digits, and inherent error from basic mathematical assumptions.

Uploaded by

Amar Mandal
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
165 views

Errors in Numerical Computations: Dr. Gokul K. C

1) Numbers can be divided into exact and approximate numbers. Approximate numbers have uncertainty arising from measurement or calculation. 2) Error is defined as the difference between the exact and approximate values. Absolute error is the magnitude of the error, relative error is the ratio of the absolute error to the exact value, and percentage error is the relative error expressed as a percentage. 3) Sources of error in numerical computation include round-off error from limiting decimal places, truncation error from cutting off digits, and inherent error from basic mathematical assumptions.

Uploaded by

Amar Mandal
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

Chapter 1

Errors in numerical computations

Dr. Gokul K. C.
Department of Mathematics,
School of Science,
Kathmandu University, Nepal
Email: [email protected]

Numerical Methods (MCSC 202)

1 / 19
Numbers

In numerical point of view, Numbers can be divided into two types


1. Exact
2. Approximate

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.

In this case π is an exact number and 3, 3.1, 3.14, 3.141, 3.1415, 22


7 are
approximate numbers.

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|

(c) Percantage error (EP )


The percentage error EP is given by
EP = ER × 100%
4 / 19
Example
Let π is approximated by 22 7 . If the precision of calculation is 4 decimal
places, find ablsolute, relative and percentage errors.

Since, precision is 4 decimal places, the exact value is X = π = 3.1416 and


approximate value is X 1 = 22
7 .
22
EA = |X − X 1| = |3.1416 − 7 | = |3.1416 − 3.1428| = 0.0012
EA 0.0012
ER = X = 3.1416 = 0.000382

EP = ER × 100% = 0.000382 × 100% = 0.0382%

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.

Rounding off rules


If (n + 1)th digit is less than 5, leave the nth digit unchanged.
If (n + 1)th digit is greater than 5, add 1 to nth digit.
If (n + 1)th digit is exactly 5 and is followed by at least one non zero
digit, add 1 to nth digit.
If (n + 1)th digit is exactly 5 and isn’t followed by non zero digit, add 1
to nth digit if it is odd, otherwise leave unchanged.

1.234 (rounded to 2 decimal places): 1.23


1.237 (rounded to 2 decimal places): 1.24
1.2350001 (rounded to 2 decimal places): 1.24
1.235 (rounded to 2 decimal places): 1.24
1.285 (rounded to 2 decimal places): 1.28
7 / 19
Truncation error
Truncation error is the error made by truncating an infinite sum and
approximating it by a finite sum.

Taylor series expansion of e x is given by the following formula:


2 3 4 5 6 7
e x = 1 + x + x2! + x3! + x4! + x5! + x6! + x7! + · · ·
Example: approximating e
n=1:e=1
n =2:e =1+1=2
n = 3 : e = 1 + 1 + 12 = 2.5
1 1
n =4:e =1+1+ 2 + 6 = 2.6667
1 1 1
n =5:e =1+1+ 2 + 6 + 24 = 2.7083
1 1 1 1
n =6:e =1+1+ 2 + 6 + 24 + 120 = 2.7167
1 1 1 1 1
n =7:e =1+1+ 2 + 6 + 24 + 120 + 720 = 2.7180
1 1 1 1 1 1
n =8:e =1+1+ 2 + 6 + 24 + 120 + 720 + 5040 = 2.7182
1 1 1 1 1 1 1
n =9:e =1+1+ 2 + 6 + 24 + 120 + 720 + 5040 + 40320 = 2.7183
1 1 1 1 1 1 1 1
n = 10 : e = 1 + 1 + 2 + 6 + 24 + 120 + 720 + 5040 + 40320 + 3628800 = 2.7183
8 / 19
Significant figures(digits)
Each of the digits of a number that are used to express it to the required
degree of accuracy, starting from the first non-zero digit. Significant
figures(digits) are any non-zero digits or embedded zeros. They do not
include leading or trailing zeros.
Rules to identify significant digits
Non zero digits are always significant.
Leading zeros are never significant
Embedded zeros are always significant.
Trailing zeros are significant if decimal point is specified otherwise not
significant.

1.234 (All non zero digits), Significant digits = 4


0.000237 (Leading zeros), Significant digits = 3
1.2350001 (Embedded zeros), Significant digits = 8
123000 (Trailing zeros), Significant digits = 3
123000. (Trailing zeros), Significant digits = 6
123000.00 (Trailing zeros), Significant digits = 8 9 / 19
Absolute error for the sum, product and quotient of two
numbers
Let a and b be any two approximate numbers and EA1 and EA2 be
corresponding absolute errors, then the exact numbers are a + EA1 and
b + EA2 .

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

The following numbers are rounded to two decimal places:


X = 1.231 → X 1 = 1.23 EA = 0.001
X = 1.232 → X 1 = 1.23 EA = 0.002
X = 1.233 → X 1 = 1.23 EA = 0.003
X = 1.234 → X 1 = 1.23 EA = 0.004
X = 1.236 → X 1 = 1.24 EA = 0.004
X = 1.237 → X 1 = 1.24 EA = 0.003
X = 1.238 → X 1 = 1.24 EA = 0.002
X = 1.239 → X 1 = 1.24 EA = 0.001
X = 1.235 → X 1 = 1.24 EA = 0.005
X = 1.245 → X 1 = 1.24 EA = 0.005
X = 1.235001 → X 1 = 1.24 EA = 0.004999
12 / 19
Upper limiting error of an approximate number

If X is rounded to 2 decimal places, the upper limiting error,

∆X = 0.005 (Maximum value of EA )

∆X = 0.5 × 0.01
1
∆X = 2 × 0.01

∆X = 1
2 × 10−2

Theorem
General formula for ∆X :

If a number X is rounded to N decimal places then upper limiting error


∆X is given by the following relation:

∆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

Similarly, 45.2537 − 7.1 = 38.2

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

Similarly, 2.31 ÷ 23 = 0.10

14 / 19
Arithmetic Operations

Example
1.625(10.21−7.5431)
Simplify: 47

10.21 − 7.5431 = 2.6669 rounded to 2.67(Two decimal places)


1.625 × 2.67 = 4.33875 rounded to 4.339(Three significant digits)
4.339 ÷ 47 = 0.0935957 rounded to 0.094(Two significant digits)

Example
Simplify: 16.25(37.513+2.34689)
3.2(12.4234−3.73)

Solution:23.

15 / 19
A general error formula

Let u = f (x1 , x2 , x3 , · · · , xn ) be a function of several variables


xi (i = 1, 2, 3, · · · , n) and let the error in each xi be ∆xi .
Then the error in u is ∆u given by

u + ∆u = f (x1 + ∆x1 , x2 + ∆x2 , x3 + ∆x3 , · · · , xn + ∆xn ) (1)

Expanding the right hand side by Taylor’s series expansion, we obtain

u + ∆u = f (x1 + ∆x1 , x2 + ∆x2 , · · · , xn + ∆xn )


∂f ∂f ∂f
= f (x1 , x2 , x3 , · · · , xn + ∆x1 + ∆x2 + · · · + ∆xn
∂x1 ∂x2 ∂xn
 2
1 ∂ f 2 ∂2f
+ (∆x 1 ) + · · · + (∆xn )2
2 ∂x12 ∂xn2
∂2f ∂2f

+ 2 ∆x1 ∆x2 + · · · + 2 ∆xn−1 ∆xn + · · · (2)
∂x1 ∂x2 ∂xn−1 ∂xn

16 / 19
n
X ∂f
u + ∆u = f (x1 , x2 , x3 , · · · , xn ) + ∆xi + terms involving (∆xi )2 . (3)
∂xi
i=1

Neglecting second and higher degree error terms, we get


n
X ∂f
u + ∆u = u + ∆xi (4)
∂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.

Since, the given numbers are correct to 2 decimal places,


∆x = ∆y = ∆z = 12 × 10−2 = 0.005
20x 2 z 2 10 × 2.472 × 13.652
Here, u = 2
, (u))x=2.47,y =34.26,z=13.65 = = 9.68
y 34.262
20xz 2 20 × 2.47 × 13.652
 
∂u ∂u
= , = = 7.84
∂x y2 ∂x x=2.47,y =34.26,z=13.65 34.262
−20x 2 z 2 −20 × 2.472 × 13.652
 
∂u ∂u
= 3
, = = −0.57
∂y y ∂y x=2.47,y =34.26,z=13.65 34.263
20x 2 z 20 × 2.472 × 13.65
 
∂u ∂u
= , = = 1.42
∂z y2 ∂z x=2.47,y =34.26,z=13.65 34.262

∂u ∂u ∂u
Now , (∆u)max = ∆x + ∆y + ∆z

∂x ∂y ∂z
= |7.84 × 0.005| + | − 0.57 × 0.005| + |1.42 × 0.005| = 0.04915 (8)
(ER )max = (∆u)max /u = 0.04915/9.68 = 0.0051
18 / 19
Example
5xy 2
Find the maximum relative error of the function u = z3 at x = y = z = 1
and ∆x = ∆y = ∆z = 0.001.

19 / 19

You might also like