Runge–Kutta methods
In numerical analysis, the Runge–Kutta methods are a family of implicit and explicit iterative methods, which includes the well-known routine called the Euler Method, used in temporal discretization for the approximate solutions of ordinary differential equations.^{[1]} These methods were developed around 1900 by the German mathematicians C. Runge and M. W. Kutta.
See the article on numerical methods for ordinary differential equations for more background and other methods. See also List of Runge–Kutta methods.
The Runge–Kutta method
The most widely known member of the Runge–Kutta family is generally referred to as "RK4", "classical Runge–Kutta method" or simply as "the Runge–Kutta method".
Let an initial value problem be specified as follows:
Here y is an unknown function (scalar or vector) of time t, which we would like to approximate; we are told that , the rate at which y changes, is a function of t and of y itself. At the initial time the corresponding y value is . The function f and the data , are given.
Now pick a step-size h > 0 and define
for n = 0, 1, 2, 3, ..., using^{[2]}
- (Note: the above equations have different but equivalent definitions in different texts).^{[3]}
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 increment based on the slope at the beginning of the interval, using (Euler's method);
- is the increment based on the slope at the midpoint of the interval, using ;
- is again the increment based on the slope at the midpoint, but now using ;
- is the increment based on the slope at the end of the interval, using .
In averaging the four increments, greater weight is given to the increments at the midpoint. If is independent of , so that the differential equation is equivalent to a simple integral, then RK4 is Simpson's rule.^{[4]}
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 .
Explicit Runge–Kutta methods
The family of explicit Runge–Kutta methods is a generalization of the RK4 method mentioned above. It is given by
where^{[5]}
- (Note: the above equations have different but equivalent definitions in different texts).^{[3]}
To specify a particular method, one needs to provide the integer s (the number of stages), and the coefficients a_{ij} (for 1 ≤ j < i ≤ s), b_{i} (for i = 1, 2, ..., s) and c_{i} (for i = 2, 3, ..., s). The matrix [a_{ij}] is called the Runge–Kutta matrix, while the b_{i} and c_{i} are known as the weights and the nodes.^{[6]} These data are usually arranged in a mnemonic device, known as a Butcher tableau (after John C. Butcher):
The Runge–Kutta method is consistent if
There are also accompanying requirements if one requires the method to have a certain order p, meaning that the local truncation error is O(h^{p}^{+1}). These can be derived from the definition of the truncation error itself. For example, a two-stage method has order 2 if b_{1} + b_{2} = 1, b_{2}c_{2} = 1/2, and a_{21} = c_{2}.^{[7]}
In general, if an explicit -stage Runge–Kutta method has order , then , and if , then .^{[8]} The minimum required for an explicit -stage Runge–Kutta method to have order is an open problem. Some values which are known are:^{[9]}
Examples
The RK4 method falls in this framework. Its tableau is^{[10]}
0 1/2 1/2 1/2 0 1/2 1 0 0 1 1/6 1/3 1/3 1/6
A slight variation of "the" Runge–Kutta method is also due to Kutta in 1901 and is called the 3/8-rule.^{[11]} The primary advantage this method has is that almost all of the error coefficients are smaller than in the popular method, but it requires slightly more FLOPs (floating-point operations) per time step. Its Butcher tableau is
0 1/3 1/3 2/3 −1/3 1 1 1 −1 1 1/8 3/8 3/8 1/8
However, the simplest Runge–Kutta method is the (forward) Euler method, given by the formula . This is the only consistent explicit Runge–Kutta method with one stage. The corresponding tableau is
0 1
Second-order methods with two stages
An example of a second-order method with two stages is provided by the midpoint method:
The corresponding tableau is
0 1/2 1/2 0 1
The midpoint method is not the only second-order Runge–Kutta method with two stages; there is a family of such methods, parameterized by α and given by the formula^{[12]}
Its Butcher tableau is
0
In this family, gives the midpoint method, and is Heun's method.^{[4]}
Usage
As an example, consider the two-stage second-order Runge–Kutta method with α = 2/3, also known as Ralston method. It is given by the tableau
0 | |||
2/3 | 2/3 | ||
1/4 | 3/4 |
with the corresponding equations
This method is used to solve the initial-value problem
with step size h = 0.025, so the method needs to take four steps.
The method proceeds as follows:
The numerical solutions correspond to the underlined values.
Adaptive Runge–Kutta methods
The adaptive methods are designed to produce an estimate of the local truncation error of a single Runge–Kutta step. This is done by having two methods in the tableau, one with order and one with order .
The lower-order step is given by
where the are the same as for the higher-order method. Then the error is
which is . The Butcher tableau for this kind of method is extended to give the values of :
0 | ||||||
The Runge–Kutta–Fehlberg method has two methods of orders 5 and 4. Its extended Butcher tableau is:
0 | |||||||
1/4 | 1/4 | ||||||
3/8 | 3/32 | 9/32 | |||||
12/13 | 1932/2197 | −7200/2197 | 7296/2197 | ||||
1 | 439/216 | −8 | 3680/513 | -845/4104 | |||
1/2 | −8/27 | 2 | −3544/2565 | 1859/4104 | −11/40 | ||
16/135 | 0 | 6656/12825 | 28561/56430 | −9/50 | 2/55 | ||
25/216 | 0 | 1408/2565 | 2197/4104 | −1/5 | 0 |
However, the simplest adaptive Runge–Kutta method involves combining Heun's method, which is order 2, with the Euler method, which is order 1. Its extended Butcher tableau is:
0 | |||
1 | 1 | ||
1/2 | 1/2 | ||
1 | 0 |
The error estimate is used to control the step size.
Other adaptive Runge–Kutta methods are the Bogacki–Shampine method (orders 3 and 2), the Cash–Karp method and the Dormand–Prince method (both with orders 5 and 4).
Nonconfluent Runge–Kutta methods
A Runge–Kutta method is said to be nonconfluent ^{[13]} if all the are distinct.
Implicit Runge–Kutta methods
All Runge–Kutta methods mentioned up to now are explicit methods. Explicit Runge–Kutta methods are generally unsuitable for the solution of stiff equations because their region of absolute stability is small; in particular, it is bounded.^{[14]} This issue is especially important in the solution of partial differential equations.
The instability of explicit Runge–Kutta methods motivates the development of implicit methods. An implicit Runge–Kutta method has the form
where
- ^{[15]}
The difference with an explicit method is that in an explicit method, the sum over j only goes up to i − 1. This also shows up in the Butcher tableau: the coefficient matrix of an explicit method is lower triangular. In an implicit method, the sum over j goes up to s and the coefficient matrix is not triangular, yielding a Butcher tableau of the form^{[10]}
The consequence of this difference is that at every step, a system of algebraic equations has to be solved. This increases the computational cost considerably. If a method with s stages is used to solve a differential equation with m components, then the system of algebraic equations has ms components. This can be contrasted with implicit linear multistep methods (the other big family of methods for ODEs): an implicit s-step linear multistep method needs to solve a system of algebraic equations with only m components, so the size of the system does not increase as the number of steps increases.^{[16]}
Examples
The simplest example of an implicit Runge–Kutta method is the backward Euler method:
The Butcher tableau for this is simply:
This Butcher tableau corresponds to the formulae
which can be re-arranged to get the formula for the backward Euler method listed above.
Another example for an implicit Runge–Kutta method is the trapezoidal rule. Its Butcher tableau is:
The trapezoidal rule is a collocation method (as discussed in that article). All collocation methods are implicit Runge–Kutta methods, but not all implicit Runge–Kutta methods are collocation methods.^{[17]}
The Gauss–Legendre methods form a family of collocation methods based on Gauss quadrature. A Gauss–Legendre method with s stages has order 2s (thus, methods with arbitrarily high order can be constructed).^{[18]} The method with two stages (and thus order four) has Butcher tableau:
- ^{[16]}
Stability
The advantage of implicit Runge–Kutta methods over explicit ones is their greater stability, especially when applied to stiff equations. Consider the linear test equation y' = λy. A Runge–Kutta method applied to this equation reduces to the iteration , with r given by
- ^{[19]}
where e stands for the vector of ones. The function r is called the stability function.^{[20]} It follows from the formula that r is the quotient of two polynomials of degree s if the method has s stages. Explicit methods have a strictly lower triangular matrix A, which implies that det(I − zA) = 1 and that the stability function is a polynomial.^{[21]}
The numerical solution to the linear test equation decays to zero if | r(z) | < 1 with z = hλ. The set of such z is called the domain of absolute stability. In particular, the method is said to be A-stable if all z with Re(z) < 0 are in the domain of absolute stability. The stability function of an explicit Runge–Kutta method is a polynomial, so explicit Runge–Kutta methods can never be A-stable.^{[21]}
If the method has order p, then the stability function satisfies as . Thus, it is of interest to study quotients of polynomials of given degrees that approximate the exponential function the best. These are known as Padé approximants. A Padé approximant with numerator of degree m and denominator of degree n is A-stable if and only if m ≤ n ≤ m + 2.^{[22]}
The Gauss–Legendre method with s stages has order 2s, so its stability function is the Padé approximant with m = n = s. It follows that the method is A-stable.^{[23]} This shows that A-stable Runge–Kutta can have arbitrarily high order. In contrast, the order of A-stable linear multistep methods cannot exceed two.^{[24]}
B-stability
The A-stability concept for the solution of differential equations is related to the linear autonomous equation . Dahlquist proposed the investigation of stability of numerical schemes when applied to nonlinear systems that satisfy a monotonicity condition. The corresponding concepts were defined as G-stability for multistep methods (and the related one-leg methods) and B-stability (Butcher, 1975) for Runge–Kutta methods. A Runge–Kutta method applied to the non-linear system , which verifies , is called B-stable, if this condition implies for two numerical solutions.
Let , and be three matrices defined by
A Runge–Kutta method is said to be algebraically stable ^{[25]} if the matrices and are both non-negative definite. A sufficient condition for B-stability ^{[26]} is: and are non-negative definite.
Derivation of the Runge–Kutta fourth-order method
In general a Runge–Kutta method of order can be written as:
where:
are increments obtained evaluating the derivatives of at the -th order.
We develop the derivation^{[27]} for the Runge–Kutta fourth-order method using the general formula with evaluated, as explained above, at the starting point, the midpoint and the end point of any interval , thus we choose:
and otherwise. We begin by defining the following quantities:
where and If we define:
and for the previous relations we can show that the following equalities holds up to :
where:
is the total derivative of with respect to time.
If we now express the general formula using what we just derived we obtain:
and comparing this with the Taylor series of around :
we obtain a system of constraints on the coefficients:
which when solved gives as stated above.
See also
- Euler's method
- List of Runge–Kutta methods
- Numerical ordinary differential equations
- PottersWheel – Parameter calibration in ODE systems using implicit Runge–Kutta integration
- Runge–Kutta method (SDE)
- General linear methods
Notes
- ↑ DEVRIES, Paul L. ; HASBUN, Javier E. A first course in computational physics. Second edition. Jones and Bartlett Publishers: 2011. p. 215.
- ↑ Press et al. 2007, p. 908; Süli & Mayers 2003, p. 328
- 1 2 Atkinson (1989, p. 423), Hairer, Nørsett & Wanner (1993, p. 134), Kaw & Kalu (2008, §8.4) and Stoer & Bulirsch (2002, p. 476) leave out the factor h in the definition of the stages. Ascher & Petzold (1998, p. 81), Butcher (2008, p. 93) and Iserles (1996, p. 38) use the y values as stages.
- 1 2 Süli & Mayers 2003, p. 328
- ↑ Press et al. 2007, p. 907
- ↑ Iserles 1996, p. 38
- ↑ Iserles 1996, p. 39
- ↑ Butcher 2008, p. 187
- ↑ Butcher 2008, pp. 187–196
- 1 2 Süli & Mayers 2003, p. 352
- ↑ Hairer, Nørsett & Wanner (1993, p. 138) refer to Kutta (1901).
- ↑ Süli & Mayers 2003, p. 327
- ↑ Lambert 1991, p. 278
- ↑ Süli & Mayers 2003, pp. 349–351
- ↑ Iserles 1996, p. 41; Süli & Mayers 2003, pp. 351–352
- 1 2 Süli & Mayers 2003, p. 353
- ↑ Iserles 1996, pp. 43–44
- ↑ Iserles 1996, p. 47
- ↑ Hairer & Wanner 1996, pp. 40–41
- ↑ Hairer & Wanner 1996, p. 40
- 1 2 Iserles 1996, p. 60
- ↑ Iserles 1996, pp. 62–63
- ↑ Iserles 1996, p. 63
- ↑ This result is due to Dahlquist (1963).
- ↑ Lambert 1991, p. 275
- ↑ Lambert 1991, p. 274
- ↑ PDF reporting this derivation
References
- Ascher, Uri M.; Petzold, Linda R. (1998), Computer Methods for Ordinary Differential Equations and Differential-Algebraic Equations, Philadelphia: Society for Industrial and Applied Mathematics, ISBN 978-0-89871-412-8.
- Atkinson, Kendall A. (1989), An Introduction to Numerical Analysis (2nd ed.), New York: John Wiley & Sons, ISBN 978-0-471-50023-0.
- Butcher, John C. (May 1963), Coefficients for the study of Runge-Kutta integration processes, 3 (2), pp. 185–201, doi:10.1017/S1446788700027932.
- Butcher, John C. (1975), "A stability property of implicit Runge-Kutta methods", BIT, 15: 358–361, doi:10.1007/bf01931672.
- Butcher, John C. (2008), Numerical Methods for Ordinary Differential Equations, New York: John Wiley & Sons, ISBN 978-0-470-72335-7.
- Cellier, F.; Kofman, E. (2006), Continuous System Simulation, Springer Verlag, ISBN 0-387-26102-8.
- Dahlquist, Germund (1963), "A special stability problem for linear multistep methods", BIT, 3: 27–43, doi:10.1007/BF01963532, ISSN 0006-3835.
- Forsythe, George E.; Malcolm, Michael A.; Moler, Cleve B. (1977), Computer Methods for Mathematical Computations, Prentice-Hall (see Chapter 6).
- Hairer, Ernst; Nørsett, Syvert Paul; Wanner, Gerhard (1993), Solving ordinary differential equations I: Nonstiff problems, Berlin, New York: Springer-Verlag, ISBN 978-3-540-56670-0.
- Hairer, Ernst; Wanner, Gerhard (1996), Solving ordinary differential equations II: Stiff and differential-algebraic problems (2nd ed.), Berlin, New York: Springer-Verlag, ISBN 978-3-540-60452-5.
- Iserles, Arieh (1996), A First Course in the Numerical Analysis of Differential Equations, Cambridge University Press, ISBN 978-0-521-55655-2.
- Lambert, J.D (1991), Numerical Methods for Ordinary Differential Systems. The Initial Value Problem, John Wiley & Sons, ISBN 0-471-92990-5
- Kaw, Autar; Kalu, Egwu (2008), Numerical Methods with Applications (1st ed.), autarkaw.com.
- Kutta, Martin Wilhelm (1901), "Beitrag zur näherungsweisen Integration totaler Differentialgleichungen", Zeitschrift für Mathematik und Physik, 46: 435–453.
- Press, William H.; Flannery, Brian P.; Teukolsky, Saul A.; Vetterling, William T. (2007), "Section 17.1 Runge-Kutta Method", Numerical Recipes: The Art of Scientific Computing (3rd ed.), Cambridge University Press, ISBN 978-0-521-88068-8. Also, Section 17.2. Adaptive Stepsize Control for Runge-Kutta.
- Stoer, Josef; Bulirsch, Roland (2002), Introduction to Numerical Analysis (3rd ed.), Berlin, New York: Springer-Verlag, ISBN 978-0-387-95452-3.
- Süli, Endre; Mayers, David (2003), An Introduction to Numerical Analysis, Cambridge University Press, ISBN 0-521-00794-1.
- Tan, Delin; Chen, Zheng (2012), "On A General Formula of Fourth Order Runge-Kutta Method" (PDF), Journal of Mathematical Science & Mathematics Education, 7.2: 1–10.
External links
- Hazewinkel, Michiel, ed. (2001), "Runge-Kutta method", Encyclopedia of Mathematics, Springer, ISBN 978-1-55608-010-4
- Runge–Kutta 4th-Order Method
- Runge Kutta Method for O.D.E.'s
- DotNumerics: Ordinary Differential Equations for C# and VB.NET — Initial-value problem for nonstiff and stiff ordinary differential equations (explicit Runge–Kutta, implicit Runge–Kutta, Gear's BDF and Adams–Moulton).