Numerical Methods Introduction To Numerical Methods
Numerical Methods Introduction To Numerical Methods
By
Numerical Methods
by Norhayati Rosli
http://ocw.ump.edu.my/course/view.php?id=449
Description
AIMS
This chapter is an introduction to the numerical methods. It is aimed to:
1. introduce the concept of precision and accuracy.
2. compute the approximate and true percent relative errors.
3. approximate the functions by using Taylor’s series.
4. define the concept of round-off error, truncation error and total numerical error.
EXPECTED OUTCOMES
REFERENCES
1. Norhayati Rosli, Nadirah Mohd Nasir, Mohd Zuki Salleh, Rozieana Khairuddin, Nurfatihah Mohamad Hanafi,
Noraziah Adzhar. Numerical Methods, Second Edition, UMP, 2017 (Internal use)
2. Chapra, C. S. & Canale, R. P. Numerical Methods for Engineers, Sixth Edition, McGraw–Hill, 2010.
Numerical Methods
by Norhayati Rosli
http://ocw.ump.edu.my/course/view.php?id=449
Content
Numerical Methods
by Norhayati Rosli
http://ocw.ump.edu.my/course/view.php?id=449
WHAT ARE NUMERICAL METHODS?
The approximate
It can be methods for solving a
implemented
directly on digital
4 1 wide variety of
mathematical
computers problems.
Numerical Methods
by Norhayati Rosli
http://ocw.ump.edu.my/course/view.php?id=449
ERRORS
1 Numerical error
occurs during the
computational
process.
Error
Definition
It can be characterized
by two types of
measurements-
3 2 Error measure how
close the approximate
solution to the true or
accuracy and precision exact solution
Numerical Methods
by Norhayati Rosli
http://ocw.ump.edu.my/course/view.php?id=449
ERRORS (Cont.)
Definition Accuracy & Precision
Accuracy
Imprecision
4 1 How close the
computed or
measured value to
Magnitude of scatter
the true value
Accuracy
&
Precision
Precision
How close a computed
value to previously
3 2 Inaccuracy
A systematic deviation
computed value from the actual value
Numerical Methods
by Norhayati Rosli
http://ocw.ump.edu.my/course/view.php?id=449
ERRORS (CONT.)
Numerical Methods
by Norhayati Rosli
http://ocw.ump.edu.my/course/view.php?id=449
ERRORS (Cont.)
Numerical Methods
by Norhayati Rosli
http://ocw.ump.edu.my/course/view.php?id=449
ERRORS (Cont.)
The iterative process is computed until
a s (2)
If the relationships (2) is hold, then the acceptable result has been
reached and no more iteration is required.
Solution
Et ,1 3945 3940 5m
True percent relative error in measuring the height of the building, 𝜀𝑡,1
5
t ,1 100% 0.13%
3945
Numerical Methods
by Norhayati Rosli
http://ocw.ump.edu.my/course/view.php?id=449
ERRORS (Cont.)
Solution (Cont.)
Et ,2 40 35 5m
5
t ,2 100% 13%
40
True percent relative error gives better measurement of the error compare
than true error
Numerical Methods
by Norhayati Rosli
http://ocw.ump.edu.my/course/view.php?id=449
ERRORS (Cont.)
Example 2: Error Estimate for Iterative Methods
Taylor’s series expansion of sin 𝑥 is given by
𝑥3 𝑥5 𝑥7 𝑥9 𝑥 11
sin 𝑥 = 𝑥 − + - + - +⋯
3! 5! 7! 9! 11!
𝜋
Estimate sin by adding terms one at a time to the above series. Iterate until
3
𝜋
𝜀𝑎 < 0.05%.If given the true value of sin = 0.8660, compute the true percent
3
relative error, 𝜀𝑡 after each iteration.
Solution
𝒊 Approximate value 𝜀𝑎 𝜀𝑡
1 𝜋 𝜋 - 20.92%
sin = = 1.0472
3 3
2 𝜋 𝜋 𝜋3 22.37% 0.045% 𝜀𝑎 < 0.05%,
sin = − = 0.8558
3 3 3! hence stop
3 𝜋 𝜋 𝜋3
𝜋 5 1.21% 0.04% the
sin = − + 3 = 0.8663 computation
3 3 3! 5!
4 0.8660 0.04% 0%
Numerical Methods
by Norhayati Rosli
http://ocw.ump.edu.my/course/view.php?id=449
TAYLOR’S SERIES EXPANSION
Taylor’s
Series
If only a few terms are
used, the value of the
function that is obtained
from the Taylor series is an
3 2 Function is
represented by a
sum of terms of a
approximation value convergent series
Numerical Methods
by Norhayati Rosli
http://ocw.ump.edu.my/course/view.php?id=449
TAYLOR’S SERIES EXPANSION
(Cont.)
A one dimensional Taylor series is a Taylor’s expansion for a function
𝑓 𝑥 that is differentiable 𝑛 + 1 times in an interval containing a point
𝑥 = 0.
Taylor’s theorem state that for each 𝑥 in the interval, there exist a value
𝑥 = 𝛿 in between 𝑥 = 𝑥0 and 𝑥.
Examples of the Taylor’s series expansion for the selected functions are given
in Table 1.
Table 1: Taylor’s Series Expansions for the Selected Functions
𝒇(𝒙) Taylor Series Expansion of 𝒇(𝒙)
1 2 1 3
exp(𝑥) exp 𝑥0 [1 + 𝑥 − 𝑥0 + 2! 𝑥 − 𝑥0 + 3! 𝑥 − 𝑥0 + ⋯]
cos(𝑥) cos 𝑥0 − sin 𝑥0 𝑥 − 𝑥0 − 12 cos 𝑥0 𝑥 − 𝑥0 2 +1 sin
6 𝑥0 𝑥 − 𝑥0 3
+⋯
sin(𝑥) 𝑠𝑖𝑛 𝑥0 + 𝑐𝑜𝑠 𝑥0 𝑥 − 𝑥0 − 12 𝑠𝑖𝑛 𝑥0 𝑥 − 𝑥0 2 −1 cos
6 𝑥0 𝑥 − 𝑥0 3
+⋯
Numerical Methods
by Norhayati Rosli
http://ocw.ump.edu.my/course/view.php?id=449
TAYLOR’S SERIES EXPANSION
(Cont.)
Example 3
Approximate the function 𝑓(𝑥) = cos 𝑥 by using Taylor series expansion about 𝑥 = 0
using two, four and six terms. In each case calculate the approximate value of the
𝜋 𝜋
function at 𝑥 = and 𝑥 = .
12 3
Solution
Find the first five derivatives of the function and the value at 𝑥 = 0of the respective
derivatives are substituted.
𝑛 Derivative of the Value of the
Function Derivative
0 𝑦 𝑥 = cos(𝑥) 𝑦 0 =1
1 𝑦 ′ 𝑥 = −sin(𝑥) 𝑦′ 0 = 0
Step 1 2 𝑦 ′′ 𝑥 = −cos(𝑥) 𝑦 ′′ 0 = −1
3 3 3
𝑦 𝑥 = sin(𝑥) 𝑦 0 =0
4 4 4
𝑦 𝑥 = cos(𝑥) 𝑦 0 =1
5 5 5
𝑦 𝑥 = −sin(𝑥) 𝑦 0 =0 Numerical Methods
by Norhayati Rosli
http://ocw.ump.edu.my/course/view.php?id=449
TAYLOR’S SERIES EXPANSION
(Cont.)
Solution (Cont.)
x2 x3 x4 x5
cos( x) 1 x(0) ( 1) (0) (1) (0)
2! 3! 4! 5!
x2 x4
1 0 0 0
2! 4!
Numerical Methods
by Norhayati Rosli
http://ocw.ump.edu.my/course/view.php?id=449
TAYLOR’S SERIES EXPANSION
(Cont.)
Solution (Cont.)
The approximate values using two, four and six terms of Taylor
Step 3 series expansion are summarised in the following table.
𝝅
Number of The Approximate Values for 𝒙 = The Approximate Values for
𝟏𝟐 𝝅
Terms 𝒙=
𝟑
Two terms 𝜋 𝜋
𝑐𝑜𝑠 =1+0=1 𝑐𝑜𝑠 = 1+0=1
12 3
Four Terms 𝜋 2 𝜋 2
𝜋 𝜋
𝑐𝑜𝑠 = 1 − 12 = 0.9657305 𝑐𝑜𝑠 =1− 3
12 2 3 2
= 0.4516886
Six Terms 0.9659263 0.5017962
Numerical Methods
by Norhayati Rosli
http://ocw.ump.edu.my/course/view.php?id=449
TRUNCATION ERROR
Truncation error resulting from the truncation of the numerical process in
order to estimate finite number of terms from the sum of an infinite series.
It arises due to the approximation method is used instead of the exact
procedure.
As in Example 2, the numerical evaluation of sine function by using Taylor’s
series is terminated after a certain term. This contribute to the truncation
error.
Numerical Methods
by Norhayati Rosli
http://ocw.ump.edu.my/course/view.php?id=449
ROUND-OFF ERROR
Computer approximation retain only a fixed number of significant figures
during a calculation.
1
Numbers such as 3 = 0.333333 … , 𝑒 = 2.71828182... and 𝜋= 3.1415926 …
cannot be expressed by a fixed number of significant figures.
Therefore they cannot be represented exactly by the computer and must
be round–off.
There are two situations in numerical computations where a number can
be shortened and lead to round off–errors which is either by chopping off or
by rounding.
Round off–errors can be reduced by increasing the numbers of significant
figures
Example 4
2
1
3
= 0.6666 if the actual number has been chopped off
2
2 = 0.6667 if the actual number has been rounded
3
Numerical Methods
by Norhayati Rosli
http://ocw.ump.edu.my/course/view.php?id=449
TOTAL NUMERICAL ERROR
Includes round–off
2 Total
and truncation
errors
Sum of the
round–off and Numerical 1
truncation errors Error
yield the total of
numerical error
Numerical Methods
by Norhayati Rosli
http://ocw.ump.edu.my/course/view.php?id=449
Conclusion
Numerical Methods
by Norhayati Rosli
http://ocw.ump.edu.my/course/view.php?id=449
Author Information
Norhayati Binti Rosli,
Nadirah Binti Mohd Nasir Senior Lecturer,
Lecturer Applied & Industrial Mathematics
Research Group,
Fakulti Sains & Teknologi Industri,
Faculty of Industrial Sciences &
Universiti Malaysia Pahang, Technology (FIST),
26300, Gambang, Pahang. Universiti Malaysia Pahang,
Google Scholar 26300 Gambang, Pahang.
: https://scholar.google.com/citatio SCOPUS ID: 36603244300
ns?user=-_qoGAsAAAAJ&hl=en UMPIR ID: 3449
email : [email protected] Google
Scholars: https://scholar.google.com/cit
ations?user=SLoPW9oAAAAJ&hl=en
e-mail: [email protected]
Numerical Methods
by Norhayati Rosli
http://ocw.ump.edu.my/course/view.php?id=449