0% found this document useful (0 votes)
3 views63 pages

Module - V

The document discusses the numerical solution of ordinary differential equations using Taylor's series and Euler's method. It provides detailed examples of applying Taylor's series to find values of y at specific points based on given differential equations and initial conditions. Additionally, it outlines the Euler method for approximating solutions to differential equations with a specified step size.

Uploaded by

temporary040405
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views63 pages

Module - V

The document discusses the numerical solution of ordinary differential equations using Taylor's series and Euler's method. It provides detailed examples of applying Taylor's series to find values of y at specific points based on given differential equations and initial conditions. Additionally, it outlines the Euler method for approximating solutions to differential equations with a specified step size.

Uploaded by

temporary040405
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Module-V

Numerical Solution of Ordinary Differ-


ential Equations

[Link] Jaison MAT2003 - Applied Numerical Methods November 25, 2025 14 / 76


Taylor’s series Method

dy
Let dx = f (x, y) is a differential equation whose solution is y = f (x) and
y(x0 ) = y0 be initial conditions.
Taylor’s series method:

(x − x0 ) 0 (x − x0 )2 00 (x − x0 )3 000
y = f (x) = y0 + y0 + y0 + y0 + · · ·
1! 2! 3!

[Link] Jaison MAT2003 - Applied Numerical Methods November 25, 2025 15 / 76


Problem 5.1.1
Find by Taylor’s series method the value of y at x = 0.1 and x = 0.2 to five
places of decimal places from
dy
= x2 y − 1, y(0) = 1
dx

Solution:
Given
dy
y0 = = x2 y − 1
dx
y(0) = 1
Also know, y(x0 ) = y0
∴ x0 = 0, y0 = 1
As we know that, Taylor’s method to find y(x) is given by
(x − x0 ) 0 (x − x0 )2 00 (x − x0 )3 000
y = f (x) = y0 + y0 + y0 + y0 + · · · (1)
1! 2! 3!
[Link] Jaison MAT2003 - Applied Numerical Methods November 25, 2025 16 / 76
From the initial condition, x0 = 0, y0 = 1.
Given that
y0 = x 2 y − 1 (2)
At initial,
y00 = x02 y0 − 1
= 02 (1) − 1 = −1
y00 = −1
Find the derivative of equation (2),
y00 = x2 y0 + y.2x − 0 (3)
At initial,
y000 = x02 y00 + y0 2 x0 − 0
= 02 (−1) + 1(2)(0) − 0
y000 = 0

[Link] Jaison MAT2003 - Applied Numerical Methods November 25, 2025 17 / 76


Find the derivative of equation (3),
y000 = x2 y00 + y0 .2x + 2y + 2xy0 (4)
At initial,
y000 2 00 0 0
0 = x0 y0 + y0 .2x0 + 2y0 + 2x0 y0
= (0)2 (0) + (−1).2(0) + 2(1) + 2(0)(−1)
= 0 + 0 + 2(1) + 0 = 2
y000
0 =2
Find the derivative of equation (4),
y0000 = x2 y000 + 2xy00 + 2y0 (1) + 2xy00 + 2y0 + 2(1)y0 + 2xy00
  

y0000 = x2 y000 + 6xy00 + 6y0


At initial,
y0000 2 000 00 0
0 = x0 y0 + 6x0 y0 + 6y0
= (0)2 (2) + 6(0)(0) + 6(−1) = 0 + 0 + 6(−1) = −6
y0000
0 = −6

[Link] Jaison MAT2003 - Applied Numerical Methods November 25, 2025 18 / 76


Substitute these values in the formula at equation (1), we get

(x − 0)2 00 (x − 0)3 000 (x − 0)4 0000


y(x) = y0 + (x − 0)(y00 ) + (y0 ) + y0 + y0
2! 3! 4!
(x − 0)2 (x − 0)3 (x − 0)4
= 1 + (x − 0)(−1) + (0) + (2) + (−6) = 1 −
2! 3! 4!
x3 x4
y(x) = 1 − x + −
3 4
(0.1)3 (0.1)4
y(0.1) = 1 − (0.1) + −
3 4
≈ 0.90030
(0.2)3 (0.2)4
y(0.2) = 1 − (0.2) + −
3 4
≈ 0.80226

[Link] Jaison MAT2003 - Applied Numerical Methods November 25, 2025 19 / 76


Problem 5.1.2
Solve the given equation for y(1.1) using Taylor’s series method.

dy
= 2y + 3ex , y(0) = 0,
dx

Given,
dy
y0 = = 2y + 3ex
dx
y(0) = 0
⇒ y(x0 ) = y0
⇒ x0 = 0, y0 = 0.
From the Taylor’s series, we have
(x − x0 ) 0 (x − x0 )2 00 (x − x0 )3 000
y = f (x) = y0 + y0 + y0 + y0 + · · · (5)
1! 2! 3!

[Link] Jaison MAT2003 - Applied Numerical Methods November 25, 2025 20 / 76


From the initial condition, x0 = 0, y0 = 0.
Given that,

y0 = 2y + 3ex (6)

