Runge-Kutta method

This method is designed to imitate the Taylor series method without requirng analytic differentiationof the original equation. In using the Taylor series method we needed to obtain x'', x''', ... by differentiating the function f. This requirement can be a serious obsicle to using the method. The user of this method must do some preliminary analytical work before writing a computer program. Ideally, a method for solving an equation shoudl involve nothing more than writing a code evaluate f. The Runge-Kutta method accomplsh this.

The formulas for Runge-Kutta method of order 4, which I used in the applet on the next page, are as follows:

x( t + h ) = x(t) + 1/6 f( F + 2G + 2H + I )

where

F = h f( t, x )

G = h f( t + 1/2 h, x + 1/2 F )

H = h f( t + 1/2 h, x + 1/2 G )

I = h f( t + h, x + H )

As can be seen, the solution as x( t + h ) is obtained at the expense of eevaluating the function four times. The final formula agrees with the Taylor expansion up to and including the term in h^4.

The method may be programmed as follows:

for ( k = 1; k <= n; k++ ) {

f1 = h*f(t, x);

f2 = h*f(t+h/2, x+f1/2);

f3 = h*f(t+h/2, x+f2/2);

f4 = h*f(t+h, x+f3);

x = x + (f1 + 2*f2 + 2*f3 + f4)/6;

t = a + k*h;

}

This link will take you to an applet demonstrating Runge-Kutta method.

Hosted by www.Geocities.ws

1