Numerical Methods With Applications
Numerical Methods With Applications
Numerical Methods With Applications
APPLICATIONS
(MEC500)
y(x 0 ) = y 0
y ′ (x 0 ) = y ′0
M
y n −1(x 0 ) = y n0 −1
Auxiliary conditions
If the conditions are specified at different values of the
independent variable, usually at extreme points or boundaries
of a system, then we have a boundary-value problem (BVP).
y(x 0 ) = α
y(xn ) = β
€
The BVP arises in many fields in engineering. For example in
the study of heat transfer.
General Method
A non-insulated uniform rod positioned between two bodies of
constant but different temperature. For this case T1 > T2 and T2 >
Ta
Ta = 20 T (0) = T1 = 40 Boundary
L = 10 m T (L) = T2 = 200 conditions
€
h ′ = 0.01 m −2 (Heat transfer coefficient)
Analytical solution:
€
€
T = 73.4523e0.1x − 53.4523e−0.1x + 20
The Shooting Method
This method is a trial-and-error which solves an equivalent
IVP after converting the original BVP.
Example:
d2T For example, the 2nd order
2 + h ′ (T a − T ) = 0 equation can be expressed
dx
as two first order ODEs:
Ta = 20 dT
=z
L = 10 m dx
€
h ′ = 0.01 m −2 dz
= h ′(T − Ta )
dx
T (0) = T1 = 40
T (L) = T2 = 200
€
€
The Shooting Method
An initial value is guessed, say z(0)=10.
Since the two sets of points, (z, T)1 and (z, T)2, are linearly
related, a linear interpolation formula is used to compute the
value of z(0) as 12.6907 to determine the correct solution.
20 − 10
z(0) = 10 + (200 − 168.3797)
285.8980 − 168.3797
z(0) = 12.6907
€
The Shooting Method
a) First shoot
b) Second shoot
c) Exact hit
The Shooting Method
Remark:
dT
€ =z
dx
€ dz
= h ′(T − Ta ) 4
dx
Now, these equations can be integrated using any of the
methods described before.
€
The Shooting Method
Nonlinear Two-Point Problem
We used the constant step-size version of the fourth-order
RK approach.
The function integrated the equations based on an initial
guess for z(0) and returned the temperature at x = 10.
The difference between this value and the goal of 200 was
used to adjust the value of z(0) until the difference was driven
to zero.
Finite-Difference Method
The most common alternatives to the shooting method.
Finite differences are substituted for the derivatives in the
original equation.
d2T Ta = 20
2 + h ′ (T a − T ) = 0
dx L = 10 m
d 2T Ti +1 − 2T + Ti −1 h ′ = 0.01 m −2
2 =
dx Δx 2
Ti +1 − 2T + Ti −1
2 − h ′ (Ti − T a ) = 0 T (0) = 40
Δx
T (L) = 200
−Ti +1 + (2 + h ′ Δx 2 )Ti − Ti −1 = h ′ Δx 2T a
€
€
Finite-Difference Method
⎡(2 − h 2 p 2 ) −1 0 0 ⎤⎧y1 ⎫
⎢ 2 2 ⎥⎪y ⎪
⎢ −1 (2 − h p ) −1 0 ⎥⎪ 2⎪
2 2 ⎨ ⎬= 0
⎢ 0 −1 (2 − h p ) −1 ⎥⎪y 3 ⎪
⎢ 2 2 ⎥
⎣ 0 0 −1 (2 − h p ) ⎦⎪
⎩y 4 ⎪
⎭
using (a) one, (b) two and (c) three interior nodes.
€
Solution:
(a) Writing for one interior node yields (h = 3/2)
−(2 − 2.25p 2 )y i = 0
Thus, for this simple case, the eigenvalue is analyzed by setting
the determinant equal to zero
€ −2 − 2.25p 2 = 0
and solving for p = ± 0.9428.
€
Example 2
Polynomial Method
b) Writing for two interior node yields (h = 3/3)
⎡(2 − p 2 ) −1 ⎤⎧y1 ⎫
⎢ 2 ⎥⎨ ⎬
=0
⎣ −1 (2 − p ) ⎦⎩y 2 ⎭
Expansion of the determinant gives
(2 − p 2 ) 2 − 1 = 0
€ be solved for p=±1 and ±1.73205.
which can
4. Repeat step 2.
3rd iteration
⎡3 7 9⎤⎧0.92084 ⎫ ⎧0.92420⎫
€ 3 ⎢ ⎥⎪ ⎪ ⎪ ⎪ ε a = 0.36%
[A ] {y } = ⎢9 4 3⎥⎨0.77836⎬= 18.623⎨0.77331⎬
⎢ ⎪ ⎪ ⎪ 1.00 ⎪
⎣9 3 8⎥ ⎦⎩ 1.00 ⎭ ⎩ ⎭
[A ] {x} λ {x}
Reading material
http://mathforcollege.com/nm/topics/textbo
ok_index.html
Chapter 6
Adaptive Runge-Kutta
Euler’s Method Multistep Method Shooting Method
Method
Finite Difference
Heun’s Method
Method
Runge-Kutta
Polynomial Method
Method
Next Lecture
Example on ODE Application
Roots of Equations