Module V
Module V
MODULE - V
NUMERICAL METHODS - 2
Introduction
Many ordinary differential equations can be solved by analytical methods discussed earlier
giving closed form solutions i.e. expressing y in terms of a finite number of elementary functions
of x. However, a majority of differential equations appearing in physical problems cannot be
solved analytically. Thus, it becomes imperative to discuss their solution by numerical methods.
𝑑𝑦
Here we must solve the differential equation = 𝑓(𝑥, 𝑦), with the condition 𝑦(𝑥0 ) =
𝑑𝑥
𝑦0 numerically. The solutions are either as a power series in x from which the values of y can be
obtained directly by substitution, or as a set of values of x and y. The method of Taylor series
belongs to the first kind whereas Euler, Runge – Kutta, Milne’s and Adams – Bash forth methods
belongs to the second Kind. In the second type of problems, the values of y are calculated in short
steps for equal intervals of x. Therefore, these methods are also called as Step – by – step methods.
Thus, we discuss the following numerical methods for solving an initial value problem.
Let 𝑦 = 𝑦(𝑥) be the exact solution of equation (1) expanding y(x) in Taylor series about the point
x0, we get,
(𝑥 − 𝑥0 ) (𝑥 − 𝑥0 )2 (𝑥 − 𝑥0 )3
𝑦(𝑥) = 𝑦(𝑥0 ) + 𝑦′(𝑥0 ) + 𝑦′′(𝑥0 ) + 𝑦′′′(𝑥0 ) + ⋯
1! 2! 3!
Since 𝑦(𝑥0 ) = 𝑦0 , 𝑦 ′ (𝑥0 ) = 𝑦 ′ 0 , 𝑦 '' (𝑥0 ) = 𝑦 ′′ 0etc., the above equation becomes
(𝑥 − 𝑥0 ) (𝑥 − 𝑥0 )2 (𝑥 − 𝑥0 )3
𝑦(𝑥) = 𝑦0 + 𝑦′0 + 𝑦′′0 + 𝑦′′′0 + ⋯
1! 2! 3!
Setting h = x1- x0and denoting y(x) = y(x1) = y1, the above equation becomes,
ℎ ℎ2 ℎ3
𝑦1 = 𝑦0 + 1! 𝑦′0 + 2! 𝑦′′0 + 3! 𝑦′′′0 +. . ..--------------(2)
This is the Taylor series solution at the point x1= x0+ h. Starting with this x1and repeating the
above procedure we get the solution at the point x2as,
Proceeding like this we get the Taylor series solution at the n𝑡ℎstep given by,
ℎ ℎ2 ℎ3
𝑦𝑛+1 = 𝑦𝑛 + 1! 𝑦′𝑛 + 2! 𝑦′′𝑛 + 3! 𝑦′′′𝑛 +. . ..---------------(3)
Problems
1. Use Taylor’s series method to find y at the points x = 0.1, given that
𝑑𝑦
= 𝑥2 + 𝑦2, y(0) = 1.
𝑑𝑥
4 7
= 1 + 𝑥 + 𝑥 2 + 𝑥 3 + 𝑥 4 +. . . . . . (ii)
3 6
Under the given condition𝑦(𝑥0 ) = 𝑦(0) = 1, this is the Taylor’s series solution for y at a point x
in a neighbourhood of 𝑥0 = 0.
For𝑥 = 𝑥1 = 0.1, expression (ii) yields the solution at 𝑥1 = 0.1 as,
4 7
𝑦(0.1) = 1 + (0.1) + (0.1)2 + (0.1)3 + (0.1)4 +. . . . . . . ≈ 1.11145
3 6
2. Find by Taylor’s series method the value of y at x = 0.1 and x = 0.2 to five places of decimals
𝑑𝑦
from = 𝑥 2 𝑦 − 1, 𝑦(0) = 1. Consider up to 4th degree terms.
𝑑𝑥
𝑥2 𝑥3 𝑥4 𝑥5 𝑥6
𝑦(𝑥) = 1 + 𝑥(−1) + (0) + (2) + (−6) + (0) + (40)+. . . . . . . ..
2! 3! 4! 5! 6!
𝑥3 𝑥4 𝑥6
=1−𝑥+ − + 18 +. . . . . . . . . . ..
3 4
(0.1)3 (0.1)4 (0.1)6
∴ 𝑦(0.1) = 1 − (0.1) + − + +. . . . . . = 0.90031 & ∴ 𝑦(0.2) = 1 − (0.2) +
3 4 18
(0.2)3 (0.2)4 (0.2)6
− + +. . . . . . = 0.80227, correct to five places of decimals.
3 4 18
3. Employ Taylor’s method to obtain approximate value of y at x = 0.2 for the differential
𝑑𝑦
equation = 2𝑦 + 3𝑒 𝑥 , 𝑦(0) = 0. Compare the numerical solution so obtained with the
𝑑𝑥
exact solution.
9 7 15 31
∴ 𝑦(0.2) = 3 × 0.2 + (0.2)2 + (0.2)3 + (0.2)4 + (0.2)5 +. . . . . . . . = 0.811248
2 2 8 40
𝑑𝑦
Direct method: Now 𝑑𝑥 − 2𝑦 = 3𝑒 𝑥 , is a linear Differential equation in x.
4. Using the Taylor’s series method, find the approximate solution (up to 4 places of decimal),
𝑑𝑦
at the point 0.1, of the following initial value problem: 𝑑𝑥 = 𝑥 − 𝑦 2 , 𝑦(0) = 1.
𝑥2 𝑥3 𝑥4 𝑥5
∴ 𝑦(𝑥) = 1 + 𝑥(−1) + × 3 + × (−8) + × 34 + × (−186)+. . . . . . ..
2! 3! 4! 5!
3 4 17 31
= 1 − 𝑥 + 2 𝑥 2 − 3 𝑥 3 + 12 𝑥 4 − 20 𝑥 5 +. . . . . . . ..
3 4 17 31
Hence 𝑦(0.1) = 1 − (0.1) + 2 (0.1)2 − 3 (0.1)3 + 12 (0.1)4 − 20 (0.1)5 +. . . . . . . . . = 0.9138.
𝑑𝑦
5. Find y at x = 1.02 correct to five decimal places given = 𝑥𝑦 − 1 and y = 2 at x = 1 applying
𝑑𝑥
= 2.02061
Hence 𝑦(1.02) = 2.02061.
Exercises:
𝑑𝑦
1) Using Taylor’s method, compute the solution of = 𝑥 + 𝑦, 𝑦(0) = 1 at the point x = 0.2
𝑑𝑥
4) By using Taylor’s series method find an approximate solution at 𝑥 = 1.02of the initial – value
problem 𝑦′ = 𝑥𝑦 − 1, 𝑦(1) = 2.
5) Using Taylor’s series method, find the solution at 𝑥 = 2.1of the differential equation 𝑥𝑦′ =
𝑥 − 𝑦, given that 𝑦(2) = 2
1
6) Use the Taylor’s series method to find 𝑦(4.1)&𝑦(4.2), given that 𝑦′ = 𝑥 2 +𝑦 2 , 𝑦(4) = 4.
𝑑𝑦
7) Obtain the Taylor’s series solution of the problem = 𝑦 𝑠𝑖𝑛 𝑥 + 𝑐𝑜𝑠 𝑥 , 𝑦(0) = 0.
𝑑𝑥
Predictor-Corrector Method:
Taylor’s method discussed above to solve a first order differential equation, require information
about the solution at a single point say 𝑥𝑛 for computing the solution at 𝑥𝑛 + 1. Hence this method
is called single-step method.
In the Predictor-Corrector Methods, a predictor formula is used to predict the value 𝑦𝑖 + 1 y at
x𝑖 + 1and then a corrector formula is used to improve the value of 𝑦𝑖 + 1 The corrector formula
is used repeatedly until two consecutive values of 𝑦𝑖 + 1 are almost equal.
Problems:
𝒅𝒚
1. Solve = 𝟏 − 𝒚 with the initial condition y(0)=0 using Euler's modified method and find
𝒅𝒙
y(0.1).
𝒅𝒚
Solution: Given 𝒅𝒙 = 𝟏 − 𝒚 = 𝑓(𝑥, 𝑦) , 𝑥0 = 0, 𝑦0 = 0, ℎ = 0.1.
(0)
∴ 𝑦1 = 𝑦0 + ℎ𝑓(𝑥0, 𝑦0 )
= 0 + 0.1(1 − 0) = 0.1
We now apply Euler's modified method to get more accurate value of y.
(𝑖) 1 (𝑖−1)
𝑦𝑛 = 𝑦𝑛−1 + ℎ[𝑓(𝑥𝑛−1 , 𝑦𝑛−1 ) + 𝑓(𝑥𝑛 , 𝑦𝑛 )]
2
(𝑖)
where 𝑦𝑛 denotes the iteration of 𝑦𝑛 up to 'i' times.
∴ For the first iteration we have,
(1) ℎ (0)
𝑦1 = 𝑦0 + [𝑓(𝑥0 , 𝑦0 ) + 𝑓(𝑥1 , 𝑦1 )]
2
0.1
=0+ [1 − 0 + 1 − 0.1]
2
= 0.095
Second iteration,
(2) ℎ (1)
𝑦1 = 𝑦0 + [𝑓(𝑥0 , 𝑦0 ) + 𝑓(𝑥1 , 𝑦1 )]
2
0.1
=0+ [1 − 0 + 1 − 0.095]
2
= 0.09525
Third iteration,
(3) ℎ (2)
𝑦1 = 𝑦0 + [𝑓(𝑥0 , 𝑦0 ) + 𝑓(𝑥1 , 𝑦1 )]
2
0.1
=0+ [1 − 0 + 1 − 0.09525]
2
= 0.0952375
∴ The approximate value of y is 0.0952.
𝑑𝑦
2. Given = 3𝑦 + 𝑒 𝑥 , 𝑦(0) = 1. Take ℎ = 0.1 and compute 𝑦(0.2) by Modified Euler’s
𝑑𝑥
method.
Solution: Here 𝑓(𝑥, 𝑦) = 3𝑦 + 𝑒 𝑥 , x0 = 0, 𝑦0 = 1&ℎ = 0.1.
(0)
𝐴𝑡 𝑥 = 0.1, 𝑦1 = 𝑦0 + ℎ𝑓(𝑥0 , 𝑦0 ) = 1.4
(1) ℎ (0)
𝑦1 = 𝑦0 + [𝑓(𝑥0 , 𝑦0 ) + 𝑓(𝑥1 , 𝑦1 )] = 1.4653
2
(2) ℎ (1)
𝑦1 = 𝑦0 + [𝑓(𝑥0 , 𝑦0 ) + 𝑓(𝑥1 , 𝑦1 )]=1.4751
2
(0)
𝐴𝑡 𝑥 = 0.2, 𝑦1 = 𝑦0 + ℎ𝑓(𝑥0 , 𝑦0 ) = 2.0281
(1) ℎ (0)
𝑦1 = 𝑦0 + [𝑓(𝑥0 , 𝑦0 ) + 𝑓(𝑥1 , 𝑦1 )] = 2.1169
2
(2) ℎ (1)
𝑦1 = 𝑦0 + [𝑓(𝑥0 , 𝑦0 ) + 𝑓(𝑥1 , 𝑦1 )] = 2.1302
2
∴ The approximate value of y is 2.1302.
𝑑𝑦
3. Using Modified Euler’s method, find an approximate value of y when x = 0.2, given that 𝑑𝑥 =
Hence𝑓(𝑥0 , 𝑦0 ) = 0 + 1 = 1
(0)
∴ 𝑦1 = 𝑦0 + ℎ𝑓(𝑥0 , 𝑦0 ) = 1 + 0.1 × 1 = 1.1
(0)
Now 𝑓(𝑥1 , 𝑦1 ) = 0.1 + 1.1 = 1.2
(1) ℎ (0) 0.1
∴ 𝑦1 = 𝑦0 + [𝑓(𝑥0 , 𝑦0 ) + 𝑓(𝑥1 , 𝑦1 )] = 1 + [1 + 1.2] = 1.11
2 2
(1)
Now 𝑓(𝑥1 , 𝑦1 ) = 0.1 + 1.11 = 1.21
(2) ℎ (1) 0.1
∴ 𝑦1 = 𝑦0 + [𝑓(𝑥0 , 𝑦0 ) + 𝑓(𝑥1 , 𝑦1 )] = 1 + [1 + 1.21] = 1.1105
2 2
(2)
Now 𝑓(𝑥1 , 𝑦1 ) = 0.1 + 1.1105 = 1.2105
(3) ℎ (2) 0.1
∴ 𝑦1 = 𝑦0 + [𝑓(𝑥0 , 𝑦0 ) + 𝑓(𝑥1 , 𝑦1 )] = 1 + [1 + 1.2105] = 1.1105
2 2
Hence 𝑦1 = 𝑦(0.1) = 1.1105
Now 𝑓(𝑥1 , 𝑦1 ) = 0.1 + 1.1105 = 1.2105.
(0)
∴ 𝑦2 = 𝑦1 + ℎ𝑓(𝑥1 , 𝑦1 ) = 1.1105 + 0.1 × 1.2105 = 1.2316
(0)
Now 𝑓(𝑥2 , 𝑦2 ) = 0.2 + 1.2316 = 1.4316
(1) ℎ (0) 0.1
∴ 𝑦2 = 𝑦1 + [𝑓(𝑥1 , 𝑦1 ) + 𝑓(𝑥2 , 𝑦2 )] = 1.1105 + [1.2105 + 1.4316] = 1.2426.
2 2
(1)
Now 𝑓(𝑥2 , 𝑦2 ) = 0.2 + 1.2426 = 1.4426
(2) ℎ (1) 0.1
∴ 𝑦2 = 𝑦1 + [𝑓(𝑥1 , 𝑦1 ) + 𝑓(𝑥2 , 𝑦2 )] = 1.1105 + [1.2105 + 1.4426] = 1.2432.
2 2
(2)
Now 𝑓(𝑥2 , 𝑦2 ) = 0.2 + 1.2432 = 1.4432
4. Using Modified Euler’s method, find an approximate value of y when x = 0.4, given that
𝑑𝑦
= log(𝑥 + 𝑦) &𝑦 = 2 when x = 0. Take h = 0.2.
𝑑𝑥
Exercises:
1) Apply Modified Euler’s method to solve 𝑦′ = 𝑥 + 𝑦, 𝑦(0) = 0, choosing the step length h =
0.2.
𝑑𝑦 𝑦−𝑥
2) Given = with boundary condition y = 1 when x = 0, find approximately y for x = 0.1
𝑑𝑥 𝑦+𝑥
𝑑𝑦
3) Given that 𝑑𝑥 = 𝑥 + 𝑦 2 &𝑦 = 1at 𝑥 = 0. Find a approximate value of y at x = 0.5 by Modified
Euler’s method.
𝑑𝑦
4) Solve the differential equation = −𝑥𝑦 2 , 𝑦 = 2at 𝑥 = 0, by Modified Euler’s method &
𝑑𝑥
𝑑𝑦
5) Given that = 2 + √𝑥𝑦, y = 1 at x = 1, find approximate value of y at x = 2 in steps of 0.2,
𝑑𝑥
7) By using the Modified Euler’s method, solve the problem 𝑦′ = 𝑥 2 + 𝑦, 𝑦(0) = 1 at x = 0.02,
0.04 & 0.06.
𝑘4 = ℎ𝑓(𝑥0 + ℎ, 𝑦0 + 𝑘3 ),
Then calculate k =
1
k1 + 2k2 + 2k3 +k 4
6
Then 𝑦1 = 𝑦0 + 𝑘, gives the required approximate value of y at 𝑥 = 𝑥1 .
Problems:
1. Apply Runge – Kutta fourth order method to find an approximate value of y when x = 0.2
𝑑𝑦
given that 𝑑𝑥 = 𝑥 + 𝑦&𝑦 = 1when x = 0.
( ) ( )
k3 = hf x0 + 1 h, y0 + 1 k2 = 0.2 f 0 + 1 0.2, 1 + 1 0.24 = 0.2 f (0.1, 1.12) = 0.2 (0.1 + 1.12) = 0.244
2 2 2 2
𝑘4 = ℎ𝑓(𝑥0 + ℎ, 𝑦0 + 𝑘3 ) = 0.2 × 𝑓(0.2, 1.244) = 0.2 × (0.2 + 1.244) = 0.2888,
Then k =
1
k1 + 2k2 + 2k3 +k 4 = 1 0.2 + 2 0.24 + 2 0.244 + 0.2888 = 0.2428
6 6
Hence𝑦1 = 𝑦(0.2) = 𝑦0 + 𝑘 = 1 + 0.2428 = 1.2428
2. Apply Runge – Kutta fourth order method to find an approximate value of y for x = 0.1 in steps
𝑑𝑦
of 0.1, if 𝑑𝑥 = 𝑥 + 𝑦 2 , given that y = 1 when x = 0.
Then k =
1
k1 + 2k2 + 2k3 +k 4 = 1 0.1 + 2 0.1153+ 2 0.1169 + 0.1347 = 0.1165
6 6
Hence𝑦1 = 𝑦(0.1) = 𝑦0 + 𝑘 = 1 + 0.1165 = 1.1165.
1 1
𝑘2 = ℎ𝑓 (𝑥0 + ℎ, 𝑦0 + 𝑘1 ) = 0.1 × 𝑓(1.05, 1.05) = 0.1 × [(1.05)(1.05)1/3 ] = 0.1067
2 2
1 1
𝑘3 = ℎ𝑓 (𝑥0 + ℎ, 𝑦0 + 𝑘2 ) = 0.1 × 𝑓(1.05, 1.05335) = 0.1 × [(1.05)(1.05335)1/3 ]
2 2
= 0.1068
𝑘4 = ℎ𝑓(𝑥0 + ℎ, 𝑦0 + 𝑘3 ) = 0.1 × 𝑓(1.1, 1.1068) = 0.1 × [(1.1)(1.1068)1/3 ] = 0.1138,
1
Then 𝑦(𝑥1 ) = 𝑦(1.1) = 𝑦0 + 6 (𝑘1 + 2𝑘2 + 2𝑘3 + 𝑘4 ) =1.1068
ℎ 𝑘1
𝑘1 = ℎ𝑓(𝑥0 , 𝑦0 ) = -8.3136 𝑘2 = ℎ𝑓 (𝑥0 + 2 , 𝑦0 + ) =-0.2110
2
ℎ 𝑘2
𝑘3 = ℎ𝑓 (𝑥0 + 2 , 𝑦𝑜 + ) = -7.9594 𝑘4 = ℎ𝑓(𝑥0 + ℎ, 𝑦𝑜 + 𝑘3 ) =-2.8874
2
1
Therefore, 𝑦(𝑥1 ) = 𝑦0 + 6 (𝑘1 + 2𝑘2 + 2𝑘3 + 𝑘4 ) =0.4097
𝑑𝑦 𝑦 2 −𝑥 2
5. Using Runge – Kutta fourth order method, solve = with 𝑦(0) = 1 at x = 0.2, 0.4.
𝑑𝑥 𝑦 2 +𝑥 2
𝑦 2 −𝑥 2
Solution: Here𝑓(𝑥, 𝑦) = 𝑦 2+𝑥 2 , x0 = 0, 𝑦0 = 1&ℎ = 0.2, then
Step I:
1−0
𝑘1 = ℎ𝑓(𝑥0 , 𝑦0 ) = 0.2 × = 0.2
1+0
1 1 (1.1)2 − (0.1)2
𝑘2 = ℎ𝑓 (𝑥0 + ℎ, 𝑦0 + 𝑘1 ) = 0.2 × 𝑓(0.1, 1.1) = 0.2 × = 0.1967
2 2 (1.1)2 + (0.1)2
( 2 2
)
k3 = hf x0 + 1 h, y0 + 1 k 2 = 0.2 f (0.1, 1.0984) = 0.2
(1.0984) 2 − (0.1) 2
(1.0984) 2 + (0.1) 2
= 0.1967 𝑘4 =
(1.1967)2 −(0.2)2
ℎ𝑓(𝑥0 + ℎ, 𝑦0 + 𝑘3 ) = 0.2 × 𝑓(0.2, 1.1967) = 0.2 × (1.1967)2+(0.2)2 = 0.1891,
Then k =
1
k1 + 2k2 + 2k3 +k 4 = 1 0.2 + 2 0.1967 + 2 0.1967 + 0.1891 = 0.196
6 6
Hence𝑦1 = 𝑦(0.2) = 𝑦0 + 𝑘 = 1 + 0.196 = 1.196
Step II:
(1.196)2 − (0.2)2
𝑘1 = ℎ𝑓(𝑥1 , 𝑦1 ) = 0.2 × = 0.1891
(1.196)2 + (0.2)2
1 1 (1.2906)2 − (0.3)2
𝑘2 = ℎ𝑓 (𝑥1 + ℎ, 𝑦1 + 𝑘1 ) = 0.2 × 𝑓(0.3, 1.2906) = 0.2 × = 0.1795
2 2 (1.2906)2 + (0.3)2
( 2 2
)
k3 = hf x1 + 1 h, y1 + 1 k 2 = 0.2 f (0.3, 1.2857) = 0.2
(1.2857) 2 − (0.3) 2
(1.2857) 2 + (0.3) 2
= 0.1793𝑘4 =
(1.3753)2 −(0.4)2
ℎ𝑓(𝑥1 + ℎ, 𝑦1 + 𝑘3 ) = 0.2 × 𝑓(0.4, 1.3753) = 0.2 × (1.3753)2 +(0.4)2 = 0.1688,
Then k =
1
k1 + 2k2 + 2k3 +k 4 = 1 0.1891+ 2 0.1795 + 2 0.1793+ 0.1688 = 0.1793
6 6
Hence𝑦2 = 𝑦(0.4) = 𝑦1 + 𝑘 = 1.196 + 0.1793 = 1.3753
Exercises:
𝑑𝑦
1) Using Runge – Kutta method of order 4, compute 𝑦(0.2) from 10 𝑑𝑥 = 𝑥 2 + 𝑦 2 , 𝑦(0) = 1,
taking h = 0.1
2) Use Runge – Kutta fourth order method to find y when x = 1.2 in steps of 0.1 given that
𝑑𝑦
= 𝑥 2 + 𝑦 2 & 𝑦(1) = 1.5
𝑑𝑥
𝑑𝑦 𝑦−𝑥
3) Using Runge – Kutta method of order 4, find y(0.2) for the equation 𝑑𝑥 = 𝑦+𝑥 , 𝑦(0) = 1. Take
h = 0.2.
𝑑𝑦 1
4) Using Runge – Kutta fourth order method, find y(0.2)given that = 3𝑥 + 2 𝑦, 𝑦(0) = 1,
𝑑𝑥
taking h = 0.1
5) Using the fourth order Runge – Kutta method, solve the equation (𝑥 + 𝑦)𝑦 1 = 1at x = 0.5
given that 𝑦(0.4) = 1.
6) By using the 4th order Runge – Kutta method with step – length h = 0.2, find a approximate
solution at x = 1.2 of the initial value problem 𝑦 1 = 𝑥𝑦, y(1) = 2.
7) Using the Runge – Kutta fourth order method, solve the problem 𝑦 1 = 𝑥 + 𝑦 2 , y(0)=1,at x =
0.2 in steps of 0.1
8) By using the Runge – Kutta fourth order method, find the solution of the problem 𝑦 1 = 1 +
𝑦 2 , y(0) = 0 for x = 0.2, 0.4, 0.6
9) Given that 𝑦 1 − 𝑥 2 𝑦 = 𝑥, y(0) =1, find y(0.1) & y(0.2) by using the Runge – Kutta fourth order
method.
10) By using the Runge – Kutta fourth order method, solve the problem 𝑦1 = 1 − 2𝑥𝑦,
Milne’s method
The Predictor-Corrector methods form a large class of general methods for numerical integration
of ordinary differential equations. As an illustration, consider Milne's method for the first-order
equation 𝑦′(𝑥) = 𝑓(𝑦(𝑥), 𝑥) initial value y(x0) = y0.
Define
𝑦𝑛 = 𝑦(𝑥0 + 𝑛ℎ),
𝑦′𝑛 = 𝑦′(𝑥0 + 𝑛ℎ) = 𝑓(𝑦𝑛 , 𝑥0 + 𝑛ℎ)
Then by Simpson's rule
𝑦′𝑛+1 = 𝑓(𝑦𝑛+1, 𝑥 + (𝑛 + 1)ℎ)
This corrector equation is an implicit equation for yn+1; if h is sufficiently small, and if a first
approximation for yn+1 can be found, the equation is solved simply by iteration, i.e., by repeated
evaluations of the right-hand side. To provide the first approximation for yn+1, an explicit predictor
formula is needed, e.g. Milne's formula
𝑦𝑛+1 = 𝑦𝑛−3 + (4ℎ/3)(2𝑦′𝑛 − 𝑦′𝑛−1 + 2𝑦′𝑛−2 ) + 𝑂(ℎ5 )
(𝑝) 4ℎ ′ ′
Predictor Formula: i.e., for n = 3 𝑦𝑛+1 = 𝑦𝑛−3 + [2𝑦𝑛−2 − 𝑦𝑛−1 + 2𝑦𝑛′ ]
3
(𝑝) 4ℎ
i.e., for n = 4 we have 𝑦5 = 𝑦1 + (2𝑓2 − 𝑓3 + 2𝑓4 )
3
(𝑐) ′ ℎ ′
Corrector Formula: i.e., for n = 3 𝑦𝑛+1 = 𝑦𝑛−1 + 3 [𝑦𝑛−1 + 4𝑦𝑛′ + 𝑦𝑛+1 ]
(𝑐) ℎ (𝑝)
i.e., for n = 4 we have 𝑦5 = 𝑦3 + (𝑓3 + 4𝑓4 + 𝑓5 ).
3
The need for a corrector formula arises because the predictor alone is numerically unstable; it gives
spurious solutions growing exponentially. Milne's predictor uses four previous values of y, these
values can be obtained by using Taylor’s or Runge-Kutta method.
Problems
𝑑𝑦
1. Using Milne’s method find y at x = 0.4 given that = 𝑥𝑦 + 𝑦 2 , 𝑦(0) = 1, 𝑦(0.1) = 1.1169,
𝑑𝑥
𝑓0 = 𝑓(𝑥0 , 𝑦0 ) = 0 + 12 = 1
𝑓1 = 𝑓(𝑥1 , 𝑦1 ) = 0.1 × 1.1169 + 1.11692 = 1.3592
𝑓2 = 𝑓(𝑥2 , 𝑦2 ) = 0.2 × 1.2773 + 1.27732 = 1.8870
𝑓3 = 𝑓(𝑥3 , 𝑦3 ) = 0.3 × 1.504 + 1.5042 = 2.7132
Now using predictor formula, we get,
(𝑝) 4ℎ 4 × 0.1
𝑦4 = 𝑦0 + (2𝑓1 − 𝑓2 + 2𝑓3 ) = 1 + (2 × 1.3592 − 1.8870 + 2 × 2.7132)
3 3
= 1.8344
(𝑝)
Now𝑓4 = 𝑓(0.4, 1.8344) = 0.4 × 1.8344 + 1.83442 = 4.0988.
Again, using corrector formula, we get
(𝑐) ℎ (𝑝) 0.1
𝑦4 = 𝑦2 + (𝑓2 + 4𝑓3 + 𝑓4 ) = 1.2773 + (1.8870 + 4 × 2.7132 + 4.0988) = 1.8386
3 3
(𝑝)
Again 𝑓4 = 𝑓(0.4, 1.8386) = 0.4 × 1.8386 + 1.83862 = 4.1159
So again, using corrector formula we get,
(𝑐) ℎ (𝑝) 0.1
𝑦4 = 𝑦2 + (𝑓2 + 4𝑓3 + 𝑓4 ) = 1.2773 + (1.8870 + 4 × 2.7132 + 4.1159) = 1.8392
3 3
(𝑝)
Now 𝑓4 = 𝑓(0.4, 1.8392) = 0.4 × 1.8392 + 1.83922 = 4.1183
So, using corrector formula we get,
(𝑐) ℎ (𝑝) 0.1
𝑦4 = 𝑦2 + (𝑓2 + 4𝑓3 + 𝑓4 ) = 1.2773 + (1.8870 + 4 × 2.7132 + 4.1183) = 1.8392
3 3
Hence 𝑦(0.4) = 1.8392
(𝑝) 4ℎ
𝑦4 = 𝑦0 + [2𝑦11 − 𝑦21 + 2𝑦31 ]
3
Here, h=0.1,
𝑦0 = 1, 𝑦11 = 4𝑦1 = 4(1.492) = 5.968
𝑦21 = 4𝑦2 = 4(2.226) = 8.904
𝑦31 = 4𝑦3 = 4(3.32) = 13.28 ∴ 𝑦 𝑝 4 = 𝑦(𝑥4 ) = 𝑦(0.4)
4(0.1)
=1+ [2(5.968) − 8.904 + 2(13.28)] = 4.9456
3
𝑆𝑜 𝑦41 = 4𝑦4 = 4(4.9456) = 19.7824
For corrector value of y(0.4):
(𝑐) ℎ 1 𝑝
𝑦𝑛+1 = 𝑦𝑛−1 + [𝑦𝑛−1 + 4𝑦𝑛1 + 𝑦𝑛+1 ]
3
(𝑐) ℎ
with n=3, 𝑦4 = 𝑦2 + 3 [𝑦21 + 4𝑦31 + 𝑦41 ]
0.1
∴ 𝑦4 = 𝑦(0.4) = 2.226 + (2.226 + 4(13.28) + 19.7824 = 4.95288 (first approximation of
3
y4).
(𝐶1 ) ℎ (𝑐)
𝑦4 = 𝑦2 + [𝑦21 + 4𝑦31 + 𝑦4 ]
3
0.1
∴ 𝑦4 = 𝑦(0.4) = 2.226 + 3
(2.226 + 4(13.28) + 19. .81152) = 4.731251.
0.1
∴ 𝑦4 = 𝑦(0.4) = 2.226 + (2.226 + 4(13.28) + 4(4.731251)) = 4.701700.
3
0.1
∴ 𝑦4 = 𝑦(0.4) = 2.226 + (2.226 + 4(13.28) + 4(4.701700)) = 4.69776.
3
0.1
∴ 𝑦4 = 𝑦(0.4) = 2.226 + (2.226 + 4(13.28) + 4(4.69776)) = 4.697234.
3
3. Using the Milne’s predictor-corrector method, find an approximate solution of the initial value
𝑑𝑦 2𝑦
problem 𝑑𝑥 = , 𝑥 ≠ 0, at the point x = 2, given y(1) = 2, y(1.25) = 3.13, y(1.5) = 4.5 and y(1.75)
𝑥
Further computing f4(p) =f(x4, y4) = 8.0027, applying the corrector again y4(c) = 8.0021
The approximate solution for ‘y’ at the point x =2, is 8.0021.
𝑑𝑦 2𝑥𝑦
4. Obtain y(0.5) for the IVP = 1+𝑥 2 , y(0.1) = 1, y(0.2) = 1.0199, y(0.3) =
𝑑𝑥
( )
This gives f 4P = f x4 , y4P = 0.9786.
ℎ
𝑦4 (𝑐) = 𝑦2 + (𝑓2 + 4𝑓3 + 𝑓4 (𝑝) ) = 1.1974.
3
5. By using the Milne’s method find a solution of the differential equation 𝑦 ′ = 𝑥 2 + 𝑦 2 at x = 0.4
for the boundary condition y = 1 at x = 0. [Take h = 0.1]
Solution: To apply Milne’s method, we required the value of y at x = 0.2, x = 0.4 & x = 0.6. For
that, we can use Taylor series method. So, referring to the problem 1 in Taylor’s series, we have
obtained y(0.1) = 1.1113 considering up to 3rd degree term. Similarly, we can obtain by Taylor
series method y(0.2) = 1.2507, y(0.3) = 1.426.
To find y at x = 0.4: Here 𝑓(𝑥, 𝑦) = 𝑥 2 + 𝑦 2 , x0 = 0, 𝑦0 = 10 & ℎ = 0.1.
(𝑝) 4 × 0.1
𝑦4 = 1+ (2 × 1.245 − 1.6043 + 2 × 2.1235) = 1.6844
3
(𝑝)
So 𝑓4 = 𝑓(𝑥4 , 𝑦4 ) = 0.42 + 1.68442 = 2.9972
(𝑐) ℎ (𝑝)
Using corrector formula 𝑦4 = 𝑦2 + 3 (𝑓2 + 4𝑓3 + 𝑓4 ), we get
(𝑐) 0.1
𝑦4 = 1.2507 + (1.6043 + 4 × 2.1235 + 2.9972) = 1.6872
3
(𝑝)
Now 𝑓4 = 𝑓(𝑥4 , 𝑦4 ) = 0.42 + 1.68722 = 3.0067 = 𝑓4 (𝑠𝑎𝑦)& again using corrector formula,
we get
(𝑐) 0.1
𝑦4 = 1.2507 + (1.6043 + 4 × 2.1235 + 3.0067) = 1.6875.
3
(𝑝)
Now 𝑓4 = 𝑓(𝑥4 , 𝑦4 ) = 0.42 + 1.68752 = 3.0077 = 𝑓4 (𝑠𝑎𝑦) & again using corrector formula
(𝑐)
we get 𝑦4 = 1.6876.
(𝑝)
Now 𝑓4 = 𝑓(𝑥4 , 𝑦4 ) = 0.42 + 1.68762 = 3.008 = 𝑓4 (𝑠𝑎𝑦) & again using corrector formula
(𝑐)
we get 𝑦4 = 1.6876.
Hence 𝑦4 = 𝑦(0.4) = 1.6876.
Self-Study
same as above.
Hence y(1.4) = 2.5751.
𝑑𝑦
2. Solve the initial value problem = 𝑥 − 𝑦 2 , 𝑦(0) = 1 to find 𝑦(0.4) by Adams – Bash forth
𝑑𝑥
method for the data: 𝑦(0.1) = 0.9138, 𝑦(0.2) = 0.8512, 𝑦(0.3) = 0.8076.
Solution: Here 𝑓(𝑥, 𝑦) = 𝑥 − 𝑦 2 , 𝑦0 = 1, 𝑦1 = 0.9138, 𝑦2 = 0.8512, 𝑦3 = 0.8076.
Now we can use Predictor corrector formula to find y at 0.4 with
𝑦0 = 1, 𝑦1 = 0.9138, 𝑦2 = 0.8512, 𝑦3 = 0.8076 & 𝑠𝑜 𝑓0 = 0 − 12 = −1,
𝑓1 = 0.1 − 0.91382 = −0.7350, 𝑓2 = 0.2 − 0.85122 = −0.5245
& 𝑓3 = 0.3 − 0.80762 = −0.3522
ℎ
Hence by Adams – Bashforth predictor formula 𝑦4𝑃 = 𝑦3 + 24 (55𝑓3 − 59𝑓2 + 37𝑓1 − 9𝑓0 ) we get
(𝑝) 0.1
𝑦4 = 0.8076 + 24 (55 × (−0.3522) − 59 × (−0.5245) + 37 × (−0.735) − 9 × (−1))
= 0.7800
(𝑝)
Now 𝑓4 = 0.4 − 0.78002 = −0.2084
ℎ
Using Adams – Bashforth corrector formula 𝑦4𝐶 = 𝑦3 + 24 (𝑓1 − 5𝑓2 + 19𝑓3 + 9𝑓4𝑝 ) we get,
(𝑐) 0.1
𝑦4 = 0.8076 + (9 × (−0.2084) + 19 × (−0.3522) − 5 × (−0.5245) + (−0.7350))
24
= 0.7798
(𝑝)
Again 𝑓4 = 0.4 − 0.77982 = −0.2080
(𝑐) 0.1
𝑦4 = 0.8076 + (9 × (−0.2080) + 19 × (−0.3522) − 5 × (−0.5245) + (−0.7350))
24
= 0.7798
Hence y(0.4) = 0.7798.
dy y 1
3. Solve the initial value problem dx + x = x2 and compute y at x = 1.4 by Adams-Bashforth
method, given that y(1) = 1, y(1.1) = 0.996, y(1.2) = 0.986, y(1.3) = 0.972.
Solution: Given that, 𝑥0 = 1, 𝑥1 = 1.1, 𝑥2 = 1.2, 𝑥3 = 1.3 & 𝑦0 = 1, 𝑦1 = 0.996,
1 𝑦
𝑦2 = 0.986, 𝑦3 = 0.972. We have 𝑓(𝑥, 𝑦) = − .
𝑥2 𝑥
Therefore, we get
𝟏 𝟎.𝟗𝟗𝟔
𝒇𝟎 = 𝒇(𝒙𝟎 , 𝒚𝟎 ) = 𝟏 − 𝟏 = 0, 𝒇𝟏 = 𝒇(𝒙𝟏 , 𝒚𝟏 ) = (𝟏.𝟏)𝟐 − = − 0.079
𝟏.𝟏
𝟏 𝟎.𝟗𝟖𝟔 𝟏 𝟎.𝟗𝟕𝟐
𝒇𝟐 = 𝒇(𝒙𝟐 , 𝒚𝟐 ) = (𝟏.𝟐)𝟐
− 𝟏.𝟐
= − 0.1272, 𝒇𝟑 = 𝒇(𝒙𝟑 , 𝒚𝟑 ) = (𝟏.𝟑)𝟐
− 𝟏.𝟑
= − 0.1560
ℎ
Hence by Adams – Bashforth predictor formula 𝑦4𝑃 = 𝑦3 + 24 (55𝑓3 − 59𝑓2 + 37𝑓1 − 9𝑓0 ) we get
(𝑝) 0.1
𝑦4 = 0.972 + (55 × (− 0.1560) − 59 × (− 0.1272) + 37 × (− 0.079) − 9 × 0)
24
= 0.9553
(𝑝)
Now 𝑓4 = − 0.1722
ℎ
Using Adams – Bashforth corrector formula 𝑦4𝐶 = 𝑦3 + 24 (𝑓1 − 5𝑓2 + 19𝑓3 + 9𝑓4𝑝 ) we get,
(𝑐) 0.1
𝑦4 = 0.972 + (− 0.079 − 5 × (− 0.1272) + 19 × (− 0.1560) + 9 × (− 0.1722))
24
= 0.9555
Hence 𝑦(1.4) = 0.9555
𝑑𝑦 𝑥2
4. Given = 1+𝑦 2 𝑤𝑖𝑡ℎ 𝑦(0) = 1, 𝑦(0.25) = 1.0026, 𝑦(0.5) = 1.0206, 𝑦(0.75) = 1.0679.
𝑑𝑥
Therefore, we get
𝟎𝟐 𝟎.𝟐𝟓𝟐
𝒇𝟎 = 𝒇(𝒙𝟎 , 𝒚𝟎 ) = 𝟏+𝟏𝟐 = 0, 𝒇𝟏 = 𝒇(𝒙𝟏 , 𝒚𝟏 ) = 𝟏+𝟏.𝟎𝟎𝟐𝟔𝟐 = 0.0312,
𝟎.𝟓𝟐 𝟎.𝟕𝟓𝟐
𝒇𝟐 = 𝒇(𝒙𝟐 , 𝒚𝟐 ) = = 0.1225, 𝒇𝟑 = 𝒇(𝒙𝟑 , 𝒚𝟑 ) = = 𝟎. 𝟐𝟔𝟐𝟖
𝟏+𝟏.𝟎𝟐𝟎𝟔𝟐 𝟏+𝟏.𝟎𝟔𝟕𝟗𝟐
ℎ
Hence by Adams – Bashforth predictor formula 𝑦4𝑃 = 𝑦3 + 24 (55𝑓3 − 59𝑓2 + 37𝑓1 − 9𝑓0 ) we get
(𝑝) 0.25
𝑦4 = 1.0679 + (55 × ( 𝟎. 𝟐𝟔𝟐𝟖) − 59 × (0.1225) + 37 × (0.0312) − 9 × 0)
24
= 1.1552
(𝑝) 12
Now 𝑓4 = 1+1.15522 = 0.4284
ℎ
Using Adams – Bashforth corrector formula 𝑦4𝐶 = 𝑦3 + 24 (𝑓1 − 5𝑓2 + 19𝑓3 + 9𝑓4𝑝 ) we get,
(𝑐) 0.25
𝑦4 = 1.0679 + (0.0312 − 5 × (0.1225) + 19 × (0.2628) + 9 × (0.4284)) = 1.1540
24
𝑑𝑦
5. Using Adams-Bashforth method, find 𝑦(4.4) given 5𝑥 𝑑𝑥 + 𝑦 2 = 2 with y(4) = 1, y(4.1) =
2 − 𝑦2
𝑦2 = 1.0097, 𝑦3 = 1.0143. We have 𝑓(𝑥, 𝑦) = .
5𝑥
Therefore, we get
𝟐 − 𝟏𝟐 𝟐 − 𝟏.𝟎𝟎𝟒𝟗𝟐
𝒇𝟎 = 𝒇(𝒙𝟎 , 𝒚𝟎 ) = = 0.05, 𝒇𝟏 = 𝒇(𝒙𝟏 , 𝒚𝟏 ) = = 0.0483,
𝟓(𝟒) 𝟓(𝟒.𝟏)
2 − 1.00972 2 − 1.01432
𝑓2 = 𝑓(𝑥2 , 𝑦2 ) = = 0.0467, 𝑓3 = 𝑓(𝑥3 , 𝑦3 ) = = 0.0452
5(4.2) 5(4.3)
ℎ
Hence by Adams – Bashforth predictor formula 𝑦4𝑃 = 𝑦3 + 24 (55𝑓3 − 59𝑓2 + 37𝑓1 − 9𝑓0 ) we get
(𝑝) 0.1
𝑦4 = 1.0143 + (55 × ( 0.0452) − 59 × ( 0.0467) + 37 × ( 0.0483) − 9 × 0.05)
24
= 1.0187
(𝑝) 2 − 1.01872
Now 𝑓4 = = 0.0437
5(4.4)
ℎ
Using Adams – Bashforth corrector formula 𝑦4𝐶 = 𝑦3 + 24 (𝑓1 − 5𝑓2 + 19𝑓3 + 9𝑓4𝑝 ) we get,
(c) 0.1
y4 = 1.0143 + (0.0483 − 5 × (0.0467) + 19 × ( 0.0452) + 9 × (0.0437)) = 1.0187
24
Hence 𝑦(1.4) = 1.0187
Exercises:
dy
1) Given 2 = (1 + x 2 ) y 2 & y(0) = 1, y(0.1) = 1.06, y(0.2) = 1.12, y(0.3) = 1.21. Evaluate
dx
y (0.4) by Milne’s predictor – corrector method.
2) Given y1 = x 2 − y, y(0) = 1 & the starting values y(0.1) = 0.90516, y(0.2) = 0.82127,
y(0.3) = 0.74918. Evaluate y (0.4) using Adams – Bashforth method.
3) By using the Milne’s predictor – corrector method, find an approximate solution of the
dy 2 y
equation = , x 0 at the point x = 2, given that y(1) = 2, y(1.25) = 3.13, y(1.5) = 4.5 &
dx x
y(1.75) = 6.13
y
4) The following table gives the solutions of the differential equation y1 = x 2 + for 1 x 1.3
2
at steps of 0.1. Find y at 1.4 using the Milne’s predictor – corrector method.
6) By employing the Adams – Bashforth predictor – corrector method, find the solution of the
equation y1 = 1 + y 2 at the point x = 0.8, given that y(0) = 0. Take step length h = 0.2.
dy
7) The following table gives the solution of the equation = 1 + xy 2 at specified values of x.
dx
Find the value of y at x = 0.4 using the Adams – Bashforth method.
9) The following table gives the solution of the equation 5xy1 + y 2 − 2 = 0 at specified values of
x. Find the value of y at x = 4.4 using the Milne’s predictor – corrector method.
Video Links:
https://youtu.be/3yGx-_qcdMM
3. Euler's Methods and Second-Order Methods
https://youtu.be/VmIwt7sM1rw
4. Runge - Kutta method of order IV
https://youtu.be/QQFIWwDA9NM
5. Introduction to Predictor-Corrector Methods
https://youtu.be/LNn2qb1dPlI
Disclaimer: The content provided is prepared by department of Mathematics for the specified
syllabus by using reference books mentioned in the syllabus. This material is specifically for the
use of RVITM students and for education purpose only.