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

CE324 Module11a ODE

This document describes numerical methods for solving ordinary differential equations (ODEs). It introduces ODEs and defines initial value problems. It then describes Euler's method and modified Euler's method for approximating the solution to initial value problems. Euler's method uses forward differencing to estimate the slope at each step. Modified Euler's method improves the estimate of the slope by taking the average of the slopes calculated at the beginning and end of each step. The document provides an example applying both methods to solve a first-order initial value problem.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
60 views

CE324 Module11a ODE

This document describes numerical methods for solving ordinary differential equations (ODEs). It introduces ODEs and defines initial value problems. It then describes Euler's method and modified Euler's method for approximating the solution to initial value problems. Euler's method uses forward differencing to estimate the slope at each step. Modified Euler's method improves the estimate of the slope by taking the average of the slopes calculated at the beginning and end of each step. The document provides an example applying both methods to solve a first-order initial value problem.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 17

CE324 Module 11a:

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.

A differential equation is an equation that contains derivatives


of an unknown function. The solution is the function that satisfies
the differential equation.

An ordinary differential equation (ODE) is any relation


between a function of a single independent variable and its
derivatives.
For example, if x is the independent variable and y is the
dependent variable, the ODE has combinations of the variables
x, y, and dy/dx.

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

Ordinary Differential Runge-Kutta Methods


Equations (ODEs)
Shooting Method
Boundary Value
Problems
Finite Difference Method

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.

An initial value problem is made up of two components: Example:

1. A mathematical model of the process, stated in the 𝑑𝑦


= 𝑓 ( 𝑡 , 𝑦 ) ,(𝑡 >0)
form of a differential equation. 𝑑𝑡

2. An initial value, given at some value of the 𝑦 ( 0 )= 𝑦 0


independent variable.

The numerical solution to this initial value problem is a sequence of numbers


𝒚𝟎 , 𝒚 𝟏 , 𝒚 𝟐, … , 𝒚𝒏
where for , is the approximation of the exact value at , with being the distance between
consecutive, equally spaced t-values.

6
Initial Value Problems
Exact Solution

Approximate
Solution
Given
(Initial Value)
Time
Step

The numerical solution to this initial value problem is a sequence of numbers


𝒚𝟎 , 𝒚 𝟏 , 𝒚 𝟐, … , 𝒚𝒏
where for , is the approximation of the exact value at , with being the distance between
consecutive, equally spaced t-values.

7
Euler’s Method
The Euler’s Method is the simplest technique for solving a first-order ODE
of the form:

𝒅𝒚
=𝒇 (𝒙,𝒚) with initial condition
𝒅𝒙

It can be formulated as an explicit method or an implicit method, with the


explicit formulation more commonly used.

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

Using the forward difference formula (from


numerical differentiation) at the point :

𝒅𝒚 𝒚 𝒊+𝟏 − 𝒚 𝒊
𝑺𝒍𝒐𝒑𝒆 = ≈ = 𝒇 (𝒙𝒊, 𝒚 𝒊)
= 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 𝑒
𝑑𝑥

Initial Value ( 𝑥1 , 𝑦 1)=( 0 , 3)

Step size h=0.5


𝑥𝑖 +1= 𝑥 𝑖 +h=𝑥 𝑖 +0.5

𝑦 𝑖 +1= 𝑦 𝑖 + 𝑓 ( 𝑥 𝑖 , 𝑦 𝑖 ) ( h )= 𝑦 𝑖 + ( − 1.2 𝑦 𝑖 +7 𝑒 ) (0.5 )


− 0.3 𝑥𝑖

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 :

3. Solve next value of using Euler’s Method:

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)

𝑓 ( 𝑥1 , 𝑦 1 )=( − 1.2(𝟑)+7 𝑒 −0.3 (𝟎) )¿ 𝟑 .𝟒 (𝑥1 , 𝑦 1)=(0 , 3)


𝑦 2𝐸𝑈 = 𝑦 1 + 𝑓 ( 𝑥1 , 𝑦 1 )( 0.5) ¿ 𝟑+ ( 3 .4 ) (0.5)¿ 𝟒 . 𝟕

𝑓 ( 𝑥2 , 𝑦 2𝐸𝑈 )=( − 1.2(𝟒 .𝟕)+7 𝑒 −0.3 (𝟎. 𝟓) ) ¿ 𝟎 .𝟑𝟖𝟓𝟎


𝑓 ( 𝑥 1 , 𝑦 1 )+ 𝑓 (𝑥 2 , 𝑦 2𝐸𝑈 ) 3.4+ 0.3850
𝑦2= 𝑦1+ ¿ 3+
h (0.5)
¿ 𝟑 .𝟗𝟒𝟔𝟐
2 2
(𝒙𝟐 , 𝒚 𝟐)=(𝟎. 𝟓,𝟑. 𝟗𝟒𝟔𝟐)

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:

1 0.5 3.4 4.7 0.3850 3.9462 (0.5, 3.9462)


2 1.0 1.2895 4.59095 -0.3234 4.1877 (1.0, 4.1877)
3 1.5 0.1605 4.26795 -0.6581 4.0633 (1.5, 4.0633)
4 2.0 -0.4126 3.8570 -0.7867 3.7635 (2.0, 3.7635)
5 2.5 -0.6745 3.42625 -0.8049 3.3937 (2.5, 3.3937)

15
Example

Euler’s Explicit Method Modified Euler’s Method

16
THANK YOU

17

You might also like