Chapter 7
Chapter 7
Ex1: Use the Taylor series method to determine the value of ( ) at ( ), where:
, and ( ) , (Use Five Terms only)
Ex3: Use the Taylor series method to determine the value of ( ) at ( ), where:
, and ( ) , (Use Five Terms only)
In this method Euler utilized the first two terms in Taylor Expansion Series, however
he divided the difference between ( ) ( ) into several segments (n) in order
to reduce error:
( )( )
( )= ( )+ ( ) Or;
If ( )⁄ then:
( )( )
( )= ( )+ ( ), where:
( )( )
= ( )= ( )⇒ ( ) ( )+( ). ( )
( ) ( )+( ). ( )
( )
n = 10 ⇒ ( )⁄
( ) ( ) ( )
0.0000 0.0000 1.0000 0.1000
0.1000 0.1000 1.2050 0.2205
0.2000 0.2205 1.4401 0.3645
0.3000 0.3645 1.7064 0.5351
0.4000 0.5351 2.0018 0.7353
0.5000 0.7353 2.3195 0.9673
0.6000 0.9673 2.6454 1.2318
0.7000 1.2318 2.9569 1.5275
0.8000 1.5275 3.2246 1.8500
0.9000 1.8500 3.4209 2.1921
1.0000 2.1921
Ex2: Use the Euler’s method to determine the value of ( ) at ( ), where:
, and ( ) , (Use n = 5)
( ) ( )+( ). ( )
( )
n=5⇒( )⁄
( ) ( ) ( )
0.0000 1.0000 1.0000 1.3000
0.3000 1.3000 1.7800 1.8340
0.6000 1.8340 3.7236 2.9511
0.9000 2.9511 9.5190 5.8068
1.2000 5.8068 35.1589 16.3545
1.5000 16.3545
( ) , and ( ) , (Use n = 6)
( ) ( )+( ). ( )
( )
n=6⇒( )⁄
( ) ( ) ( )
0.0000 0.0000 0.0000 0.0000
0.2000 0.0000 0.1987 0.0397
0.4000 0.0397 0.4257 0.1248
0.6000 0.1248 0.6630 0.2574
0.8000 0.2574 0.8711 0.4316
1.0000 0.4316 0.9903 0.6297
1.2000 0.6297
Chapter Seven : Numerical Solution of Ordinary Differential Equations: (3)
3- Modified Euler’s Method to solve Ordinary Differential Equations.
( ) ( )+( ). ( ( ) ( ))
Ex1: Use the Modified Euler’s method to determine the value of ( ) at ( ), where:
, and ( ) , (Use n = 5)
( ) ( )+( ). ( )
( )
( ) ( )+( ). ( ( ) ( ))
( )
n=5⇒( )⁄
( ) ( ) ( ) ( ) ( )
1.0000 2.3000 6.2900 1.0400 2.5516 7.5923 2.5776
1.0400 2.5776 7.7256 1.0800 2.8866 9.4990 2.9221
1.0800 2.9221 9.7050 1.1200 3.3103 12.2125 3.3604
1.1200 3.3604 12.5470 1.1600 3.8623 16.2630 3.9366
1.1600 3.9366 16.8424 1.2000 4.6103 22.6948 4.7273
1.2000 4.7273
Ex2: Use the Modified Euler’s method to determine the value of ( ) at ( ), where:
, and ( ) , (Use n = 5)
Sol: Modified Euler’s Method is:
( ) ( )+( ). ( )
( )
( ) ( )+( ). ( ( ) ( ))
( )
n=5⇒( )⁄
( ) ( ) ( ) ( ) ( )
0.0000 1.0000 -1.0000 0.0200 0.9800 -0.9404 0.9806
0.0200 0.9806 -0.9416 0.0400 0.9618 -0.8850 0.9623
0.0400 0.9623 -0.8860 0.0600 0.9446 -0.8323 0.9451
0.0600 0.9451 -0.8332 0.0800 0.9284 -0.7820 0.9289
0.0800 0.9289 -0.7829 0.1000 0.9132 -0.7340 0.9137
0.1000 0.9137
Ex3: Use the Modified Euler’s method to determine the value of ( ) at ( ), where:
( ) , and ( ) , (Use n = 5)
Sol: Modified Euler’s Method is:
( ) ( )+( ). ( )
( ) ( )
( ) ( )+( ). ( ( ) ( ))
( )
n=5⇒( )⁄
( ) ( ) ( ) ( ) ( )
0.0000 1.0000 -0.5000 0.0600 0.9700 -0.4550 0.9714
0.0600 0.9714 -0.4557 0.1200 0.9441 -0.4120 0.9454
0.1200 0.9454 -0.4127 0.1800 0.9206 -0.3703 0.9219
0.1800 0.9219 -0.3710 0.2400 0.8996 -0.3298 0.9009
0.2400 0.9009 -0.3304 0.3000 0.8811 -0.2905 0.8823
0.3000 0.8823
Chapter Seven : Numerical Solution of Ordinary Differential Equations: (4)
4- Runge-Kutta’s (Second order) Method to solve Ordinary Differential Equations.
This method is the most popular method to solve Initial Value Problems for Ordinary
Differential Equations. However, this method (Runge-Kutta’s Second order) is similar
to the modified Euler Method with little differences as follows:
Figure (1) Euler’s Method Figure (2) Modified Euler’s and Runge-Kutta Method
( ) ( )+( ). ( )
Where:
( ) ( )
Ex1: Use the Runge-Kutta’s (Second Order) method to determine the value of ( ) at
( ), where:
, and ( ) , (Use n = 5)
( )
( ) ( )
( )
( ) ( )+( ). ( )
( )
n=5⇒( )⁄
( ) ( ) ( )
1.0000 2.3000 6.2900 1.0400 2.5516 7.5923 2.5776
1.0400 2.5776 7.7259 1.0800 2.8866 9.4991 2.9221
1.0800 2.9221 9.7051 1.1200 3.3103 12.2125 3.3605
1.1200 3.3605 12.5470 1.1600 3.8624 16.2636 3.9367
1.1600 3.9367 16.8433 1.2000 4.6104 22.6961 4.7273
1.2000 4.7273
Ex2: Use the Runge-Kutta’s (Second Order) method to determine the value of ( ) at
( ), where:
, and ( ) , (Use n = 5)
Sol: Runge-Kutta’s (Second Order) Method is:
( )
( ) ( )
( )
( ) ( )+( ). ( )
( )
n=5⇒( )⁄
( ) ( ) ( )
0.0000 1.0000 -1.0000 0.0200 0.9800 -0.9404 0.9806
0.0200 0.9806 -0.9416 0.0400 0.9618 -0.8850 0.9623
0.0400 0.9623 -0.8860 0.0600 0.9446 -0.8323 0.9451
0.0600 0.9451 -0.8332 0.0800 0.9284 -0.7820 0.9289
0.0800 0.9289 -0.7829 0.1000 0.9132 -0.7340 0.9137
0.1000 0.9137
Chapter Seven: Solution of Ordinary Differential Equations
Where:
𝑦𝑖−1 𝑦𝑖 𝑦𝑖+1
-
𝑥𝑖−1
1 𝑥𝑖 𝑥𝑖+1
Type equation here.
-
1
h h
Type equation here.
-1 it can be represent first derivative and second derivative in ordinary
In other words
differential equations in (B.V.P.) with the above expressions. However, the interval
-1
between any two following points (h) should be constant.
EX. 1:
For the following differential equation, by using Finite Difference Method find the
value of [𝑦 = 𝑓(𝑥)] in each point, where :
𝑑2𝑦
+ 𝑦 = 0 , 𝑦(0) = 0 , 𝑦(1) = 1 , ℎ = 0.25
𝑑𝑥 2
Solution:
−1.9375𝑦1 + 𝑦2 = 0 ------(1)
@ Node 2: 𝑥2 = 0.50
𝑑2𝑦 𝑦1 −2𝑦2 + 𝑦3
+ 𝑦 = 0 => + 𝑦2 = 0 , ℎ = 0.25
𝑑𝑥 2 ℎ2
𝑦1 − 1.9375𝑦2 + 𝑦3 = 0 ------(2)
@ Node 3: 𝑥3 = 0.75
𝑑2𝑦 𝑦2 −2𝑦3 + 𝑦4
+ 𝑦 = 0 => + 𝑦3 = 0 , 𝑦4 = 1, ℎ = 0.25
𝑑𝑥 2 ℎ2
EX. 2:
For the following differential equation, by using Finite Difference Method find the
value of [𝑦 = 𝑓(𝑥)] in each point, where :
𝑑2𝑦
= 4(𝑦 − 𝑥) , 𝑦(0) = 0 , 𝑦(1) = 2 , ℎ = 0.25
𝑑𝑥 2
Solution:
@ Node 1: 𝑥1 = 0.25
𝑑2𝑦 𝑦0 −2𝑦1 + 𝑦2
= 4(𝑦 − 𝑥) => = 4(𝑦1 − 𝑥1 ) , 𝑦0 = 0, 𝑥1 = 0.25, ℎ = 0.25
𝑑𝑥 2 ℎ2
@ Node 2: 𝑥2 = 0.50
𝑑2𝑦 𝑦1 −2𝑦2 + 𝑦3
= 4(𝑦 − 𝑥) => = 4(𝑦2 − 𝑥2 ) , 𝑥2 = 0.50, ℎ = 0.25
𝑑𝑥 2 ℎ2
@ Node 3: 𝑥3 = 0.75
𝑑2𝑦 𝑦2 −2𝑦3 + 𝑦4
= 4(𝑦 − 𝑥) => = 4(𝑦3 − 𝑥3 ) , 𝑦4 = 2, 𝑥3 = 0.75, ℎ = 0.25
𝑑𝑥 2 ℎ2
EX. 3:
For the following differential equation, by using Finite Difference Method find the
value of [𝑦 = 𝑓(𝑥)] in each point, where :
𝑑2𝑦 1 𝑑𝑦 𝑦
+ × − = 0 , 𝑦(2.5) = 0.008 , 𝑦(6.5) = 0.003 , ℎ = 1.0
𝑑𝑥 2 𝑥 𝑑𝑥 𝑥2
Solution:
𝑑𝑦 𝑦𝑖−1 − 𝑦𝑖+1
𝑖=
𝑑𝑥 2ℎ
𝑑2𝑦 𝑦𝑖−1 −2𝑦𝑖 + 𝑦𝑖+1
𝑖=
𝑑𝑥 2 ℎ2
@ Node 1: 𝑥1 = 3.5
𝑑2𝑦 1 𝑑𝑦 𝑦 𝑦0 −2𝑦1 + 𝑦2 1 𝑦0 − 𝑦2 𝑦1
+ × − =0 => + × − =0
𝑑𝑥 2 𝑥 𝑑𝑥 𝑥2 ℎ2 𝑥1 2ℎ 𝑥12
@ Node 2: 𝑥2 = 4.5
𝑑2𝑦 1 𝑑𝑦 𝑦 𝑦1 −2𝑦2 + 𝑦3 1 𝑦1 − 𝑦3 𝑦2
+ × − =0 => + × − =0
𝑑𝑥 2 𝑥 𝑑𝑥 𝑥2 ℎ2 𝑥2 2ℎ 𝑥22
@ Node 3: 𝑥3 = 5.5
𝑑2𝑦 1 𝑑𝑦 𝑦 𝑦2 −2𝑦3 + 𝑦4 1 𝑦2 − 𝑦4 𝑦3
+ × − =0 => + × − =0
𝑑𝑥 2 𝑥 𝑑𝑥 𝑥2 ℎ2 𝑥3 2ℎ 𝑥32
Sol.:
y0(0) = 0.0 -------- y1(0.25) =? -------- y2(0.50) = ? --------- y3(0.75) = ? --------- y4(1) = 1.0
@ Node 1 : x1 = 0.25
Where :
@ Node 2 : x2 = 0.5
Where :
@ Node 3 : x3 = 0.75
Where :
Sol.:
y0(0) = 40 -------- y1(2) =? -------- y2(4) = ? --------- y3(6) = ? --------- y4(8) = 160
@ Node 1 : x1 = 2.0
( ) ⇒ ( )
Where :
@ Node 2 : x2 = 4.0
( ) ⇒ ( )
Where :
@ Node 3 : x3 = 6.0
( ) ⇒ ( )
Where :