Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

UMA401 – NMCP: Improved Euler Method

Improved Euler Method (Second Order Runge Kutta Method)

Requirements: Geometrical Interpretation of derivative

(i) This method is a self-starting method of predictor corrector type having greater accuracy
than Euler method.
(ii) It is known by a variety of names such as Euler Trapezoidal method, Euler Predictor-
Corrector method, the Improved Euler Method, Heun’s method, Euler-Cauchy method and
Modified Euler method.

𝑑𝑦
Consider the first order differential equation = 𝑓(𝑥, 𝑦) with initial condition 𝑦 = 𝑦0 when 𝑥 = 𝑥0
𝑑𝑥

To find the value of 𝑦 at 𝑥 = 𝑥𝑛+1 , Improved Euler Method makes use of average slope of 𝑦𝑛′ (i.e.
′ ′ ℎ
𝑓(𝑥𝑛 , 𝑦𝑛 )) and 𝑦𝑛+1 (i.e. 𝑓(𝑥𝑛+1 , 𝑦𝑛+1 )) as 𝑦𝑛+1 = 𝑦𝑛 + {𝑦𝑛′ + 𝑦𝑛+1 }
2

or 𝑦𝑛+1 = 𝑦𝑛 + {𝑓(𝑥𝑛 , 𝑦𝑛 ) + 𝑓(𝑥𝑛+1 , 𝑦𝑛+1 )}
2

Let us consider a line passing through (𝑥0 , 𝑦0 ) whose slope is the average of the slopes at (𝑥0 , 𝑦0 ) and
(1)
(𝑥1 , 𝑦1 ).

(1) (1)
Here 𝑦1 is known as the first approximation of 𝑦1 and is obtained by Euler method as 𝑦1 = 𝑦0 +
ℎ𝑓(𝑥0 , 𝑦0 )

