Home

Recent
Archive

Numerical experiments, Tips, Tricks and Gotchas

Numerically speaking

Brownian Motion Simulation

Introduction

In the earlier post Brownian Motion and Geometric Brownian Motion. I discussed that the simulation of geometric Brownian motion can be reduced to the simulation of Brownian motion or the random walk simulation [1]. There are discussions about particular forms of the simulation equations. In fact, many of them are equivalent.

Simulation with Gaussian random variable

The Brownian motion is described by the following stochastic differential equation (SDE) [1, 2]: \begin{equation} dX_{t}=\mu dt+\sigma dW_{t}\label{eq:BrMdr} \end{equation} Here $W_{t}$ is the Wiener process, $\mu$ is the drift and $\sigma$ is the diffusion coefficient. The solution of (\ref{eq:BrMdr}) is well known [2]: \begin{equation} X_{t}\sim\mathit{\mathcal{N}}(\mu t,\sigma^{2}t)\label{eq:gauss} \end{equation} where $\mathit{\mathcal{N}}(m,v)$ is the Gaussian variable with mean $m$ and variance $v$. The simulation formula is \begin{equation} \Delta X=\mu\Delta t+\sigma\Delta W\label{eq:simul} \end{equation} There are several variants of simulation implementation. All the above expressions are mathematically equivalent because \begin{equation} \mathit{\mathcal{N}}(m,v)=m+\sqrt{v}\mathit{\mathcal{N}}(0,1) \end{equation}

Simulation with random walk

We can also replace $\Delta W$ with a symmetric random walk with steps $h_{i}=\pm h$: \begin{equation} \Delta X=\mu\Delta t+\sigma\sum_{i=1}^{n}h_{i}\label{eq:simul-4} \end{equation} where \begin{equation} \Delta t=n\tau\label{eq:Dt} \end{equation} and \begin{equation} h^{2}=\tau\label{eq:h2tau} \end{equation} or with asymmetric random walk \begin{equation} \Delta X=\sigma\sum_{i=1}^{n}\left(\varrho+h_{i}\right) \end{equation} where \begin{equation} \varrho=\frac{\mu\tau}{\sigma}=\frac{\mu h^{2}}{\sigma} \end{equation}

Advantages of random walk simulation

Random walk simulation has some advantages. First, it is simple and less time consuming than (\ref{eq:simul-1} - \ref{eq:simul-3}) even with more steps ($n\sim10^{1}\div10^{2}$). Second, it can be easier generalized for the case when the drift and diffusion depend on time and coordinate: \begin{equation} dX_{t}=\mu(X_{t},t)dt+\sigma(X_{t},t)dW_{t}\label{eq:non-homo} \end{equation} because for sufficiently small steps (\ref{eq:non-homo}) can be modeled as \begin{equation} \Delta X=\sum_{i=1}^{n}\left(\tau\mu_{i}+\sigma_{i}h_{i}\right)\label{eq:simul-5} \end{equation}

Numerical experiments

Below are simple scripts implementing several variants of the Brownian motion simulation. The IPython HTML notebook was converted to HTML and the simulation session can be viewed at the link below.

Note that the numbers of random paths used in the simulations are relatively small. Therefore the simulated values of drifts and variances are not very accurate.

For more details:

 

References

  1. Nikolai Shokhirev, Brownian Motion and Geometric Brownian Motion. , www.numericalexpert.com, 2013
  2. Gardiner C. W., Handbook of Stochastic Methods for Physics, Chemistry and the Natural Science, Berlin: Springer-Verlag, 1983.

 

© Nikolai Shokhirev, 2012-2024

email: nikolai(dot)shokhirev(at)gmail(dot)com

Count: