Unit - 2 Numerical Solutions of First Order ODE: Mathematics - II
Unit - 2 Numerical Solutions of First Order ODE: Mathematics - II
2nd Semester
Mathematics – II (2301HS201)
Unit – 2
Numerical
Solutions of
First Order ODE
Prof. Darshan Pipaliya
Department of Humanities &
Science
Darshan Institute of Engineering & Technology, Rajkot
darshan.pipaliya@darshan.ac.in
8160597689
Looping
Topics of Unit 2
Numerical Solutions of First Order ODE
• Euler’s Method
• Modified Euler’s Method
• Runge – Kutta Methods (3rd & 4th Order)
• Predictor-Corrector Methods
Milne’s Method
Adam’s Bashforth Method
Looping
Outline of Unit 2
Euler’s Method
Modified Euler’s Method
Third Order Runge – Kutta Method
Fourth Order Runge – Kutta Method
Milne’s Method
Adam’s Bashforth Method
Introduction
Here,
Solution
x 0 =0 , y 0 =1
:
, =5
x n =0.1 m
x n − x¿ 0.1 − 0
h= 0
5
¿ 0.02
m
y ( 0.1 ) =?
Step : 3 𝐱 𝐢+𝟏= 𝐱 𝐢 + 𝐡 , i= 2
x 3 =x 2+ h¿ 0 .04 +0.02=0.0 6 x 2=0.04 ,y 2 =1.0412h=0.02
,
⇒ x 3 =0.06 𝐲 𝐢+𝟏 = 𝐲 𝐢+ 𝐡 ⋅ 𝐟 ( 𝐱𝐢 , 𝐲 𝐢 ) ,i=2
y 3 = y 2 +h⋅ f ( x 2 , y 2 ) f ( x , y ) =x + y + xy
y 3 =1 .0412+0.02 ⋅f ( 0 .04 , 1.0412 )
y 3 =1 .0412+0.02 ⋅ { 0 .04 +1 .0412+0 .04 ( 1 .0412 ) }
y 3 =1 .0412+0.02 ( 1.1228 )
⇒y 3 = y ( x 3 ) = y ( 0.0 6 )=1.0637
#2301HS201 (Mathematics – II) Unit 2 – Numerical Solutions of
Prof. Darshan Pipaliya 11
Method : 1 Example : 1 (Continue)
Step : 4 𝐱 𝐢+𝟏= 𝐱 𝐢 + 𝐡 , i= 3
x 4 =x 3 + h¿ 0 .06 +0.02=0.0 8 x 3 =0.06 ,y 3 =1.0637h=0.02
,
⇒ x 4=0.08 𝐲 𝐢+𝟏 = 𝐲 𝐢+ 𝐡 ⋅ 𝐟 ( 𝐱𝐢 , 𝐲 𝐢 ) ,i=3
y 4= y 3 +h ⋅ f ( x 3 , y 3 ) f ( x , y ) =x + y + xy
y 4=1 .0637+0.02 ⋅f ( 0 .06 ,1.0637 )
y 4=1 .0637+0.02 ⋅ { 0 .06 +1.0637+0 .06 ( 1.0637 ) }
y 4=1 .0637+ 0.02 ( 1.1875 )
⇒y 4= y ( x 4 ) = y ( 0. 08 )=1 .0875
#2301HS201 (Mathematics – II) Unit 2 – Numerical Solutions of
Prof. Darshan Pipaliya 12
Method : 1 Example : 1 (Continue)
Step : 5 𝐱 𝐢+𝟏= 𝐱 𝐢 + 𝐡 , i= 4
x 5= x 4 +h¿ 0 .08 +0.02=0. 1 x 4 =0.08 ,y 4=1.0875h=0.02
,
⇒ x 5 =0.1 𝐲 𝐢+𝟏 = 𝐲 𝐢+ 𝐡 ⋅ 𝐟 ( 𝐱𝐢 , 𝐲 𝐢 ) ,i=4
y 5 = y 4 +h ⋅ f ( x 4 , y 4 ) f ( x , y ) =x + y + xy
y 5 =1.0875 +0.02 ⋅ f ( 0 .08 ,1.0875 )
y 5 =1.0875 +0.02 ⋅ { 0.08 +1.0875+0 .08 ( 1.0875 ) }
y 5 =1.0875 +0.02 ( 1.2545 )
⇒ y 5 = y ( x 5 ) = y ( 0.1 ) =1.1126
#2301HS201 (Mathematics – II) Unit 2 – Numerical Solutions of
Prof. Darshan Pipaliya 13
Method : 1 Example : 2
Exampl
e:2
Solution y− x
: Here , f ( x , y ) =
y+x
x 0 =0 , y 0 =1
x n =0.3
h=0.1
y ( 0.3 )=?
#2301HS201 (Mathematics – II) Unit 2 – Numerical Solutions of
Prof. Darshan Pipaliya 14
Method : 1 Example : 2 (Continue)
Step : 1 𝐱 𝐢+𝟏= 𝐱 𝐢 + 𝐡 , i= 0
x 1= x 0 + h¿ 0 +0. 1=0.1 x 0 =0 ,y 0 =1 ,h=0.1
⇒ x 1 =0.1 𝐲 𝐢+𝟏 = 𝐲 𝐢+ 𝐡 ⋅ 𝐟 ( 𝐱𝐢 , 𝐲 𝐢 ) ,i=0
y 1 = y 0 +h ⋅ f ( x 0 , y 0 ) y− x
y 1 =1+0.1 ⋅f ( 0 ,1 ) f ( x , y )=
y+x
y 1 =1+0.1
1 −0
1+ 0 ( )
y 1 =1+0.1 ( 1 )
⇒y 1 = y ( x 1 )= y ( 0.1 ) =1 .1
Prof. Darshan Pipaliya
#2301HS201 (Mathematics – II) Unit 2 – Numerical Solutions of
15
Method : 1 Example : 2 (Continue)
Step : 2 𝐱 𝐢+𝟏= 𝐱 𝐢 + 𝐡 , i=1
x 2= x1 + h¿ 0 .1+ 0.1=0. 2 x 1=0.1 ,y 1 =1.1h=0.1
,
⇒ x 2 =0.2 𝐲 𝐢+𝟏 = 𝐲 𝐢+ 𝐡 ⋅ 𝐟 ( 𝐱𝐢 , 𝐲 𝐢 ) ,i=1
y 2 = y 1 +h ⋅ f ( x 1 , y 1 )
y− x
y 2 =1.1+ 0.1⋅ f ( 0 .1 , 1. 1 ) f ( x , y )=
y+x
y 2 =1.1+ 0.1 (
1.1− 0 .1
1.1+ 0.1 )
y 2 =1.1+ 0.1 ( 0.8333 )
⇒y 2 = y ( x 2 ) = y ( 0. 2 )=1 .1833
Prof. Darshan Pipaliya
#2301HS201 (Mathematics – II) Unit 2 – Numerical Solutions of
16
Method : 1 Example : 2 (Continue)
Step : 3 𝐱 𝐢+𝟏= 𝐱 𝐢 + 𝐡 , i= 2
x 3 =x 2+ h¿ 0 .2+ 0.1=0. 3 x 2=0.2 ,y 2 =1.1833 h
, =0.
⇒ x 3 =0.3 𝐲 𝐢+𝟏 = 𝐲 𝐢+ 𝐡 ⋅ 𝐟 ( 𝐱𝐢 , 𝐲 𝐢 ) ,i=2
y 3 = y 2 +h⋅ f ( x 2 , y 2 ) y− x
y 3 =1.1833+0.1⋅ f ( 0.2,1.1833 ) f ( x , y )=
y+x
y 3 =1.1833+0.1 (
1.1833−0.2
1.1 833+0.2 )
y 3 =1 .1 833+0.1 ( 0.7108 )
⇒y 3 = y ( x 3 ) = y ( 0. 3 )=1 .2544
Prof. Darshan Pipaliya
#2301HS201 (Mathematics – II) Unit 2 – Numerical Solutions of
17
Method – 2
Modified Euler’s Method
Modified Euler’s Method to Solve First Order
ODE
Consider the differential
dy
=f ( x, y ) with y ( x 0 )= y 0 ,then
equation
dx
,
𝐲 𝐢+𝟏 = 𝐲 𝐢+ ( 𝐤 𝟏+ 𝐤 𝟐
𝟐 ) , where
i=0,1,2,3,…,n−1
𝐤 𝟏=𝐡 ∙ 𝐟 ( 𝐱 𝐢 , 𝐲 𝐢 )
𝐤 𝟐=𝐡 ∙ 𝐟 ( 𝐱 𝐢 + 𝐡 , 𝐲 𝐢 + 𝐤 𝟏)
#2301HS201 (Mathematics – II) Unit 2 – Numerical Solutions of
Prof. Darshan Pipaliya 19
Modified Euler’s Method to Solve First Order
ODE
xn − x0
h= is step size, where m is number of steps.
m
Note: Modified Euler’s method is also
known as
Improved Euler’s
Method OR
OR
Heun’s Method.
#2301HS201 (Mathematics – II) Unit 2 – Numerical Solutions of
Prof. Darshan Pipaliya 20
Procedure to Solve First Order ODE by Modified
Euler’s Method
(1). Find from differential
equation.
(2). Identify x 0∧ y 0 ¿ initial condition y (x 0 )= y 0 .
(3). Identify x n from instruction.
xn − x0
(4). Calculate h if required by using h= .
m
(5). Find x 1 ,x 2 ,…, x n by using.
𝐲 𝐢+𝟏 = 𝐲 𝐢+ ( 𝐤 𝟏+ 𝐤 𝟐
𝟐 ) , where
i=0,1,2,3,…,n−1
𝐤 𝟏=𝐡 ∙ 𝐟 ( 𝐱 𝐢 , 𝐲 𝐢 )
𝐤 𝟐=𝐡 ∙ 𝐟 ( 𝐱 𝐢 + 𝐡 , 𝐲 𝐢 + 𝐤 𝟏)
Solution 2
: Here , f ( x , y ) =x − y
x 0 =0 , y 0 =1
x n =0.2
h=0.1
y ( 0.2 ) =?
#2301HS201 (Mathematics – II) Unit 2 – Numerical Solutions of
Prof. Darshan Pipaliya 23
Method : 2 Example : 1 (Continue)
Step : 1 𝐱 𝐢+𝟏= 𝐱 𝐢 + 𝐡 , i= 0
x 1= x 0 + h¿ 0 +0. 1=0.1 x 0 =0 ,y 0 =1 ,h=0.1
⇒ x 1 =0.1 𝐤 𝟏=𝐡 ⋅ 𝐟 ( 𝐱𝐢 , 𝐲 𝐢 ) ,i=0
k 1=h ⋅ f ( x 0 , y 0 ) f ( x , y )=x − y
2
k 1=0.1 ⋅ f ( 0 , 1 )
k 1=0.1 { 0 − ( 1 ) 2
}
⇒k 1=− 0.1
#2301HS201 (Mathematics – II) Unit 2 – Numerical Solutions of
Prof. Darshan Pipaliya 24
Method : 2 Example : 1 (Continue)
Step : 1 (Continue) 𝐤 𝟐=𝐡 ⋅ 𝐟 ( 𝐱𝐢 + 𝐡 , 𝐲 𝐢 + 𝐤 𝟏 ) ,i
k 2=h⋅ f ( x 0 + h , y 0 +k 1) x 0 =0 ,h=0.1
k 2=0.1⋅ f ( 0+0.1 ,1 −0.1 ) y 0 =1 ,k 1=− 0.1
y 1 =1+
2 ( − 0.1− 0.0710
) x 1= 0.1
y 1 =1− 0.0855
⇒ y 1 = y ( x 1 )= y ( 0.1 ) =0 .9145
#2301HS201 (Mathematics – II) Unit 2 – Numerical Solutions of
Prof. Darshan Pipaliya 26
Method : 2 Example : 1 (Continue)
Step : 2 𝐱 𝐢+𝟏= 𝐱 𝐢 + 𝐡 , i=1
x 2= x1 + h¿ 0 .1+ 0.1=0. 2 x 1=0.1 ,y 1 =0.9145h=0.1
,
⇒ x 2 =0.2 𝐤 𝟏=𝐡 ⋅ 𝐟 ( 𝐱𝐢 , 𝐲 𝐢 ) ,i=1
k 1=h ⋅ f ( x 1 , y 1 ) f ( x , y )=x − y
2
k 1=0.1 ⋅ f ( 0 .1 ,0.9145 )
k 1=0.1 { 0.1− ( 0.9145 ) 2
}
⇒k 1=− 0.0736
#2301HS201 (Mathematics – II) Unit 2 – Numerical Solutions of
Prof. Darshan Pipaliya 27
Method : 2 Example : 1 (Continue)
Step : 2 (Continue) 𝐤 𝟐=𝐡 ⋅ 𝐟 ( 𝐱𝐢 + 𝐡 , 𝐲 𝐢 + 𝐤 𝟏 ) ,i=
k 2=h⋅ f ( x 1 +h , y 1 + k 1 ) x 1= 0.1h=0.1
,
k 2=0.1⋅ f ( 0 .1+0.1,0.9145− 0.0736 ) y 1 =0.9145k, 1=− 0.073
k 2=0.1⋅ f ( 0.2 , 0.8409 ) f ( x , y )=x − y
2
y =0.9145+ (
2 ) 1 2
2 x 2= 0.2
y 2 =0.9145 − 0.0622
⇒ y 2 = y ( x 2 ) = y ( 0.2 ) =0 .8524
#2301HS201 (Mathematics – II) Unit 2 – Numerical Solutions of
Prof. Darshan Pipaliya 29
Method : 2 Example : 2
Exampl
e:2
Solution y− x
: Here , f ( x , y ) =
x =1 , y =2
0
√ xy
0
x n =1.3
h=0.1
y ( 1.3 ) =?
#2301HS201 (Mathematics – II) Unit 2 – Numerical Solutions of
Prof. Darshan Pipaliya 30
Method : 2 Example : 2 (Continue)
Step : 1 𝐱 𝐢+𝟏= 𝐱 𝐢 + 𝐡 , i=0
x 1= x 0 + h¿ 1+ 0.1=1 .1 x 0 =1 ,y 0 =2 ,h =0.1
⇒ x 1 =1.1 𝐤 𝟏=𝐡 ⋅ 𝐟 ( 𝐱𝐢 , 𝐲 𝐢 ) ,i=0
k 1=h ⋅ f ( x 0 , y 0 ) y− x
f ( x , y )=
k 1=0.1 ⋅ f (1 , 2 ) √ xy
k 1=0.1
2 −1
√1 ( 2 ) ( )
⇒k 1=0.0707
#2301HS201 (Mathematics – II) Unit 2 – Numerical Solutions of
Prof. Darshan Pipaliya 31
Method : 2 Example : 2 (Continue)
Step : 1 (Continue) 𝐤 𝟐=𝐡 ⋅ 𝐟 ( 𝐱𝐢 + 𝐡 , 𝐲 𝐢 + 𝐤 𝟏 ) ,i=
k 2=h⋅ f ( x 0 + h , y 0 +k 1) x 0 =1 ,h=0.1
k 2=0.1⋅ f ( 1+0.1 , 2+0.0707 ) y 0 =2 ,k 1=0.0707
k 2=0.1⋅ f ( 1.1, 2.0707 ) y− x
( )
2 .0707 −1 .1 f ( x , y )=
k 2=0.1 √ xy
√1 .1 ( 2.0707 )
⇒k 2= 0.0643
#2301HS201 (Mathematics – II) Unit 2 – Numerical Solutions of
Prof. Darshan Pipaliya 32
Method : 2 Example : 2 (Continue)
Step : 1 (Continue) 𝐲 𝐢+𝟏 = 𝐲 𝐢+ ( 𝐤 𝟏+ 𝐤 𝟐
𝟐 ) , i=0
y1= y0 +
k1+ k2
2 ( ) y 0 =2 , k 1=0.0707k,2=0.064
y 1 =2+ ( 2
0.0707+ 0.0643
) x 1=1.1
y 1 =2+0.0675
⇒ y 1 = y ( x 1 )= y (1 . 1 )=2.0675
#2301HS201 (Mathematics – II) Unit 2 – Numerical Solutions of
Prof. Darshan Pipaliya 33
Method : 2 Example : 2 (Continue)
Step : 2 𝐱 𝐢+𝟏= 𝐱 𝐢 + 𝐡 , i=1
x 2= x1 + h¿ 1.1+ 0.1=1. 2 x 1=1.1y,1 =2.0675h=0.1
,
⇒ x 2 =1.2 𝐤 𝟏=𝐡 ⋅ 𝐟 ( 𝐱𝐢 , 𝐲 𝐢 ) ,i=1
k 1=h ⋅ f ( x 1 , y 1 ) y− x
f ( x , y )=
k 1=0.1 ⋅ f (1.1 , 2.0675 ) √ xy
k 1=0.1
2.0675 − 1.1
√1.1 ( 2.0675 ) ( )
⇒k 1=0.0642
#2301HS201 (Mathematics – II) Unit 2 – Numerical Solutions of
Prof. Darshan Pipaliya 34
Method : 2 Example : 2 (Continue)
Step : 2 (Continue) 𝐤 𝟐=𝐡 ⋅ 𝐟 ( 𝐱𝐢 + 𝐡 , 𝐲 𝐢 + 𝐤 𝟏 ) ,i=
k 2=h⋅ f ( x 1 +h , y 1 + k 1 ) x 1=1.1
h=0.1
,
k 2=0.1⋅ f ( 1.1+0.1 , 2.0675+0.0642 ) y 1 =2.0675k, 1=0.064
k 2=0.1⋅ f ( 1.2 ,2.1317 ) y− x
(√ )
2 .1317 −1 .2 f ( x , y )=
k 2=0.1 √ xy
1 .2 ( 2.1317 )
⇒k 2= 0.0583
#2301HS201 (Mathematics – II) Unit 2 – Numerical Solutions of
Prof. Darshan Pipaliya 35
Method : 2 Example : 2 (Continue)
Step : 2 (Continue) 𝐲 𝐢+𝟏 = 𝐲 𝐢+ ( 𝐤 𝟏+ 𝐤 𝟐
𝟐 ) , i=1
y2= y1 +
k 1 +k 2
2 (0.0642+0.0583) y 1 =2.0675k, 1=0.0642k,2=0.058
y 2 =2.0675+ ( 2 ) x 2=1
y 2 =2.0675+0.0613
⇒ y 2 = y ( x 2 ) = y ( 1. 2 ) =2.1288
#2301HS201 (Mathematics – II) Unit 2 – Numerical Solutions of
Prof. Darshan Pipaliya 36
Method : 2 Example : 2 (Continue)
Step : 3 𝐱 𝐢+𝟏= 𝐱 𝐢 + 𝐡 , i= 2
x 3 =x 2+ h¿ 1.2+ 0.1=1 .3 x 2=1.2y,2 =2.1288h=0.1
,
⇒ x 3 =1.3 𝐤 𝟏=𝐡 ⋅ 𝐟 ( 𝐱𝐢 , 𝐲 𝐢 ) ,i=2
k 1=h ⋅ f ( x 2 , y 2 ) y− x
f ( x , y )=
k 1=0.1 ⋅ f (1.2 , 2.1288 ) √ xy
k 1=0.1
2.1288 − 1.2
√1.2 ( 2.1288 ) ( )
⇒k 1=0.0581
#2301HS201 (Mathematics – II) Unit 2 – Numerical Solutions of
Prof. Darshan Pipaliya 37
Method : 2 Example : 2 (Continue)
Step : 3 (Continue) 𝐤 𝟐=𝐡 ⋅ 𝐟 ( 𝐱𝐢 + 𝐡 , 𝐲 𝐢 + 𝐤 𝟏 ) ,i
k 2=h⋅ f ( x 2 +h , y 2+ k 1 ) x 2=1.2
h=0.1
,
k 2=0.1⋅ f ( 1.2+0.1 , 2.1288+0.0581 ) y 2 =2.1288 ,k 1=0.058
k 2=0.1⋅ f ( 1.3 , 2.1869 ) y− x
2 .1869 −1 .3
( )
f ( x , y )=
k 2=0.1 √ xy
√1 .3 ( 2 .1869 )
⇒k 2= 0.0526
#2301HS201 (Mathematics – II) Unit 2 – Numerical Solutions of
Prof. Darshan Pipaliya 38
Method : 2 Example : 2 (Continue)
Step : 3 (Continue) 𝐲 𝐢+𝟏 = 𝐲 𝐢+ ( 𝐤 𝟏+ 𝐤 𝟐
𝟐 ) , i=2
y3= y2 +
k1+ k2
2 (0.0581+0.0526) y 2 =2.1288k, 1=0.0581k,2=0.052
y 3 =2.1288+ ( 2 ) x 3 =1
y 3 =2.1288+0.0554
⇒ y 3 = y ( x 3 ) = y ( 1 . 3 )=2.1842
#2301HS201 (Mathematics – II) Unit 2 – Numerical Solutions of
Prof. Darshan Pipaliya 39
Method – 3
Third Order Runge – Kutta
Method
Third Order Runge – Kutta Method to Solve First
Order ODE dy
Consider the differential =f ( x, y ) with y ( x 0 )= y 0 ,then
dx
,equation
𝟏
𝐲 𝐢+𝟏 = 𝐲 𝐢+ ( 𝐤 𝟏+𝟒 𝐤 𝟐 +𝐤 𝟑 ) ,where
𝟏
𝟔
𝐤 =𝐡 ∙ 𝐟 ( 𝐱 , 𝐲 ) 𝐢 𝐢
i=0,1,2,3,…,n−1
𝐤 𝟐=𝐡 ∙ 𝐟 𝐱 𝐢 +
𝟐 ( 𝟐
𝐡
, 𝐲 𝐢+
𝐤𝟏
)
𝐤 𝟑=𝐡 ∙ 𝐟 ( 𝐱 𝐢 + 𝐡 , 𝐲 𝐢 − 𝐤 𝟏 +𝟐 𝐤 𝟐 )
xn − x0
h= is step size, where m is number of steps.
m
Prof. Darshan Pipaliya
#2301HS201 (Mathematics – II) Unit 2 – Numerical Solutions of
41
Procedure to Solve First Order ODE by Third Order Runge-Kutta Method
Solution
: Here , f ( x , y ) =−2 x − y
x 0 =0 , y 0 =−1
x n =0.2
h=0.1
y ( 0.2 ) =?
#2301HS201 (Mathematics – II) Unit 2 – Numerical Solutions of
Prof. Darshan Pipaliya 44
Method : 3 Example : 1 (Continue)
Step : 1 𝐱 𝐢+𝟏= 𝐱 𝐢 + 𝐡 , i= 0
x 1= x 0 + h¿ 0 +0. 1=0.1 , =0.1
x 0 =0 ,y 0 =−1 h
⇒ x 1 =0.1 𝐤 𝟏=𝐡 ⋅ 𝐟 ( 𝐱𝐢 , 𝐲 𝐢 ) ,i=0
k 1=h ⋅ f ( x 0 , y 0 ) f ( x , y ) =−2 x − y
k 1=0.1 ⋅ f ( 0 , −1 )
k 1=0.1 { − 2(0)− ( − 1 ) }
⇒k 1=0.1
#2301HS201 (Mathematics – II) Unit 2 – Numerical Solutions of
Prof. Darshan Pipaliya 45
Method : 3 Example : 1 (Continue)
Step : 1 (Continue)
𝐡
𝐤 𝟐=𝐡 ⋅ 𝐟 𝐱 𝐢 + , 𝐲 𝐢 +
𝟐 (𝐤𝟏
𝟐
, i= )
h
k 2=h⋅ f x 0 + , y 0 +
2
k1
2 ( )0.1 x 0 =0 ,h=0.1
0.1
k 2=0.1⋅ f 0+ , −1+
2 2 ( ) , 1=0.1
y 0 =−1 k
f ( x , y ) =−2 x −
k 2=0.1⋅ f ( 0.05 , −0.95 )
k 2=0.1 {− 2 ( 0.05 ) − ( − 0.95 ) }
⇒k 2= 0.0850
#2301HS201 (Mathematics – II) Unit 2 – Numerical Solutions of
Prof. Darshan Pipaliya 46
Method : 3 Example : 1 (Continue)
Step : 1 (Continue) 𝐤 𝟑=𝐡 ⋅ 𝐟 ( 𝐱𝐢 + 𝐡 , 𝐲 𝐢 − 𝐤 𝟏+𝟐 𝐤 𝟐 ) ,i=0
k 3=h⋅ f ( x 0 + h , y 0 −k 1+ 2 k 2 ) x 0 =0 ,h=0.1y, 0 =−1
Solution
: Here , f ( x , y ) =2 xy
x 0 =1 , y 0 =1
x n =1.1
h=0.1
y ( 1.1 )=?
#2301HS201 (Mathematics – II) Unit 2 – Numerical Solutions of
Prof. Darshan Pipaliya 53
Method : 3 Example : 2 (Continue)
Step : 1 𝐱 𝐢+𝟏= 𝐱 𝐢 + 𝐡 , i= 0
x 1= x 0 + h¿ 1+ 0.1=1 .1 x 0 =1 ,y 0 =1h=0.1
,
⇒ x 1 =1.1 𝐤 𝟏=𝐡 ⋅ 𝐟 ( 𝐱𝐢 , 𝐲 𝐢 ) ,i=0
k 1=h ⋅ f ( x 0 , y 0 ) f ( x , y ) =2 xy
k 1=0.1 ⋅ f (1 , 1 )
k 1=0.1 { 2 (1) ( 1 ) }
⇒k 1=0.2
#2301HS201 (Mathematics – II) Unit 2 – Numerical Solutions of
Prof. Darshan Pipaliya 54
Method : 3 Example : 2 (Continue)
Step : 1 (Continue)
𝐡
𝐤 𝟐=𝐡 ⋅ 𝐟 𝐱 𝐢 + , 𝐲 𝐢 +
𝟐 (𝐤𝟏
𝟐
, i= )
h
k 2=h⋅ f x 0 + , y 0 +
2
k1
2 ( )0.2 x 0 =1 ,h=0.1
k 2=0.1⋅ f 1+
0.1
2
,1+
2 ( ) y 0 =1k,1=0.2
f ( x , y ) =2 xy
k 2=0.1⋅ f ( 1.05 ,1.1 )
k 2=0.1 { 2 ( 1.05 )( 1.1 ) }
⇒k 2= 0.2310
#2301HS201 (Mathematics – II) Unit 2 – Numerical Solutions of
Prof. Darshan Pipaliya 55
Method : 3 Example : 2 (Continue)
Step : 1 (Continue) 𝐤 𝟑=𝐡 ⋅ 𝐟 ( 𝐱𝐢 + 𝐡 , 𝐲 𝐢 − 𝐤 𝟏+𝟐 𝐤 𝟐 ) ,i=0
k 3=h⋅ f ( x 0 + h , y 0 −k 1+ 2 k 2 ) , 0=
x 0 =1 ,h=0.1 y
2 2
y − x
Solution Here , f ( x , y ) = 2 2
y +x
:
x 0 =0 , y 0 =1
x n =0.1
h=0.1
y ( 0.1 ) =?
#2301HS201 (Mathematics – II) Unit 2 – Numerical Solutions of
Prof. Darshan Pipaliya 58
Method : 3 Example : 3 (Continue)
Step : 1 𝐱 𝐢+𝟏= 𝐱 𝐢 + 𝐡 , i= 0
x 1= x 0 + h¿ 0 +0. 1=0.1 x 0 =0 ,y 0 =1h=0.1
,
⇒ x 1 =0.1 𝐤 𝟏=𝐡 ⋅ 𝐟 ( 𝐱𝐢 , 𝐲 𝐢 ) ,i=0
k 1=h ⋅ f ( x 0 , y 0 ) y
2
− x
2
f ( x , y )= 2 2
k 1=0.1 ⋅ f ( 0 , 1 ) y +x
{ }
2 2
( 1) −( 0)
k 1=0.1 2 2
( 1 ) +( 0 )
⇒k 1=0.1 #2301HS201 (Mathematics – II) Unit 2 – Numerical Solutions of
Prof. Darshan Pipaliya 59
Method : 3 Example : 3 (Continue)
Step : 1 (Continue)
𝐡
𝐤 𝟐=𝐡 ⋅ 𝐟 𝐱 𝐢 + , 𝐲 𝐢 +
𝟐 (𝐤𝟏
𝟐
, i= )
h
k 2=h⋅ f x 0 + , y 0 +
2
k1
2 ( )0.1 x 0 =0 ,h=0.1
0.1
k 2=0.1⋅ f 0+ , 1+
2 2 ( ) y 0 =1k,1=0.1
{ }
2 2
(1.05 ) − ( 0.05 )
k 2=0.1 2 2
( 1.05 ) + ( 0.05 )
⇒k 2= 0.0995 #2301HS201 (Mathematics – II) Unit 2 – Numerical Solutions of
Prof. Darshan Pipaliya 60
Method : 3 Example : 3 (Continue)
Step : 1 (Continue) 𝐤 𝟑=𝐡 ⋅ 𝐟 ( 𝐱𝐢 + 𝐡 , 𝐲 𝐢 − 𝐤 𝟏+𝟐 𝐤 𝟐 ) ,i=0
k 3=h⋅ f ( x 0 + h , y 0 −k 1+ 2 k 2 ) , 0=
x 0 =0 ,h=0.1 y
{ }
2 2
(1.0991 ) − ( 0.1 ) y +x
k 2=0.1 2 2
( 1.0991 ) + ( 0.1 )
⇒k 3= 0.0984
#2301HS201 (Mathematics – II) Unit 2 – Numerical Solutions of
Prof. Darshan Pipaliya 61
Method : 3 Example : 3 (Continue)
𝟏
Step : 1 (Continue) 𝐲 𝐢+𝟏 = 𝐲 𝐢+ ( 𝐤 𝟏+𝟒 𝐤 𝟐 + 𝐤 𝟑 ) , i=
𝟔
1 y 0 =1 ,k 1=0.1
y 1 = y 0 + ( k 1+ 4 k 2 + k 3 )
6 k =0.0995 k , =0.098
1 2 3
y 1 =1+ { 0.1+ 4 ( 0. 0 995 ) + 0. 0 984
x 1= } 0.1
6
y 1 =1+0.0994
⇒ y 1 = y ( x 1 )= y ( 0 .1 )=1.0994
#2301HS201 (Mathematics – II) Unit 2 – Numerical Solutions of
Prof. Darshan Pipaliya 62
Method – 4
Fourth Order Runge – Kutta
Method
Fourth Order Runge – Kutta Method to Solve
First Order ODE dy
Consider the differential =f ( x, y ) with y ( x 0 )= y 0 ,then
dx
equation
,
𝟏
𝐲 𝐢+𝟏 = 𝐲 𝐢+ ( 𝐤 𝟏+𝟐 𝐤 𝟐+𝟐 𝐤 𝟑+ 𝐤 𝟒 ) ,where
𝟏
𝟔
𝐤 =𝐡 ∙ 𝐟 ( 𝐱 , 𝐲 ) 𝐢 𝐢
( 𝟐,𝐲 + 𝟐 )
𝐤 𝟐=𝐡 ∙ 𝐟 𝐱 𝐢 +
𝐡
𝐢
𝐤𝟏
i=0,1,2,3,…,n−1
𝐤 =𝐡 ∙ 𝐟 ( 𝐱 + , 𝐲 +
𝟐 )
𝐡 𝐤 𝟐
𝟑 𝐢 𝐢
𝟐
𝐤 𝟒=𝐡 ∙ 𝐟 ( 𝐱 𝐢 + 𝐡 , 𝐲 𝐢 + 𝐤 𝟑 )
#2301HS201 (Mathematics – II) Unit 2 – Numerical Solutions of
Prof. Darshan Pipaliya 64
Procedure to Solve First Order ODE by Fourth Order Runge-Kutta Method
( 𝟐,𝐲 + 𝟐 )
𝐤 𝟐=𝐡 ∙ 𝐟 𝐱 𝐢 +
𝐡
𝐢
𝐤𝟏
i=0,1,2,3,…,n−1
𝐤 =𝐡 ∙ 𝐟 ( 𝐱 + , 𝐲 +
𝟐 )
𝐡 𝐤 𝟐
𝟑 𝐢 𝐢
𝟐
𝐤 𝟒=𝐡 ∙ 𝐟 ( 𝐱 𝐢 + 𝐡 , 𝐲 𝐢 + 𝐤 𝟑 )
Solution 2
: Here , f ( x , y ) =−2 xy
x 0 =0 , y 0 =1
x n =0.2
h=0.2
y ( 0.2 ) =?
#2301HS201 (Mathematics – II) Unit 2 – Numerical Solutions of
Prof. Darshan Pipaliya 67
Method : 4 Example : 1 (Continue)
Step : 1 𝐱 𝐢+𝟏= 𝐱 𝐢 + 𝐡 , i= 0
x 1= x 0 + h¿ 0 +0. 2=0 . 2 x 0 =0 ,y 0 =1h=0.2
,
⇒ x 1 =0.2 𝐤 𝟏=𝐡 ⋅ 𝐟 ( 𝐱𝐢 , 𝐲 𝐢 ) ,i=0
k 1=h ⋅ f ( x 0 , y 0 ) f ( x , y ) =−2 xy
2
k 1=0.2 ⋅ f ( 0 , 1 )
k 1=0.2 { −2 ( 0 ) ( 1 ) 2
}
⇒k 1=0
#2301HS201 (Mathematics – II) Unit 2 – Numerical Solutions of
Prof. Darshan Pipaliya 68
Method : 4 Example : 1 (Continue)
Step : 1 (Continue)
𝐡
𝐤 𝟐=𝐡 ⋅ 𝐟 𝐱 𝐢 + , 𝐲 𝐢 +
𝟐 (
𝐤𝟏
𝟐
, i= )
h
k 2=h⋅ f x 0 + , y 0 +
2
k1
2 ( )0 x 0 =0 ,h=0.2
k 2=0.2⋅ f 0+
0.2
2
,1+
2 ( ) y 0 =1k,1=0
( )
f x , y =−2 xy
2
k 2= 0.2⋅ f ( 0.1 ,1 )
k 2= 0.2 {−2 ( 0.1 ) ( 1 ) 2
}
⇒k 2=− 0.04
#2301HS201 (Mathematics – II) Unit 2 – Numerical Solutions of
Prof. Darshan Pipaliya 69
Method : 4 Example : 1 (Continue)
Step : 1 (Continue)
𝐡
𝐤 𝟑=𝐡 ⋅ 𝐟 𝐱 𝐢 + , 𝐲 𝐢 +
𝟐 (
𝐤𝟐
𝟐
, i= )
( 0.2 −0.04)
h
k 3=h⋅ f x 0 + , y 0+
2
k2
2
x 0 =0 ,h=0.2
k =0.2⋅ f ( 0+ ,1+
2 )
y 0 =1k,2=− 0.0
2
2 f ( x , y ) =−2 xy
2
Solution 2
: Here , f ( x , y ) =xy + y
x 0 =0 , y 0 =1
x n =0.2
h=0.1
y ( 0.1 ) =?∧¿
y ( 0.2 ) =?
#2301HS201 (Mathematics – II) Unit 2 – Numerical Solutions of
Prof. Darshan Pipaliya 73
Method : 4 Example : 2 (Continue)
Step : 1 𝐱 𝐢+𝟏= 𝐱 𝐢 + 𝐡 , i= 0
x 1= x 0 + h¿ 0 +0. 1=0 .1 x 0 =0 ,y 0 =1h=0.1
,
⇒ x 1 =0.1 𝐤 𝟏=𝐡 ⋅ 𝐟 ( 𝐱𝐢 , 𝐲 𝐢 ) ,i=0
k 1=h ⋅ f ( x 0 , y 0 ) f ( x , y ) = xy + y
2
k 1=0.1 ⋅ f ( 0 , 1 )
k 1=0.1 { 0 ( 1 ) + ( 1 ) 2
}
⇒k 1=0.1
#2301HS201 (Mathematics – II) Unit 2 – Numerical Solutions of
Prof. Darshan Pipaliya 74
Method : 4 Example : 2 (Continue)
Step : 1 (Continue)
𝐡
𝟐 (
𝐤 𝟐=𝐡 ⋅ 𝐟 𝐱 𝐢 + , 𝐲 𝐢 +
𝐤𝟏
𝟐
, i= )
h
k 2=h⋅ f x 0 + , y 0 +
2
k1
2 ( )0.1 x 0 =0 ,h=0.1
0.1
k 2=0.1⋅ f 0+ , 1+
2 2 ( ) y 0 =1k ,1=0.1
f ( x , y ) =xy + y
k 2=0.1⋅ f ( 0.0 5 , 1.05 )
k 2=0.1 {0.05 ( 1.05 ) + ( 1.05 ) 2
}
⇒k 2= 0.1155
#2301HS201 (Mathematics – II) Unit 2 – Numerical Solutions of
Prof. Darshan Pipaliya 75
Method : 4 Example : 2 (Continue)
Step : 1 (Continue)
𝐡
𝐤 𝟑=𝐡 ⋅ 𝐟 𝐱 𝐢 + , 𝐲 𝐢 +
𝟐 (
𝐤𝟐
𝟐
, i= )
h
k 3=h⋅ f x 0 + , y 0+
2
k2
2 ( ) x 0 =0 ,h=0.1
( )
0.1 0.1155 y 0 =1k,2=0.115
k 2=0.1⋅ f 0+ , 1+
2 2 f ( x , y ) = xy + y
2
Solution x
: Here , f ( x , y ) =3 e + 2 y
x 0 =0 , y 0 =0
, =0.1
x n =0.1 h
y ( 0.1 ) =?
#2301HS201 (Mathematics – II) Unit 2 – Numerical Solutions of
Prof. Darshan Pipaliya 84
Method : 4 Example : 3 (Continue)
Step : 1 𝐱 𝐢+𝟏= 𝐱 𝐢 + 𝐡 , i= 0
x 1= x 0 + h¿ 0 +0. 1=0 .1 x 0 =0 ,y 0 =0h=0.1
,
⇒ x 1 =0.1 𝐤 𝟏=𝐡 ⋅ 𝐟 ( 𝐱𝐢 , 𝐲 𝐢 ) ,i=0
k 1=h ⋅ f ( x 0 , y 0 ) x
f ( x , y ) =3 e + 2 y
k 1=0.1 ⋅ f ( 0 , 0 )
k 1=0.1 { 3 ( e ) +2 ( 0 ) }
0
⇒k 1=0.3
#2301HS201 (Mathematics – II) Unit 2 – Numerical Solutions of
Prof. Darshan Pipaliya 85
Method : 4 Example : 3 (Continue)
Step : 1 (Continue)
𝐡
𝐤 𝟐=𝐡 ⋅ 𝐟 𝐱 𝐢 + , 𝐲 𝐢 +
𝟐 (
𝐤𝟏
𝟐
, i= )
h
k 2=h⋅ f x 0 + , y 0 +
2
k1
2 ( )0.3 x 0 =0 ,h=0.1
0.1
k 2=0.1⋅ f 0+ , 0 +
2 2 ( ) y 0 =0k ,1=0.3
x
f ( x , y ) =3 e + 2 y
k 2=0.1⋅ f ( 0.0 5 , 0.15 )
k 2=0.1 {3 ( e ) 0.05
+2 ( 0 .15 ) }
⇒k 2= 0.3454
#2301HS201 (Mathematics – II) Unit 2 – Numerical Solutions of
Prof. Darshan Pipaliya 86
Method : 4 Example : 3 (Continue)
Step : 1 (Continue)
𝐡
𝐤 𝟑=𝐡 ⋅ 𝐟 𝐱 𝐢 + , 𝐲 𝐢 +
𝟐 (𝐤𝟐
𝟐
, i= )
h
k 3=h⋅ f x 0 + , y 0+
2
k2
2 ( ) x 0 =0 ,h=0.1
( )
0.1 0.3454 y 0 =0k ,2=0.345
k 2=0.1⋅ f 0+ , 0 +
2 2 x
f ( x , y ) =3 e + 2 y
k 2=0.1⋅ f ( 0.05 , 0.1727 )
k 2=0.1 {3 ( e ) 0 .05
+2 ( 0.1727 ) }
⇒k 3= 0.3499
#2301HS201 (Mathematics – II) Unit 2 – Numerical Solutions of
Prof. Darshan Pipaliya 87
Method : 4 Example : 3 (Continue)
Step : 1 (Continue) 𝐤 𝟒=𝐡 ⋅ 𝐟 ( 𝐱 𝐢 + 𝐡 , 𝐲 𝐢 + 𝐤 𝟑 ) ,i=0
x 0 =0 ,h=0.1
k 4 =h ⋅ f ( x 0 +h , y 0 + k 3 )
y 0 =0k ,3=0.3499
k 2=0.1⋅ f ( 0+ 0.1 ,0 +0.3499 )
x
f ( x , y ) =3 e + 2 y
k 2=0.1⋅ f ( 0.1 , 0.3499 )
k 2= 0.1 {3 ( e ) 0 .1
+2 ( 0.3499 ) }
⇒k 4 =0.4015
#2301HS201 (Mathematics – II) Unit 2 – Numerical Solutions of
Prof. Darshan Pipaliya 88
Method : 4 Example : 3 (Continue)
𝟏
Step : 1 (Continue) 𝐲 𝐢+𝟏 = 𝐲 𝐢+ ( 𝐤 𝟏+𝟐 𝐤 𝟐+𝟐 𝐤 𝟑+ 𝐤 𝟒 ) ,i=0
𝟔
1
y 1 = y 0 + ( k 1+2 k 2 +2 k 3 +k 4 )
6
1
y 1 =0+ { 0 .3 +2 ( 0.3454 ) +2 ( 0.3499 ) +0.4015 }
6
y 1 =0+ 0.3487 y 0 =0 ,k 1=0.3k, 2=0.345
⇒ y 1 = y ( x 1 )= y ( 0 .1 ) =0.3487 k 3 =0.3499 k ,
4 =0.4015
x 1= 0.1
#2301HS201 (Mathematics – II) Unit 2 – Numerical Solutions of
Prof. Darshan Pipaliya 89
Method : 4 Example : 3 (Continue)
By exact
method
dy x
Here , =3 e +2 y , y ( 0 ) =0
dx
dy x
⇒ − 2 ∙ y =3 e
dx
pare the given differential equation with Leibnitz′s differential equation
dy
+ P ( x ) ∙ y=Q ( x )
dx
We get P ( x )=− a
2nd Q ( x )=3 e x
I.F. ¿ e∫ P ( x ) dx
¿e∫ −2 dx
¿e
−2x
I.F. ¿ e
−2x P ( x )=− 2
x
The solution of given differential equation is
Q ( x )=3 e
y ∙ ( I . F. ) =∫ {Q ( x ) ∙ ( I .F . ) } dx+c
⇒ y∙ ( e ) =∫ { 3e ∙ ( e ) } dx+c
− 2x x −2x
y =−3 e +c ∙e −− → ( 1 )
x 2x
Here ⇒ at x =0 , y =0
Substitutein equation we get
0 2(0)
0=− 3 e +c ∙ e
⇒ 0=−3+ c
⇒ c=3Substitute in equation we get
x 2x
y =−3 e +3 e
#2301HS201 (Mathematics – II) Unit 2 – Numerical Solutions of
Prof. Darshan Pipaliya 92
Method : 4 Example : 3 (Continue)
x 2x
y ( is
e solution of the given differential equation x )=− 3 e +3 e
L et , x =0.1
0.1 2 ( 0.1)
( )
⇒ y 0.1 =− 3 e +3 e
0.1 0.2
⇒ y ( 0.1 )=− 3 e +3 e
⇒ y ( 0.1 )=0.3487
Milne′s Predictor−Cor ector method is an iterative numerical method used to solve first order ordinary dif erential equations of the form:
dy
=f ( x , y ) with y ( x 0 )= y 0
dx
.corrector.
Identifyfrom instruction
Find by using
4h
( 7 ) . Find y ( n+ 1) p = y n − 3+
3
( 2 f n −2 − f n −1 +2 f n )
Findsolution.
h
( 9 ) . Find y ( n+ 1) c = y n −1 + ( f n −1 +4 f n +f n+1 )
3
Above numerical solution is known as Milne’s Corrector
solution.
#2301HS201 (Mathematics – II) Unit 2 – Numerical Solutions of
Prof. Darshan Pipaliya 99
Method : 5 Example : 1
Exampl
Evaluate using Milne’s Method.
e:1
Solution ( 1+ x ) y 2 2
Here , f ( x , y ) =
: 2
, ,
, ,
y ( 0. 4 ) =?
#2301HS201 (Mathematics – II) Unit 2 – Numerical Solutions of
Prof. Darshan Pipaliya 100
Method : 5 Example : 1 (Continue)
𝐟 𝐧 =𝐟 ( 𝐱 𝐧 , 𝐲 𝐧 )
( 1+ x ) y 2 2
f ( x , y )=
2
1 1
[ 1+ ( 0.1 ) ] (1.06 ) = 0.5674
2 2
f 1=f ( x 1 , y 1) = ( 1+x 1 ) y 1 2
2 2¿
2
1 2 1
f 2=f ( x 2 , y 2 ) = ( 1+ x 2 ) y 2 ¿ 2 [ 1+ 0.2 ] 1.12 =0.6523
2 2 2
( ) ( )
2
1 2 1
f 3=f ( x 3 , y 3 ) = ( 1+ x 3 ) y 3¿ [ 1+ ( 0.3 ) ] ( 1. 21 ) =0.7979
2 2 2
2 2
1 (
𝐲 𝟒 𝐩=𝟏.𝟏+ 𝟐
𝟐𝟕𝟕𝟏
𝐱 𝐲) 𝟐
f 4 = f ( x 4 , y 4 ) = ( 1+ x 4 ) ( y 4 p ) 𝐟 (𝐱 , 𝐲)=
2 2
2 𝟐
1
¿ [ 1+ ( 0.4 ) ] ( 1. 2771 )
2 2
2
¿ 0.9460
0.1 𝐲 =𝟏 .𝟏𝟐 , 𝐡 =𝟎 .𝟏
¿ 1 .12+
3
[ 0.6523+ 4 ( 0.7979 ) +0.9460 ] 𝟐
𝐟 =𝟎 . 𝟔𝟓𝟐𝟑 𝟐
¿ 1 .2797 𝐟 𝟑=𝟎 . 𝟕𝟗𝟕𝟗
∴ y ( 0.4 )=1 .2797 𝐟 𝟒=𝟎 .𝟗𝟒𝟔𝟎
#2301HS201 (Mathematics – II) Unit 2 – Numerical Solutions of
Prof. Darshan Pipaliya 104
Method : 5 Example : 2
Exampl
e:2 Taylor’s series and Evaluate using Milne’s Method.
Solution Here
:
x 0 =0 , y 0 =1
, ,
By Taylor’s
series h ′′ h ′′′′
2 3
y 1 = y 0 +h y + y0 + y0 + …
0
2! 3!
( 0.1 )2 ( 0.1 )3
≈ 1+ ( 0.1 ) 1+ (3 )+ ( 10 )
2! 3!
¿ 1 .1167
By Taylor’s
series,
2 3
h ′′ h ′ ′′ ′
y 2 = y 1 +h y + y1 + y 1 +…
1
2! 3!
2 3
( 0.1 ) ( 0.1 )
≈ 1 .1167+ ( 0.1 ) 1.3587+ ( 4.2871 ) + ( 16.4131 )
2! 3!
¿ 1 .2767
By Taylor’s
series,
2 3
′ h ′′ h ′′′
y3 = y2 + h y2 + y2 + y2 + …
2! 3!
( 0.1 )2 ( 0.1 )3
≈ 1 . 2767+ ( 0.1 ) 1. 8853+ ( 6.4677 ) + ( 28.6875 )
2! 3!
¿ 1 .5023
f ( x , y ) =xy + y
2 𝐱𝟑𝟏𝟐 =𝟎 .𝟑
.𝟐 , 𝐲 𝟑𝟏𝟐=𝟏
.𝟏 𝟐𝟕𝟔𝟕 𝐟 𝐧 =𝐟 ( 𝐱𝐧 , 𝐲 𝐧 )
=𝟏..𝟓𝟎𝟐𝟑
𝟏𝟏𝟔𝟕
2
f 1= f ( x 1 , y 1) = x 1 y 1¿+( 0.1
y 1 )( 1.1167 ) + ( 1. 1167 ) =1.3587 2
2
f 2=f ( x 2 , y 2 ) =x 2 y 2+ y 2¿ ( 0.2 )( 1.2767 ) + ( 1.2767 ) =1.8853 2
2
f 3=f ( x 3 , y 3 ) =x 3 y 3 + y 3¿ ( 0.3 ) (1.5023 ) + ( 1.5023 ) =2.7076 2
f 4 =f ( x 4 , y 4 ) =x 4 y 4 + y 4 p
2
𝐲𝐟 𝟒( 𝐱
𝐩=𝟏 𝟖𝟑𝟑
, 𝐲 ).= 𝐱𝐲 + 𝐲
2
¿ ( 0.4 ) ( 1.833 ) + ( 1. 833 )
¿ 4.093
¿ 1 . 2767+
( 0.1 )
[ 𝐲 =𝟏.𝟐𝟕𝟔𝟕
1.8853 +4 ( 2.7076 ) + 4.093 ]
𝟐 , 𝐡 =𝟎. 𝟏
3
𝐟 𝟐=𝟏 . 𝟖𝟖𝟓𝟑
¿ 1 . 8369 𝐟 𝟑=𝟐 . 𝟕𝟎𝟕𝟔
∴ y ( 0.4 )=1 . 8369 𝐟 𝟒=𝟒 . 𝟎𝟗𝟑
#2301HS201 (Mathematics – II) Unit 2 – Numerical Solutions of
Prof. Darshan Pipaliya 115
Method – 6
Adam’s-Bashforth
Method
Adam’s-Bashforth Method
dy
Consider the differential equation =f ( x , y ) with y ( x 0 ) = y 0 ,
dx
𝐱 𝐢+𝟏= 𝐱 𝐢 + 𝐡 , i=0 , 1 ,2 , 3 , … , n −1
If is not given, then calculate using Taylor’s
2 3
series ′ h ′ ′ h ′ ′′
y k = y k −1 +h y k −1 + y k − 1+ y k − 1+…;k ∈ { 1 ,2 , …. n }
2! 3!
𝐟 𝐧 =𝐟 ( 𝐱 𝐧 , 𝐲 𝐧 )
xn − x0
Where,h= is step size , where m is number of steps
m
#2301HS201 (Mathematics – II) Unit 2 – Numerical Solutions of
Prof. Darshan Pipaliya 118
Procedure to Solve First Order ODE by Adam’s-Bashforth Method
dy
Consider the differential equation =f ( x , y ) with y ( x 0 ) = y 0 ,
dx
(1). Find from differential equation.
Identifyfrom instruction
Find by using
h
( 7 ) . Find y ( n+ 1) p = y n +
24
( 55 f n −59 f n −1 +37 f n − 2 − 9 f n − 3 )
Solution
Here
:
, ,
, ,
y ( 1 . 4 )=?
#2301HS201 (Mathematics – II) Unit 2 – Numerical Solutions of
Prof. Darshan Pipaliya 121
Method : 6 Example : 1 (Continue)
2 𝐱𝐱
𝐱𝟑𝟏𝟐=𝟏
=𝟏 .𝟑
=𝟏 ,,𝐲,𝐲,𝟏𝐲
.𝟏.𝟐 𝟏𝐲
=𝟏
=𝟏 .𝟗𝟕𝟗
𝟏 =𝟏
=𝟏 𝐟 𝐧 =𝐟 ( 𝐱 𝐧 , 𝐲 𝐧 )
.𝟓𝟒𝟖
.𝟐𝟑𝟑
f ( x , y ) =x ( 1+ y ) 𝟎 𝟎
2
f 0=f ( x 0 , y 0 ) =x 0 ( 1+ y 0¿) ( 1 )2 [ 1+1 ] = 2
2
f 1=f ( x 1 , y 1) =x 1 ( 1+ y 1¿) ( 1.1 ) [ 1+1.233 ] =2.70193
2
2
f 2=f ( x 2 , y 2 ) =x 2 ( 1+ y 2¿) ( 1. 2 )2 [ 1+ 1.548 ] =3.66912
2
f 3=f ( x 3 , y 3 ) =x 3 ( 1+ y 3¿) ( 1. 3 )2 [ 1+1.979 ] =5.03454
0.1
¿ 1.979+
24
[ 55 (5.0345 ) − 59 ( 3.66 91 ) +37 ( 2.7019 ) − 9 ( 2 ) ]
¿ 2 .57 23
#2301HS201 (Mathematics – II) Unit 2 – Numerical Solutions of
Prof. Darshan Pipaliya 123
Method : 6 Example : 1 (Continue)
Now, we find the value of , 𝐟𝐱𝐧 𝟒==𝟏
𝐟 ( 𝐱. 𝐧𝟒, 𝐲 𝐧 )
2
f 4 =f ( x 4 , y 4 ) =x 4 ( 1+ y 4 p )
𝐲 𝟒 𝐩=𝟐.𝟐 𝟓𝟕𝟐𝟐
2
𝐟 ( 𝐱 , 𝐲 ) =𝐱 (𝟏+ 𝐲 )
¿ ( 1.4 ) (1+ 2.5722 )
¿ 7.0017
¿ 2 .57 49
∴ y ( 0.4 )=2 . 5749
#2301HS201 (Mathematics – II) Unit 2 – Numerical Solutions of
Prof. Darshan Pipaliya 125
Method : 6 Example : 2
Exampl
Taylor’s series method and Evaluate using Adam’s –
e:2
Bashforth Method.
Solution
Here
:
x 0 =0 , y 0 =1
, ,
¿ 1+2 ( 1 ) ( 1 )=𝟑 ¿ 2 ( 1 ) ( 3 ) +2 ( 1 ) = 𝟖
2
By Taylor’s
series h ′′ h ′′′′
2 3
y 1 = y 0 +h y + y0 + y0 + …
0
2! 3!
( 0.1 )2 ( 0.1 )3
≈ 1+ ( 0.1 ) 1+ (3 )+ (8 )
2! 3!
¿ 1 .116 3
By Taylor’s
series,
2 3
h ′′ h ′ ′′ ′
y 2 = y 1 +h y + y1 + y 1 +…
1
2! 3!
2 3
( 0.1 ) ( 0.1 )
≈ 1 .116 3+ ( 0.1 ) 1.3 461+ ( 4. 0064 )+ ( 1 2.5687 )
2! 3!
¿ 1 .27 30
By Taylor’s
series,
2 3
′ h ′′ h ′′′
y3= y2 + h y2 + y2 + y2 + …
2! 3!
( 0.1 )2 ( 0.1 )3
≈ 1 . 2730+ ( 0.1 ) 1. 8205+ ( 5.6350 ) + ( 20.9752 )
2! 3!
¿ 1 . 4867
f ( x , y ) =x + y
2 𝐱𝟑𝟐𝟏=𝟎
𝐱 =𝟎
𝟎 =𝟎
.𝟑
.𝟐 ,𝟑𝟐𝟏𝐲
.𝟏,,𝐲𝐲 =𝟏
=𝟏𝟎.=𝟏
𝟒𝟖𝟔𝟕
𝟐𝟕𝟑𝟎 𝐟 𝐧 =𝐟 ( 𝐱 𝐧 , 𝐲 𝐧
. 𝟏𝟏𝟔𝟑
2
f 0=f ( x 0 , y 0 ) =x 0 + y¿
0 0 + ( 1 ) =1
2
2
f 1= f ( x 1 , y 1) = x ¿
1+ y 1 ( 1.1163 ) =1.3461
0 .1+
2
2
f 2=f ( x 2 , y 2 ) =x 2 + y¿ 20 .2+ ( 1.2730 ) =1.8205 2
2
f 3=f ( x 3 , y 3 ) =x 3 + y¿ 30 .3 + ( 1. 4867 )2=2.5103
0.1
¿ 1 . 4867 +
24
[ 55 ( 2.5103 ) −59 ( 1.8205 ) + 37 ( 1.3461 ) − 9 ( 1 )
¿ 1 .7845
#2301HS201 (Mathematics – II) Unit 2 – Numerical Solutions of
Prof. Darshan Pipaliya 134
Method : 6 Example : 2(Continue)
Now, we find the value of , 𝐟𝐱𝐧𝟒=
=𝟎𝐟 ( 𝐱. 𝟒
𝐧 ,𝐲𝐧)
f 4= x4+ y4 p
2
𝐟 𝐲( 𝐱 , 𝐲 )𝟕𝟖𝟒𝟓
𝟒 𝐩=𝟏. =𝐱 +
2
¿ ( 0.4 ) + ( 1 .7845 )
¿ 3.5844
¿ 1.7875
∴ y ( 0.4 )=1.7875
#2301HS201 (Mathematics – II) Unit 2 – Numerical Solutions of
Prof. Darshan Pipaliya 136
B.Tech. 2nd Semester
Mathematics – II (2301HS201)
THA
NK
YOU