CISE301 Topic8L8&9
CISE301 Topic8L8&9
Topic 8
Ordinary Differential Equations (ODEs)
Lecture 28-36
KFUPM
(Term 101)
Section 04
CISE301_Topic8L8&9 1
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 2
Lecture 35
Lesson 8: Boundary Value Problems
CISE301_Topic8L8&9 3
Outlines of Lesson 8
Shooting Method
Examples
CISE301_Topic8L8&9 4
Learning Objectives of Lesson 8
Grasp the difference between initial value
problems and boundary value problems.
CISE301_Topic8L8&9 5
Boundary-Value and
Initial Value Problems
Initial-Value Problems Boundary-Value Problems
2 t
2 t
x 2 x x e x 2 x x e
x(0) 1, x (0) 2.5 x(0) 1, x(2) 1.5
same different
CISE301_Topic8L8&9 6
Shooting Method
CISE301_Topic8L8&9 7
The Shooting Method
Target
CISE301_Topic8L8&9 8
The Shooting Method
Target
CISE301_Topic8L8&9 9
The Shooting Method
Target
CISE301_Topic8L8&9 10
Solution of Boundary-Value Problems
Shooting Method for Boundary-Value Problems
CISE301_Topic8L8&9 12
Example 1
Original BVP
y 4 y 4 x 0
y (0) 0, y (1) 2
0 1 x
CISE301_Topic8L8&9 13
Example 1
Original BVP
y 4 y 4 x 0
y (0) 0, y (1) 2
2. 0
0 1 x
CISE301_Topic8L8&9 14
Example 1
Original BVP
y 4 y 4 x 0
y (0) 0, y (1) 2
2. 0
0 1 x
CISE301_Topic8L8&9 15
Example 1
Original BVP
y 4 y 4 x 0
y (0) 0, y (1) 2
2. 0
to be
determined
0 1 x
CISE301_Topic8L8&9 16
Example 1
Step1: Convert to a System of First Order ODEs
y 4 y 4 x 0
y (0) 0, y (1) 2
Convert to a system of first order Equations
y 1 y 2 y1 (0) 0
y 4(y x), y (0) ?
2 1 2
Guess #1
y (0) 0
0 1 x
-0.7688
CISE301_Topic8L8&9 18
Example 1
Guess # 2
y 4 y 4 x 0
y (0) 0, y (1) 2
0.99
Guess #2
y (0) 1
0 1 x
CISE301_Topic8L8&9 19
Example 1
Interpolation for Guess # 3
y 4 y 4 x 0 y(1)
y (0) 0, y (1) 2
0.99
Guess y (0) y(1)
1 0 -0.7688
0 1 2 y’(0)
2 1 0.9900
-0.7688
CISE301_Topic8L8&9 20
Example 1
Interpolation for Guess # 3
y 4 y 4 x 0 y(1)
y (0) 0, y (1) 2 2
Guess 3
0.99
Guess y (0) y(1)
1.5743
1 0 -0.7688
0 1 2 y’(0)
2 1 0.9900
-0.7688
CISE301_Topic8L8&9 21
Example 1
Guess # 3
y 4 y 4 x 0 2.000
y (0) 0, y (1) 2
Guess #3
y (0) 1.5743
0 1 x
CISE301_Topic8L8&9 22
Summary of the Shooting Method
1. 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 23
Properties of the Shooting Method
CISE301_Topic8L8&9 24
Lecture 36
Lesson 9: Discretization Method
CISE301_Topic8L8&9 25
Outlines of Lesson 9
Discretization Method
Finite Difference Methods for Solving Boundary
Value Problems
Examples
CISE301_Topic8L8&9 26
Learning Objectives of Lesson 9
CISE301_Topic8L8&9 27
Solution of Boundary-Value Problems
Finite Difference Method
Boundary-Value convert
Algebraic
Problems Equations
Find the unknowns y1, y2, y3
y4=0.8
Find y ( x) to solve BVP y3=?
y y1=?
y 2 y y x 2
y0=0.2
y2=?
y (0) 0.2, y (1) 0.8
0 0.25 0.5 0.75 1.0 x
x0 x1 x2 x3 x4
CISE301_Topic8L8&9 28
Solution of Boundary-Value Problems
Finite Difference Method
Divide the interval into n sub-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 29
Finite Difference Method
Example
y 2 y y x 2
y (0) 0.2, y (1) 0.8 To be
determined
Divide the interval
[0,1 ] into n = 4 y y3=? y4=0.8
intervals y1=?
Base points are y2=?
x0=0
x1=0.25 y0=0.2
x2=.5
x3=0.75 0 0.25 0.5 0.75 1.0 x
x4=1.0 x0 x1 x2 x3 x4
CISE301_Topic8L8&9 30
Finite Difference Method
Example
y 2 y y x 2
y (0) 0.2, y (1) 0.8
Divide the interval Replace
[0,1 ] into n = 4 yi 1 2 yi yi 1
intervals y 2
central difference formula
h
Base points are y y
y i 1 i 1 central difference formula
x0=0 2h
x1=0.25 y 2 y y x 2
x2=.5 Becomes
yi 1 2 yi yi 1 yi 1 yi 1
x3=0.75 2 yi xi 2
h2 2h
x4=1.0
CISE301_Topic8L8&9 31
Second Order BVP
d2y dy 2
2
2 y x with y (0) 0.2, y (1) 0.8
dx dx
Let h 0.25
Base Points
x0 0, x1 0.25, x2 0.5, x3 0.75, x4 1
dy y ( x h) y ( x) yi 1 yi
dx h h
d2y y ( x h) 2 y ( x ) y ( x h) yi 1 2 yi yi 1
2
2
dx h h2
CISE301_Topic8L8&9 32
Second Order BVP
d2y dy 2
2 y x
dx 2 dx
yi 1 2 yi yi 1 yi 1 yi 2
2
2 yi xi i 1,2,3
h h
x0 0, x1 0.25, x2 0.5, x3 0.75, x4 1
y0 0.2, y1 ?, y2 ?, y3 ?, y4 0.8
16 yi 1 2 yi yi 1 8 yi 1 yi yi xi 2
24 yi 1 39 yi 16 yi 1 xi 2
CISE301_Topic8L8&9 33
Second Order BVP
2
24 yi 1 39 yi 16 yi 1 xi
2
i 1 24 y2 39 y1 16 y0 x1
2
i2 24 y3 39 y2 16 y1 x2
2
i3 24 y4 39 y3 16 y2 x3
39 24 0 y1 0.252 16(0.2)
16 39 24 y 0.5 2
2
0 16 39 y3 0.752 24(0.8)
Solution y1 0.4791, y2 0.6477, y3 0.7436
CISE301_Topic8L8&9 34
Second Order BVP
d2y dy 2
2 y x
dx 2 dx
yi 1 2 yi yi 1 yi 1 yi 2
2
2 yi xi i 1,2,...,100
h h
x0 0, x1 0.01, x2 0.02 ... x99 0.99, x100 1
y0 0.2, y1 ?, y2 ?, ... y99 ?, y100 0.8
10000 yi 1 2 yi yi 1 200 yi 1 yi yi xi 2
CISE301_Topic8L8&9 37
Remarks
Finite 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 38
Summary of Topic 8
Solution of ODEs
Lessons 1-3:
• Introduction to ODE, Euler Method,
• Taylor Series methods,
• Midpoint, Heun’s Predictor corrector methods
Lessons 4-5:
• Runge-Kutta Methods (concept & derivation)
• Applications of Runge-Kutta Methods To solve first order ODE
Lessons 6:
•Solving Systems of ODE
Lesson 7:
Multi-step methods
Lessons 8-9:
• Boundary Value Problems
• Discretization method
CISE301_Topic8L8&9 39