ENGINEERING MATHEMATICS II
010.141
NUMERICAL METHODS FOR
DIFFERENTIAL EQUATIONS
MODULE 6
INTRODUCTION
Ø The methods which we will cover are:
• Methods for First-Order Differential Equation o Euler Method
o Improved Euler Method o Runge-Kutta
o Adams-Bashforth o Adams-Moulton
• Methods for Higher Order Equations and for Systems
METHODS FOR FIRST-ORDER DIFFERENTIAL EQUATION
In this section, we will assume that the problem to be solved is expressed as:
y' = f ( x, y ) y ( x0 ) = y0 Initial Value Problem and f is such that the problem has a unique solution.
We shall start with step-by-step methods, i.e., x0 ® x1 = x0 + h ® x2 = x0 + 2h, ×××
where "h" is the step size.
METHODS FOR FIRST-ORDER DIFFERENTIAL EQUATION (cont)
Step-by-step methods' formulation is derived from Taylor series
(
+)
=( )
+( )
+ ¢¢( )
+Ly x h y h
x y' x
y h
x y
2
EULER'S METHOD
For instance, the Euler method also called Euler-Cauchy is derived directly from the first two terms of the Taylor expansion:
( )
( ) ( ) ( )
( ) x h f ( x, y )
y
x y' h x
y h
x y
y x, f y
+
»
+
» +
¢ =
EULER'S METHOD
The iteration process follows:
( )
( )
( ) ( ) ( )
( )
(
1 1)
1 2
0 0
0 1
0 0
0 0
1
0 0
y , x f h y
y
y , x f h y
y
y , x f h x
y h
x y y
y 0
y i.e.
known y
+
=
+
=
+
= +
=
=
®
(
n n)
n 1
n
y h f x , y
y
+= +
EULER'S METHOD
EULER'S METHOD
Example
Consider the D.E.
wyth i.c. y(0) = 0
This D.E. has solution:
y(x) = ex – x - 1
EULER
y dx x
dy = +
EULER: TABLE 19.1 h = 0.2
Note: exact solution y = e1 – 1 – 1 = 0.718 Approx. is 0.489
error 0.229 ® significant
A priori, one would want to create methods which use more terms of the Taylor series
where
IMPROVED EULER (HEUN'S METHOD)
( )
f f
f
x y y
f x
y f x f
y
x + ×
=
¶
× ¶
¶ + ¶
¶
= ¶ ,
'
( ) ( ) ( ) ( )
( ) ( ) ( )
LL
+ +
+
=
+ +
+
= +
y , x ' 2 f y h
x, hf x
y
x
"
2 y x h
hy' x
y h
x y
2 2
Obtaining the derivatives of f is time consuming and cumbersome.
Instead an another approach is preferred where intermediate values are introduced to increase accuracy.
Uses Predictor - Corrector Method Predictor:
Corrector:
IMPROVED EULER METHOD
(
n n)
n 1
n
y h f x , y y
*+= +
( ) ( )
[
+ *+]
+1 = n + n n + n 1 n 1
n f x ,y f x ,y
2 y h
y
Improved Euler is called a predictor-corrector method, i.e., one step predicts, one step predicts.
Example: Consider:
IMPROVED EULER METHOD
( ) 0 0
y
y dx x
dy
= +
=
IMPROVED EULER METHOD (cont)
( ) ( )
[ ]
[ ]
n+1 n 2 n n n+1 1
n 2 n n n n n n
n 2 n n n n n n
n 2 n n
n
y = y x + y + x + y , y = x + y = y x + y + x + h + y + h x + y
= y x + y + x + y + 0.2x + 0.2y , h = 0.2 = y 2.2x + 2.2y + 0.2
= y
h
n h
h
h
*
+ ¢
é ù
+ ë û
+ éë ùû
+ + +
( )
( )
n n
n n n
n+1 n n n
0.22x + 0.22y + 0.02
= y 0.22 x + y + 0.02 Improved Euler y = y 0.2 x + y Euler
+ +
ILLUSTRATION – TABLE 19.3
( )
( ) ( )
Define:
y = y h f x , y
y = y f x , y + f x , y
n n n
n n n n+1
n
n h
n +
*
+ *+
+
+ é
ëê
ù ûú
1
1 2 1
ILLUSTRATION – TABLE 19.3 (cont)
( ) ( )
[ ]
[ ]
( )
y = y x + y + x + h + y + h x + y = y .1 2.2x + 2.2y + .2
= y 0.22 x + y + .02
n+1 n n n n n n n
n n n
n n n
+ + +
h 2
0 0
0
RUNGE-KUTTA
( )
( )
( )
0 0
n+1 0
n+1
1 n n
2 n n 1
3 n n 2
= f x, y ; x = x , y = y x = x + n + 1
Find y :
= h f x , y
1 1
= h f x + h, y +
2 2
1 1
= h f x + h, y +
2 2
y
at h
Define k
k k
k k
¢
æ ö
ç ÷
è ø
æ è
( )
( )
4 n n 3
n+1 n 1 2 3 4
= h f x + h, y +
y = y + 1 + 2 + 2 +
k k
k k k k
ç ö÷
ø
RUNGE-KUTTA (Cont.)
( )
( )
( )
1 n n
2 n n 1
3 n n 2
4
Again = x + y
= 0.2, 5 steps, from 0 to 1 = 0.2 x , y
= 0.2 x + 0.1 + y + 0.5 = 0.1 x + 0.1 + y + 0.5 = 0
y h k
k k
k k
k
¢
( )
( )
( )
n n 3
n+1 n n n
5 n
n+1 n n n
.2 x + 0.2 + y + After simplification:
y = y + 0.2214 x , y + 0.0214 at n=5: x =1
y = 0.718215 very close y = y + 0.22 x , y + 0.02 Euler: 0.48
k
®
9 IE: 0.7027 RK: 0.718215 True : 0.718282
MULTI-STEP METHOD (Optional)
Multi-step method are methods that use information from more than one of the preceding steps, thereby increasing accuracy.
ADAMS-BASFORTH METHOD (Optional)
(
x, y)
, y( )
x0 y0f
y¢ = =
Consider
where f such that there is a unique solution
IDEA!! Replace f(x, y(x)) by an interpolation polynomial p(x).
( ) ( ] ( ) ( )
( )
( )
ò ò
+ + +
=
-
=
¢ = +
1 n
n
1 n n 1
n
n
x
x
n 1
n x
x x
x
dx x
y , x f
x y x
y y
dx x
y
The method is explained by taking a polynomial of order 3, p3(x) such that
ADAMS-BASFORTH METHOD (Optional)
ò ( )
+
+
+
=
1 n
n
x
x n
1
n
y p x dx
y
( )
( )
( )
(
n 3 n 3)
3 n
2 n 2
n 2
n
1 n 1
n 1
n
n n
n
y , x
f f
y , x
f f
y , x
f f
y , x f f
- -
-
- -
-
- -
-
=
=
=
=
p3(x) can for instance be given by the Newton-backward difference formula (p807)
where
ADAMS-BASFORTH METHOD (Optional)
( ) ( )
( )( )
3 nn 2 n
n
3 r r 1 r 2 f
6 f 1
2 1 r f r
r f
x
p + Ñ + + + Ñ
+ Ñ
+
=
1 n 1 k n
1 k n
k
1 n n
n
f f
f
f f
f
- - -
-
Ñ - Ñ
= Ñ
-
= Ñ
ADAMS-BASFORTH METHOD (Optional)
( )
3 n 2
n 1
n
2 n 1
n 1
n 2
1 n 2 n
2 n
3
2 n 1
n n
2 n 1
n 1
n n
1 n n
n 2
1 n n
n
f f
2 f
f f
f
f f
f
f f
2 f
f f
f f
f f
f
f f
f
- -
-
- -
-
-
- -
- -
-
- -
+ -
=
Ñ - Ñ
= Ñ
Ñ - Ñ
= Ñ
+ -
= -
- -
=
Ñ - Ñ
= Ñ
-
=
Ñ
ADAMS-BASFORTH METHOD (Optional)
( ) ( ) ( )
( )
( )( )( )
h x r x
f f
2 f
f f
2 f
2 r 1 r 6 r 1
f f
2 2 f
1 r f r
f r f
x p
n
3 n 2
n 1
n 2
n 1
n n
2 n 1
n n
1 n n
n 3
= -
- +
- +
- +
+ +
+ + -
+ -
+
=
- -
- -
-
- -
-
where r varies between 0 and 1 h dr = dx
ADAMS-BASFORTH METHOD (Optional)
( ) [ ]
( )
( )
( ) ò ( )
ò ò
ò ò ò
+ +
- +
- +
+ + -
+
- +
=
=
- -
-
- -
-
+
1
0
2 3
n 2
n 1
n n
1
0
2 2
n 1
n n
1
0 1 n n
1
0 n 1
0 x
x
3
dr 2 r 3 r
6 r f 1
f 3 f
3 f
h
2 dr r f r
f 2 f
h
dr r f
f h
dr f
h
dr h dx
x p
1 n
n
L
ADAMS-BASFORTH METHOD (Optional)
( )
( ] ( )
( )
( )
úú û ù çç
è
æ + +
- +
- +
úú û ù çç
è
æ + +
- +
úú û ù çç è - æ
+
=
=
- -
-
- -
-
ò
+
2 2 r 3
3r 4
r 6 f 1
f 3 f
3 f
h
4 r 6 f r
f 2 f
h
2 f r
f h r
f h
? dx x p
2 3
4 3
n 2
n 1
n n
1
0 2 3
2 n 1
n n
1
0 2 1
n n
1 n 0 x
x
3
1 n
n
ADAMS-BASFORTH METHOD (Optional)
( ) ( )
( )
( )
+L úû ù êë
é ÷
ø ç ö
è æ +
÷- ø ç ö
è æ + -
- +
÷ø ç ö
è
æ + + + + + +
=
÷ø ç ö
è
æ + + -
+ -
+
÷ø ç ö
è æ + +
- +
- +
=
-
- -
-
- -
ò
-+
4 2 1 6 3 4
1 6
2 1 2 f 1
h
24 4 24
4 24
1 4
1 6
1 2
1 1 f h
1 4 1
1 6 f 1
f 3 f
3 f
h
4 1 6
f 1 f
2 f
h
f 2 f
f h h dx
x p
1 n n
3 n 2
n 1
n n
2 n 1
n n
1 n n
n x
x
3
1 n
n
ADAMS-BASFORTH METHOD (Optional)
( )
÷ø ç ö
è
æ - - +
÷ø ç ö
è
æ + + + +
÷ø ç ö
è
æ - - - - - +
+ + +
= +
úû ù êë
é ÷
ø ç ö
è æ + -
ú + û ù êë
é ÷
ø ç ö
è æ + +
+ +
=
- - -
-
ò
-+
24 8 f 1
h
24
24 3
6 f 4
h
24
24 3
12 8
f 12 h
f 24 h
1 6 4 12 24
4 2 1 6 f 1
h 4 2
1 6 3 4 1 6 f 1
h dx
x p
3 n
2 n
1 n
n
3 n 2
n x
x
3
1 n
n
L
ADAMS-BASFORTH METHOD (Optional)
( )
3 n 2
n 1
n n
n 1
n
3 n 2
n 1
n n
x
x
3
f 24 h f 9
24 h f 37
24 h f 59
24 h y 55
y
24 f 9
24 h f 37
24 h f 59
h f
24 h dx 55
x p
1 n
n
- -
- +
- -
-
- +
-
= -
÷ø ç ö
è + æ -
÷ø ç ö
è + æ
÷ø ç ö
è + æ -
ò
=+