title: Python Code: Geometric Brownian Motion - what's wrong?
body: <p>I'm pretty new to Python, but for a paper in University I need to apply some models, using preferably Python. I spent a couple of days with the code I attached, but I can't really help, what's wrong, it's not creating a random process which looks like standard brownian motions with drift. My parameters like mu and sigma (expected return or drift and volatility) tend to change nothing but the slope of the noise process. That's my problem, it all looks like noise. Hope my problem is specific enough, here is my coode:</p>
  
  <pre><code>import math
  from matplotlib.pyplot import *
  from numpy import *
  from numpy.random import standard_normal
  
  '''
  geometric brownian motion with drift!
  
  Spezifikationen:
  
      mu=drift factor [Annahme von Risikoneutralitaet]
      sigma: volatility in %
      T: time span
      dt: lenght of steps
      S0: Stock Price in t=0
      W: Brownian Motion with Drift N[0,1] 
  '''
  
  T=1
  mu=0.025
  sigma=0.1
  S0=20
  dt=0.01
  
  Steps=round(T/dt)
  
  t=(arange(0, Steps))
  x=arange(0, Steps)
  W=(standard_normal(size=Steps)+mu*t)### standard brownian motion###
  X=(mu-0.5*sigma**2)*dt+(sigma*sqrt(dt)*W) ###geometric brownian motion####
  y=S0*math.e**(X)
  
  plot(t,y)
  
  show()
  </code></pre>