The equation of the line passing through (𝑥0 , 𝑦0 ) and having slope which is the average of the slopes at
(1)
(1) 𝑓(𝑥0 ,𝑦0 )+𝑓((𝑥1 ,𝑦1 )
(𝑥0 , 𝑦0 ) and (𝑥1 , 𝑦1 ) is 𝑦 − 𝑦0 = (𝑥 − 𝑥0 ) { }
2

(1)
𝑓(𝑥0 ,𝑦0 )+𝑓((𝑥1 ,𝑦1 )
Since this line is to pass through (𝑥1 , 𝑦1 ) we get 𝑦1 − 𝑦0 = (𝑥1 − 𝑥0 ) { }
2

(1)
𝑓(𝑥0 , 𝑦0 ) + 𝑓((𝑥1 , 𝑦1 )
𝑦1 = 𝑦0 + ℎ { }
2

In general,
(1)
𝑓(𝑥𝑛 ,𝑦𝑛 )+𝑓((𝑥𝑛+1 , 𝑦𝑛+1 ) (1)
𝑦𝑛+1 = 𝑦𝑛 + ℎ { }, where 𝑦𝑛+1 = 𝑦𝑛 + ℎ𝑓(𝑥𝑛 , 𝑦𝑛 )
2

This is known as Improved Euler formula.

To obtain 𝑦2 , it would be

(1)
𝑦2 = 𝑦1 + ℎ𝑓(𝑥1 , 𝑦1 )

(1)
𝑓(𝑥1 , 𝑦1 ) + 𝑓((𝑥2 , 𝑦2 )
𝑦2 = 𝑦1 + ℎ { }
2

Copyright©2024, Dr. A. A. Basumatary, Dept. of Mathematics, CIT Kokrajhar. Page 1 of 6


UMA401 – NMCP: Improved Euler Method

To obtain 𝑦3 , it would be

(1)
𝑦3 = 𝑦2 + ℎ𝑓(𝑥2 , 𝑦2 )

(1)
𝑓(𝑥2 , 𝑦2 ) + 𝑓((𝑥3 , 𝑦3 )
𝑦3 = 𝑦2 + ℎ { }
2

To obtain 𝑦4 , it would be

(1)
𝑦4 = 𝑦3 + ℎ𝑓(𝑥3 , 𝑦3 )

(1)
𝑓(𝑥3 , 𝑦3 ) + 𝑓((𝑥4 , 𝑦4 )
𝑦4 = 𝑦3 + ℎ { }
2

and so on …

Example No. 1 (Improved Euler Method):

𝑑𝑦
Solve numerically = 𝑦 + 𝑒 𝑥 , 𝑦(0) = 0 at 𝑥 = 0.2, 0.4 by Improved Euler Method
𝑑𝑥

Soln: Here we are given

𝑑𝑦
= 𝑓(𝑥, 𝑦) = 𝑦 + 𝑒 𝑥 , with 𝑥0 = 0, 𝑦0 = 0,
𝑑𝑥

Also, 𝑥1 = 0.2, 𝑥2 = 0.4, so ℎ = 𝑥1 − 𝑥0 = 0.2 − 0 = 0.2

Using Improved Euler Method,

For 𝒚𝟏 at 𝒙𝟏 = 𝟎. 𝟐

(1)
𝑦1 = 𝑦0 + ℎ𝑓(𝑥0 , 𝑦0 ) = 𝑦0 + ℎ{𝑦0 + 𝑒 𝑥0 } = 0 + 0.2{0 + 𝑒 0 } = 0.2

ℎ (1) ℎ (1)
𝑦1 = 𝑦0 + {𝑓(𝑥0 , 𝑦0 ) + 𝑓(𝑥1 , 𝑦1 )} = 𝑦0 + [{𝑦0 + 𝑒 𝑥0 } + {𝑦1 + 𝑒 𝑥1 }]
2 2
0.2
=0+ [{0 + 𝑒 0 } + {0.2 + 𝑒 0.2 }] =0.24214
2

For 𝒚𝟐 at 𝒙𝟐 = 𝒙𝟐 + 𝒉 = 𝟎. 𝟒

(1)
𝑦2 = 𝑦1 + ℎ𝑓(𝑥1 , 𝑦1 ) = 0.24214 + 0.2{0.24214 + 𝑒 0.2 } = 0.53485

Copyright©2024, Dr. A. A. Basumatary, Dept. of Mathematics, CIT Kokrajhar. Page 2 of 6


UMA401 – NMCP: Improved Euler Method

(1)
𝑓(𝑥1 , 𝑦1 ) + 𝑓((𝑥2 , 𝑦2 ) {0.24214 + 𝑒 0.2 } + {0.53485 + 𝑒 0.4 }
𝑦2 = 𝑦1 + ℎ { } = 0.24214 + 0.2 [ ]
2 2
= 0.59116

Example No. 2 (Improved Euler Method):

𝑑𝑦 2𝑥
Using Improved Euler method find 𝑦 at 𝑥 = 0.1 and 𝑥 = 0.2 given that =𝑦− , y(0) = 1
𝑑𝑥 𝑦
[2012, 2013]

Soln: Here we are given

𝑑𝑦 2𝑥
= 𝑓(𝑥, 𝑦) = 𝑦 − , with 𝑥0 = 0, 𝑦0 = 1,
𝑑𝑥 𝑦

Also, 𝑥1 = 0.1, 𝑥2 = 0.2, so ℎ = 𝑥1 − 𝑥0 = 0.1 − 0 = 0.1

Using Improved Euler Method,

For 𝒚𝟏 at 𝒙𝟏 = 𝟎. 𝟏

(1) 2𝑥0 2(0)


𝑦1 = 𝑦0 + ℎ𝑓(𝑥0 , 𝑦0 ) = 𝑦0 + ℎ {𝑦0 − } = 1 + 0.1 {1 − } = 1.1
𝑦0 1

ℎ (1) ℎ 2𝑥0 (1) 2𝑥1


𝑦1 = 𝑦0 + {𝑓(𝑥0 , 𝑦0 ) + 𝑓(𝑥1 , 𝑦1 )} = 𝑦0 + [{𝑦0 − } + {𝑦1 − (1) }]
2 2 𝑦0 𝑦 1

0.1 2(0) 2(0.1)


=1+ [{1 − } + {1.1 − }] = 1.095909
2 1 1.1

For 𝒚𝟐 at 𝒙𝟐 = 𝒙𝟐 + 𝒉 = 𝟎. 𝟐

(1) 2(0.1)
𝑦2 = 𝑦1 + ℎ𝑓(𝑥1 , 𝑦1 ) = 1.095909 + 0.1 {1.095909 − } = 1.18725
1.095909
ℎ (1)
𝑦2 = 𝑦1 + {𝑓(𝑥1 , 𝑦1 ) + 𝑓(𝑥2 , 𝑦2 )}
2
0.1 2(0.1) 2(0.2)
= 1.095909 + [{1.095909 − } + {1.18725 − }] = 1.1841009
2 1.095909 1.18725

Copyright©2024, Dr. A. A. Basumatary, Dept. of Mathematics, CIT Kokrajhar. Page 3 of 6


UMA401 – NMCP: Improved Euler Method

Example No. 3.

𝑑𝑦
Using Improved Euler Method solve numerically the equation = 𝑥 + 𝑦 , 𝑦(0) = 1 for 𝑥 = 1.0 with
𝑑𝑥
ℎ = 0.2. Check your answer with exact values (analytical values)

Soln: Here we have

𝑑𝑦
= 𝑥 + 𝑦 = 𝑓(𝑥, 𝑦) , with 𝑥0 = 0, 𝑦0 = 1,
𝑑𝑥

Also, 𝑥𝑛 = 1, ℎ = 0.2

Now, By Improved Euler’s Method,

For 𝒚𝟏 at 𝒙𝟏 = 𝒙𝟎 + 𝒉 = 𝟎. 𝟐

(1)
𝑦1 = 𝑦0 + ℎ𝑓(𝑥0 , 𝑦0 ) = 𝑦0 + ℎ(𝑥0 + 𝑦0 ) = 1 + 0.2 (0 + 1) = 1.2

ℎ (1) ℎ (1)
𝑦1 = 𝑦0 + {𝑓(𝑥0 , 𝑦0 ) + 𝑓(𝑥1 , 𝑦1 )} = 𝑦0 + [{𝑥0 + 𝑦0 } + {𝑥1 + 𝑦1 }]
2 2
0.2
=1+ [{0 + 1} + {0.2 + 1.2}] = 1.24
2

For 𝒚𝟐 at 𝒙𝟐 = 𝒙𝟐 + 𝒉 = 𝟎. 𝟒

(1)
𝑦2 = 𝑦1 + ℎ𝑓(𝑥1 , 𝑦1 ) = 𝑦1 + ℎ(𝑥1 + 𝑦1 ) = 1.24 + 0.2 (0.2 + 1.24) = 1.528

ℎ (1) ℎ (1)
𝑦2 = 𝑦1 + {𝑓(𝑥1 , 𝑦1 ) + 𝑓(𝑥2 , 𝑦2 )} = 𝑦1 + [{𝑥1 + 𝑦1 } + {𝑥2 + 𝑦2 }]
2 2
0.2
= 1.24 + [{0.2 + 1.24} + {0.4 + 1.528}] = 1.5768
2

For 𝒚𝟑 at 𝒙𝟑 = 𝒙𝟐 + 𝒉 = 𝟎. 𝟔

(1)
𝑦3 = 𝑦2 + ℎ𝑓(𝑥2 , 𝑦2 ) = 𝑦2 + ℎ(𝑥2 + 𝑦2 ) = 1.5768 + 0.2 (0.4 + 1.5768) = 1.97216

ℎ (1) ℎ (1)
𝑦3 = 𝑦2 + {𝑓(𝑥2 , 𝑦2 ) + 𝑓(𝑥3 , 𝑦3 )} = 𝑦2 + [{𝑥2 + 𝑦2 } + {𝑥3 + 𝑦3 }]
2 2
0.2
= 1.5768 + [{0.4 + 1.5768 } + {0.6 + 1.97216}] = 2.03169
2

For 𝒚𝟒 at 𝒙𝟒 = 𝒙𝟑 + 𝒉 = 𝟎. 𝟖

(1)
𝑦4 = 𝑦3 + ℎ𝑓(𝑥3 , 𝑦3 ) = 𝑦3 + ℎ(𝑥3 + 𝑦3 ) = 2.03169 + 0.2 (0.6 + 2.03169 ) = 2.55802

Copyright©2024, Dr. A. A. Basumatary, Dept. of Mathematics, CIT Kokrajhar. Page 4 of 6


UMA401 – NMCP: Improved Euler Method

ℎ (1) ℎ (1)
𝑦4 = 𝑦3 + {𝑓(𝑥3 , 𝑦3 ) + 𝑓(𝑥4 , 𝑦4 )} = 𝑦3 + [{𝑥3 + 𝑦3 } + {𝑥4 + 𝑦4 }]
2 2
0.2
= 2.03169 + [{0.6 + 2.03169 } + {0.8 + 2.55802}] = 2.63066
2

For 𝒚𝟓 at 𝒙𝟓 = 𝒙𝟒 + 𝒉 = 𝟏. 𝟎

(1)
𝑦5 = 𝑦4 + ℎ𝑓(𝑥4 , 𝑦4 ) = 𝑦4 + ℎ(𝑥4 + 𝑦4 ) = 2.63066 + 0.2 (0.8 + 2.63066) = 3.31679

ℎ (1) ℎ (1)
𝑦5 = 𝑦4 + {𝑓(𝑥4 , 𝑦4 ) + 𝑓(𝑥5 , 𝑦5 )} = 𝑦4 + [{𝑥4 + 𝑦4 } + {𝑥5 + 𝑦5 }]
2 2
0.2
= 2.63066 + [{0.8 + 2.63066 } + {1.0 + 3.31679}] = 3.40540
2

Analytical soln:

𝑑𝑦 𝑑𝑦
= 𝑥 + 𝑦 => − 𝑦 = 𝑥 => 𝐼. 𝐹. = 𝑒 ∫ −𝑑𝑥 = 𝑒 −𝑥
𝑑𝑥 𝑑𝑥

𝑑
∴ 𝑦𝑒 −𝑥 = ∫ 𝑥𝑒 −𝑥 𝑑𝑥 + 𝐶 = 𝑥 ∫ 𝑒 −𝑥 𝑑𝑥 − ∫ { (𝑥). ∫ 𝑒 −𝑥 𝑑𝑥} 𝑑𝑥 + 𝐶 = −𝑥𝑒 −𝑥 − 𝑒 −𝑥 + 𝐶
𝑑𝑥

=> 𝑦 = 𝐶𝑒 𝑥 − 𝑥 − 1

At 𝑥 = 0, 𝑦 = 1 so 1 = 𝐶𝑒 0 − 0 − 1 => 𝐶 = 2

∴ 𝑦 = 2𝑒 𝑥 − 𝑥 − 1

Now, the tabulated value of 𝑦 are

𝑥 0 0.2 0.4 0.6 0.8 1.0


Analytical value of 𝑦 1 1.24281 1.58365 2.04424 2.65108 3.43656
Improved Euler value of 𝑦 1 1.24 1.5768 2.03169 2.63066 3.40540
Difference in 𝑦 0 0.00281 0.00685 0.01255 0.02042 0.03116

Observation/Comment:

In this problem, we see that Improved Euler values of 𝑦 deviates from the analytical values of 𝑦 as
𝑥 increases.

Remarks:

As compared to Euler values of 𝑦 (which we had obtained in previous chapter) which are given below

𝑥 0 0.2 0.4 0.6 0.8 1.0


Analytical value of 𝑦 1 1.24281 1.58365 2.04424 2.65108 3.43656
Euler value of 𝑦 1 1.2 1.48 1.856 2.34720 2.97664
Difference in 𝑦 0 0.04281 0.10365 0.18824 0.30388 0.45992

Copyright©2024, Dr. A. A. Basumatary, Dept. of Mathematics, CIT Kokrajhar. Page 5 of 6


UMA401 – NMCP: Improved Euler Method

we see that the difference in the value of 𝑦 is much lesser throughout in the case of Improved Euler
values of 𝑦. This shows that the value of 𝑦 obtained through Improved Euler Method are better
approximations than that of Euler Method. ∎

Practice Questions:

Solve by Improved Euler Method

𝑑𝑦 2𝑥
(1) Given =𝑦− , 𝑦(0) = 1, ℎ = 0.1. Find 𝑦(0.3)
𝑑𝑥 𝑦
𝑑𝑦
(2) Given = 𝑥 + 𝑦, 𝑦(0) = 0, ℎ = 0.2. Find 𝑦(0.6), 𝑦(0.8), 𝑦(1)
𝑑𝑥
𝑑𝑦
(3) Calculate 𝑦(0.5) taking ℎ = 0.1 and = 𝑦 + 𝑆𝑖𝑛 𝑥, 𝑦(0) = 2
𝑑𝑥
𝑑𝑦 2𝑦
(4) Calculate 𝑦(1.2), 𝑦(1.4) given = + 𝑥3 , 𝑦(1) = 0.5
𝑑𝑥 𝑥
𝑑𝑦
(5) Given = −𝑥𝑦2 , 𝑦(0) = 2, ℎ = 0.1. Evaluate 𝑦(0.2)
𝑑𝑥
𝑑𝑦
(6) Given = 1 − 𝑦, 𝑦(0) = 0. Evaluate 𝑦(0.1) and 𝑦(0.2)
𝑑𝑥

Copyright©2024, Dr. A. A. Basumatary, Dept. of Mathematics, CIT Kokrajhar. Page 6 of 6

You might also like