File:ItoWienerProcess2D.svg
Summary
| Description |
English: A simulation of 2D Ito and Wiener processes. |
| Date | |
| Source | Own work |
| Author | Shiyu Ji |
| SVG development |
Python/Matplotlib Code
# A simulation of 2D drifted Wiener process with time step dt = .0001
import matplotlib.pyplot as pl
import numpy as np
t0 = 0.0
dt = 0.0001
t_final = 2
T = np.arange(t0, t_final, dt)
ax = pl.figure().add_subplot(111)
ax.set_xlabel('X')
ax.set_ylabel('Y')
x, y = 0.0, 0.0
mu = .02
sigma = 1.0
# drifted Wiener's (also Ito's)
np.random.seed(1)
for t in T:
new_x = x + mu*dt + sigma * np.random.normal(0, dt)
new_y = y + mu*dt + sigma * np.random.normal(0, dt)
ax.plot([x, new_x], [y, new_y], 'b-', linewidth=0.5)
x, y = new_x, new_y
# Wiener's
x, y = 0.0, 0.0
np.random.seed(1)
for t in T:
new_x = x + sigma * np.random.normal(0, dt)
new_y = y + sigma * np.random.normal(0, dt)
ax.plot([x, new_x], [y, new_y], 'r-', linewidth=0.5)
x, y = new_x, new_y
pl.show()
Licensing
I, the copyright holder of this work, hereby publish it under the following license:
This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International license.
- You are free:
- to share – to copy, distribute and transmit the work
- to remix – to adapt the work
- Under the following conditions:
- attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
- share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.