In numerical analysis, the Runge–Kutta methods (ˈrʊŋəˈkʊtɑː ) are a family of implicit and explicit iterative methods, which include the Euler method, used in temporal discretization for the approximate solutions of simultaneous nonlinear equations. These methods were developed around 1900 by the German mathematicians Carl Runge and Wilhelm Kutta.
The most widely known member of the Runge–Kutta family is generally referred to as "RK4", the "classic Runge–Kutta method" or simply as "the Runge–Kutta method".
Let an initial value problem be specified as follows:
Here is an unknown function (scalar or vector) of time , which we would like to approximate; we are told that , the rate at which changes, is a function of and of itself. At the initial time the corresponding value is . The function and the initial conditions , are given.
Now we pick a step-size h > 0 and define:
for n = 0, 1, 2, 3, ..., using
(Note: the above equations have different but equivalent definitions in different texts).
Here is the RK4 approximation of , and the next value () is determined by the present value () plus the weighted average of four increments, where each increment is the product of the size of the interval, h, and an estimated slope specified by function f on the right-hand side of the differential equation.
is the slope at the beginning of the interval, using (Euler's method);
is the slope at the midpoint of the interval, using and ;
is again the slope at the midpoint, but now using and ;
is the slope at the end of the interval, using and .
In averaging the four slopes, greater weight is given to the slopes at the midpoint. If is independent of , so that the differential equation is equivalent to a simple integral, then RK4 is Simpson's rule.
The RK4 method is a fourth-order method, meaning that the local truncation error is on the order of , while the total accumulated error is on the order of .
In many practical applications the function is independent of (so called autonomous system, or time-invariant system, especially in physics), and their increments are not computed at all and not passed to function , with only the final formula for used.