How to numerically simulate exponential stochastic integral

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)

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.
• Hi, I think your second step should read "2. Simulate $\Delta W\sim N(0,\sqrt{\Delta t})$"
– ZRH
Mar 17 '19 at 19:49
• That is the variance Mar 17 '19 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
W = np.cumsum(dW)
F = np.cumsum(np.exp(a * W) * dt)
• 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 ) Dec 10 '19 at 1:34
• Yes in hindsight seem like I made an error here that you describe
– Attack68
Dec 10 '19 at 7:30