0% found this document useful (0 votes)
31 views

CISE301 Topic8L8&9

This document provides an outline and learning objectives for lessons 8 and 9 of Topic 8 on Ordinary Differential Equations in the course CISE301. Lesson 8 covers boundary value problems and the shooting method for solving them. Lesson 9 discusses the finite difference method, which converts boundary value problems into systems of algebraic equations. Examples are provided to illustrate both the shooting method and finite difference method.

Uploaded by

Claire Tabor
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views

CISE301 Topic8L8&9

This document provides an outline and learning objectives for lessons 8 and 9 of Topic 8 on Ordinary Differential Equations in the course CISE301. Lesson 8 covers boundary value problems and the shooting method for solving them. Lesson 9 discusses the finite difference method, which converts boundary value problems into systems of algebraic equations. Examples are provided to illustrate both the shooting method and finite difference method.

Uploaded by

Claire Tabor
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 39

CISE301: Numerical Methods

Topic 8
Ordinary Differential Equations (ODEs)
Lecture 28-36

KFUPM
(Term 101)
Section 04

Read 25.1-25.4, 26-2, 27-1

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

 Boundary Value Problem

 Shooting Method

 Examples

CISE301_Topic8L8&9 4
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 5
Boundary-Value and
Initial Value Problems
Initial-Value Problems Boundary-Value Problems

 The auxiliary conditions  The auxiliary conditions are


are at one point of the not at one point of the
independent variable
independent
 More difficult to solve than
variable
initial value problem

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

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 11
Solution of Boundary-Value Problems
Shooting Method
Boundary-Value convert
Initial-value
Problem Problem
1. Convert the ODE to a system of
first order ODEs.
2. Guess the initial conditions that
Find y ( x) to solve BVP are not available.
3. Solve the Initial-value problem.
y  2 y  y  x 2
4. Check if the known boundary
conditions are satisfied.
y (0)  0.2, y (1)  0.8 5. If needed modify the guess and
resolve the problem again.

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   

The problem will be solved using RK2 with h  0.01


for different values of y 2 (0) until we have y(1)  2
CISE301_Topic8L8&9 17
Example 1
Guess # 1
y  4 y  4 x  0
y (0)  0, y (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

y(1)=2.000 This is the solution to the


boundary value problem.

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

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 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

 Use the finite difference method to solve


BVP.

 Convert linear second order boundary


value problems into linear algebraic
equations.

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
i2 24 y3  39 y2  16 y1  x2
2
i3 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

10200 yi 1  20199 yi  10000 yi 1  xi 2


CISE301_Topic8L8&9 35
CISE301_Topic8L8&9 36
Summary of the Discretiztion Methods
 Select the base points.
 Divide the interval into n sub-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 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

You might also like