File:GeometricBrown1D.svg

Summary

Description
English: Two realizations of Geometric Brownian motions.
Date
Source Own work
Author Shiyu Ji
SVG development
InfoField
 The source code of this large SVG is invalid due to an error.
Category:Large SVG files#004852
 This oversized W3C-invalid plot was created with Matplotlib.
Category:Invalid SVG created with Matplotlib#1000GeometricBrown1D.svg

Python/Matplotlib Code

# Two realizations of Geometric Brownian process with time step dt = .0001

import matplotlib.pyplot as pl
import numpy as np
import matplotlib.patches as mpatches

t0 = 0.0
dt = 0.0001
t_final = 1.0
T = np.arange(t0, t_final, dt)
ax = pl.figure().add_subplot(111)
ax.set_xlabel('t')
ax.set_ylabel('X')

np.random.seed(1)

def drawMotion(mu, sigma, color):
    x = 1.0
    for t in T:
        new_x = x + mu*x*dt + sigma*x*np.random.normal(0, dt)#this is brownian motion, not geometric brownian motion
        ax.plot([t, t+dt], [x, new_x], color, linewidth=0.5)
        x = new_x

drawMotion(1, 20, 'b-')
drawMotion(0.5, 50, 'g-')

bluePatch = mpatches.Patch(color='blue', label='$\mu = 1$, $\sigma = 20$')
greenPatch = mpatches.Patch(color='green', label='$\mu = 0.5$, $\sigma = 50$')
pl.legend(handles = [bluePatch, greenPatch], loc=2)

pl.show()

Licensing

I, the copyright holder of this work, hereby publish it under the following license:
w:en:Creative Commons
attribution share alike
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.
Category:CC-BY-SA-4.0#GeometricBrown1D.svg
Category:Self-published work Category:Stochastic processes
Category:CC-BY-SA-4.0 Category:Invalid SVG created with Matplotlib Category:Large SVG files Category:Self-published work Category:Stochastic processes