Professional Documents
Culture Documents
Lecture 2
Lecture 2
1
Contents
1. Error Definition
1.1 Absolute Error
1.2 Relative Error
2. Types of Computational Errors
2.1 Round Off Error
2.2 Truncation Error
2.3 Machine Epsilon Error
3. Numerical Instability
3.1 Inherent Instability
3.2 Induced Instability
2
Error Definition
𝐸𝑟𝑟𝑜𝑟
𝑅𝑒𝑙𝑎𝑡𝑖𝑣𝑒 𝐸𝑟𝑟𝑜𝑟 =
𝑇𝑟𝑢𝑒 𝑉𝑎𝑙𝑢𝑒
𝐸𝑟𝑟𝑜𝑟
%𝑅𝑒𝑙𝑎𝑡𝑖𝑣𝑒 𝐸𝑟𝑟𝑜𝑟 = 𝑋100
𝑇𝑟𝑢𝑒 𝑉𝑎𝑙𝑢𝑒
3
Problem Statement: Suppose that you have the task of measuring the lengths of
a bridge and a rivet and come up with 9999 and 9 cm, respectively. If the true
values are 10,000 and 10 cm, respectively, compute (a) the true error and (b)
the true percent relative error for each case.
Solution.
(a) The error for measuring the bridge is
Error = 10,000−9999 = 1 cm
and for the rivet it is
Error = 10−9 = 1 cm
Thus, although both measurements have an error of 1 cm, the relative error for
the rivet is much greater. We would conclude that we have done an adequate
job of measuring the bridge, whereas our estimate for the rivet leaves
something to be desired.
4
Types of Computational Errors
1
= 0.3333; 𝑅 = 0.0000333 … .
3
Other examples are rational numbers, roots of most positive numbers.
Note: Round Off Error is not under the control of the user.
5
Types of Computational Errors contd…
2) Truncation Error:
It is a quantity ‘T’ which must be added to the representation of a quantity in
order to make this quantity exactly equal to the number. It arises due to the
use of approximate formulae based on Taylor’s series.
Example:
𝑥
𝑥2 𝑥3 𝑥4 𝑥𝑛
𝑒 =1+𝑥+ + + + ⋯……………….+ (𝑓𝑜𝑟 𝑠𝑚𝑎𝑙𝑙 𝑥)
2! 3! 4! 𝑛!
So, 𝑒 0.1 = 1.1 (𝑖𝑓 𝑜𝑛𝑙𝑦 𝑓𝑖𝑟𝑠𝑡 𝑡𝑤𝑜 𝑡𝑒𝑟𝑚𝑠 𝑎𝑟𝑒 𝑐𝑜𝑛𝑠𝑖𝑑𝑒𝑟𝑒𝑑) and
𝑒 0.1 = 1.105 (𝑖𝑓 𝑜𝑛𝑙𝑦 𝑓𝑖𝑟𝑠𝑡 𝑡ℎ𝑟𝑒𝑒 𝑡𝑒𝑟𝑚𝑠 𝑎𝑟𝑒 𝑐𝑜𝑛𝑠𝑖𝑑𝑒𝑟𝑒𝑑)
Note: Truncation Error is under the control of the user. If we need better
approximation, we can take more terms in the Taylor’s series.
6
Types of Computational Errors contd…
7
Other Sources of Errors
0.5×10−5 +0.5×10−5
Now relative error in (𝑥 − 𝑦) is ≈ 2.32 × 10−3 , which is
0.000431×101
8
Other Sources of Errors
Therefore, error in the 6th place of ′𝑥′ has produced error in the 5th place of
𝑓 𝑥 .
9
Numerical Instability
If the growth of error is under control i.e. bounded then the method gives
stable results. Otherwise, Numerical Instability occurs.
10
Inherent Instability
Example of Wilkinson:
Finding the zeros of the polynomial: 𝑃20 = 𝑥 − 1 𝑥 − 2 … 𝑥 − 20
i.e. 𝑃20 = 𝑥 20 − 210𝑥 19 + ⋯ + 20!
Exact roots are: 1, 2, 3, …, 20.
Now change −210 𝑡𝑜 − (210 + 2−23 ), where 2−23 is of the order of
machine epsilon.
If we use the standard methods to find the roots, we obtain the smallest roots
with good accuracy.
Accuracy decreases as larger roots are obtained.
For 𝑟𝑜𝑜𝑡𝑠 ≥ 12, they become complex pairs.
This is an example of Inherent Instability.
11
Induced Instability
1 𝑥𝑛
Example: Evaluate 𝐼𝑛 = 0 𝑥+6
𝑑𝑥, 𝑛 = 1, 2, 3, … , 10
12
Induced Instability
1 𝑥𝑛
Example: Evaluate 𝐼𝑛 = 0 𝑥+6
𝑑𝑥, 𝑛 = 1, 2, 3, … , 10
1 1 1 1 1 1
𝐼𝑛−1 = 6 − 𝐼𝑛 and then 𝐼9 = 6 − 𝐼10 = 0.01666, 𝐼8 = 6 − 𝐼9 =
𝑛 10 9
0.01574, … . , 𝐼1 = 0.15415
13
Quiz: Choose the best answer
1) The error that occurs in the result of the quantity 𝑒 0.05 sin 45 is
a) Truncation Error
b) Machine Epsilon Error
c) Round-off Error
d) None of them
Ans: a
14
Quiz: Choose the best answer
2
2) The error that occurs in the result of the quantity ′ 3 ′is
a) Truncation Error
b) Machine Epsilon Error
c) Round-off Error
d) None of them
Ans: c
15
Quiz: State True or False
Ans: False
Explanation: It is not under the control of the user, only truncation error is
under the control of the user.
16
Quiz: Fill in the blanks
17
Summary
Following topics are covered in this lecture:
1. Error Definition
1.1 Absolute Error
1.2 Relative Error
2. Computational Errors
2.1 The Truncation Error
2.2 The Round-off Error
2.3 The Machine Epsilon Error
3. Numerical Instability
3.1 Inherent Instability
3.2 Induced Instability
18