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

Y y T y F T Y: - A First Order Initial Value Problem of ODE May Be Written in The Form

This document discusses numerical methods for solving ordinary differential equations (ODEs). It introduces the forward Euler method, backward Euler method, and modified Euler method for numerically solving initial value problems of first order ODEs. The document also discusses higher order Runge-Kutta methods including the second, third, and fourth order methods. Examples are provided to demonstrate solving ODEs using these numerical techniques.

Uploaded by

Mohammad Rameez
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views

Y y T y F T Y: - A First Order Initial Value Problem of ODE May Be Written in The Form

This document discusses numerical methods for solving ordinary differential equations (ODEs). It introduces the forward Euler method, backward Euler method, and modified Euler method for numerically solving initial value problems of first order ODEs. The document also discusses higher order Runge-Kutta methods including the second, third, and fourth order methods. Examples are provided to demonstrate solving ODEs using these numerical techniques.

Uploaded by

Mohammad Rameez
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 18

1

Numerical Solution
of Ordinary Differential Equation
A first order initial value problem of ODE may be written
in the form


Example:



Numerical methods for ordinary differential equations
calculate solution on the points, where h is
the steps size

0
) 0 ( ), , ( ) ( ' y y t y f t y = =
0 ) 0 ( , 1 ) ( '
1 ) 0 ( , 5 3 ) ( '
= + =
= + =
y ty t y
y y t y
h t t
n n
+ =
1
2
Numerical Methods for ODE
Euler Methods
Forward Euler Methods
Backward Euler Method
Modified Euler Method

Runge-Kutta Methods
Second Order
Third Order
Fourth Order
3
Forward Euler Method
Consider the forward difference approximation for first
derivative

Rewriting the above equation we have

So, is recursively calculated as
n n
n n
n
t t h
h
y y
y =

~
+
+
1
1
, '
) , ( ' , '
1 n n n n n n
t y f y hy y y = + =
+
n
y
) , (
) , (
) , ( '
1 1 1
1 1 1 2
0 0 0 0 0 1

+ =
+ =
+ = + =
n n n n
t y f h y y
t y f h y y
t y f h y hy y y

4
Example: solve

Solution:










etc
25 . 0 , 1 0 , 1 ) 0 ( , 1 '
0
= s s = = + = h t y y ty y
1.25 1) 1 * 0.25(0 1
) 1 (
' , 25 . 0 for
0 0 0
0 0 1 1
= + + =
+ + =
+ = =
y t h y
hy y y t
1.5781 1) 1.25 * 0.25(0.25 1.25
) 1 (
' , 5 . 0 for
1 1 1
1 1 2 2
= + + =
+ + =
+ = =
y t h y
hy y y t
1 ) 0 ( , 0 for
0 0
= = = y y t
5
Graph the solution
6
Backward Euler Method
Consider the backward difference approximation for first
derivative

Rewriting the above equation we have

So, is recursively calculated as
1
1
, '

~
n n
n n
n
t t h
h
y y
y
) , ( ' , '
1 n n n n n n
t y f y hy y y = + =

n
y
) , (
) , (
) , ( '
1
2 2 1 2
1 1 0 1 0 1
n n n n
t y f h y y
t y f h y y
t y f h y hy y y
+ =
+ =
+ = + =

7
Example: solve

Solution:
Solving the problem using backward Euler method for
yields




So, we have

25 . 0 , 1 0 , 1 ) 0 ( , 1 '
0
= s s = = + = h t y y ty y
n
n
n
n n n n
n n n n n n
ht
h y
y
h y y ht y
y t h y hy y y

+
=
+ =
+ + = + =


1
) 1 ( '
1
1
1 1
n
y
333 . 1
25 . 0 * 25 . 0 1
25 . 0 1
1
, 25 . 0 for
1
0
1 1
=

+
=

+
= =
ht
h y
y t
8
8091 . 1
5 . 0 * 25 . 0 1
25 . 0 333 . 1
1
, 5 . 0 for
2
1
2 2
=

+
=

+
= =
ht
h y
y t
5343 . 2
75 . 0 * 25 . 0 1
25 . 0 8091 . 1
1
, 75 . 0 for
3
2
3 3
=

+
=

+
= =
ht
h y
y t
7142 . 3
1 * 25 . 0 1
25 . 0 5343 . 2
1
, 1 for
4
3
4 4
=

+
=

+
= =
ht
h y
y t
9
Graph the solution
10
Modified Euler Method
Modified Euler method is derived by applying the
trapezoidal rule to integrating ; So, we have


If f is linear in y, we can solved for similar as
backward euler method
If f is nonlinear in y, we necessary to used the method
for solving nonlinear equations i.e. successive
substitution method (fixed point)
) , ( ' t y f y
n
=
) , ( ' ), (
2
' '
1 1 n n n n n n n
t y f y y y
h
y y = + + =
+ +
1 + n
y
11
Example: solve

Solution:
f is linear in y. So, solving the problem using modified Euler
method for yields




25 . 0 , 1 0 , 1 ) 0 ( , 1 '
0
= s s = = + = h t y y ty y
h y
t
h
t
h
y
h t
h
y t
h
y
y t y t
h
y
y y
h
y y
n
n
n
n
n n n n
n n n n n
n n n n
+

+
=
+ + =
+ + + + =
+ + =




1
1
1 1
1 1 1
1 1
)
2
1 (
)
2
1 (
)
2
1 ( )
2
1 (
) 1 1 (
2
) ' ' (
2
n
y
12
Graph the solution
13
Second Order Runge-Kutta Method
The second order Runge-Kutta (RK-2) method is derived
by applying the trapezoidal rule to integrating
over the interval . So, we have





We estimate by the forward euler method.
) , ( ' t y f y =
] , [
1 + n n
t t
( ) ) , ( ) , (
2
) , (
1 1
1
1
+ +
+
+ + =
+ =
}
+
n n n n n
t
t
n n
t y f t y f
h
y
dt t y f y y
n
n
1 + n
y
14
So, we have



