# 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)

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 at 19:49
• That is the variance – 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)