Algorithm: Runge-Kutta Method of Order $ 2$

For the IVP ([*]) or ([*]), let $ x_i = a + i h, \; i=0,1, 2, \ldots, n$ where $ h$ is a given prescribed step size. For $ k = 1, 2, \ldots, n-1$ , define $ y_{k+1}$ by

$\displaystyle y_0 = y_0, \; y_{k+1} = y_k + \frac{1}{2}\left(k_1 + k_2\right), \;
k_1 = h f(x_k, y_k), \;{\mbox{ and }} \; k_2 = h f(x_k + h, y_k + k_1).$

Then the flow chart associated with the R-K method of order $ 2$ is

Figure: Flow-Chart of Runge-Kutta method of order $ 2$
\includegraphics[scale=.7]{flowchart_3.eps}

EXAMPLE 14.3.1   Use the Ringe-Kutta method to find the approximate value of $ y(0.5)$ where $ y$ is the solution of the IVP

$\displaystyle y^\prime = y^2, \;\; y(0) = 1, \; 0 \le x \le 0.5$

with step sizes $ (i) \; 0.1$ and $ (ii) \; 0.05.$ Also, calculate the error and tabulate the results.

Solution: Comparing the given IVP with ([*]), we note that $ f(x,y) = y^2, \; a = 0, b = 0.5$ and $ y_0 = 1$ . We now calculate the values of $ k_1$ and $ k_2$ from the R-K method of order $ 2$ and use the formula $ y_{k+1} = y_k + \frac{k_1+k_2}{2}$ to calculate the approximate values. The results are shown in Tables [*] and [*].

    Table $ 3$        
Initial $ x$ Initial $ y$ Step size $ h$ Approx $ y$ Exact $ y$ Error $ k_1$ $ k_2$
$ 0.00000$ 1.00000 0.10000 1.00000 1.00000 0.00000 0.1 0.121
$ 0.10000$ 1.00000 0.10000 1.11050 1.11111 $ 0.00061 $ 0.1 0.146531
0.20000 1.11050 0.10000 1.23377 1.25000 0.01623 0.12332 0.18417
0.30000 1.23377 0.10000 1.338751 1.42857 0.04106 0.15222 0.23708
0.40000 1.38751 0.10000 1.58216 1.66667 0.08451 0.19252 0.31495
0.50000 1.58216 0.10000 1.83589 2.00000 0.16411 0.25032 0.00627




    Table $ 4$        
Initial $ x$ Initial $ y$ Step size $ h$ Approx $ y$ Exact $ y$ Error $ k_1$ $ k_2$
$ 0.00000$ 1.00000 0.05000 1.00000 1.00000 0.00000 0.05000 0.05513
$ 0.05000$ 1.00000 0.05000 1.05256 1.05263 $ -0.00007 $ 0.05539 0.06138
0.10000 1.05256 0.05000 1.11095 1.11111 $ -$ 0.00016 0.06171 0.06876
0.15000 1.11095 0.05000 1.17618 1.17647 0.00029 0.06917 0.07755
0.20000 1.17618 0.05000 1.24954 1.25000 0.00046 0.0781 0.08813
0.25000 1.24954 0.05000 1.33264 1.33333 0.00070 0.08880 0.10102
0.30000 1.33264 0.05000 1.42755 1.42857 $ -$ 0.00102 0.10190 0.11696
0.35000 1.42755 0.05000 1.53697 1.53846 $ -$ 0.00149 0.11812 0.13697
0.40000 1.53697 0.05000 1.66451 1.66667 $ -$ 0.00215 0.13853 0.16255
0.45000 1.66451 0.05000 1.81505 1.81818 $ -$ 0.00313 0.16472 0.19598
0.50000 1.81505 0.05000 1.99540 2.00000 $ -$ 0.00460 0.199082 0.24079

A K Lal 2007-09-12