Or in a more standard form as
( ) ) ), , ( ( ) , (
2
1 1 + +
+ + + =
n n n n n n n n
t t y hf y f t y f
h
y y
( )
) , (
) , ( where
2
1
1 1 2
1
2 1 1
+
+
+ =
=
+ + =
n n
n n
n n
t k y hf k
t y hf k
k k y y
15
Third Order Runge-Kutta Method
The third order Runge-Kutta (RK-3) method is derived by
applying the Simpsons 1/3 rule to integrating
over the interval . So, we have





We estimate by the forward euler method.
) , ( ' t y f y =
] , [
1 + n n
t t
( ) ) , ( ) , ( 4 ) , (
6
) , (
1 1
1
2
1
2
1
1
+ + + +
+
+ + + =
+ =
}
+
n n n n n n n
t
t
n n
t y f t y f t y f
h
y
dt t y f y y
n
n
2
1
+ n
y
16
The estimate may be obtained by forward difference
method, central difference method for h/2, or linear
combination both forward and central difference method.
One of RK-3 scheme is written as






( )
) , 2 (
)
2
, (
) , ( where
4
6
1
1 2 1 3
1 2
1
2
1
3 2 1 1
+
+
+ =
+ + =
=
+ + + =
n n
n n
n n
n n
t k k y hf k
h
t k y hf k
t y hf k
k k k y y
1 + n
y
17
Fourth Order Runge-Kutta Method
The fourth order Runge-Kutta (RK-4) method is derived
by applying the Simpsons 1/3 or Simpsons 3/8 rule to
integrating over the interval . The
formula of RK-4 based on the Simpsons 1/3 is written as






) , ( ' t y f y =
] , [
1 + n n
t t
( )
) , (
)
2
, (
)
2
, (
) , ( where
2 2
6
1
3 4
2 2
1
3
1 2
1
2
1
4 3 2 1 1
h t k y hf k
h
t k y hf k
h
t k y hf k
t y hf k
k k k k y y
n n
n n
n n
n n
n n
+ + =
+ + =
+ + =
=
+ + + + =
+
18
The fourth order Runge-Kutta (RK-4) method is derived
based on Simpsons 3/8 rule is written as






( )
) , 3 3 (
)
3
2
, (
)
3
, (
) , ( where
3 3
8
1
3 2 1 4
2 3
1
1 3
1
3
1 3
1
2
1
4 3 2 1 1
h t k k k y hf k
h
t k k y hf k
h
t k y hf k
t y hf k
k k k k y y
n n
n n
n n
n n
n n
+ + + =
+ + + =
+ + =
=
+ + + + =
+

You might also like