Professional Documents
Culture Documents
MBE 2036
Engineering Computing
Part 1
Text Book
Year: 2009
Assessment pattern
Lecture
Quiz, 10% of total course mark
Examination, 45% of total course mark
2 hours
Closed-book
Lab
2 Lab Reports, 35% of total course mark
Skill Tests, 10% of total course mark
Simple programming tasks
Department of Mechanical and
Biomedical Engineering City University of Hong Kong
MBE2036 Engineering Computing ,Part 1, version 7, Dr. Yajing Shen 5
Lecture Outline
Part1: Modeling and engineering computing -1
Part2: Modeling and engineering computing -2
Part3: Error: Quantifying Error
Part4: Error: Truncation error, Taylor series
Part5: Find roots: Bracketing method
Part6: Find roots: Open Method
Review, exercise part1-part6 WK8
Quiz: Midterm test
Part7: Optimization: One-Dimensional Unconstrained
Part8: Optimization: Multi-Dimensional Unconstrained
Part9: Curve Fitting: Least squares regression
Part10: Curve Fitting: Fourier series
Review, exercise part8-part11
What is a model?
It is a representation of something, usually
smaller than the original, e.g. a model of
an airport, a model car, etc
Mathematical models
A mathematical model is a description of a
system using mathematical concepts and
language.
F=ma
Mathematical model
Mathematical models
Mathematical models
Why modeling?
Some of the reasons why we need modeling:
To increase the understanding of some
engineering and scientific problems
To develop solutions for engineering
problems through simulations
To predict and control the system being
modeled
To diagnose faults of the system being
modeled
Department of Mechanical and
Biomedical Engineering City University of Hong Kong
MBE2036 Engineering Computing ,Part 1, version 7, Dr. Yajing Shen 12
Simple Example 1
Problem Statement
A parachutist of mass 68.1 kg jumps
out of a stationary hot air balloon
with a drag coefficient of 12.5kg/s.
Assuming the air resistance is
linearly proportional to velocity.
Example 1
Solution
Based on Newtons second law:
Example 1 (cont)
F
This imply: a m
(Eq1.2)
Since we want to calculate the velocity of the
person, we need somehow to introduce the
velocity term into Eq 1.2
dv
a (Eq 1.3)
dt
dv F
(Eq 1.4)
dt m
Example 1 (cont) FU
Negative
The net force on the body can written as: direction
F = FD + FU (Eq1.5)
FD is the downward force of gravity and FU is the
upward force of air resistance
FD mg (Eq 1.6)
g is the acceleration due to gravity, which is
approximately equal to 9.8 m/s2
FU cv (Eq 1.7)
Eq 1.7 assumes air resistance is linearly Positive
proportional to velocity direction
c is the drag coefficient FD
Department of Mechanical and
Biomedical Engineering City University of Hong Kong
MBE2036 Engineering Computing ,Part 1, version 7, Dr. Yajing Shen 16
Example 1 (cont)
Substitute Eq1.6 and 1.7 into 1.5
F = mg cv (Eq 1.8)
Substitute Eq1.8 into Eq 1.4
dv mg cv
(Eq 1.9)
dt m
dv c
or simplify to g v (Eq 1.20)
dt m
Example 1 (cont)
As Eq 1.20 is a separable equation
F(x,y) is a function of two variables x and y
F(x,y) can be factored as a function of x times a
function of y i.e. F(x,y) = g(x)f(y)
dv
dt Eq 1.21
c
g v
m
To find the solution, we need to integrate both
sides
Department of Mechanical and
Biomedical Engineering City University of Hong Kong
MBE2036 Engineering Computing ,Part 1, version 7, Dr. Yajing Shen 18
Example 1 (Cont)
That is dv
dt Eq 1.22
c
g v
m
Difficult to solve directly!
To solve the above equation, we can apply
integration by substitution. That is to convert the
above equation to:
Kdu c
dt , where u g - v Eq1.23
u
u du m
k k ln u C
Example 1 (cont)
To find K, which is a constant:
c
dg v
du m c
dv dv m
c
du - dv
m
m
dv - du Eq1.24
c
Example 1 (cont)
Substitute Eq 1.24 to Eq1.23 to replace K
m
du
c
u
dt
Eq1.25
Example 1 (cont)
Next, we need to find C. As when t=0, v=0. This
means that Eq 1.26 becomes:
m m
ln(u0 ) 0 C C ln(u0 )
c c
c c
where u0 g v g 0 g
m m
and C can be calculated as follows:
m
ln( g ) C Eq 1.27
c
Example 1 (cont)
Substitute Eq1.27 into Eq1.26:
m c m
ln( g v ) t ln( g ) Eq 1.28
c m c
c c
ln( g v ) t ln( g )
m m
c
c t ln(g )
g v e m
m c
c t
g v e m eln(g )
m
Department of Mechanical and
Biomedical Engineering City University of Hong Kong
MBE2036 Engineering Computing ,Part 1, version 7, Dr. Yajing Shen 23
Example 1 (cont)
This implies:
c
c t
g v ge m
m
c
c t
v g ge m
m
c
m t
v g (1 - e m ) Eq. 1.29
c
This is only a simple example but
it is not easy to get this solution!!!
Department of Mechanical and
Biomedical Engineering City University of Hong Kong
MBE2036 Engineering Computing ,Part 1, version 7, Dr. Yajing Shen 24
Engineering Computation
The solutions of engineering problems can be obtained
using analytical methods
Often involve the solving of differential equations
However, very often analytical solutions are difficult to
obtain for many practical engineering problems
dv c
g v (Eq 1.20)
dt m
c
m t
v g (1 - e m ) Eq. 1.29
c
Department of Mechanical and
Biomedical Engineering City University of Hong Kong
MBE2036 Engineering Computing ,Part 1, version 7, Dr. Yajing Shen 25
Engineering Computation
With the advancement of computer, numerical methods
provide an alternative tool for solving complicated
engineering calculations and problems, which are
almost impossible to solve analytically
Numerical methods provide an approximation of the
exact solutions of the engineering problems
Numerical methods will normally reformulate the
mathematical problems in such a way that they can be
solved by arithmetic operations
dv c
g v (Eq 1.20)
dt m
Example 1(cont)
Try to compute the velocity
by using numerical method
Eulers method
dv c
g v (Eq 1.20)
dt m
Example 1(cont)
To use a finite difference to approximate the
first derivative of v with respect to t
True slope Approximate slope
dv v v (t i 1) v (t i )
Eq. 1.30
dt t t i 1 t i
v(ti+1)
v
v
v(ti)
Example 1 (cont)
From Figure 1.1
dv v v (t i 1) v (t i )
Eq. 1.31
dt t t i 1 t i
Example 1 (cont)
Substitute Eq 1.31 into Eq 1.20
v (t i 1) v (t i ) c
g v (t i ) Eq 1.32
t i 1 ti m
Example 1 (cont)
Notice that the term in the brackets is in fact the
right-hand side of the differential equation itself
(Eq 1.20)
c
v (t i 1) v (t i ) g v (t i )(t i 1 t i ) Eq 1.33
m
dv c
g v (Eq 1.20)
dt m
Example 1 (cont)
c
v (t i 1) v (t i ) g v (t i )(t i 1 t i ) Eq 1.33
m
Example 1 (cont)
Analytical solution inserting parameters into
Eq 1.29:
12.5
t
68.1
v (t ) (9.8)1 - e 68.1 53.3904 1 - e 0.18355 t
12.5
Where g = 9.8 m/s2
c = 12.5 kg/s
m = 68.1 kg
Also, e 0
Example 1 (cont)
The results obtained from the analytical
method: t(s) v(m/s)
2 second step 0 0
2 16.4050
4 27.7693
6 35.6418
8 41.0953
10 44.8731
12 47.4902
53.3904
Department of Mechanical and
Biomedical Engineering City University of Hong Kong
MBE2036 Engineering Computing ,Part 1, version 7, Dr. Yajing Shen 34
Example 1 (cont)
Example 1 (cont)
Numerical solution inserting parameters
into Eq 1.33:
12.5
v (t i 1) v (t i ) 9.8 v (t i ) 2 n t v(t) slop Slop x Step size
68.1 0
1
0
2
0
19.6
9.8
6.2
19.6
12.4
Example 1 (cont)
The results obtained from the numerical method
are: error
v vt
100%
Analytical Numerical
Method Method v
t(s) v(m/s) vt(m/s) Error (%)
0 0.0000 0.0000
2 16.4050 19.6000 -19.4758
4 27.7693 32.0048 -15.2525
6 35.6418 39.8559 -11.8235
8 41.0953 44.8248 -9.0752
10 44.8731 47.9696 -6.9006
12 47.4902 49.9600 -5.2007
76 53.3904 53.3914 -0.0019
78 53.3904 53.3914 -0.0019 2 second step
Example 1 (cont)
Numerical solution : approximation
Example 1 (cont)
Analytical Numerical
Example 1 (cont)
Numerical solution
Analytical solution
Eulers method
Question: Why the errors are much reduced???
Numerical solution : approximation Numerical solution : approximation
Eulers method
Concave Convex Line
Eulers method
how to reduce the error
New value = old value + slope x step size
Choose proper
step size to
reduce the error
Learning Outcomes
After this lecture, the student would be able to
understand the following:
The importance of engineering modelling
The importance of numerical method
How mathematical models can be formulated
on the basis of scientific principles to simulate
the behaviour of a simple physical system
How numerical methods can be used to
generate approximate solutions in a manner
that can be implemented on a digital
computer
Department of Mechanical and
Biomedical Engineering City University of Hong Kong