Professional Documents
Culture Documents
Chap 1
Chap 1
2022
1/22
(UNIMAS) Chapter 1: Error Analysis 2022 1 / 22
Outline
1 Measuring Errors
True Error
Relative True Error
Approximate Error
Relative Approximate Error
Significant Digits
2 Sources of Error
Round-O↵ Error
Truncation Error
2/22
(UNIMAS) Chapter 1: Error Analysis 2022 2 / 22
True Error
3/22
(UNIMAS) Chapter 1: Error Analysis 2022 3 / 22
True Error
Example
The derivative of a function f (x) at a particular value of x can be
approximately calculated by
f (x + h) f (x)
f 0 (x) ⇡ .
h
For f (x) = 7e 0.5x and h = 0.3, find
(a) the approximate value of f 0 (2)
(b) the true value of f 0 (2)
(c) the true error for part (a)
4/22
(UNIMAS) Chapter 1: Error Analysis 2022 4 / 22
True Error
Solution:
(a)
f (x + h) f (x)
f 0 (x) ⇡
h
f (2 + 0.3) f (2) 7e 0.5(2.3) 7e 0.5(2)
f 0 (2) ⇡ =
0.3 0.3
22.107 19.028
= = 10.2646
0.3
(b) The exact value of f 0 (2) can be calculated by using our
knowledge of di↵erential calculus.
f (x) = 7e 0.5x
f 0 (x) = 7(0.5)e 0.5x = 3.5e 0.5x ) f 0 (2) = 3.5e 0.5(2) = 9.5140
5/22
(UNIMAS) Chapter 1: Error Analysis 2022 5 / 22
True Error
(c)
6/22
(UNIMAS) Chapter 1: Error Analysis 2022 6 / 22
Relative True Error
The magnitude of true error does not show how bad the error is.
This brings us to the definition of relative true error.
relative .
7/22
(UNIMAS) Chapter 1: Error Analysis 2022 7 / 22
Relative True Error
Example
The derivative of a function f (x) at a particular value of x can be
approximately calculated by
f (x + h) f (x)
f 0 (x) ⇡ .
h
For f (x) = 7e 0.5x and h = 0.3, find the relative true error at x = 2.
Solution:
True Value Approximate Value 0.75061
"t = =
True Value 9.5140
= 0.078895/ 7.8895%
But mostly we will not have the luxury of knowing true values as why
would you want to find the approximate values if you know the true
values.
9/22
(UNIMAS) Chapter 1: Error Analysis 2022 9 / 22
Approximate Error
Example
The derivative of a function f (x) at a particular value of x can be
approximately calculated by
f (x + h) f (x)
f 0 (x) ⇡ .
h
For f (x) = 7e 0.5x and at x = 2, find
(a) f 0 (2) using h = 0.3
(b) f 0 (2) using h = 0.15
(c) approximate error for the value of f 0 (2) for part (b)
10/22
(UNIMAS) Chapter 1: Error Analysis 2022 10 / 22
Approximate Error
Solution:
(a)
The magnitude of approximate error does not show how bad the
error is. This brings us to the definition of relative approximate
error.
Relative approximate error is denoted by "a and is defined as the
ratio between the approximate error and the present
approximation.
Approximate Error
Relative Approximate Error =
Present Approximation
12/22
(UNIMAS) Chapter 1: Error Analysis 2022 12 / 22
keeping 4,5, 6 decimal point
Relative Approximate Error
Example
The derivative of a function f (x) at a particular value of x can be
approximately calculated by
f (x + h) f (x)
f 0 (x) ⇡ .
h
For f (x) = 7e 0.5x , find the relative approximate error in calculating f 0 (2)
using vlaues from h = 0.3 and h = 0.15.
Solution:
Approximate Value 0.3874
"a = =
Present Approximation 9.8799
= 0.038942/ 3.8942%
Absolute relative approximate errors may also need to be calculated,
|"a | = | 0.038942| = 0.038942 = 3.8942% 13/22
(UNIMAS) Chapter 1: Error Analysis 2022 13 / 22
Relative Approximate Error
In a numerical method that uses iterative methods, a user can
calculate relative approximate error "a at the end of each
iteration.
The user may pre-specify a minimum acceptable tolerance called
the pre-specified tolerance, "s .
If the absolute relative approximate error "a is less than or equal
to the pre-specified tolerance "s , i.e. |"a | "s , then the
acceptable error has been reached and no more iterations would
be required.
Alternatively, one may pre-specify how many significant digits
they would like to be correct in their answer. In that case, if one
wants at least m significant digits to be correct in the answer,
then you would need to have the absolute relative approximate
error, |"a | 0.5 ⇥ 102 m %.
14/22
(UNIMAS) Chapter 1: Error Analysis 2022 14 / 22
Relative Approximate Error
Example
If one chooses 6 terms of the Maclaurin series for e x to calculate e 0.7 , how
many significant digits can you trust in the solution? Find your answer
without knowing or using the exact answer.
x x2
e =1+x + + ···
2!
Using 6 terms, we get the current approximation as
0.72 0.73 0.74 0.75
e 0.7 = 1 + 0.7 + + + + = 2.0136
2! 3! 4! 5!
Using 5 terms, we get the previous approximation as
0.72 0.73 0.74
e 0.7 = 1 + 0.7 + + + = 2.0122
2! 3! 4!
15/22
(UNIMAS) Chapter 1: Error Analysis 2022 15 / 22
Relative Approximate Error
2.0136 2.0122
|"a | = ⇥ 100% = 0.069527%
2.0136
0.5×10
0.05 % ≤ 0.0695277 .
≤ 0.5%
16/22
(UNIMAS) Chapter 1: Error Analysis 2022 16 / 22
Significant Digits
Example
0.0459 has three significant digits
4.590 has four significant digits
4008 has four significant digits
4008.0 has five significant digits
1.079 ⇥ 103 has four significant digits
1.0790 ⇥ 103 has five significant digits
1.07900 ⇥ 103 has six significant digits
17/22
(UNIMAS) Chapter 1: Error Analysis 2022 17 / 22
Sources of Error
Error in solving an engineering or science problem can arise due
to several factors.
First, the error may be in the modeling technique. A
mathematical model may be based on using assumptions that
are not acceptable. For example, one may assume that the drag
force on a car is proportional to the velocity of the car, but
actually, it is proportional to the square of the velocity of the
car. This itself can create huge errors in determining the
performance of the car, no matter how accurate the numerical
methods you may use are.
Second, errors may arise from mistakes in programs themselves
or in the measurement of physical quantities. But, in
applications of numerical methods itself, the two errors we need
to focus on are
I Round o↵ error
I Truncation error. 18/22
(UNIMAS) Chapter 1: Error Analysis 2022 18 / 22
Round-O↵ Error
19/22
(UNIMAS) Chapter 1: Error Analysis 2022 19 / 22
Truncation Error
Truncation error is defined as the error caused by truncating a
mathematical procedure. For example, the Maclaurin series for
e x is given as
x2 x3
ex = 1 + x + + + ··· .
2! 3!
This series has an infinite number of terms but when using this
series to calculate e x , only a finite number of terms can be
used. For example, if one uses three terms to calculate e x , then
x x2
e =1+x + .
2!
The truncation error for such an approximation is
✓ ◆
x x2 x3 x4
truncation error = e 1+x + = + + ··· .
2! 3! 4!
20/22
(UNIMAS) Chapter 1: Error Analysis 2022 20 / 22
Truncation Error
21/22
(UNIMAS) Chapter 1: Error Analysis 2022 21 / 22
Truncation Error
n e 1.2 Ea |"a |%
1 1 - -
2 2.2 1.2 54.546
3 2.92 0.72 24.658
4 3.208 0.288 8.9776
5 3.2944 0.0864 2.6226
6 3.3151 0.020736 0.62550
22/22
(UNIMAS) Chapter 1: Error Analysis 2022 22 / 22