At initial,

y00 = 2y0 + 3ex0 = 2(0) + 3e0 = 0 + 3(1) = 3


y00 = 3

Find the derivative of equation (6),

y00 = 2y0 + 3ex (7)

At initial,

y000 = 2y00 + 3ex0


= 2(3) + 3e0 = 6 + 3(1)
y000 = 9

[Link] Jaison MAT2003 - Applied Numerical Methods November 25, 2025 21 / 76


Find the derivative of equation (7),

y000 = 2y00 + 3ex (8)

At initial,

y000 00 x0 0
0 = 2y0 + 3e = 2(9) + 3e = 21
y000
0 = 21

Find the derivative of equation (8),

y0000 = 2y000 + 3ex

At initial,

y0000 000 x0
0 = 2y0 + 3e = 2(21) + 3e
0

y0000
0 = 45

[Link] Jaison MAT2003 - Applied Numerical Methods November 25, 2025 22 / 76


Substituting these values in equation (5), we get

(x − x0 ) 0 (x − x0 )2 00 (x − x0 )3 000 (x − x0 )4 0000
y = f (x) = y0 + y0 + y0 + y0 + y0 + · · ·
1! 2! 3! 4!
(x − 0) (x − 0)2 (x − 0)3 (x − 0)4
y(x) = 0 + (3) + (9) + (21) + (45)
1! 2! 3! 4!
x2 x3 x4
y(x) = 3x + (9) + (21) + (45)
2 6 24
(1.1) 2 (1.1)3 (1.1)4
y(1.1) = 3(1.1) + (9) + (21) + (45)
2 6 24
= 3.3 + 5.445 + 4.6585 + 2.7452 = 16.1457

[Link] Jaison MAT2003 - Applied Numerical Methods November 25, 2025 23 / 76


Taylor’s Series Method

Problem 5.1.3
From Taylor’s series method, find y(0.1) considering up to fourth degree term
dy
if y(x) satisfies the equation dx = x − y2 , y(0) = 1.

Taylor’s series expansion is given by


(x − x0 )2 00
y(x) = y0 + (x − x0 )y00 + y0
2!
(x − x0 )3 000 (x − x0 )4 0000
+ y0 + y0 + · · · (9)
3! 4!
From initial condition y(0) = 1, we can conclude x0 = 0 ⇒ y0 = 1.
Given equation can be written as y0 = x − y2 , Therefore, we substitute the
values in (9), we have
(x − 0)2 00
y(x) = 1 + (x − 0)2 y0 (0) + y (0) (10)
2!
(x − 0)3 000 (x − 0)4 0000
+ y (0) + y (0) (11)
3! 4!
[Link] Jaison MAT2003 - Applied Numerical Methods November 25, 2025 24 / 76
Given,
y0 = x − y2 (12)
At initial,
y00 = 0 − 12 = −1
Find the derivative of equation (12)
y00 = 1 − 2yy0 (13)
At initial,
y000 = 1 − 2(1)(−1) = 3
Find the derivative of equation (13)
y000 = 0 − 2 yy00 + (y0 )2
 
(14)
At initial,
y000 2
 
0 = −2 (1)(3) + (−1) = −8

[Link] Jaison MAT2003 - Applied Numerical Methods November 25, 2025 25 / 76


Find the derivative of equation (14)

y0000 = −2 yy000 + y0 y00 + 2y0 y00 = −2 yy00 + 3y0 y00


   
(15)

At initial,

y0000
0 = −2 [(1)(−8) + 3(−1)(3)] = 34

y(x) ⇒ y(0.1) Substitute y0 , y00 , y000 , y00000 in equation (9). Therefore

(0.1)2 (0.1)3 (0.1)4


y(0.1) = 1 + (0.1)(−1) + (3) + (−8) + (34)
2 6 24
y(0.1) = 0.9138

[Link] Jaison MAT2003 - Applied Numerical Methods November 25, 2025 26 / 76


Practice Problem
dy
1 Consider the first order differential equation dx = x + y, with initial con-
dition y(1) = 0. Find y value at x = 1.2.
2 Use Taylor’s series method to approximate y when x = 0.1, convert to 4
dy
decimal places given that dx = 3x + y2 and y = 1 when x = 0 by taking
the first five terms of Taylor’s series expansions.

[Link] Jaison MAT2003 - Applied Numerical Methods November 25, 2025 27 / 76


Euler’s Method

dy
Given y0 = dx = f (x, y) and initial condition y(x0 ) = y0 .
Euler’s method formula

yi+1 = yi + hf (xi , yi )

[Link] Jaison MAT2003 - Applied Numerical Methods November 25, 2025 28 / 76


Problem 5.2.1
dy
Using Euler’s method solve for y at x = 0.1 from dx = x + y + xy, y(0) = 1
taking h = 0.025

