0% found this document useful (0 votes)
109 views22 pages

Differential Equation

The document discusses numerical methods for solving ordinary differential equations. It introduces Euler's method and modified Euler's method. An example problem is provided and solved using both methods to approximate the solution between x=2 and x=3.

Uploaded by

Dean Ackles
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
109 views22 pages

Differential Equation

The document discusses numerical methods for solving ordinary differential equations. It introduces Euler's method and modified Euler's method. An example problem is provided and solved using both methods to approximate the solution between x=2 and x=3.

Uploaded by

Dean Ackles
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

CE50P-2:

Numerical Solution
to Engineering Problems
ORDINARY
DIFFERENTIAL EQUATION
COURSE OUTCOME 4:
Solve Ordinary Differential Equation
problems numerically when their
analytical solution is either not
available or difficult to obtain.
Ordinary Differential Equation
COURSE OUTCOME 4:
Solve Ordinary Differential Equation problems
numerically when their analytical solution is either
not available or difficult to obtain.
Ordinary Differential Equation
Differential Equations are one of the most important
mathematical tools used in producing models of
physical and biological processes.

Differential Equations are classified according to


order but for our discussion, we shall only consider
one type, the first order differential equation which
takes the form

𝑦 ′ 𝑥 = 𝑓 𝑥, 𝑦 𝑥 , 𝑥≥0
Ordinary Differential Equation
The simplest form of differential equation is
𝑦′ 𝑥 = 𝑓 𝑥
with 𝑓(𝑥) a given function. The general solution of this
equation is
𝑦 𝑥 = න 𝑓 𝑥 𝑑𝑥 + 𝑐

with 𝑐 an arbitrary constant. A particular solution is


obtained by specifying the value of 𝑦(𝑥) at some given
point, 𝑦(𝑥0 )= 𝑦0 , thus determining the value of 𝑐. This
is the initial value problem.
Ordinary Differential Equation
EULER’S METHOD
Euler’s Method is said to be the simplest method for
solving initial value problem.

Let 𝑌(𝑥) denote the true solution of the initial value


problem, with the initial value 𝑌0 .

𝑌 ′ 𝑥 = 𝑓 𝑥, 𝑌 𝑥 , 𝑥0 ≤ 𝑥 ≤ 𝑏
𝑌 𝑥0 = 𝑌0
Ordinary Differential Equation
EULER’S METHOD
Numerical methods for solving the previous
Differential Equation will find an approximate
solution 𝑦(𝑥) at only a discrete set of nodes,

𝑥0 < 𝑥1 < 𝑥2 … < 𝑥𝑁 ≤ 𝑏

and for our work, we will take these nodes to be


evenly spaced:

𝑥𝑛 = 𝑥0 + 𝑛ℎ, 𝑛 = 0,1,2, … , 𝑁
Ordinary Differential Equation
EULER’S METHOD
To derive Euler’s Method, recall the derivative
approximation we have previously,

1
𝑌 𝑥 ≈ 𝑌 𝑥 + ℎ − 𝑌(𝑥)

Applying this to the initial value problem at 𝑥 = 𝑥𝑛 ,
𝑌 ′ 𝑥𝑛 = 𝑓(𝑥𝑛 , 𝑌 𝑥𝑛 )
we obtain
1
𝑌 𝑥𝑛+1 − 𝑌(𝑥𝑛 ) ≈ 𝑓(𝑥𝑛 , 𝑌 𝑥𝑛 )

𝑌 𝑥𝑛+1 ≈ 𝑌 𝑥𝑛 + ℎ𝑓(𝑥𝑛 , 𝑌 𝑥𝑛 )
Ordinary Differential Equation
EULER’S METHOD
Thus, Euler’s Method is defined by taking this to be
exact:

𝑦𝑛+1 = 𝑦𝑛 + ℎ𝑓 𝑥𝑛 , 𝑦𝑛 , 0≤𝑛 ≤𝑁−1


Ordinary Differential Equation
MODIFIED EULER’S METHOD
In Euler’s Method it is assumed that the slope is
constant across the entire interval ℎ and that is equal
at the beginning of the interval.

This assumption is the fundamental source of error in


Euler’s Method. In reality the slope of the actual
curve 𝑦(𝑥) is not constant across the interval and
changes continuously as the value of the independent
variable changes.
Ordinary Differential Equation
MODIFIED EULER’S METHOD
We need to use an average slope over the interval if
we hope to estimate the change in 𝑦 with precision.
By using this, the Euler’s Method can be
substantially improved. This procedure is known as
the Modified Euler’s Method and also as Heun’s
Method.
Ordinary Differential Equation
MODIFIED EULER’S METHOD
Thus, the Modified Euler’s Method is defined by
taking this to be exact:

1
𝑦𝑛+1 = 𝑦𝑛 + ℎ 𝑓 𝑥𝑛 , 𝑦𝑛 + 𝑓(𝑥𝑛 + ℎ, 𝑦𝑛 + ℎ𝑓 𝑥𝑛 , 𝑦𝑛 )
2
Ordinary Differential Equation
Example
For the initial value problem

𝑑𝑦 𝑦 ln 𝑦
= , 𝑦 2 =𝑒
𝑑𝑥 𝑥

Approximate solution from 2 to 3, using


