- [[Wiener process]], [[stochastic calculus]]
# Idea
![[Pasted image 20201123185231.png]]
For every $t \geq 0$ and $\Delta t \geq 0$, the increment $W_{t+\Delta t} - W_{t}$ is normally distributed with mean 0 and standard deviation $\sqrt{\Delta t}$^[https://www.quantconnect.com/tutorials/introduction-to-options/stochastic-processes-and-monte-carlo-method].
```python
import numpy as np
import matplotlib.pyplot as plt
def wiener_process(T, N):
"""
T: total time
N: The total number of steps
"""
W0 = [0]
dt = T/float(N)
# simulate the increments by normal random variable generator
increments = np.random.normal(0, 1*np.sqrt(dt), N)
W = W0 + list(np.cumsum(increments))
return W
N = 1000
T = 10
dt = T / float(N)
t = np.linspace(0.0, N*dt, N+1)
plt.figure(figsize=(15,10))
for i in range(5):
W = wiener_process(T, N)
plt.plot(t, W)
plt.xlabel('time')
plt.ylabel('W')
plt.grid(True)
```
![[Pasted image 20201123185917.png]]
# References
- [scipy cookbook Brownian Motion](https://scipy-cookbook.readthedocs.io/items/BrownianMotion.html)
- https://www.quantconnect.com/tutorials/introduction-to-options/stochastic-processes-and-monte-carlo-method