示例#1
0
def LogWalk(T, nSteps, mu, sigma, x_0=1, t_0=0, boundary=500):

    ex._check_params(T, nSteps, t_0)
    dt = T/(10*nSteps)
    x_t = []
    t = t_0
    for i in range((10*nSteps)):
       
        x = x_0*np.exp((mu - sigma**2/2)*t + sigma*np.random.randn()*np.sqrt(t))
		if abs(x) > boundary:
            raise Warning("Risk of going beyond the definition of a random process. Boundary: " + str(boundary) + ". If You wish You could change boundary conditions in parameters (default:'boundary'=500).")
        x_t.append(x) 
        t += dt
示例#2
0
def OrnsteinUlenbekProcess(T, nSteps, alpha, beta, _sigma, x_0=1, t_0=0, boundary=500):
    ex._check_params(T, nSteps, t_0)

    dt = T/(10*nSteps)
    x_t = []
    x_t.append(x_0)
    t = t_0
    
    for i in range(1, 10*nSteps):
        x = alpha + (x_0 - alpha)*np.exp(-beta*t) + _sigma/np.sqrt(2*beta)*np.sqrt(1-np.exp(-2*beta*t))*np.random.randn()
		if abs(x) > boundary:
            raise Warning("Risk of going beyond the definition of a random process. Boundary: " + str(boundary) + ". If You wish You could change boundary conditions in parameters (default:'boundary'=500).")
        x_t.append(x)
        t += dt
示例#3
0
def BrownianBridge(T, nSteps, alpha, _sigma, x_0=1, t_0=0, boundary=500):

    ex._check_params(T, nSteps, t_0)	

    dt = T/(10*nSteps)
    x_t = []
    x_t.append(x_0)
    t = t_0
    
    for i in range(1, 10*nSteps):
        x = alpha + (x_0 - alpha)*(T - t)/(T - t_0) + _sigma*np.sqrt((t - t_0)*(T - t)/T - t_0)*np.random.randn()
		if abs(x) > boundary:
            raise Warning("Risk of going beyond the definition of a random process. Boundary: " + str(boundary) + ". If You wish You could change boundary conditions in parameters (default:'boundary'=500).")
        x_t.append(x)
        t += dt
示例#4
0
def stoch_proc(T, nSteps, a, b, x_0=1, t_0=0, boundary=500):

    ex._check_params(T, nSteps, t_0)

    x_t = []
    t = t_0
    dt = T*/(10*nSteps)
    x = x_0
    x_t.append(x_0)
    
    for i in range(1, 10*nSteps):
        t += dt
        x += a(x_t[i], t)*dt + b(x_t[i], t)*dW(dt)
		if abs(x) > boundary:
            raise Warning("Risk of going beyond the definition of a random process. Boundary: " + str(boundary) + ". If You wish You could change boundary conditions in parameters (default:'boundary'=500).")
        x_t.append(x)
示例#5
0
def correlated_wandering(T, nSteps, ro, sigma, x_0, t_0=0):

	ex._check_params(T, nSteps, t_0)
示例#6
0
def DampedOscillator(T, nSteps, sigma, lambda_, omega, x_0, y_0, t_0=0):
    
	ex._check_params(T, nSteps, t_0)

	x_t, y_t = [], []
示例#7
0
def linear_system(T, nSteps, x_0, y_0, t_0=0):
   
	ex._check_params(T, nSteps, t_0)