Given h = 0.025
x0 = 0
x1 = x0 + h = 0 + 0.025 = 0.025
x2 = x0 + 2h = 0 + 2(0.025) = 0.05
x3 = x0 + 3h = 0 + 3(0.025) = 0.075
x4 = x0 + 4h = 0 + 4(0.025) = 0.1
Given
dy
y0 = = x + y + xy
dx
y(0) = 1 ⇒ y(x0 ) = y0
∴ x0 = 0, y0 = 1
Also given, h = 0.025
[Link] Jaison MAT2003 - Applied Numerical Methods November 25, 2025 29 / 76
Now, we can calculate y1 using Euler formula
yi+1 = yi + hf (xi , yi )

y1 = y0 + hf (x0 , y0 )
y1 = 1 + 0.025 (x0 + y0 + x0 y0 )
y1 = 1 + 0.025 (0 + 1 + 0)
y1 = y(x1 ) = 1 + 0.025
i.e) y(0.025) = 1.025

x1 = 0.025 y1 = 1.025

y2 = y1 + hf (x1 , y1 ) = y1 + h(x1 + y1 + x1 y1 )
y2 = 1.025 + 0.025 (0.025 + 1.025 + 0.025(1.025))
y2 = 1.025 + 0.025 (1.0756)
∴ y(0.05) = y(x2 ) = 1.05189
[Link] Jaison MAT2003 - Applied Numerical Methods November 25, 2025 30 / 76
y3 = y2 + hf (x2 , y2 )
y3 = y2 + h(x2 + y2 + x2 y2 )
y3 = y(x3 ) = 1.05189 + 0.025 (0.05 + 1.05189 + 0.05(1.05189))
∴ y(0.075) = 1.08075

x3 = 0.075, y3 = 1.08075

y4 = y3 + hf (x3 , y3 )
y4 = y3 + h(x3 + y3 + x3 y3 )
y4 = 1.08075 + 0.025 (0.075 + 1.08075 + 0.075(1.08075))
y4 = y(x4 ) = 1.11167

∴ y(0.1) = 1.11167
[Link] Jaison MAT2003 - Applied Numerical Methods November 25, 2025 31 / 76
Example 5.2.2
dy 1
Using Euler’s method solve for y at x = 1 from dx = 2ex + y2 , y(0) = 2 taking
h = 0.25.
Given h = 0.25

x0 = 0
x1 = x0 + h = 0 + 0.25 = 0.25
x2 = x0 + 2h = 0 + 2(0.25) = 0.50
x3 = x0 + 3h = 0 + 3(0.25) = 0.75
x4 = x0 + 4h = 0 + 4(0.25) = 1

Given
dy 1
y0 = = 2ex + y2 y(0) = ⇒ y(x0 ) = y0
dx 2
1
∴ x0 = 0, y0 = Also given, h = 0.25
2

[Link] Jaison MAT2003 - Applied Numerical Methods November 25, 2025 32 / 76


Now, we can calculate y1 using Euler formula
yi+1 = yi + hf (xi , yi )

1
+ 0.25 2ex0 + y20

y1 = y0 + hf (x0 , y0 ) =
2
 2 !
1 1
y1 = + 0.25 2(1) +
2 2
y1 = y(x1 ) = 1.0625
i.e) y(0.25) = 1.0625
So, x1 = 0.25, y1 = 1.0625

y2 = y1 + hf (x1 , y1 ) = y1 + h(2ex1 + y21 )


y2 = 1.0625 + 0.25 2e0.25 + (1.0625)2 = 1.0625 + 0.25 (3.697)


∴ y(0.50) = y(x2 ) = 1.9867


So, x2 = 0.50, y2 = 1.9867
[Link] Jaison MAT2003 - Applied Numerical Methods November 25, 2025 33 / 76
y3 = y2 + hf (x2 , y2 ) = y2 + h(2ex2 + y22 )
y3 = 1.9867 + (0.25)(2e0.50 + 1.98672 ) = 1.9867 + (0.25)(7.2446)
y3 = y(x3 ) = 3.7979
∴ y(0.75) = 3.7979
So, x3 = 0.75, y3 = 3.7979

y4 = y3 + hf (x3 , y3 ) = y3 + h(2ex3 + y23 )


y4 = 3.7979 + (0.25)(2e0.75 + 3.79792 ) = 3.7979 + (0.25)(18.6579)
y4 = 8.4624
y4 = y(x4 ) = 8.4624
∴ y(1) = 8.4624

[Link] Jaison MAT2003 - Applied Numerical Methods November 25, 2025 34 / 76


Modified Euler’s Method

Given
dy
= f (x, y), y(x0 ) = y0
dx
Modified Euler’s formula is given by

(r+1) hh 
(r)
i
yn+1 = yn + f (xn , yn ) + f xn+1 , yn+1
2
where, r = 0, 1, 2, · · · where
(0)
yn+1 = yn + hf (xn , yn ), n = 0, 1, 2, · · · ,

using Euler’s formula.

[Link] Jaison MAT2003 - Applied Numerical Methods November 25, 2025 35 / 76


Example 5.3.1
dy
Using Modified Euler’s method find y(0.2) given that dx = x + y, y(0) = 1.
Correct to 4 decimal places.

Given

