CE324 Module11a ODE
CE324 Module11a ODE
Ordinary
Differential
Equations
Outline
Introduction to Ordinary Differential Equations
Numerical Methods for Solving ODEs
Initial Value Problems
Euler’s Method
Modified Euler’s Method
2
Ordinary Differential Equations
Differential equations appear in all branches of science and
engineering as they provide detailed information regarding
distributions or variations of the dependent variable as a
function of the independent variable.
3
Ordinary Differential Equations
ODEs are classified in terms of order and degree.
The order of an ODE is the same as the highest derivative while the degree is the power
of the highest derivative.
Example:
𝑑3 𝑦
3
2
2 𝑑 𝑦 𝑑𝑦 𝑥 Order: 3
𝑥 + 𝑥 + 𝑥 +𝑥𝑦 =𝑒
𝑑𝑥
3
𝑑𝑥
2
𝑑𝑥 Degree: 1
( )
2
𝑑𝑦 2 𝑑𝑦 Order: 1
+1 + 𝑥 =sin (𝑥 )
𝑑𝑥 𝑑𝑥 Degree: 2
4
Numerical Methods for Solving ODEs
Euler’s Method
Initial Value
Modified Euler’s Method
Problems
5
Initial Value Problems
When, as in many applications, it is impossible or undesirable to find the exact or analytic solution,
numerical methods can be used to find approximate solutions of initial value problems.
6
Initial Value Problems
Exact Solution
Approximate
Solution
Given
(Initial Value)
Time
Step
7
Euler’s Method
The Euler’s Method is the simplest technique for solving a first-order ODE
of the form:
𝒅𝒚
=𝒇 (𝒙,𝒚) with initial condition
𝒅𝒙
8
Euler’s Explicit Method
The Euler’s Explicit Method is a single-step numerical technique for solving a first-order ODE.
𝑥𝑖 +1= 𝑥 𝑖 +h
= constant estimating from
𝑦 𝑖 +1= 𝑦 𝑖 +( 𝑆𝑙𝑜𝑝𝑒)(h) to
𝒅𝒚 𝒚 𝒊+𝟏 − 𝒚 𝒊
𝑺𝒍𝒐𝒑𝒆 = ≈ = 𝒇 (𝒙𝒊, 𝒚 𝒊)
= step size 𝒅𝒙 𝒙 𝒊+𝟏 − 𝒙 𝒊
9
Example
𝑑𝑦 −0.3 𝑥
=− 1.2 𝑦 +7 𝑒
Use Euler’s explicit method to solve the ODE 𝑑𝑥 from to with the initial
condition at and with .
Given:
𝑑𝑦 −0.3 𝑥
ODE =− 1.2 𝑦 +7 𝑒
𝑑𝑥
10
Example
Solution: 𝑥𝑖 +1= 𝑥 𝑖 +h=𝑥 𝑖 +0.5 𝑦 𝑖 +1= 𝑦 𝑖 + ( − 1.2 𝑦 𝑖+ 7 𝑒
− 0.3 𝑥 𝑖
) (0.5 )
Step 1:
𝑥2 = 𝑥1 +0.5 ¿ 𝟎+0.5 ¿ 𝟎 .𝟓
𝑦 2 = 𝑦 1 + ( − 1.2 𝑦 1+7 𝑒
− 0.3 𝑥 1
) ( 0.5 )¿ 𝟑+ ( −1.2(𝟑)+7 𝑒 −0.3 (𝟎) ) (0.5) ¿ 𝟒 . 𝟕
(𝒙𝟐 , 𝒚 𝟐)=(𝟎 . 𝟓 ,𝟒. 𝟕)
Step 2:
𝑥3 =𝑥 2+0.5 ¿ 𝟎 .𝟓+ 0.5 ¿ 𝟏 .𝟎
𝑦 3 = 𝑦 2+ ( − 1.2 𝑦 2 +7 𝑒
− 0.3 𝑥 2
) (0.5 )¿ 𝟒 . 𝟕+ ( − 1.2(𝟒 . 𝟕)+ 7 𝑒− 0.3 (𝟎 .𝟓) ) (0.5)
¿ 𝟒 . 𝟖𝟗𝟐𝟓
(𝒙𝟑 , 𝒚 𝟑)=(𝟏. 𝟎 ,𝟒. 𝟖𝟗𝟐𝟓)
11
Example
Solution: 𝑥𝑖 +1= 𝑥 𝑖 +h=𝑥 𝑖 +0.5 𝑦 𝑖 +1= 𝑦 𝑖 + ( − 1.2 𝑦 𝑖+ 7 𝑒
− 0.3 𝑥 𝑖
) (0.5 )
Step 3: (𝑥3 , 𝑦 3 )=(1.0 , 4.8925)
𝑥 4= 𝑥 3 +0.5 ¿ 𝟏 .𝟎+ 0.5 ¿ 𝟏 .𝟓
𝑦 4= 𝑦 3 + ( − 1.2 𝑦 3 +7 𝑒
−0.3 𝑥 3
) (0.5)¿ 𝟒 . 𝟖𝟗𝟐𝟓+ ( − 1.2(𝟒 . 𝟖𝟗𝟐𝟓)+7 𝑒 −0.3 (𝟏 . 𝟎)) (0.5)
¿ 𝟒 . 𝟓𝟒𝟗𝟗
(𝒙 𝟒 , 𝒚 𝟒)=(𝟏. 𝟓, 𝟒.𝟓𝟒𝟗𝟗)
Step 4:
𝑥5 = 𝑥 4 +0.5 ¿ 𝟏 .𝟓+ 0.5 ¿ 𝟐 .𝟎
𝑦 5 = 𝑦 4 + ( − 1.2 𝑦 4 +7 𝑒
−0.3 𝑥 4
) (0.5 )¿ 𝟒 . 𝟓𝟒𝟗𝟗+ ( − 1.2(𝟒 . 𝟓𝟒𝟗𝟗)+7 𝑒 −0.3 (𝟏 . 5) ) (0.5)
¿ 𝟒 . 𝟎𝟓𝟏𝟕
(𝒙𝟓 , 𝒚 𝟓)=(𝟐. 𝟎 ,𝟒. 𝟎𝟓𝟏𝟕)
Step 3:
𝑥6 = 𝑥 5+ 0.5 ¿ 𝟐 .𝟎+ 0.5 ¿ 𝟐 .𝟓
𝑦 6 = 𝑦 5 + ( − 1.2 𝑦 5 +7 𝑒
− 0.3 𝑥 5
) (0.5)¿ 𝟒 . 𝟖𝟗𝟐𝟓+ ( − 1.2(𝟒 . 𝟖𝟗𝟐𝟓)+7 𝑒 −0.3 (𝟏 . 𝟎)) (0.5)
¿ 𝟑 .𝟓𝟒𝟏𝟓
(𝒙𝟔 , 𝒚 𝟔)=(𝟐. 𝟓,𝟑. 𝟓𝟒𝟏𝟓)
12
Modified Euler’s Method
Algorithm
4. Calculate
1. Solve next value of :
2. Calculate 5. Calculate the solution at :
13
Example 𝑑𝑦 −0.3 𝑥
=− 1.2 𝑦 +7 𝑒
Use modified Euler’s method to solve the ODE 𝑑𝑥 from to with the initial
condition at and with .
Solution: 𝑥𝑖 +1= 𝑥 𝑖 +h=𝑥 𝑖 +0.5
𝑓 ( 𝑥𝑖 , 𝑦 𝑖)=( −1.2 𝑦 𝑖 +7 𝑒 )
− 0.3 𝑥 𝑖
Step 1:
𝑥2 = 𝑥1 +0.5 ¿ 𝟎+0.5 ¿ 𝟎 .𝟓 𝑦 𝑖 +1= 𝑦 𝑖 + 𝑓 ( 𝑥𝑖 , 𝑦 𝑖)( 0.5)
14
Example 𝑑𝑦 −0.3 𝑥
=− 1.2 𝑦 +7 𝑒
Use modified Euler’s method to solve the ODE 𝑑𝑥 from to with the initial
condition at and with .
Solution:
15
Example
16
THANK YOU
17