ASSIGNMENT
SUBMITTED TO:
Mam Gul Sana
SUBMITTED BY:
Group8
Anam Shehnaz (08) Aresha Abid (13)
Momina javed (50) Nasira Batool (51)
Tehreem Fatima (60) Zunaira Ilyas (65)
Ifra Safdar (27)
COURSE TITLE:
Numerical Analysis II
COURSE CODE:
MTH - 462
TOPIC:
Higher Order Runge Kutta Method
DEPARTMENT:
BS Mathematics
Govt College Women University Faisalabad
1
Higher Order Runge Kutta Method
The Higher Order Runge Kutta Method is a numerical technique used to solve
ordinary differential equation .It extends the basic Runge-Kutta Method, which
is widely used for approximating solutions to ODEs. The key idea behind these
method is to use multiple function at different points to achieve a more accurate
estimate of the solution. They improve upon the accuracy of the basic Euler
Method by incorporating multiple evaluations of the derivative within each step.
Instead of using only the slop at the beginning of the interval, higher order
method uses slopes at intermediate points to better capture the curvature of the
solution. This leads to smaller truncation errors and more accurate
approximations, especially for problems with rapidly changing solutions.
The most commonly used higher order Runge-Kutta Method are 3 rd order
Runge-Kutta Method and 4th order Runge-Kutta Method.
3rd Order Runge-Kutta Method (RK3)
Formula
yn+1 = yn + K
1
where K= 6 (k1 + 4k2 + k3 ) , k1 = h f (xn , yn )
h k1
k2 = h f (xn + 2 , yn + 2 ) , k3 = h f (xn +h, yn +2k2 – k1)
2
Question:-Apply Runge Kutta Method to solve the initial value problem
dy
=3 x+¿ y2,y(0) = 1 , and find the value of y at x = 0.1
dx
Solution:- f (x,y) = x + y , y(0) = 1 ⇒ x0 = 0 , y0 = 1 , h = 0.1
k1 = h f (x0 , y0 ) = 0.1 f (0,1 ) = 0.1 (0+1) = 0.1
h k1 0.1 0.1
k2 = h f (x0 + 2 , y0 + 2 ) = 0.1 f (0 + 2 , 1 + 2 ) = 0.1 f ( 0 +0.05 ,1 + 0.05)
= 0.1 f ( 0.05 , 1.05) = 0.1 (0.15 + 1.1025 ) = 0.1(1.2525) = 0.12525
k3 = h f (x0 +h, y0 +2k2 – k1) = 0.1 f [ 0 +0.1 ,1 + 2(0.12525) – 0.1]
= 0.1 f [ 0.1 ,1 + 0.2505 – 0.1] = 0.1 f [ 0.1 ,1.1505] =0.1 [3(0.1) + (1.1505 ) 2 ]
= 0.1 (0.3 + 1.3237 ) = 0.1 (1.6237 ) = 0.16237
1 1
K= 6 (k1 + 4k2 + k3 ) = 6 [0.1 + 4(0.12525) + 0.16237]
= 0.167 (0.1 + 0.501 + 0.16237) = 0.167 (0.76337) = 0.127
y1 = y0 + K = 1 + 0.127 = 1.127
⇒ y(0.1) = 1.127
4th Order Runge-Kutta Method (RK4)
Formula
3
yn+1 = yn + K
1
where K= 6 (k1 + 2k2 +2k3 + k4 )
h k1
and k1 = h f (xn , yn ) , k 2 = h f (xn + 2 , yn + 2)
h k2
k3 = h f (xn + 2 , yn + 2 ) , k4 = h f (xn +h, yn +k3)
Question:-Apply Runge Kutta Method to solve the initial value problem
dy
=x+ y , y(0) = 1 , and find the value of y at x = 0.2 taking h = 0.1
dx
Solution:- f (x,y) = x + y , y(0) = 1 ⇒ x0 = 0 , y0 = 1 , h = 0.1
k1 = h f (x0 , y0 ) = 0.1 f (0,1 ) = 0.1 (0+1) = 0.1
h k1 0.1 0.1
k2 = h f (x0 + 2 , y0 + 2 ) = 0.1 f (0 + 2 , 1 + 2 ) = 0.1 f ( 0 +0.05 ,1 + 0.05)
= 0.1 f ( 0.05 , 1.05) = 0.1 (0.05 + 1.05 ) = 0.1(1.1) = 0.11
h k2 0.1 0.11
k3 = h f (x0 + 2 , y0 + 2 ) = 0.1 f (0 + 2 , 1 + 2 ) = 0.1 f ( 0 +0.05 ,1 +
0.055) =0.1 f ( 0.05 , 1.055) = 0.1 (0.05 + 1.055 ) = 0.1(1.105) = 0.1105
k4 = h f (x0 +h, y0 +k3) = 0.1 f (0 +0.1, 1 +0.1105) = 0.1 f (0.1, 1.1105)
= 0.1 (0.1 + 1.1105 ) = 0.1(1.2105) = 0.12105
1 1
K= 6 (k1 + 2k2 + 2k3 + k4) = 6 [0.1 + 2(0.11) + 2(0.1105) + 0.12105]
= 0.167 (0.1 + 0.22 + 0.221+ 0.12105) = 0.167 (0.66205) = 0.1105
y1 = y0 + K = 1 + 0.1105 = 1.1105
we have
x0 = 0 ⇒ x1 = x0 + h = 0 + 0.1 = 0.1
x2 = x1 + h = 0.1 + 0.1 = 0.2
k1 = h f (x1 , y1 ) = 0.1 f (0.1,1.1105 ) = 0.1 (0.1+1.1105)
= 0.1(1.2105) =0.12105
4
h k1 0.1 0.12105
k2 = h f (x1 + 2 , y1 + 2 ) = 0.1 f (0.1 + 2 , 1.1105 + 2
)
= 0.1 f ( 0.1 +0.05 ,1.1105 + 0.0605)
= 0.1 f ( 0.15 , 1.171) = 0.1 (0.15 + 1.171 ) = 0.1(1.321) = 0.1321
h k2 0.1 0.1321
k3 = h f (x1 + 2 , y1 + 2 ) = 0.1 f (0.1 + 2 , 1.1105 + 2
)
= 0.1 f ( 0.1 +0.05 ,1.1105 + 0.06605) =0.1 f ( 0.15 , 1.17655)
= 0.1 (0.15 + 1.17655 ) = 0.1(1.32655) = 0.132655
k4 = h f (x1 +h, y1 +k3) = 0.1 f (0.1 +0.1, 1.1105 +0.132655)
= 0.1 f (0.2, 1.243155)
= 0.1 (0.2 + 1.243155 ) = 0.1(1.443155) = 0.1443155
1
K= 6 (k1 + 2k2 + 2k3 + k4)
1
= 6 [0.12105 + 2(0.1321) + 2(0.132655) + 0.1443155]
= 0.167 (0.12105 + 0.2642 + 0.26531+ 0.1443155) = 0.167 (0.7949) = 0.13275
y2 = y1 + K = 1.1105 + 0.13275 = 1.24325
⇒ y(0.2) = 1.24325
5th Order Runge-Kutta Method (RK5)
Formula
h
yn+1 = yn + 90 (7k1 + 32k3 + 12k4+32k5 + 7k6 )
where
k1 = f (xn , yn )
1 1
k2 = f (xn + 4 h , yn + 4 k1h )
1 1 1
k3 = f (xn + 4 h , yn + 8 k1h+ 8 k2h )
5
1 1
k4 = f (xn + 2 h , yn - - 2 k2h+ k3h )
3 3 9
k5 = f (xn + 4 h , yn + 16 k1h+ 16 k4h )
3 2 12 12 8
k6 = f (xn + h , yn - 7 k1h+ 7 k2h + 7 k3h - 7 k4h + 7 k5h )
Question:-Apply fifth order Runge Kutta Method to solve the initial value
problem
dy
=x+ y , y(0) = 1 , and find the value of y at x = 0.2 taking h = 0.2
dx
Solution:- f (x,y) = y +2x-x2 , y(0) = 1 ⇒ x0 = 0 , y0 = 1 , h = 0.2
6
k1 = f (x0 , y0 ) = f (0 , 1 ) = 1+2(0)-(0)2 = 1+0-0 =1
1 1 1 1
k2 = f (x0 + 4 h , y0 + 4 k1h ) = f [0 + 4 (0.2) , 1 + 4 (1)(0.2) ]
= f [0 + 0.05 , 1 +0.05 ] = f (0.05 , 1.05 ) = 1.05+2(0.05)-(0.05)2
= 1.05 + 0.1- 0.0025 = 1.125
1 1 1
k3 = f (x0 + 4 h , y0 + 8 k1h+ 8 k2h )
1 1 1
= f [0+ 4 (0.2) , 1 + 8 (1)(0.2)+ 8 (1.125)(0.2) ]
= f [0 + 0.05 , 1 +0.025+0.0281 ] = f (0.05 , 1.0531 ) = 1.0531+2(0.05)-(0.05)2
= 1.0531 + 0.1- 0.0025 = 1.1506
1 1
k4 = f (x0 + 2 h , y0 - - 2 k2h+ k3h )
1 1
= f [0 + 2 (0.2) , 1 - - 2 (1.125)(0.2)+ (1.1506)(0.2) ]
= f [0 + 0.1 , 1 -0.1125+0.23 ]
= f (0.1 , 1.1175 )
= 1.1175+2(0.1)-(0.1)2
= 1.1175 + 0.2- 0.01
= 1.3075
3 3 9
k5 = f (x0 + 4 h , y0 + 16 k1h+ 16 k4h )
3 3 9
= f [0 + 4 (0.2) , 1 + 16 (1)(0.2)+ 16 (1.3075)(0.2) ]
= f [0 + 0.15 , 1 + 0.0375+0.147 ]
= f (0.15 , 1.1845 )
= 1.1845+2(0.15)-(0.15)2
= 1.1845 + 0.3- 0.01
7
= 1.4745
3 2 12 12 8
k6 = f (x0 + h , y0 - 7 k1h+ 7 k2h + 7 k3h - 7 k4h + 7 k5h )
3 2 12
= f [0+0.2 , 1 - 7 (1)(0.2) + 7 (1.125)(0.2) + 7 (1.1506)(0.2)
12 8
- 7 (1.3075)(0.2) + 7 (1.4745)(0.2) ]
= f [0.2 , 1 - 0.086+0.064+0.3944-0.448+0.337 ]
= f (0.2 , 1.2614 ) = 1.2614+2(0.2)-(0.2)2
= 1.2614+ 0.4- 0.04 = 1.6214
h
Thus ,y1 = y0 + 90 (7k1 + 32k3 + 12k4+32k5 + 7k6 )
0.2
= 1 + 90 [7(1) + 32(1.1506) + 12(1.3075)+32(1.4745) + 7(1.6214) ]
= 1 + 0.00222 [7 + 36.8192 + 15.69+47.184 + 11.3498 ]
⇒ y(0.2) = 1.262
= 1 + 0.00222(118.043) = 1 + 0.262 = 1.262
6th Order Runge-Kutta Method (RK6)
Formula
11k 1+ 81 k 3+81 k 4−32 k 5−32 k 6+11 k 7
yn+1 = yn + 120
where
k1 = h f (xn , yn )
1 1
k2 = h f (xn + 3 h , yn + 3 k1 )
2 2
k3 = h f (xn + 3 h , yn + 3 k2 )
1 k 1+ 4 k 2−k 3
k4 = h f (xn + 3 h , yn + - 12
)
1 −k 1+18 k 2−3 k 3−6 k 4
k5 = h f (xn + 2 h , yn + 16
)
8
1 9 k 2−3 k 3−6 k 4 +4 k 5
k6 = h f (xn + 2 h , yn + 8
)
9 k 1−36 k 2+63 k 3+72 k 4−64 k 5
k7 = h f (xn + h , yn + 44
)
7th Order Runge-Kutta Method (RK7)
Formula
41 k 1+216 k 4 +27 k 5+272 k 6+27 k 7 +216 k 8+ 41 k 9
yn+1 = yn + 840
where
k1 = h f (xn , yn )
1 1
k2 = h f (xn + 12 h , yn + 12 k1 )
1 −10 k 1+ 11k 2
k3 = h f (xn + 12 h , yn + - 12
)
2 2
k4 = h f (xn + 12 h , yn + 12 k3 )
4 157 k 1−318 k 2+4 k 3+160 k 4
k5 = h f (xn + 12 h , yn + 9
)
9
6 −322 k 1+199 k 2+108 k 3−131 k 5
k6 = h f (xn + 12 h , yn + 30
)
8 3158 k 1 638 k 2 23 k 3 157 k 4 157 k 6
k7 = h f (xn + 12 h , yn + 45
- 6 - 2 + 3 + 45 )
10 53 k 1 38 k 2 3 k 3 65 k 5 29 k 7
k8 = h f (xn + 12 h , yn - 14 - 7 - 14 - 72 + 90 )
56 k 1 283 k 2 199 k 3 26 k 4 13 k 5 149 k 6
k9 = h f (xn + h , yn + 25 - 14 - 6 - 7 - 15 - 32 -
25 k 7 27 k 8
+ )
9 25
For methods up to 4th order the number of steps is equal to the order of the
method. For the higher order method, the number of steps exceeds its order. In
the 6th order R-K method the steps are 7 and 8 or more.
General Form of Runge-Kutta Method
s
yn+1 = yn + h ∑ b k i i
i=1
where k1 = f (xn , yn )
k2 = f (xn +c2h , yn + h (a21k1 ))
k3 = f (xn +c3h , yn + h (a21k1+ a32k2 ))
: : : : : :
i−1
Ki = f (xn +cih , yn + h ∑ aij k j
j=1
10
Advantages and Disadvantages of Higher-Order RK Methods
Advantages:-
- Higher accuracy compared to Euler’s method and lower-order RK methods.
- Greater stability in solving stiff equations.
- Can be used for a wide range of scientific and engineering applications.
Disadvantages:-
- Increased computational complexity and execution time.
- More intermediate steps require additional memory.
- Difficult to derive and implement manually for very high orders.
Conclusion:-
Higher-order Runge-Kutta methods, such as RK5 and RK6, provide a significant
improvement in accuracy for solving ordinary differential equations. However,
they come at the cost of increased computational effort. Choosing the
appropriate order depends on the trade-off between accuracy and efficiency for
a given problem.
11
REFRENCES
https://www.scirp.org/journal/paperinformation?paperid=116804
https://www.slideserve.com/phong/ee-3561-computational-methods-
topic-8-solution-of-ordinary-differential-equations
https://youtu.be/soEj7YHrKyE?si=3SHZL0xAVpRX1F4M
https://youtu.be/40NvJNrmHhw?si=cJ90DQqQ_ijLMj2C
https://youtu.be/ouuFC0eg5lQ?si=ADBs2KSVYqDkALv5
https://www.phys.uconn.edu/~rozman/Courses/m3510_19f/downloads/
runge-kutta.pdf
12
13