In mathematics of stochastic systems, the Runge–Kutta method is a technique for the approximate numerical solution of a stochastic differential equation. It is a generalisation of the Runge–Kutta method for ordinary differential equations to stochastic differential equations (SDEs). Importantly, the method does not involve knowing derivatives of the coefficient functions in the SDEs.

Most basic scheme

Consider the Itō diffusion X {\displaystyle X} satisfying the following Itō stochastic differential equation d X t = a ( X t ) d t + b ( X t ) d W t , {\displaystyle dX_{t}=a(X_{t})\,dt+b(X_{t})\,dW_{t},} with initial condition X 0 = x 0 {\displaystyle X_{0}=x_{0}}, where W t {\displaystyle W_{t}} stands for the Wiener process, and suppose that we wish to solve this SDE on some interval of time [ 0 , T ] {\displaystyle [0,T]}. Then the basic Runge–Kutta approximation to the true solution X {\displaystyle X} is the Markov chain Y {\displaystyle Y} defined as follows:

  • partition the interval [ 0 , T ] {\displaystyle [0,T]} into N {\displaystyle N} subintervals of width δ = T / N > 0 {\displaystyle \delta =T/N>0}: 0 = τ 0 < τ 1 < ⋯ < τ N = T ; {\displaystyle 0=\tau _{0}<\tau _{1}<\dots <\tau _{N}=T;}
  • set Y 0 := x 0 {\displaystyle Y_{0}:=x_{0}};
  • recursively compute Y n {\displaystyle Y_{n}} for 1 ≤ n ≤ N {\displaystyle 1\leq n\leq N} by Y n + 1 := Y n + a ( Y n ) δ + b ( Y n ) Δ W n + 1 2 ( b ( Υ ^ n ) − b ( Y n ) ) ( ( Δ W n ) 2 − δ ) δ − 1 / 2 , {\displaystyle Y_{n+1}:=Y_{n}+a(Y_{n})\delta +b(Y_{n})\Delta W_{n}+{\frac {1}{2}}\left(b({\hat {\Upsilon }}_{n})-b(Y_{n})\right)\left((\Delta W_{n})^{2}-\delta \right)\delta ^{-1/2},} where Δ W n = W τ n + 1 − W τ n {\displaystyle \Delta W_{n}=W_{\tau _{n+1}}-W_{\tau _{n}}} and Υ ^ n = Y n + a ( Y n ) δ + b ( Y n ) δ 1 / 2 . {\displaystyle {\hat {\Upsilon }}_{n}=Y_{n}+a(Y_{n})\delta +b(Y_{n})\delta ^{1/2}.}

The random variables Δ W n {\displaystyle \Delta W_{n}} are independent and identically distributed normal random variables with expected value zero and variance δ {\displaystyle \delta }.

This scheme has strong order 1, meaning that the approximation error of the actual solution at a fixed time scales with the time step δ {\displaystyle \delta }. It has also weak order 1, meaning that the error on the statistics of the solution scales with the time step δ {\displaystyle \delta }. See the references for complete and exact statements.

The functions a {\displaystyle a} and b {\displaystyle b} can be time-varying without any complication. The method can be generalized to the case of several coupled equations; the principle is the same but the equations become longer.

Variation of the Improved Euler is flexible

A newer Runge—Kutta scheme also of strong order 1 straightforwardly reduces to the improved Euler scheme for deterministic ODEs. Consider the vector stochastic process X → ( t ) ∈ R n {\displaystyle {\vec {X}}(t)\in \mathbb {R} ^{n}} that satisfies the general Ito SDE d X → = a → ( t , X → ) d t + b → ( t , X → ) d W , {\displaystyle d{\vec {X}}={\vec {a}}(t,{\vec {X}})\,dt+{\vec {b}}(t,{\vec {X}})\,dW,} where drift a → {\displaystyle {\vec {a}}} and volatility b → {\displaystyle {\vec {b}}} are sufficiently smooth functions of their arguments. Given time step h {\displaystyle h}, and given the value X → ( t k ) = X → k {\displaystyle {\vec {X}}(t_{k})={\vec {X}}_{k}}, estimate X → ( t k + 1 ) {\displaystyle {\vec {X}}(t_{k+1})} by X → k + 1 {\displaystyle {\vec {X}}_{k+1}} for time t k + 1 = t k + h {\displaystyle t_{k+1}=t_{k}+h} via K → 1 = h a → ( t k , X → k ) + ( Δ W k − S k h ) b → ( t k , X → k ) , K → 2 = h a → ( t k + 1 , X → k + K → 1 ) + ( Δ W k + S k h ) b → ( t k + 1 , X → k + K → 1 ) , X → k + 1 = X → k + 1 2 ( K → 1 + K → 2 ) , {\displaystyle {\begin{array}{l}{\vec {K}}_{1}=h{\vec {a}}(t_{k},{\vec {X}}_{k})+(\Delta W_{k}-S_{k}{\sqrt {h}}){\vec {b}}(t_{k},{\vec {X}}_{k}),\\{\vec {K}}_{2}=h{\vec {a}}(t_{k+1},{\vec {X}}_{k}+{\vec {K}}_{1})+(\Delta W_{k}+S_{k}{\sqrt {h}}){\vec {b}}(t_{k+1},{\vec {X}}_{k}+{\vec {K}}_{1}),\\{\vec {X}}_{k+1}={\vec {X}}_{k}+{\frac {1}{2}}({\vec {K}}_{1}+{\vec {K}}_{2}),\end{array}}}

  • where Δ W k = h Z k {\displaystyle \Delta W_{k}={\sqrt {h}}Z_{k}} for normal random Z k ∼ N ( 0 , 1 ) {\displaystyle Z_{k}\sim N(0,1)};
  • and where S k = ± 1 {\displaystyle S_{k}=\pm 1}, each alternative chosen with probability 1 / 2 {\displaystyle 1/2}.

The above describes only one time step. Repeat this time step ( t m − t 0 ) / h {\displaystyle (t_{m}-t_{0})/h} times in order to integrate the SDE from time t = t 0 {\displaystyle t=t_{0}} to t = t m {\displaystyle t=t_{m}}.

The scheme integrates Stratonovich SDEs to O ( h ) {\displaystyle O(h)} provided one sets S k = 0 {\displaystyle S_{k}=0} throughout (instead of choosing ± 1 {\displaystyle \pm 1}).

Higher order Runge-Kutta schemes

Higher-order schemes also exist, but become increasingly complex. Rößler developed many schemes for Ito SDEs, whereas Komori developed schemes for Stratonovich SDEs. Rackauckas extended these schemes to allow for adaptive-time stepping via Rejection Sampling with Memory (RSwM), resulting in orders of magnitude efficiency increases in practical biological models, along with coefficient optimization for improved stability.