f (x, y) = x + y,
x0 = 0, y0 = 1,
x1 = 0.2,
h = x1 − x0 = 0.2 − 0
h = 0.2

[Link] Jaison MAT2003 - Applied Numerical Methods November 25, 2025 36 / 76


Initial approximation
(0)
yn+1 = yn + hf (xn , yn )

Put n = 0
(0)
y1 = y0 + hf (x0 , y0 )
= 1 + 0.2(0 + 1)
(0)
y1 = 1.2

Modified Euler formula is


(r+1) hh (r)
i
yn+1 = yn + f (xn , yn ) + f (xn+1 , yn+1 ) (16)
2

[Link] Jaison MAT2003 - Applied Numerical Methods November 25, 2025 37 / 76


First approximation:
Put r = 0 and n = 0 in equation (16)
(1) hh (0)
i
y1 = y0 + f (x0 , y0 ) + f (x1 , y1 )
2
0.2 h (0)
i
=1+ (x0 + y0 ) + (x1 + y1 )
2
0.2
=1+ [(0 + 1) + (0.2 + 1.2)]
2
(1)
y1 = 1.24
Second Approximation
Put r = 1, n = 0 in equation (16)
(2) hh (1)
i
y1 = y0 + f (x0 , y0 ) + f (x1 , y1 )
2
0.2
=1+ [(0 + 1) + (0.2 + 1.24)]
2
(2)
y1 = 1.244

[Link] Jaison MAT2003 - Applied Numerical Methods November 25, 2025 38 / 76


Third approximation:
Put r = 2, n = 0 in equation (16)
(3) hh (2)
i
y1 = y0 + f (x0 , y0 ) + f (x1 , y1 )
2
0.2
=1+ [(0 + 1) + (0.2 + 1.244)]
2
(3)
y1 = 1.2444
Fourth Approximation
Put r = 3, n = 0 in equation (16)
(4) hh (3)
i
y1 = y0 + f (x0 , y0 ) + f (x1 , y1 )
2
0.2
=1+ [(0 + 1) + (0.2 + 1.2444)]
2
(4)
y1 = 1.24444
(3) (4)
Since, y1 and y1 are the same at corrected to four decimal places.
y1 = y(x1 ) = y(0.2) = 1.2444

[Link] Jaison MAT2003 - Applied Numerical Methods November 25, 2025 39 / 76


Practice question

Example 5.3.2
Use Modified Euler’s Method to find the approximate value of y(1.1) for the
dy
solution of the initial value problem dx = 2xy, y(1) = 1 correct to 3 decimal
places, perform 2 iterations.

f (x, y) = 2xy
x0 =, y0 = 1, x1 = 1.1
h = x1 − x0 = 1.1 − 1 = 0.1
y(1.1) = 1.2355

[Link] Jaison MAT2003 - Applied Numerical Methods November 25, 2025 40 / 76


Example 5.3.3
dy 2y
Find y(1.2) and y(1.4) by modified Euler’s method given that dx = x + x3 ,
y(1) = 0.5 correct to 3 decimal places.
2y
Given f (x, y) = x + x3

x0 = 1, y0 = 0.5,
and x1 = 1.2, x2 = 1.4

x0 = 1 x1 = x0 + h = 1.2 x2 = x0 + 2h = 1.4
y0 = 0.5 h = x1 − x0 = 0.2 h = x2 −x
2
0
= 0.2

[Link] Jaison MAT2003 - Applied Numerical Methods November 25, 2025 41 / 76


(i). To find y(1.2)

h = x1 − x0 = 1.2 − 1 = 0.2

Modified Euler’s formula is given by

(r+1) hh 
(r)
i
yn+1 = yn + f (xn , yn ) + f xn+1 , yn+1 (17)
2
where,
(0)
yn+1 = yn + hf (xn , yn ) (18)

[Link] Jaison MAT2003 - Applied Numerical Methods November 25, 2025 42 / 76


Step:1
To find y1 = y(x1 ) = y(1.2)
Put n = 0 in equation (17) and (18)

(r+1) hh (r)
i
y1 = y0 + f (x0 , y0 ) + f (x1 , y1 ) (19)
2
(0)
where y1 = y0 + hf (x0 , y0 ) (20)

Initial approximation from equation (20)


 
(0) 2y0 3
y1 = 0.5 + 0.2 + (x0 )
x0
 
(2)(0.5) 3
= 0.5 + 0.2 + (1)
1
(0)
y1 = 0.9

[Link] Jaison MAT2003 - Applied Numerical Methods November 25, 2025 43 / 76


First Approximation, put r = 0 in equation (19)

(1) hh (0)
i
y1 = y0 + f (x0 , y0 ) + f (x1 , y1 )
2 " !#
  (0)
0.2 2y0 2y
= 0.5 + + (x0 )3 + 1
+ (x1 )3
2 x0 x1
(1)
y1 = 1.0227

Second Approximations, put r = 1 in equation (19)

(2) hh (1)
i
y1 = y0 + f (x0 , y0 ) + f (x1 , y1 )
2 " !#
  (1)
