Professional Documents
Culture Documents
Methods
Lecture-2
[MA-200]
ARISHA ALI
Sources of Error
ARISHA ALI
Measuring Tools Creation of Mathematical Human Error
and Methods Model for problem
Inherit Error
Numerical Errors
ARISHA ALI 3
Truncation Error
It is an error due to truncating a process involving infinite number of steps to finite numbers of
steps.
For example,
𝑥2 𝑥3 𝑥4 𝑥5
Maclaurine series of 𝑒𝑥 =1+𝑥+ + + + +⋯
2! 3! 4! 5!
We cannot use infinite terms: say we can use only first four terms
𝑥2 𝑥3
Truncate it to 𝑒𝑥 ≈1+𝑥+ +
2! 3!
𝑥2 𝑥3
Truncation error = 𝑒𝑥 − (1 + 𝑥 + + )
2! 3!
𝑥4 𝑥5
= + +⋯
4! 5!
ARISHA ALI 4
Example
Estimate 𝑒 0.5 for different number of terms and calculate relative %
approximation error (Exact value of 𝑒 0.5 up to 5 decimal places is 1.64872)
ARISHA ALI 5
Example
1Τ 2
Given that 0 2
𝑒 𝑥 𝑑𝑥 = 0.544987104184 = 𝑥 , determine the accuracy of
2
approximation obtain by replacing the integrand 𝑓 𝑥 = 𝑒 𝑥 with the truncated
Taylor series
𝑥 4 𝑥 6 𝑥 8
𝑥2
𝑒 = 1 + 𝑥2 + + +
2! 3! 4!
1ൗ 4 6 8
2 𝑥 𝑥 𝑥
=න 1 + 𝑥2 + + + 𝑑𝑥
0 2! 3! 4!
1ൗ
𝑥3 𝑥5 𝑥7 𝑥9 2
= 𝑥+ + + +
3 5(2!) 7(3!) 9(4!) 0
ARISHA ALI 6
Cont…
1 1Τ 3 1Τ 5 1Τ 7 1Τ 9
= + 2 + 2
+ 2
+ 2
2 3 5(2!) 7(3!) 9(4!)
1 1 1 1 1 1 1 1 1
= + ∗ + ∗ + ∗ + ∗
2 8 3 32 10 128 42 512 216
1 1 1 1 1
= + + + +
2 24 320 5376 110592
2109491
=
3870720
𝑥 ∗ = 0.544986720817
ARISHA ALI 7
Cont…
𝐸𝑟𝑟𝑜𝑟 = 𝑥 − 𝑥 ∗
= 0.544987104184 − 0.544986720817
= 0.000000383367
= 3.83367 ∗ 10−7
ARISHA ALI 8
Homework
Complete the following computation
1Τ 2 1Τ 𝑥4 𝑥6
0 4
𝑒 𝑥 𝑑𝑥 ≅ 0 4
1+ 𝑥2 + + 𝑑𝑥
2! 3!
State what type of error is present in this situation. Compare your answer with
true value 0.2553074606
ARISHA ALI 9
Round off Error
ARISHA ALI
Floating Point Number
ARISHA ALI 11
Normalization Rules for floating Point
Numbers
▪ The integer part Should be Zero
▪ 0. 𝑑1 𝑑2 𝑑3 … 𝑑𝑛 ∗ 𝐵𝐼𝐸 𝑡ℎ𝑒𝑛 𝑑1 > 0
0.123 ∗ 104
0.0123 ∗ 106
1.23 ∗ 103
ARISHA ALI 12
Representation Techniques
IEEE(Institute of Electrical and Electronic Engineering) 754 floating point
standard
▪ Single Precision (32 bit)
ARISHA ALI 13
Chopping Versus Rounding
Chopping Rounding
𝑒 = 2.71828182845 … 𝑒 = 2.71828182845 …
We Need 7 significant digits We Need 7 significant digits
𝑒 = 2.71828182845 … 𝑒 = 2.71828182845 …
After Chopping After Rounding
𝑒 = 2.718281 𝑒 = 2.718282
𝐸𝑟𝑟𝑜𝑟 = 8.2844999 ∗ 10−7 𝐸𝑟𝑟𝑜𝑟 = −1.715499 ∗ 10−7
ARISHA ALI 14
Remarks
▪Rounding is a better choice since the sign of the error can be either positive or
negative leading to smaller total numerical error.
▪Whereas error in chopping is always positive and always adds up.
15
Example
Determine the five-digit normalized decimal form (a) chopping and (b) rounding
values of the irrational number 𝜋.
𝜋 = 3.14159265
Solution:
Written in normalized decimal form
𝜋 = 0.314159265 … ∗ 101
(a) The floating-point form of 𝜋 using five-digit chopping is
𝑓𝑙(𝜋) = 0.31415 ∗ 101 = 3.1415.
ARISHA ALI 16
Cont…
𝜋 = 0.314159265 … ∗ 101
(b) The sixth digit of the decimal expansion of 𝜋 is a 9, so the floating-point
form of 𝜋 using five-digit rounding is
𝑓𝑙 𝜋 = 0.31415 + 0.00001 ∗ 101 = 3.1416.
ARISHA ALI 17