For example given an integral

$$ \int^t_0 \exp(aW(t'))\,dt', t\in\mathbb R_+ $$ where $W(t')$ is a standard Wiener process.

I've been very confused about stochastic integrals like $\int^t_0 W(t')\,dt'$, for example here Integral of Brownian motion w.r.t. time

My question is how to numerically simulate this integral (i.e. simulate trajectories with evolution of time)


Let's define $F$ as: $$ F(t)=\int^t_0 \exp(aW(t'))\,dt', \forall t\in\mathbb R_+\\ dF(t)=\exp(aW(t))dt $$

  1. Choose a small $\Delta t$.
  2. Simulate $\Delta W\sim \mathcal N(0,\Delta t)$
  3. Calculate $W(t+\Delta t)=W(t) + \Delta W$
  4. Calculate $F(t+\Delta t)=F(t)+ \exp(aW(t))\Delta t $
  5. Repeat 2, 3 and 4 as many times as you want.
  • $\begingroup$ Hi, I think your second step should read "2. Simulate $\Delta W\sim N(0,\sqrt{\Delta t})$" $\endgroup$ – ZRH Mar 17 at 19:49
  • 1
    $\begingroup$ That is the variance $\endgroup$ – Thomas G. Mar 17 at 20:23

@ThomasG's solution is implemented in python (give or take some care with the zero index) as:

import numpy as np

dt = 1e-2; j = 10; a = 1

dW = np.random.randn(j+1); dW[0] = 0
W = np.cumsum(dW)
F = np.cumsum(np.exp(a * W) * dt)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.