590 Chapter 20Numerical methods
EXAMPLE 20.19Apply the Runge–Kutta methods of orders 2 and 4 to the initial
value problem in Example 20.18, with step sizeh 1 = 1 0.2.
The result of applying the recursion relations (20.55) for order 2 and (20.56) for order
4 are displayed in Table 20.11.
The table shows that the second-order method with step size h 1 = 1 0.2is already
considerably more accurate that Euler’s first-order method withh 1 = 1 0.1, and that the
fourth-order method is very much more accurate still.
0 Exercises 38–42
20.10 Systems of differential equations
A problem involving second- or higher-order differential equations can always be
reduced to one involving a system of simultaneous first-order equations. For
example, the general second-order linear equation
(20.57)
can be written as the pair of first-order equations
(20.58)
for the two functions of x, y(x)and z(x). If (20.57) is the differential equation of
an initial value problem, with initial conditionsy(x
0
) 1 = 1 y
0
andy′(x
0
) 1 = 1 z(x
0
) 1 = 1 y
1
, then
equations (20.58) are a pair of (coupled) first-order initial value problems. The
dz
dx
=− −rx pxz qxy() () ()
dy
dx
=z
dy
dx
px
dy
dx
qxy rx
2
2
++=() () ()
Table 20.11 Example of Runge–Kutta methods
order nx
n
y
n
exact error order nx
n
y
n
error
2 0 0.0 1.000000 1.000000 0.000000 4 0 0.0 1.000000 0.000000
1 0.2 1.440000 1.442806 0.002805 1 0.2 1.442800 0.000005
2 0.4 1.976800 1.983649 0.006849 2 0.4 1.983636 0.000013
3 0.6 2.631696 2.644238 0.012542 3 0.6 2.644213 0.000025
4 0.8 3.430669 3.451082 0.020413 4 0.8 3.451042 0.000040
5 1.0 4.405416 4.436563 0.031147 5 1.0 4.436502 0.000061