4.3 Intial Value Problems For Ordinary Differential Equations
4.3 Intial Value Problems For Ordinary Differential Equations
Introduction :
Example : 1 : Use Taylor series method to find y(0.1) and y (0.2) from the
equation
y' = y2 + x, y(0) =1
Solution : Given
y'=y 2 + x, y(0) =1
f(x,y) =y 2 + x, x 0 =0, y0 =1
= 1 + x + 3 x 2 + 4 x 3 + 17 x 4 + 31 x 5 +............
2 3 12 20
Euler’s Method :
y(x) y0 (x x 0 )y 0 ' .
Similarly y 2 y1 h f (x1 , y1 ) .
dy y x
Example 2. Given with initial condition y 1 at x 0 : find
dx y x
y for x 1 By Euler’s method.
Solution. We divide the interval (0, 0.1) into five steps. The various
calculations are arranged as follows:
Remark :
The process is very slow and to obtain reasonable accuracy with Euler’s
method, we need to take a smaller value for h. Because of this restriction
on h, the method is unsuitable for practical use a modification of it,
known as modified Euler’s method, which gives more accurate results.
dy
Example 1. Using modified Euler’s method , Solve x2 y , y(0) 1 .
dx
Choose h= 0.05, Compute y(0.1). Modify the solution twice
in each step.
Solution : x 0 0, y0 1 and f (x 0 , y 0 ) x 0 2 y 0 1
y1(0) y 0 h f (x 0 , y 0 ) 1.05 .
h
Then y 2(1) y1 f (x1 , y1 ) f (x 2 , y 2(0) ) 1.10549
2
h
Again modifying y 2 (2) y1 f (x1 , y1 ) f (x 2 , y 2 (1) ) 1.1055 .
2
h
y1(2) y0 f (x 0 , y 0 ) f (x1 , y1(1) ) 1.1105
2
h
y1(3) y 0 f (x 0 , y 0 ) f (x1 , y1(2) ) 1.1105 .
2
h
y 2 (1) y1 f (x1 , y1 ) f (x 2 , y 2 (0) ) 1.2426
2
h
y 2 (2) y1 f (x1 , y1 ) f (x 2 , y 2 (1) ) 1.2432
2
h
y 2 (3) y1 f (x1 , y1 ) f (x 2 , y 2 (2) ) 1.2432 .
2
y 3(0) y 2 h f (x 2 , y 2 ) 1.3875
h
y3(1) y 2 f (x 2 , y 2 ) f (x 3 , y3(0) ) 1.3997
2
h
y3(2) y 2 f (x 2 , y 2 ) f (x 3 , y3(1) ) 1.4003
2
h
y3(3) y 2 f (x 2 , y 2 ) f (x 3 , y3(2) ) 1.4004 .
2
dy
Example 3 : Solve the following differential equation log10 (x y) ,
dx
y(0) 2 at x 0.6 and 0.8 with h 0.2 .
h
y1(2) y 0 f (x 0 , y 0 ) f (x1 , y1(1) ) 2.0656
2
h
y 2 (1) y1 f (x1 , y1 ) f (x 2 , y 2 (0) ) 2.1455
2
h
y 2 (2) y1 f (x1 , y1 ) f (x 2 , y 2 (1) ) 2.1416
2
y 3(0) y 2 h f (x 2 , y 2 ) 2.2226
h
y3(1) y 2 f (x 2 , y 2 ) f (x 3 , y3(0) ) 2.2272
2
h
y3(2) y 2 f (x 2 , y 2 ) f (x 3 , y 3(1) ) 2.2272
2
y 4 (0) y 3 h f (x 3 , y 3 ) 2.3175
h
y 4 (1) y 3 f (x 3 , y 3 ) f (x 4 , y 4 (0) ) 2.3217
2
h
y 4 (2) y3 f (x 3 , y3 ) f (x 4 , y 4 (1) ) 2.3217 .
2
Note: In Euler method, the interval length h should be kept small and
hence these methods can be applied for tabulating y over a limited range
only.
Exercise
dy
2. Given that 2 xy and y=1 when x=0. Find the approximate value
dx
of y at x=2 in steps of 0.2, using Euler’s modified method.
Runge-Kutta Methods
Introduction:
𝐝𝐲
Consider the initial value problem = 𝐟(𝐱, 𝐲), 𝐲(𝐱 𝟎 ) = 𝐲𝟎 .
𝐝𝐱
𝐝𝐲
Example 1 : Given = 𝐲 − 𝐱 where 𝐲(𝟎) = 𝟐, find 𝐲(𝟎. 𝟏) and
𝐝𝐱
𝐲(𝟎. 𝟐)correct to four decimal places.
The most commonly used RK method is a method which uses four slopes and is
called R-K method of fourth order. The method is given by :
𝐝𝐲
Consider the Ordinary Differential Equation = 𝐟(𝐱, 𝐲), 𝐲(𝐱 𝟎 ) = 𝐲𝟎 .
𝐝𝐱
We need to find ‘y’ at 𝐱 𝐧 = 𝐱 𝟎 + 𝐧𝐡. The fourth-order Runge-Kutta
method formula is given by
𝟏
𝐲𝟏 = 𝐲(𝐱 𝟎 + 𝐡) = 𝐲𝟎 + (𝐤 𝟏 + 𝟐𝐤 𝟐 + 𝟐𝐤 𝟑 + 𝐤 𝟒 )
𝟔
Where 𝐤 𝟏 = 𝐡𝐟(𝐱 𝟎 , 𝐲𝟎 )
𝐡 𝐤
𝐤 𝟐 = 𝐡𝐟(𝐱 𝟎 + , 𝐲𝟎 + 𝟏 )
𝟐 𝟐
𝐡 𝐤𝟐
𝐤 𝟑 = 𝐡𝐟(𝐱 𝟎 + , 𝐲𝟎 + )
𝟐 𝟐
𝐤 𝟒 = 𝐡𝐟(𝐱 𝟎 + 𝐡, 𝐲𝟎 + 𝐤 𝟑 ).
𝐝𝐲 𝐲
Example 1 : Given = 𝟑𝐱 + , 𝐲(𝟎) = 𝟏 compute y (0.2) by taking h =
𝐝𝐱 𝟐
0.2 using Runge-Kutta method of fourth order.
Solution:
Given f(x, y) = 3x + , x = 0, y = 1, h = 0.2
k = hf(x , y ) = 0.2f(0,1) = (0.2)(3 × 0 + ) = 0.1
k = hf x + , y + = 0.2f(0.1, 1.05) = 0.165
k = hf x + , y + = (0.2)f(0.1, 1.0825) = 0.16825
k = hf(x + h, y + k ) = 0.2f(0.2, 1.16825) = 0.236825
Solution:
By data we have f(x, y) = , x = 0.4, y = 1, h = 0.1
Solution:
By data we have 𝑓(𝑥, 𝑦) = , 𝑥 = 0, 𝑦 = 1, ℎ = 0.2
Exercise :