2
$\begingroup$

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)

$\endgroup$
5
$\begingroup$

making use of this formula :

$$ y(t_{k+1}) = y({t_k}) + \int^{t_{k+1}}_{t_k} y(t) dt $$

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.
| improve this answer | |
$\endgroup$
  • $\begingroup$ Hi, I think your second step should read "2. Simulate $\Delta W\sim N(0,\sqrt{\Delta t})$" $\endgroup$ – ZRH Mar 17 '19 at 19:49
  • 3
    $\begingroup$ That is the variance $\endgroup$ – Thomas G. Mar 17 '19 at 20:23
2
$\begingroup$

@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)
| improve this answer | |
$\endgroup$
  • $\begingroup$ don't you think that if you generate dW like that, meaning on intervals of length 0.1, the normal vector should be generated by $ \mathcal N(0, 0.1)$ ? for that reason, I'd have written : np.cumsum(np.exp(a * W * \sqrt dt ) * dt ) $\endgroup$ – Marine Galantin Dec 10 '19 at 1:34
  • $\begingroup$ Yes in hindsight seem like I made an error here that you describe $\endgroup$ – Attack68 Dec 10 '19 at 7:30

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.