8.7 Section 2 Background .1 Cosmology .11 Math Section 8.9

#### Book 9 Computational Mathematics Chapter 8 Ordinary Differential Equation Initial Value Problems

Section 8 Runge-Kutta Method

Consider the Cauchy problem for the differential equation

(8.1)

with the initial condition

(8.2)

Let yi denote the approximate value of the required solution at the point xi. By the Runge-Kutta method ( [2],[13],[18]),) the approximate value yi+1 at the next point xi+1 = xi + h is given by

(8.3)

where

(8.4)

The corresponding hand computations are best performed by the scheme:

1. Enter x0, y0 in the first row. 2. Evaluate K1(0) = hf(x0,y0). 3. Enter x0 + h/2, y0 + K1(0)/2 in the second row.
4. Compute and enter K2(0) = hf(x0 + h/2,y0 + K1(0)/2).etc.Add the numbers in the last column, in order to obtain

Repeat these steps using x1, y1 as initial point, etc. Note that h may be changed when passing from one point to another. A proper choice of h can be obtained as follows:

If the quantity

(8.5)

exceeds several hundredths; the value of h must be reduced. The accuracy of the Runge-Kutta method is O(h4). Its error estimate is rather involved. A rough error estimate, which involves repeated computations, is:

where y(xn) is the value of the exact solution of (8.1) and y*n, yn are the approximate values obtained for h/2 and h, respectively.

Example 1: Use the Runge-Kutta method to find the solution of the equation

(8.6)

for the initial condition y(0) = -1 with the interval [0,0.5], using h = 0.1.

Solution: The following table displays the solution of (8.6):

Note that the last column of this table has been computed using (8.5).

Example 2: Use the Runge-Kutta Method to find within 5?10-6 the solution of the differential equation

(8.7)

for the initial condition y(0) = 0 on the interval [0.0.2].

Solution: In order to select h, compute the solution for x = 0.1 with h = 0.1 as well as with h = 0.05.
For h = 0.1, one finds

Hence

The next table presents the calculation of y(0.1) using h = 0.05:

Since the obtained result is within the specified accuracy, continue the computations both with h = 0.1 and h = 0.2. The next two tables present the further computations.

A comparison of the results for h =0.1 and h = 0.2 shows that y(0.2) ~ 0.014158 is accurate within 5?10-6 and that for further computations the step length h can again be doubled.

Solving (8.7) using h = 0.1

Solving (8.7) using h = 0.2

Note: The Runge-Kutta method can also be used for the solution of systems of differential equations and higher order differential equations after reduction to systems of first order equations.

Example 3: Use the Runge-Kutta method to compute a table of values of the solutions of the system of differential equations

(8.8)

for the initial conditions x(0) = 2, y(0) = 1, z(0) =1 for the interval [0,0.3] with h = 0.1.

Solution: The calculations are presented in the next table, where f1 = -2x + 5z, f2 = -(1 - sin t)x - y + 3z, f3 = -x + 2z.

Exercises

Use the Runge-Kutta method with h = 0.2 to solve the following differential equations and systems of differential equations for the given intervals [a,b].

1.