0.2 2y0 3 2y1 3
= 0.5 + + (x0 ) + + (x1 )
2 x0 x1
(2)
y1 = 1.043

[Link] Jaison MAT2003 - Applied Numerical Methods November 25, 2025 44 / 76


(3) (4)
Similarly, y1 = 1.046 and y1 = 1.046.
(3) (4)
Since y1 and y1 are the same correct to 4 decimal places

y(1.2) = 1.046 (21)

[Link] Jaison MAT2003 - Applied Numerical Methods November 25, 2025 45 / 76


Step: To find y2 = y(x2 ) = y(1.4)
Put n = 1 in equations (17) and (18)

(r+1) hh (r)
i
y2 = y1 + f (x1 , y1 ) + f (x2 , y2 ) (22)
2
(0)
y2 = y1 + h(x1 , y1 ) (23)

Initial Approximation from equation 23


 
(0) 2y1 3
y2 = 1.046 + 0.2 + (x1 )
x1
 
2(1.046) 3
= 1.046 + 0.2 + (1.2)
1.2
(0)
y2 = 1.740

[Link] Jaison MAT2003 - Applied Numerical Methods November 25, 2025 46 / 76


First Approximation
Put r = 0 in equation (22)

(1) hh (0)
i
y2 = y1 + f (x1 , y1 ) + f (x2 , y2 )
2  
0.2 2(1.046) 3 2(1.74) 3
= 1.046 + + (1.2) + + (1.4)
2 1.2 1.4
(1)
y2 = 1.916.

Similarly,
(2) (3)
y2 = 1.941, y2 = 1.944
(4) (5)
y2 = 1.945, y2 = 1.945

(4) (5)
Since, y2 and y2 are the same correct to the decimal places

y(1.4) = 1.945

[Link] Jaison MAT2003 - Applied Numerical Methods November 25, 2025 47 / 76


Runge-kutta method of 4th order

Given
dy
= f (x, y), y(x0 ) = y0
dx
The Runge-kutta method of 4th order is given by
1
yn+1 = yn + [k1 + 2k2 + 2k3 + k4 ]
6
where
k1 = hf (xn , yn )
 
h k1
k2 = hf xn + , yn +
2 2
 
h k2
k3 = hf xn + , yn +
2 2
k4 = hf (xn + h, yn + k3 )

[Link] Jaison MAT2003 - Applied Numerical Methods November 25, 2025 48 / 76


Runge-Kutta Method

Example 5.4.1
Apply Runge Kutta Method of fourth order to find an approximate value of
dy
y(0.1) and y(0.2) of dx = x + y2 , y(0) = 1, correct to three decimal places.

[Link] Jaison MAT2003 - Applied Numerical Methods November 25, 2025 49 / 76


Given f (x, y) = x + y2
x0 = 0, y0 = 1
x1 = 0.1, x2 = 0.2

h = x1 − x0 = 0.1 − 0 = 0.1
We have to calculate y1 and y2 .
The Runge-Kutta method of 4th order is given by
1
yn+1 = yn + [k1 + 2k2 + 2k3 + k4 ] ,
6
where,
k1 = hf (xn , yn )
h k1
k2 = hf (xn + , yn + )
 2 2 
h k2
k3 = hf xn + , yn +
2 2
k4 = hf (xn + h, yn + k3 ) (24)
[Link] Jaison MAT2003 - Applied Numerical Methods November 25, 2025 50 / 76
Step 1: Finding y(0.1) i.e. y1
Put n = 0 in equation (24)
1
y1 = y0 + [k1 + 2k2 + 2k3 + k4 ] (25)
6
where
k1 = hf (x0 , y0 ) = h x0 + (y0 )2
 

= 0.1 0 + (1)2
 

k1 = 0.1
 
h k1
k2 = hf x0 + , y0 +
2 2
"  #
k1 2
 
h
k2 = h x0 + + y0 +
2 2
"  #
0.1 2
 
0.1
= 0.1 0 + + 1+
2 2
k2 = 0.1152

[Link] Jaison MAT2003 - Applied Numerical Methods November 25, 2025 51 / 76


 
h k2
k3 = hf x0 + , y0 +
2 2
"  #
k2 2
 
h
= h x0 + + y0 +
2 2
"  #
0.1152 2
 
0.1
= 0.1 0 + + 1+
2 2
k3 = 0.1168

k4 = hf (x0 + h, y0 + k3 )
= h (x0 + h) + (y0 + k3 )2
 

= 0.1 (0 + 0.1) + (1 + 0.1168)2


 

k4 = 0.1347

[Link] Jaison MAT2003 - Applied Numerical Methods November 25, 2025 52 / 76


Substitute y0 , k1 , k2 , k3 and k4 in equation (25), we get
1
y1 = 1 + [0.1 + 2(0.1152) + 2(0.1168) + 0.1347]
6
y1 = 1.1164
i.e., y(0.1) = 1.1164
Step 2: Finding y(0.2) i.e., y2
Put n = 1 in equation (24), we get
1
y2 = y1 + [k1 + 2k2 + 2k3 + k4 ]
6
where,
k1 = hf (x1 , y1 )
k1 = 0.1 x1 + y21
 

