import numpy as np
import matplotlib.pyplot as plt
@interact
def foo(count=(1,20,1), value=slider(1,10000,100,default=100)):
plt.cla()
dt = 1/value
x = np.arange(1, step=dt)
xl = np.arange(1, step=0.0000001)
W = np.zeros(value, np.dtype(float))
lin = .2+x*0
plt.plot(x, lin)
l = np.sqrt(2*x*ln(ln(1/x)))
plt.plot(x, l,'r--') # <= add subplot
plt.plot(x, -l,'r--')
# Z variable, N(0,1)
mu, sig = 0, 1
for ITER in range(1, count+1):
for i in range(1, len(W)):
W[i] = W[i-1] + np.random.normal(mu, sig) * np.sqrt(dt)
plt.plot(x,W)
plt.xlabel('t',fontsize=26)
plt.ylabel('W(t)',fontsize=26)
plt.grid(True)
@interact
def _dee(deep=slider(.01, 2.1, .01,default=1)):
plt.xlim(0, .5)
plt.ylim(-.5, .5)
plt.show()
#print '\nlin ', lin
print '\nW ', W
Func = lin - W
Sign = np.sign(Func)
print '\nSign ', Sign
Diff = np.diff(Sign)
print '\nDiff ', Diff
Points = np.where(Diff != 0)[0]
print '\nPoints ', Points*dt