02 Introduction To Numerical Analysis
02 Introduction To Numerical Analysis
Chapter 1
INTRODUCTION TO NUMERICAL ANALYSIS
AHMAD NURFAIDHI RIZALMAN (PhD)
Civil Engineering Programme
, No. 66 Level 2 Block A, Faculty of Engineering
( 088 – 320000 (ext. 3033) + [email protected]
Prepared by: Ahmad Nurfaidhi Rizalman
CONTENT
Sample Questions
Solution to Exercise
1
3/15/21
INTRODUCTION
INTRODUCTION
There are three (3) methods to solve engineering problems:
Experiment Simulation Mathematical Model
Outcome is expressive but Define and solve the Expresses the problems in
involves lots of equipment problems graphically to mathematical terms (i.e.
and facilities which are characterize the behavior of formula). Solutions are
expensive. systems. derived analytically or
numerically.
2
3/15/21
INTRODUCTION
There are two (2) types of mathematical models
ANALYTICAL NUMERICAL
• Produce exact solutions. • Produce approximate solutions.
• Limited to linear problems with simple • Capable to solve nonlinear problems
geometry and low dimensionality. with complex shapes and high
dimensionality.
• Thus, it involves large numbers of
tedious arithmetic calculations.
• This method has increased dramatically
due to the development of digital
computers and software, i.e. MATLAB,
Excel, SPSS, and etc.
INTRODUCTION
There are eight (8) types of numerical methods, including
a) Nonlinear Equations (Roots of Equations).
b) Linear Equations
c) Optimization
d) Curve Fitting
e) Interpolation
f) Numerical Differentiation and Integration
g) Ordinary Differential Equations
h) Partial Differential Equations
3
3/15/21
INTRODUCTION
a) Nonlinear Equations (Roots of Equations)
These problems are concerned with the value of
a variable or a parameter that satisfies a single
nonlinear equations. (i.e. solve 𝑓 𝑥 = 0 for 𝑥).
INTRODUCTION
b) Linear Algebraic Equations
They are also concerned with values that satisfy
equations. But, in this approach, a set of values is
sought that simultaneously satisfies a set of linear
algebraic equations.
4
3/15/21
INTRODUCTION
c) Optimization
The problem involve determining value(s) of an
independent variable that correspond to a “best,”
or optimal, value of a function.
INTRODUCTION
d) Curve Fitting
Curve fitting (or regression) is employed where
there is a significant degree of error associated
with the data.
10
5
3/15/21
INTRODUCTION
e) Interpolation
Interpolation is used where the objective is to
determine intermediate values between
relatively error-free data points.
11
INTRODUCTION
f) Numerical Differentiation and Integration
Numerical integration is determination of the
area under a curve.
12
6
3/15/21
INTRODUCTION
g) Ordinary Differential Equations
ODE are of great significance in engineering
practice. For instance, the acceleration of a falling
body (rate of change of velocity).
Given
%& (&
%'
≈ ()
= 𝑓(𝑡, 𝑦)
Solve for 𝑦 as a function of 𝑡.
𝑦*+! = 𝑦* + 𝑓 𝑡* , 𝑦* ∆𝑡
13
INTRODUCTION
h) Partial Differential Equations
They are used to characterize engineering
systems where the behavior of a physical quantity
is couched in terms of its rate of change with
respect to two or more independent variables.
14
7
3/15/21
15
• The concept of significant figures will have relevance to the definition of accuracy
and precision.
16
8
3/15/21
QUESTION 1.1
How many significant figures in the following numbers?
a) 0.01688
b) 0.001688
c) 0.0001688
d) 0.000000001688
e) 37900
f) 3.79 x 104
g) 3.790 x 104
h) 3.7900 x 104
17
(f), (g) and (h) are three, four, or five significant figures, respectively.
18
9
3/15/21
imprecise imprecise
19
• But, since the numerical methods to obtain approximate solutions, it is expected the
results consist of certain errors. There are two (2) major form of unavoidable numerical
errors – (1) Round-off Errors, and (2) Truncation Errors.
20
10
3/15/21
ROUND-OFF ERRORS
21
ROUND-OFF ERROR
• Round-off error arise when the numbers having limited significant figures are used
to represent exact numbers.
• In the calculations, round-off errors occur when the digits to the right of the decimal
are discarded. Say for and 𝜋 computer can store 4 significant figures. Therefore,
a) Chopping-off à 𝜋 = 3.1415
b) Rounding-off à 𝜋 = 3.1416
22
11
3/15/21
QUESTION 1.2
Perform each of the computation below (i) exactly, (ii) using four-digit chopping
arithmetic, and (iii) four-digit rounding arithmetic.
. 0
a) / + 1
. 0
b) /
−1
23
24
12
3/15/21
QUESTION 1.3
Given an irrational number 𝜋 = 3.141592654 …, find the five-digit representations of 𝜋
by
a) Chopping-off technique,
b) Rounding-off technique.
25
26
13
3/15/21
TRUNCATION ERROR
27
TRUNCATION ERROR
• Truncation error arise when approximation are used to represent exact mathematical
procedure or expression. It originates from the technique of replacing a complicated
function with a truncated Taylor series. For example, the infinite Taylor series of
'! '" '# '$ '%
𝑒 ' = 1 + 𝑥 + "! + .! + 2! + 0! + ⋯ + 4!
28
14
3/15/21
QUESTION 1.4
!/" !
Given that ∫5 𝑒 ' 𝑑𝑥 = 0.544987104184. Find the approximation by replacing the
! '# '& ''
integrand 𝑓 𝑥 = 𝑒 ' with the truncated Taylor series 𝑒 ' ≈ 1 + 𝑥 " + "!
+ .!
+ 2!
.
Give the answer in 3 decimal places using round-off technique.
29
30
15
3/15/21
ERROR ANALYSIS
31
ERROR ANALYSIS
In the practice of numerical analysis, it is important to note that computed solutions are
not exact mathematical solutions. Perfect accuracy in most computational processes is
impossible. Therefore, it is imperative to make certain approximations, thus called as
errors.
The error in a computed quantity is defined by the relationship between exact solution (or
true value) and the approximate value. It is expressed as follows:
32
16
3/15/21
ERROR ANALYSIS
The relative error is a measure of the error in relation to the size of the true being sought.
Mathematically, it is expressed as:
<==>=
Relative Error = )=-< ?#@-<
'" A'#
= '$
True percent
)=-< ?#@-< A#BB=>'*C#)< ?#@-<
relative error, 𝜀) = )=-< ?#@-<
× 100%
Approximate percent
B=<D<4) #BB=>'*C#)*>4 AB=<?*>-D #BB=>'*C#)*>4
relative error, 𝜀# = B=<D<4) #BB=>'*C#)*>4
×100%
33
QUESTION 1.5
Find the absolute error and relative error for values given below:
a) Let 𝑥E = 3.141592 and 𝑥F = 3.14
b) Suppose that the true value is 1000000 and our estimation is 999996.
.
c) The answer obtained from analytical solution is ; meanwhile the answer
"05555
from from numerical method is 0.000009.
34
17
3/15/21
35
36
18
3/15/21
QUESTION 1.6
Suppose that you have the task of measuring the length of a table and a handphone,
from measurement, you got 110.0 𝑐𝑚 and 11.0 𝑐𝑚, respectively. Find
a) Absolute error,
b) Relative error (in percentage), for each case.
37
38
19
3/15/21
SAMPLE QUESTIONS
39
QUESTION 1.7
How many significant figures in the following numbers?
a) 929
b) 0.0929
c) 0.00929
d) 0.00000000929
e) 512000
f) 5.12 x 105
g) 5.120 x 105
h) 5.12000 x 105
Solution:
a) - d): Three significant figures
e) may have three, four, five or six significant figures.
f), g) and h) are three, four, or six significant figures, respectively.
Prepared by: Ahmad Nurfaidhi Rizalman
40
20
3/15/21
QUESTION 1.8
Perform each of the computation below (i) exactly, (ii) using three-digit chopping arithmetic,
and (iii) three-digit rounding arithmetic.
2 !
a) 0
+ .
2 !
b) ×
0 .
Solution:
"
a)(i) 1 !0 (ii) 1.13 (iii) 1.13
b)(i) 4⁄15 (ii) 0.266 (iii) 0.267
Prepared by: Ahmad Nurfaidhi Rizalman
41
QUESTION 1.9
Find the representation of the following numbers by chopping–off technique and rounding-off
technique.
a) 97450677
b) e = 2.718281828
c) 0.2553075606
d) mn = 1.67492716 x 10-27
Solution:
a)(i) 97450600 (ii) 97450700
b)(i) 2.71828 (ii) 2.71828
c)(i) 0.255307 (ii) 0.255308
d)(i) 1.67492 ×10A"/ (ii)1.67493 ×10A"/
Prepared by: Ahmad Nurfaidhi Rizalman
42
21
3/15/21
QUESTION 1.10
!/2 ' !
Given that ∫5 𝑒 𝑑𝑥 = 0.2553074606 . Find the approximation by replacing the integrand
! ! '% '&
𝑓 𝑥 = 𝑒 ' with the truncated Taylor series 𝑒 ' ≈ 1 + 𝑥 " + "!
+ .!
. Give the answer in 3
decimal places using round-off technique.
Solution:
0.255
Prepared by: Ahmad Nurfaidhi Rizalman
43
QUESTION 1.11
Find the absolute error and relative error for values given below:
a) Let 𝑥E = 2.7182818 and 𝑥F = 2.7182.
b) Suppose that the true value is 97450 and the estimation is 97000.
c) The answer obtained from analytical solution is 0.000764, meanwhile the answer from
numerical method is 0.000760.
Solution:
a) 0.0000818, 0.00003009
b) 450, 0.004618
c) 0.000004, 0.0005236
Prepared by: Ahmad Nurfaidhi Rizalman
44
22
3/15/21
QUESTION 1.12
If 𝑥 = 2 is approximated by 𝑥̅ = 1.94, find the true error and relative error.
Solution:
True error = 0.06, Relative error = 0.03
Prepared by: Ahmad Nurfaidhi Rizalman
45
QUESTION 1.13
.
If 𝑥 = 𝜋 is approximated by 𝑥̅ = /, find the actual error and relative percent error.
Solution:
True error = 2.71302, Relative percent error = 86.36%
46
23
3/15/21
QUESTION 1.14
Given a function 𝑓 𝑥 = sin(𝑥) . Compute the following Taylor’s polynomial at 𝑥 = 0 for
a) 𝑃! 𝑥 , 𝑃" 𝑥 , 𝑃.(𝑥), and 𝑃G(𝑥),
b) If the above Taylor’s polynomial is used to approximates 𝑠𝑖𝑛 27> , then find the true error
𝐸) of each of these approximations.
47
A systematic way to calculate these polynomials is by constructing a table for the derivatives.
! ! ! !
Therefore 𝑃! 𝑥 = 0, 𝑃" 𝑥 = 𝑥, 𝑃. 𝑥 = 𝑥 − 1 𝑥 . and 𝑃G 𝑥 = 𝑥 − 1 𝑥 . + !"5 𝑥 0 − 0525 𝑥 /.
b) The true value sin 275 = 0.4540. To use these polynomials to approximate sin 27> , we
J
need to take 𝑥 in radians as 𝑥 = 27> × "/' = 0.4712. Hence, the solution is
𝑠𝑖𝑛 27> − 𝑃! 27> = 0.4540
𝑠𝑖𝑛 27> − 𝑃" 27> = 0.0172
𝑠𝑖𝑛 27> − 𝑃. 27> = 0.0002
𝑠𝑖𝑛 27> − 𝑃G 27> = 3.4662 × 10A0
48
24
3/15/21
QUESTION 1.15
Find the second and fourth order Taylor’s polynomial, 𝑃"(𝑥) and 𝑃2(𝑥), centered at 𝑥 = 𝑥5, for
each of the following functions
a) 𝑓 𝑥 = 𝑒 ' , 𝑥5 = 1
(
b) 𝑓 𝑥 = 𝑥 ) , 𝑥5 = 5
49
b)
1 2
𝑃" 𝑥 = 5!/. 1 + 5A! 𝑥 − 5 − 5A"(𝑥 − 5)"
3 18
𝑃" 𝑥
1 2 5 A. 5
= 5!/. Q1 + 5A! 𝑥 − 5 − 5A"(𝑥 − 5)"+ 5 (𝑥 − 5).− 5A2 𝑥 − 5 2
3 18 162 1458
11
+ 5A0(𝑥 − 5)0R
104976
50
25
3/15/21
QUESTION 1.16
Compute the following Taylor’s polynomial, 𝑃4 (𝑥) centered at 𝑥 = 0 of 𝑦 = cos 𝑥 " for
a) 𝑃!(𝑥)
b) 𝑃"(𝑥)
c) 𝑃2(𝑥)
51
!" 2
Therefore 𝑃2 𝑥 = 1 − "2 𝑥
52
26
3/15/21
QUESTION 1.17
A civil engineer has measured the height of a 15 floor building as 3940 m and the working
height of each beam as 35 m while the true values are 3945 m and 40 m, respectively.
Compare their true error and true percent relative error.
53
Although the true errors are the same, the true percent relative errors differ by 100%. Hence,
there is something wrong in the measurement of the height of the beam by using true error.
Thus, it should be done more accurately.
54
27