a) Euler’s Method
b) Modified Euler’s Method
Ordinary Differential Equation
Example Initial value
Slope=f(x,y)
EULER'S METHOD
x y dy/dx
2.0 2.7182818285 1.3591409142
2.1 2.8541959199 1.4254536226 y ln (y) / x
2.2 2.9967412821 1.4949999323
2.3 3.1462412754 1.5679341197
2.4 3.3030346873 1.6444180873
2.5 3.4674764961 1.7246216904
2.6 3.6399386651 1.8087230858
2.7 3.8208109737 1.8969091045
2.8 4.0105018841 1.9893756448
2.9 4.2094394486 2.0863280900 actual DE: y = 𝑒 𝑥/2 at x=3; y=4.48168907
3.0 4.4180722576 2.1879817468
4.4180722576 = approx actual − approx
1.4194829606 = error% 𝑒𝑟𝑟𝑜𝑟% = ∗ 100%
actual
h=0.1=equally spaced from 2 to 3
Ordinary Differential Equation
Example ℎ
𝑦𝑛+1 = 𝑦𝑛 + 𝑓 𝑥𝑛 , 𝑦𝑛 + 𝑓(𝑥𝑛 + ℎ, 𝑦𝑛 + ℎ𝑓(𝑥𝑛 , 𝑦𝑛 ))
2
EULER'S METHOD MODIFIED EULER'S METHOD
x y dy/dx x SAME y dy/dx
2.0 2.7182818285 1.3591409142 2.0 2.7182818285 1.3591409142
2.1 2.8541959199 1.4254536226 2.1 2.8575115553 1.4254536226
2.2 2.9967412821 1.4949999323 2.2 3.0035342330 1.4949999323
2.3 3.1462412754 1.5679341197 2.3 3.1566809356 1.5679341197
2.4 3.3030346873 1.6444180873 2.4 3.3172985460 1.6444180873
2.5 3.4674764961 1.7246216904𝐃𝐈𝐅𝐅𝐄𝐑𝐄𝐍𝐓
2.5 3.4857505349 1.7246216904
2.6 3.6399386651 1.8087230858 2.6 3.6624177737 1.8087230858
2.7 3.8208109737 1.8969091045 2.7 3.8476993832 1.8969091045
2.8 4.0105018841 1.9893756448 2.8 4.0420136207 1.9893756448
2.9 4.2094394486 2.0863280900 2.9 4.2457988074 2.0863280900
3.0 4.4180722576 2.1879817468 3.0 4.4595142993 2.1879817468
4.4180722576 = approx 4.4595142993 = approx
1.4194829606 = error% 0.4947860221 = error%
Ordinary Differential Equation
Example ℎ
𝑦𝑛+1 = 𝑦𝑛 + 𝑓 𝑥𝑛 , 𝑦𝑛 + 𝑓(𝑥𝑛 + ℎ, 𝑦𝑛 + ℎ𝑓(𝑥𝑛 , 𝑦𝑛 ))
2
actual DE: y = 𝑒 𝑥/2 at x=3; y=4.48168907
MODIFIED EULER'S METHOD
x y dy/dx
2.0 2.7182818285 1.3591409142
2.1 2.8575115553 1.4254536226
2.2 3.0035342330 1.4949999323
𝑦1 2.3 3.1566809356 1.5679341197
= 2.7182818285 2.4 3.3172985460 1.6444180873
0.1
+ 1.3591409142 + 1.4254536226 2.5 3.4857505349 1.7246216904
2 2.6 3.6624177737 1.8087230858
=2.8575115553
2.7 3.8476993832 1.8969091045
2.8 4.0420136207 1.9893756448
2.9 4.2457988074 2.0863280900
3.0 4.4595142993 2.1879817468
average slope
4.4595142993 = approx
0.4947860221 = error%
Ordinary Differential Equation
Example
EULER'S METHOD MODIFIED EULER'S METHOD
x y dy/dx x y dy/dx
2.0 2.7182818285 1.3591409142 2.0 2.7182818285 1.3591409142
2.1 2.8541959199 1.4254536226 2.1 2.8575115553 1.4254536226
2.2 2.9967412821 1.4949999323 2.2 3.0035342330 1.4949999323
2.3 3.1462412754 1.5679341197 2.3 3.1566809356 1.5679341197
2.4 3.3030346873 1.6444180873 2.4 3.3172985460 1.6444180873
2.5 3.4674764961 1.7246216904 2.5 3.4857505349 1.7246216904
2.6 3.6399386651 1.8087230858 2.6 3.6624177737 1.8087230858
2.7 3.8208109737 1.8969091045 2.7 3.8476993832 1.8969091045
2.8 4.0105018841 1.9893756448 2.8 4.0420136207 1.9893756448
2.9 4.2094394486 2.0863280900 2.9 4.2457988074 2.0863280900
3.0 4.4180722576 2.1879817468 3.0 4.4595142993 2.1879817468
4.4180722576 = approx 4.4595142993 = approx
1.4194829606 = error% 0.4947860221 = error%
Ordinary Differential Equation
CW4

Upload Word file of CW4


Filename: CW4-Surname
CW4: Numerical Methods to Solve Differential Equations
CW4-Page1: Euler’s Method
Solution could be presented by using Word-Equation Tool
or handwritten
CW4-Page2: Modified Euler’s Method
Solution could be presented by using Word-Equation Tool
or handwritten

USE THE SAME PROBLEM GIVEN AS EXAMPLE


Ordinary Differential Equation
LA4

Upload Excel file of CW4


Filename: LA4-Surname
LA4: Numerical Methods to Solve Differential Equations
LA4-Sheet1: Euler’s Method
LA4-Sheet2: Modified Euler’s Method
Formula should be inserted to cells for each Table presented

USE THE SAME PROBLEM GIVEN AS EXAMPLE

You might also like