Euler–Maruyama method

This article is about numerical methods in stochastic models (stochastic differential equations). For the same issue, but in deterministic realm, see Euler method and Ordinary differential equation.

In mathematics, more precisely in Itô calculus, the Euler–Maruyama method, also called simply the Euler method, is a method for the approximate numerical solution of a stochastic differential equation (SDE). It is a simple generalization of the Euler method for ordinary differential equations to stochastic differential equations. It is named after Leonhard Euler and Gisiro Maruyama. Unfortunately the same generalization cannot be done for the other methods from deterministic theory,[1] e.g. Runge–Kutta schemes.

Consider the stochastic differential equation (see Itō calculus)

\mathrm{d} X_t = a(X_t) \, \mathrm{d} t + b(X_t) \, \mathrm{d} W_t,

with initial condition X0 = x0, where Wt stands for the Wiener process, and suppose that we wish to solve this SDE on some interval of time [0, T]. Then the Euler–Maruyama approximation to the true solution X is the Markov chain Y defined as follows:

0 = \tau_{0} < \tau_{1} < \cdots < \tau_{N} = T \text{ and } \Delta t = T/N;
\, Y_{n + 1} = Y_n + a(Y_n) \, \Delta t + b(Y_n) \, \Delta W_n,
where
\Delta W_n = W_{\tau_{n + 1}} - W_{\tau_n}.

The random variables ΔWn are independent and identically distributed normal random variables with expected value zero and variance \Delta t.

Example

Numerical simulation

Gene expression modelled as stochastic process

An area that has benefited significantly from SDE is biology or more precisely mathematical biology. Here the number of publications on the use of stochastic model grew, as most of the models are nonlinear, demanding numerical schemes.

The graphic depicts a stochastic differential equation being solved using the Euler Scheme. The deterministic counterpart is shown as well.

Computer implementation

The following Python code implements Euler–Maruyama to solve the Ornstein–Uhlenbeck process

 dY_t=\theta \cdot (\mu-Y_t) \, dt + \sigma \, dW_t,\;\;Y_0=IC.
import numpy as np
import matplotlib.pyplot as plt

tBegin = 0
tEnd = 2
dt = .00001

t = np.arange(tBegin, tEnd, dt)
N = t.size 
IC = 0
theta = 1
mu = 1.2
sigma = 0.3

sqrtdt = np.sqrt(dt)
y = np.zeros(N)
y[0] = IC
for i in xrange(1, N):
    y[i] = y[i-1] + dt*(theta*(mu-y[i-1])) + sigma*sqrtdt*np.random.normal(loc=0.0, scale=1.0)

ax = plt.subplot(111)
ax.plot(t, y)
plt.show()

See also

Notes

  1. Kloeden & Platen, 1992

References

This article is issued from Wikipedia - version of the Friday, September 18, 2015. The text is available under the Creative Commons Attribution/Share Alike but additional terms may apply for the media files.