= 0.1 0.1 + (1.1164)2


 

k1 = 0.1346

[Link] Jaison MAT2003 - Applied Numerical Methods November 25, 2025 53 / 76


 
h k1
k2 = hf x1 + , y1 +
2 2
"  #
k1 2
 
h
= h x1 + + y1 +
2 2
"  #
0.1346 2
 
0.1
= 0.1 0.1 + + 1.1164 +
2 2
k2 = 0.1551

 
h k2
k3 = hf x1 + , y1 +
2 2
"  #
k2 2
 
h
= h x1 + + y1 +
2 2
"  #
0.1551 2
 
0.1
= 0.1 0.1 + + 1.1164 +
2 2
k = 0.1575
[Link] Jaison
3 MAT2003 - Applied Numerical Methods November 25, 2025 54 / 76
k4 = hf [x1 + h, y1 + k3 ]
= h (x1 + h) + (y1 + k3 )2
 

= 0.1 (0.1 + 0.1) + (1.1164 + 0.1575)2


 

k4 = 0.1822

Substituting y1 , k1 , k2 , k3 and k4 in equation (24), we get

1
y2 = 1.1164 + [0.1346 + 2(0.1575) + 0.1822]
6
y2 = 1.2734
i.e., y(0.2) = 1.2734.

[Link] Jaison MAT2003 - Applied Numerical Methods November 25, 2025 55 / 76


Example 5.4.2
Use Runge-kutta method of fourth order to approximate y when x = 0.1, given
dy
that y = 1 when x = 0, dx = x + y, correct to 4 decimal places.

[Link] Jaison MAT2003 - Applied Numerical Methods November 25, 2025 56 / 76


Given,

f (x, y) = x + y
x0 = 0, y0 = 1, x1 = 0.1
h = x1 − x0 = 0.1 − 0 = 0.1
y1 =? ⇒ y(0.1) =?

The Runga-Kutta method of 4th order is given by


1
yn+1 = yn + [k1 + 2k2 + 2k3 + k4 ] (26)
6
where k1 = hf (xn , yn ) (27)
 
h k1
k2 = hf xn + , yn + (28)
2 2
 
h k2
k3 = hf xn + , yn +
2 2
k4 = hf (xn + h, yn + k3 ) (29)

[Link] Jaison MAT2003 - Applied Numerical Methods November 25, 2025 57 / 76


Put n = 0 in equation (26)

1
y1 = y0 + [k1 + 2k2 + 2k3 + k4 ]
6
where,

k1 = hf (x0 , y0 )
 
h k1
k2 = hf x0 + , y0 +
2 2
 
h k2
k3 = hf x0 + , y0 + (30)
2 2
k4 = hf (x0 + h, y0 + k3 )

[Link] Jaison MAT2003 - Applied Numerical Methods November 25, 2025 58 / 76


∴ k1 = 0.1 [x0 + y0 ]
= 0.1 [0 + 1] = 0.1
   
h k1
k2 = 0.1 x0 + + y0 +
2 2
   
0.1 0.1
= 0.1 0 + + 1+
2 2
k2 = 0.11
   
h k2
k3 = 0.1 x0 + + y0 +
2 2
   
0.1 0.11
= 0.1 0 + + 1+
2 2
k3 = 0.1105
k4 = 0.1 [(x0 + h) + (y0 + k3 )]
= 0.1 [(0 + 0.1) + (1 + 0.1105)]
k4 = 0.1210
[Link] Jaison MAT2003 - Applied Numerical Methods November 25, 2025 59 / 76
k1 = 0.1, k2 = 0.11, k3 = 0.1105, k4 = 0.1210, y0 = 1.
Substitute all the values in equation (30), we get

1
y1 = 1 + [0.1 + 2(0.11) + 2(0.1105) + 0.1210]
6
y1 = 1.1103
i.e. y(0.1) = 1.1103

[Link] Jaison MAT2003 - Applied Numerical Methods November 25, 2025 60 / 76


Practice Problem

Example 5.4.3
Use Runge-kutta method of fourth order to obtain an approximation to y(1.5)
dy
for the solution of dx = 2xy, y(1) = 1, correct to 4 decimal places.

Hint:

f (x, y) = 2xy, x0 = 1, y0 = 1
x1 = 1.5
h = x1 − x0 = 1.5 − 1 = 0.5
y1 = 3.4543

[Link] Jaison MAT2003 - Applied Numerical Methods November 25, 2025 61 / 76


Adams- Bashforth Predictor-corrector method

Given
dy
= f (x, y), y(x0 ) = y0
dx
Adams- Bashforth’s predictor and corrector formula is given by
4h
y4,p = y0 + (2f1 − f2 + 2f3 ) (Predictor Formula) (31)
3
(r+1) h (r)

y4,c = y2 + f2 + 4f3 + f4 (Corrector Formula) (32)
3
where
f1 = f (x1 , y1 ), f2 = f (x2 , y2 ), f3 = f (x3 , y3 )
(r) (r) (0) (0)
f4 = f (x4 , y4 ), f4 = f (x4 , y4 )
where
(0) (r) (r)
y4 = y4,p , for r = 0, y4 = y4,c , for r 6= 0.

