Mechanical Engineering
INTRODUCTION
1
TEXT BOOK
Steven C. Chapra and Raymond P. Canale, 2014. Numerical Methods for Engineers,
International Edition 7th Edition, McGraw Hill (or any earlier editions)
2
COURSE OUTCOMES
3
WHAT IS NUMERICAL METHOD?
Given y x2 3x 2
Problem: Find the minimum value of the function
above using analytical and numerical method
Analytical Method
dy
2 x 3 0
dx
3
x 1.5
2
d 2y Therefore x 1.5 is the minimum value
2
dx 2
• yield exact result with no error!
5
NUMERICAL METHOD
5
approximate the min point
4
y 3
0
0.0
0.4
0.8
1.2
1.6
2.0
2.4
2.8
3.2
3.6
4.0
-1
6
Analytical versus Numerical methods
• Previous example favors the ANALYTICAL
METHOD – quick, simple and exact results!
• BUT….
What if the problem is COMPLEX???
p V
sin V
s s
OR
7
WHY NUMERICAL METHODS?
8
EXAMPLE: Numerical method to solve an
engineering problem
Question:
9
Step 1: Draw FBD and derive the equation of
motion using Newton’s second law
= Where
ODE problem
10
Step 2: Attempt to solve the problem
analytically if possible
Exact solution
Intro/10
11
Step 3: If the equation cannot be solved easily, use
Numerical Method to solve it
12
13
Using Euler’s method to solve ODE numerically
14
2nd iteration,
Iteration
continues:
15
Comparison: Analytical vs Numerical solutions
16
CONCLUSION
17
MDB 3053 Numerical Methods
ERROR ANALYSES
18
Course Outcome
19
Error Analysis
Differentiate and understand the following terminologies
for numerical methods:
• Significant Figures
• Accuracy & Precision
• True Error & Approximate Error
• Round-off Error & Truncation Error
20
Odometer and Speedometer Readings
21
Based on the reading, it can be confidently said that:
22
Significant Figures (SF)
23
Speedometer reading - consists of
the three significant figures: 48.5 km/h.
Certain Estimated
Certain Estimated
24
Significant Figures (SF)
48.5 (3 SF)
87324.45 (7 SF)
25
Examples of number of significant figures (SF)
27
CLASS ACTIVITY
Number SF Rule
1234
13008
9.820
41100
0.00082
5.20000E8
28
ACCURACY vs. PRECISION
29
ANALOGY OF TARGET PRACTICE
30
MEASUREMENT OF ERROR
31
TRUE ERROR
32
Example
33
APPROXIMATE ERROR
35
TYPES OF NUMERICAL ERRORS
• Round-off errors
• Caused by the limited no. of significant digits that can
be retained by the digital computers (16-bit or 32-bit)
has to round-off the digits
• Ex : = 3.1415926535897…… vs. = 3.1416 (5 SF)
36
Chopping of numbers:
Chopping to 4 SF : 324.2
37
CLASS ACTIVITY
Exact 4.71
3-digit 4.71
(chopping)
3-digit 4.71
(rounding)
39
CLASS ACTIVITY
40
41
CONCLUSION
42
• Round-off errors are caused by the limited no. of
significant digits that can be retained by the digital
computers
43
MDB 3053 Numerical Methods
44
Measurement Uncertainty
45
1 2
Propagation of Error s ut at
2
•Example:
L Area of a rectangle: A=L*W
W if L= 5.0 0.2 mm and W = 2.0 0.2 mm
Calculate the area and its uncertainty.
46
Propagation of Error
Example:
Given z = x+y where x =3.0 0.1 , y=4.0 0.2
Find the uncertainty of z. (ans: 0.2)
47
Propagation of Error
Example:
Given A = LW ; where L =3.0 0.1 , W=4.0 0.2
Find the uncertainty of z. (ans: 0.7)
48
Propagation of Error
Example:
Given F = mg ; where m =5.10 0.05 kg
Find the uncertainty of F. (ans: 0.49)
49
Propagation of Error
Example:
Given, z = x2 ; where x =3 0.1
Find the uncertainty of z. (ans: 0.6)
50
Rules in Combination
Find the error propagation in y = vt – 0.5gt2
51
Machine Epsilon
52
Machine Epsilon
Chap3/51
53
MDB 3053 Numerical Methods
Series Expansion
&
Approximation of Small Perturbation
54
Motivation
• Sought: sin(0.1)
• Missing: calculator or lookup table
• But we know: sin for another nearby value i.e. sin(0)
• Also known: values of all derivatives at 0.
• Can we use them to approximate sin(0.1)?
• What will be the error of this approximation?
55
Taylor’s series
Small perturbation
df (x) 1 d 2 f (x)
f x x f (x) x x
2
2
dx 2! dx
1 d 3 f (x)
3! dx 3
3
x O x
4
56
Taylor Series
57
Taylor Series
f ( xi ) 2 f ( xi ) 3 f n ( xi ) n
f ( xi 1 ) f ( xi ) f ( xi )h h h h Rn
2! 3! n!
where step size, h = xi+1 xi
Remainder Rn can be expressed as Rn=O(hn+1) --- big O notation
58
Approximation of Taylor Series
f ( x)
Zero Order (constant)
First Order (linear)
Increasing accuracy
xi xi1 x
60
CLASS ACTIVITY
Ans:
zero to 3rd order: t = 41.4% ; 4.4%; 0.45%; 0.026%
61
SOLUTION
2! 3!
Step 3: use xi+1=/3 and xi= /4 , step h = /3-/4 = /12
Ans:
zero to 3rd order: t = 41.4% ; 4.4%; 0.45%; 0.026%
62
CLASS ACTIVITY
What about sin(1)? Use xi+1=1 and xi=0.5 (in radian) and
compute the true percent relative error, t. Step h =1–0.5 = 0.5
f (0) 2 f (0) 3
f ( x) f (0) f (0) x x x
2! 3!
x3 x5 x 7 f ( x) sin x f (0) 0
sin x x f ( x) cos x f (0) 1
3! 5! 7 !
f ( x) sin x f (0) 0
f ( x) cos x f (0) 1
1st order term
3rd order term
64
EXAMPLE
x 2 x 4 x 6 x8
Answer: cos x 1
2 ! 4 ! 6 ! 8!
65
CLASS ACTIVITY
66
Error Analysis and Series
67
Application of Taylor Series
f (xi1 ) f (xi ) R1
f (xi )
(xi1 xi ) (xi1 xi )
f (xi1 ) f (xi )
O(h)
(xi1 xi )
Truncation Error
First-orderApproximation
68
Finite-Divided Difference Scheme
69
First Forward Differencing
f (xi1) f (xi )
f '(x i )
h
h
Truncation error = O(h) xi xi1 x
It is linearly convergent base pt forward pt
70
First Backward Differencing
True
Derivative
f(x)
base pt backward pt
Approximation
f (xi ) f (xi1 )
f (xi )
h h
Truncation error = O(h) xi1 xi x
backward pt base pt
It is linearly convergent
71
First Centered Differencing
f (xi1) f (xi1)
f (x) i
2h
2h
Truncation error = O(h2)
xi1 xi1 x
72
CLASS ACTIVITY
73