You are on page 1of 3

The Runge-Kutta method

The Runge-Kutta (R-K) technique is an efficient and commonly used approach for solving initial-
value problems of differential equations.

It's used to generate high-order accurate numerical methods without the necessity for high-order
derivatives of functions. The Runge-Kutta method addresses Euler's method challenge in selecting a
sufficiently short step size to provide satisfactory accuracy in problem resolution.

Note: Want to read more about ODEs? Refer here.

Formula

Consider an ordinary differential equation ��/��=�(�,�)dy/dx=f(x,y) with the initial


condition �(�0)=�0y(x0)=y0.

The formulae for Runge-Kutta methods are defined as follows.

1��1st order R-K method


The formula is defined as follows:

�1=�0+ℎ.�(�0,�0)=�0+ℎ.�’0y1=y0+h.f(x0,y0)=y0+h.y’0

This equation is equivalent to Euler's method.

2��2nd order R-K method


The following series of formulae are involved in calculating 2��2nd order R-K method.

�1=�0+(½).(�1+�2)y1=y0+(½).(k1+k2)

Here,

�1=ℎ.�(�0,�0)k1=h.f(x0,y0)

�2=ℎ.�(�0+ℎ,�0+�1)k2=h.f(x0+h,y0+k1)

3��3rd order R-K method


This level of R-K method comprises the following:

�1=�0+16(�1+4�2+�3)y1=y0+61(k1+4k2+k3)

Here,

�1=ℎ.�(�0,�0)k1=h.f(x0,y0)
�2=ℎ.�(�0+ℎ2,�0+�12)k2=h.f(x0+2h,y0+2k1)

�3=ℎ.�(�0+ℎ,�0+2�2−�1)k3=h.f(x0+h,y0+2k2−k1)

4�ℎ4th order R-K method


The R-K4 method is the most frequently used R-K method for solving differential equations.

The Runge-Kutta method estimates �y for a given position �x. The local truncation error, in this
case, is of the order of �(ℎ5)O(h5), whereas the accumulated error is on the order
of �(ℎ4)O(h4).

Equations for calculating 4�ℎ4th order are stated below:

�1=�0+16(�1+2�2+2�3+�4)y1=y0+61(k1+2k2+2k3+k4)

Here,

�1=ℎ.�(�0,�0)k1=h.f(x0,y0)

�2=ℎ.�(�0+ℎ2,�0+�12)k2=h.f(x0+2h,y0+2k1)

�3=ℎ.�(�0+ℎ2,�0+�22)k3=h.f(x0+2h,y0+2k2)

�4=ℎ.�(�0+ℎ,�0+�3)k4=h.f(x0+h,y0+k3)

 ℎh is the interval size


 �1k1 is the slope at the beginning using �y
 �2k2 is the midpoint slop using �yand �1k1
 �3k3 is again the midpoint slope using �y and �2k2
 �4k4 is the slope at the end of the interval using �y and �3k3

Example

Find �(0.1)y(0.1) for �′=�−�4y′=4x−y , �(0)=1y(0)=1, with step length 0.10.1 using R-K4


method.

Solution

Given the function �′y′, �(0)=1,ℎ=0.1,�(0.2)=?y(0)=1,h=0.1,y(0.2)=?

Step 1: Find �1k1, �2k2, �3k3, and �4k4using the above-aforementioned formulae for R-K4.

�1=ℎ.�(�0,�0)=(0.1)�(0,1)=(0.1)⋅(−0.25)=−0.025k1=h.f(x0,y0
)=(0.1)f(0,1)=(0.1)⋅(−0.25)=−0.025
�2=ℎ.�(�0+ℎ2,�0+�12)=(0.1)�(0.05,0.9875)=(0.1)⋅(−0.2344)=−0.02344k2=h.f(x0+2h,y0
+2k1)=(0.1)f(0.05,0.9875)=(0.1)⋅(−0.2344)=−0.02344

�3=ℎ.�(�0+ℎ2,�0+�22)=(0.1)�(0.05,0.9883)=(0.1)⋅(−0.2346)=−0.02346k3=h.f(x0+2h,y0
+2k2)=(0.1)f(0.05,0.9883)=(0.1)⋅(−0.2346)=−0.02346

�4=ℎ.�(�0+ℎ,�0+�3)=(0.1)�(0.1,0.9765)=(0.1)⋅(−0.2191)=−0.02191k4=h.f(x0+h,y0+k3
)=(0.1)f(0.1,0.9765)=(0.1)⋅(−0.2191)=−0.02191

Step 2: Now put the values in �y to get �1y1 that leads to the result.

�1=�0+16(�1+2�2+2�3+�4)�1=1+16[−0.025+2(−0.02344)+2(−0.02346)+
(−0.02191)]y1=y0+61(k1+2k2+2k3+k4)y1=1+61[−0.025+2(−0.02344)+2(−0.02346)+(−0.02191)]

�1=0.9765�(0.1)=0.9765y1=0.9765y(0.1)=0.9765

Continue the iterations till the optimized desired outcome is obtained.

Find �(0.3)y(0.3) for �′=1−�3y′=1−y3 , �(0.1)=0y(0.1)=0, with step length 0.10.1 using R-


K2 method.

A)

0.0999875

B)

0.19965

C)

0.674533

Reset Quiz

Submit Answer

Applications
The R-K methods are widely employed in numerous disciplines, primarily in fluid dynamics and
mechanics, to optimize fluid solutions. Simulation and games are two further real-world applications
of this method.

You might also like