[Link] Jaison MAT2003 - Applied Numerical Methods November 25, 2025 62 / 76


Example 5.5.1
dy
Solve the initial value problem dx = 1 + xy2 , y(0) = 1 for x = 0.4 by Milne’s
predictor and corrector method correct to three decimal places, given that

x 0.1 0.2 0.3


y 1.105 1.223 1.355

[Link] Jaison MAT2003 - Applied Numerical Methods November 25, 2025 63 / 76


Given f (x, y) = 1 + xy2 , h = x2 − x1 = 0.1
x0 = 0 x1 = 0.1 x2 = 0.2 x3 = 0.3 x4 = 0.4
y0 = 1 y1 = 1.105 y2 = 1.223 y3 = 1.355 y4 =?
Milne’s predictor formula is given by
4h
y4,p = y0 + (2f1 − f2 + 2f3 ) (33)
3

xi yi fi = f (xi , yi ) = 1 + xi y2i
f1 = 1 + x1 y21
x1 =0.1 y1 =1.105 =1+(0.1)(1.105)2
=1.122
f2 = 1 + x2 y22
x2 =0.2 y2 =1.223 =1+(0.2)(1.223)2
=1.299
f3 = 1 + x3 y23
x3 =0.3 y3 =1.355 =1+(0.3)(1.355)2
=1.550
[Link] Jaison MAT2003 - Applied Numerical Methods November 25, 2025 64 / 76
Substituting all the values in equation (33) we get,
 
4(0.1)
y4,p = 1 + [2(1.122) − 1.299 + 2(1.550)]
3
y4,p = 1.526

Milne’s corrector formula is given by


 
(r+1) h (r)

y4,c = y2 + f2 + 4f3 + f4 (34)
3

where
(r) (r)
f4 = f (x4 , y4 )
(0)
y4 = y4,p , r = 0
(r) (r)
y4 = y4,c , r 6= 0.

[Link] Jaison MAT2003 - Applied Numerical Methods November 25, 2025 65 / 76


First improvement:

Put r = 0 in equation (34)


 
(1) h (0)

y4,c = y2 + f2 + 4f3 + f4
3

where
(0) (0)
f4 = f (x4 , y4 ) = f (x4 , y4,p )
= 1 + x4 (y4,p )2
(0)
f4 = 1 + (0.4)(1.526)2 = 1.931
 
(1) 0.1
∴ y4,c = 1.223 + (1.299 + 4(1.550) + 1.931)
3
(1)
y4,c = 1.537

[Link] Jaison MAT2003 - Applied Numerical Methods November 25, 2025 66 / 76


Second improvement:

Put r = 1 in equation (34)


 
(2) h (1)

y4,c = y2 + f2 + 4f3 + f4
3
where
 
(1) (1)
f4 = f x4 , y4
 2
(1)
= 1 + x4 y4,c
= 1 + (0.4)(1.537)2
(1)
f4 = 1.944
 
(2) 0.1
∴ y4,c = 1.223 + (1.299 + 4(1.550 + 1.944))
3
(2)
y4,c = 1.537
(1) (2)
Since, y4,c and y4,c are the same up to three decimal places
y(0.4) = 1.537
[Link] Jaison MAT2003 - Applied Numerical Methods November 25, 2025 67 / 76
Example 5.5.2
dy
Solve the initial value problem dx = x+y2 , y(0) = 2 for x = 2 by Milne’s
predictor and corrector method correct to three decimal places, given that

x 0.5 1 1.5
y 2.636 3.595 4.968

Sol: y(2) = 6.8732

Example 5.5.3
2 2
dy
Solve the initial value problem dx = (1+x2 )y , y(0) = 1 for x = 0.4 by Milne’s
predictor and corrector method correct to three decimal places, given that

x 0.1 0.2 0.3


y 1.06 1.12 1.21

Sol: y(2) = 1.2797


[Link] Jaison MAT2003 - Applied Numerical Methods November 25, 2025 68 / 76
T(0, y) = 100◦ C (Left edge)

T(4, y) = 100 C (Right edge)

T(x, 0) = 0 C (Bottom edge)

T(x, 4) = 0 C (Top edge)

[Link] Jaison MAT2003 - Applied Numerical Methods November 25, 2025 69 / 76


Explicit method - Bender-Schmidt method

