CISE301_Topic8L8&9 KFUPM 1 Methods Topic 8 Ordinary Differential Equations (ODEs) Lecture 28-36 KFUPM Read 25.1-25.4, 26-2, 27-1
Feb 19, 2016
CISE301_Topic8L8&9 KFUPM 1
CISE301: Numerical Methods
Topic 8 Ordinary Differential
Equations (ODEs)Lecture 28-36
KFUPM
Read 25.1-25.4, 26-2, 27-1
CISE301_Topic8L8&9 KFUPM 2
Outline of Topic 8 Lesson 1: Introduction to ODEs Lesson 2: Taylor series methods Lesson 3: Midpoint and Heun’s method Lessons 4-5: Runge-Kutta methods Lesson 6: Solving systems of ODEs Lesson 7: Multiple step Methods Lesson 8-9: Boundary value Problems
CISE301_Topic8L8&9 KFUPM 3
Lecture 35Lesson 8: Boundary Value
Problems
CISE301_Topic8L8&9 KFUPM 4
Outlines of Lesson 8
Boundary Value Problem
Shooting Method
Examples
CISE301_Topic8L8&9 KFUPM 5
Learning Objectives of Lesson 8 Grasp the difference between initial value
problems and boundary value problems.
Appreciate the difficulties involved in solving the boundary value problems.
Grasp the concept of the shooting method.
Use the shooting method to solve boundary value problems.
CISE301_Topic8L8&9 KFUPM 6
Boundary-Value and Initial Value Problems
Boundary-Value Problems
The auxiliary conditions are not at one point of the independent variable
More difficult to solve than initial value problem
5.1)2(,1)0(2 2
xxexxx t
Initial-Value Problems
The auxiliary conditions are at one point of the independent variable
5.2)0(,1)0(2 2
xxexxx t
same different
CISE301_Topic8L8&9 KFUPM 7
Shooting Method
CISE301_Topic8L8&9 KFUPM 8
The Shooting Method
Target
CISE301_Topic8L8&9 KFUPM 9
The Shooting Method
Target
CISE301_Topic8L8&9 KFUPM 10
The Shooting Method
Target
CISE301_Topic8L8&9 KFUPM 11
Solution of Boundary-Value Problems (BVP) Shooting Method for Boundary-Value Problems
1. Guess a value for the auxiliary conditions at one point of time.
2. Solve the initial value problem using Euler, Runge-Kutta, …
3. Check if the boundary conditions are satisfied, otherwise modify the guess and resolve the problem.
Use interpolation in updating the guess. It is an iterative procedure and can be
efficient in solving the BVP.
CISE301_Topic8L8&9 KFUPM 12
Solution of Boundary-Value Problems Shooting Method
8.0)1(,2.0)0(2
)(2
yyxyyy
BVPsolvetoxyFind
Boundary-Value Problem
Initial-value Problemconvert
1. Convert the ODE to a system of first order ODEs.
2. Guess the initial conditions that are not available.
3. Solve the Initial-value problem.4. Check if the known boundary
conditions are satisfied.5. If needed modify the guess and
resolve the problem again.
CISE301_Topic8L8&9 KFUPM 13
Example 1 Original BVP
2)1(,0)0(044
yyxyy
0 1 x
CISE301_Topic8L8&9 KFUPM 14
Example 1 Original BVP
2)1(,0)0(044
yyxyy
2. 0
0 1 x
CISE301_Topic8L8&9 KFUPM 15
Example 1 Original BVP
2)1(,0)0(044
yyxyy
2. 0
0 1 x
CISE301_Topic8L8&9 KFUPM 16
Example 1 Original BVP
2)1(,0)0(044
yyxyy
to be determined
2. 0
0 1 x
CISE301_Topic8L8&9 KFUPM 17
Example 1 Step1: Convert to a System of First Order ODEs
1 2 1
2 1 2
2
4 4 0(0) 0, (1) 2
Convert toa system of first order ODEsy y y (0) 0
,y 4(y ) y (0) ?
The problem will be solved using RK2 with h 0.01for different values of y (0) until we
y y xy y
x
have y(1) 2
CISE301_Topic8L8&9 KFUPM 18
Example 1 Guess # 1
0)0(1#
yGuess
-0.7688
0 1 x
2)1(,0)0(044
yyxyy
CISE301_Topic8L8&9 KFUPM 19
Example 1 Guess # 2
1)0(2#
yGuess
0.99
0 1 x
2)1(,0)0(044
yyxyy
CISE301_Topic8L8&9 KFUPM 20
Example 1 Interpolation for Guess # 3
2)1(,0)0(044
yyxyy
)0(yGuess y(1)
1 0 -0.7688
2 1 0.9900
0.99
0 1 2 y’(0)
-0.7688
y(1)
CISE301_Topic8L8&9 KFUPM 21
Example 1 Interpolation for Guess # 3
2)1(,0)0(044
yyxyy
)0(yGuess y(1)
1 0 -0.7688
2 1 0.9900
0.99
0 1 2 y’(0)
-0.7688
1.5743
2
y(1)
Guess 3
CISE301_Topic8L8&9 KFUPM 22
Example 1 Guess # 3
5743.1)0(3#
yGuess
2.000
0 1 x
2)1(,0)0(044
yyxyy
Guess #3 should be used for the solution to the boundary value problem.
y(1)=2.000
CISE301_Topic8L8&9 KFUPM 23
Summary of the Shooting Method1. Guess the unavailable values for the
auxiliary conditions at one point of the independent variable.
2. Solve the initial value problem.3. Check if the boundary conditions are
satisfied, otherwise modify the guess and resolve the problem.
4. Repeat (3) until the boundary conditions are satisfied.
CISE301_Topic8L8&9 KFUPM 24
Properties of the Shooting Method
1. Using interpolation to update the guess often results in few iterations before reaching the solution.
2. The method can be cumbersome for high order BVP because of the need to guess the initial condition for more than one variable.
CISE301_Topic8L8&9 KFUPM 25
Lecture 36Lesson 9: Discretization
Method
CISE301_Topic8L8&9 KFUPM 26
Outlines of Lesson 9
Discretization Method Finite Difference Methods for Solving Boundary
Value Problems
Examples
CISE301_Topic8L8&9 KFUPM 27
Learning Objectives of Lesson 9
Use the finite difference method to solve BVP.
Convert linear second order boundary value problems into linear algebraic equations.
CISE301_Topic8L8&9 KFUPM 28
Solution of Boundary-Value Problems Finite Difference Method
8.0)1(,2.0)0(2
)(2
yyxyyy
BVPsolvetoxyFind
y4=0.8
0 0.25 0.5 0.75 1.0 xx0 x1 x2 x3 x4
y
y0=0.2
y1=?y2=?
y3=?
Boundary-Value Problems
Algebraic Equationsconvert
Find the unknowns y1, y2, y3
CISE301_Topic8L8&9 KFUPM 29
Solution of Boundary-Value Problems Finite Difference Method Divide the interval into n intervals. The solution of the BVP is converted to the
problem of determining the value of function at the base points.
Use finite approximations to replace the derivatives.
This approximation results in a set of algebraic equations.
Solve the equations to obtain the solution of the BVP.
CISE301_Topic8L8&9 KFUPM 30
Finite Difference Method Example
8.0)1(,2.0)0(2 2
yyxyyy
y4=0.8
0 0.25 0.5 0.75 1.0 xx0 x1 x2 x3 x4
y
y0=0.2
Divide the interval [0,1 ] into n = 4 intervalsBase points are x0=0x1=0.25x2=.5x3=0.75x4=1.0
y1=?y2=?
y3=?
To be determined
CISE301_Topic8L8&9 KFUPM 31
Finite Difference Method Example
8.0)1(,2.0)0(2 2
yyxyyy
2112
11
2
11
211
222
22
2Replace
iiiiiii
ii
iii
xyhyy
hyyy
Becomesxyyy
formuladifferencecentralhyyy
formuladifferencecentralh
yyyy
Divide the interval [0,1 ] into n = 4 intervalsBase points are x0=0x1=0.25x2=.5x3=0.75x4=1.0
CISE301_Topic8L8&9 KFUPM 32
Second Order BVP
211
22
2
1
43210
22
2
2)()(2)(
)()(1,75.0,5.0,25.0,0
Points Base25.0
8.0)1(,2.0)0(2
hyyy
hhxyxyhxy
dxyd
hyy
hxyhxy
dxdy
xxxxx
hLet
yywithxydxdy
dxyd
iii
ii
CISE301_Topic8L8&9 KFUPM 33
Second Order BVP
2
11
2111
43210
43210
212
11
22
2
163924
8216
8.0?,?,?,,2.01,75.0,5.0,25.0,0
3,2,122
2
iiii
iiiiiii
iiiiiii
xyyy
xyyyyyy
yyyyyxxxxx
ixyhyy
hyyy
xydxdy
dxyd
CISE301_Topic8L8&9 KFUPM 34
Second Order BVP
0.74360.6477,0.4791,
)8.0(2475.05.0
)2.0(1625.0
3916024391602439
1639243
1639242
1639241
163924
321
2
2
2
3
2
1
23234
22123
21012
211
yyySolution
yyy
xyyyi
xyyyi
xyyyi
xyyy iiii
CISE301_Topic8L8&9 KFUPM 35
Second Order BVP
2
11
2111
1003210
10099210
212
11
22
2
100002019910200
200210000
8.0?,?,?,,2.01,99.0,02.0,01.0,0
100,...,2,122
2
iiii
iiiiiii
iiiiiii
xyyy
xyyyyyy
yyyyyxxxxx
ixyhyy
hyyy
xydxdy
dxyd
CISE301_Topic8L8&9 KFUPM 36
CISE301_Topic8L8&9 KFUPM 37
Summary of the Discretiztion Methods Select the base points. Divide the interval into n intervals. Use finite approximations to replace the
derivatives. This approximation results in a set of
algebraic equations. Solve the equations to obtain the solution
of the BVP.
CISE301_Topic8L8&9 KFUPM 38
RemarksFinite Difference Method :
Different formulas can be used for approximating the derivatives.
Different formulas lead to different solutions. All of them are approximate solutions.
For linear second order cases, this reduces to tri-diagonal system.
CISE301_Topic8L8&9 KFUPM 39
Summary of Topic 8Solution of ODEs
Lessons 1-3:• Introduction to ODE, Euler Method, • Taylor Series methods, • Midpoint, Heun’s Predictor corrector methodsLessons 4-5:• Runge-Kutta Methods (concept & derivation) • Applications of Runge-Kutta Methods To solve first order ODE
Lessons 6:• Solving Systems of ODE
Lessons 8-9:• Boundary Value Problems• Discretization method
Lesson 7:Multi-step methods