Bender-Schmidt method is used to solve the heat equation and similar partial
equations.
The general equation of heat equation is
(
∂2u ∂u x → indicate distance
2
−a = 0; where
∂x ∂t y → indicate time

General formula of Bender-Schmidt explicit method is


1
ui,j+1 = [ui−1,j + ui+1,j ]
2

k
assume λ = 21
 
1 λ= ah2
2 uxx = aut
3 h = ∆x and k = ∆t

[Link] Jaison MAT2003 - Applied Numerical Methods November 25, 2025 70 / 76


Example 5.6.1
2
Solve ∂∂xu2 = 2 ∂u∂t given u(0, t) = 0, u(4, t) = 0, u(x, 0) = x(4 − x), taking
∆x = 1 and ∆t = 1. Find the value of u upto t = 5 using Bender-Schmidt’s
explicit finite difference Scheme.

Given:
uxx = 2ut ⇒ a=2
h = ∆x = 1 and k = ∆t = 1
k 1 1
λ= 2 ⇒ λ= 2
=
ah 2(1) 2
x varies from 0 to 4 with h = 1.
x: 0 1 2 3 4
i: 0 1 2 3 4
Find the value of u upto t = 5 with k = ∆(t) = 1.
t: 0 1 2 3 4 5
j: 0 1 2 3 4 5
[Link] Jaison MAT2003 - Applied Numerical Methods November 25, 2025 71 / 76
Using the boundary conditions u(0, t) = 0 and u(4, t) = 0, we can find

u(0, t) = 0 ⇒ u0,j = 0 First Column


u(4, t) = 0 ⇒ u4,j = 0 Last Column

Using initial condition u(x, 0) = x(4−x), we can find first row value as follows,

u(0, 0) = 0
u(1, 0) = 1(4 − 1) = 3
u(2, 0) = 2(4 − 2) = 4
u(3, 0) = 3(4 − 3) = 3
u(4, 0) = 4(4 − 4) = 0

General formula of Bender-Schmidt explicit method is


1
ui,j+1 = [ui−1,j + ui+1,j ]
2

[Link] Jaison MAT2003 - Applied Numerical Methods November 25, 2025 72 / 76


The values of ui,j are tabulated below:
x=0 x=1 x=2 x=3 x=4
i
0 1 2 3 4
j
t=0 0 0 3 4 3 0
t=1 1 0 0
t=2 2 0 0
t=3 3 0 0
t=4 4 0 0
t=5 5 0 0

x=0 x=1 x=2 x=3 x=4


i
0 1 2 3 4
j
t=0 0 0 3 4 3 0
t=1 1 0 2 3 2 0
t=2 2 0 1.5 2 1.5 0
t=3 3 0 1 1.5 1 0
t=4 4 0 0.75 1 0.75 0
t=5 5 0 0.5 0.75 0.50 0
[Link] Jaison MAT2003 - Applied Numerical Methods November 25, 2025 73 / 76
Example 5.6.2
2
Solve ∂∂xu2 = ∂u 2 2
∂t given u(0, t) = 0, u(5, t) = 0, u(x, 0) = x (25 − x ). Compute
u(x, t) upto t = 5 with ∆x = 1 using Benders-Schmidt’s method.

Ans: Since λ value is not given, let us take λ = 12 .


Given:
uxx = ut ⇒ a=1
Since, h = ∆x = 1
k k 1
=λ ⇒ = ⇒ k = ∆(t) = 0.5
ah2 1(1) 2 2
Using the boundary conditions
u(0, t) = 0 ⇒ u0,j = 0 First Column
u(5, t) = 0 ⇒ u5,j = 0 Last Column
x varies from 0 to 5 with h = 1.
x: 0 1 2 3 4 5
i: 0 1 2 3 4 5
[Link] Jaison MAT2003 - Applied Numerical Methods November 25, 2025 74 / 76
Find the value of u upto t = 5 with k = ∆(t) = 0.5.
t: 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
j: 0 1 2 3 4 5 6 7 8 9 10
Next,
u(x, 0) = x2 (25 − x2 )
The value of first row is given by,
u(0, 0) = 02 (25 − 02 ) = 0
u(1, 0) = 12 (25 − 12 ) = 24
u(2, 0) = 22 (25 − 22 ) = 84
u(3, 0) = 32 (25 − 32 ) = 144
u(4, 0) = 42 (25 − 42 ) = 144
u(5, 0) = 52 (25 − 52 ) = 0
General formula of Bender-Schmidt explicit method is
1
ui,j+1 = [ui−1,j + ui+1,j ]
2
[Link] Jaison MAT2003 - Applied Numerical Methods November 25, 2025 75 / 76
The values of ui,j are tabulated below:

x=0 x=1 x=2 x=3 x=4 x=5


i
0 1 2 3 4 5
j
t=0 0 0 24 84 144 144 0
t = 0.5 1 0 42 84 114 72 0
t=1 2 0 42 78 78 57 0
t = 1.5 3 0 39 60 67.5 39 0
t=2 4 0 30 53.25 49.5 33.75 0
t = 2.5 5 0 26.625 39.75 43.5 24.75 0
t=3 6 0 19.875 35.0625 37.25 21.75 0
t = 3.5 7 0 17.5313 26.0625 28.4063 16.125 0
t=4 8 0 13.0313 22.9688 21.0938 14.2031 0
t = 4.5 9 0 11.4844 17.0625 18.5859 10.5469 0
t=5 10 0 8.5313 15.0351 13.8047 9.2930 0

[Link] Jaison MAT2003 - Applied Numerical Methods November 25, 2025 76 / 76

You might also like