dt = T / nt ts = brownian.get_t_series(nt, dt) if which_process == 'bm': Bts = sackmat_m.make_zero_matrix(nX, nt) for i in xrange(0, nX): brownian.get_SRW_series(Bts[i], dt) values = Bts elif which_process == 'bbbm': Bts = sackmat_m.make_zero_matrix(nX, nt) Xts = sackmat_m.make_zero_matrix(nX, nt) for i in xrange(0, nX): brownian.get_SRW_series(Bts[i], dt) brownian.get_BB_series_from_BM(Xts[i], Bts[i], X0, XT, dt) values = Xts if which_process == 'bm': values = Bts elif which_process == 'bbbm': values = Xts # ---------------------------------------------------------------- # Print time-series data. if which_action == 'plot': for i in xrange(0, nt): t = ts[i] if which_process == 'bm': mean_t = 0.0 stddev_t = sqrt(t)
elif re.match(r'^nR=', arg): nR = int(arg[3:]) elif re.match(r'^nt=', arg): nt = int(arg[3:]) elif re.match(r'^X0=', arg): X0 = float(arg[3:]) elif re.match(r'^Y0=', arg): Y0 = float(arg[3:]) elif re.match(r'^XT=', arg): XT = float(arg[3:]) elif re.match(r'^YT=', arg): YT = float(arg[3:]) else: usage() dt = T / nt ts = brownian.get_t_series(nt, dt) BtXs = sackmat_m.make_zero_matrix(nR, nt) BtYs = sackmat_m.make_zero_matrix(nR, nt) Xts = sackmat_m.make_zero_matrix(nR, nt) Yts = sackmat_m.make_zero_matrix(nR, nt) for i in xrange(0, nR): brownian.get_BM_series(BtXs[i], dt) brownian.get_BM_series(BtYs[i], dt) brownian.get_BB_series_from_BM(Xts[i], BtXs[i], X0, XT, dt) brownian.get_BB_series_from_BM(Yts[i], BtYs[i], Y0, YT, dt) # ---------------------------------------------------------------- # Print time-series data. for i in xrange(0, nt): for j in xrange(0, nR): print ' %11.7f %11.7f' % (Xts[j][i], Yts[j][i]), print
elif re.match(r'^nR=', arg): nR = int (arg[3:]) elif re.match(r'^nt=', arg): nt = int (arg[3:]) elif re.match(r'^X0=', arg): X0 = float(arg[3:]) elif re.match(r'^Y0=', arg): Y0 = float(arg[3:]) elif re.match(r'^XT=', arg): XT = float(arg[3:]) elif re.match(r'^YT=', arg): YT = float(arg[3:]) else: usage() dt = T / nt ts = brownian.get_t_series(nt, dt) BtXs = sackmat_m.make_zero_matrix(nR, nt) BtYs = sackmat_m.make_zero_matrix(nR, nt) Xts = sackmat_m.make_zero_matrix(nR, nt) Yts = sackmat_m.make_zero_matrix(nR, nt) for i in xrange(0, nR): brownian.get_BM_series(BtXs[i], dt) brownian.get_BM_series(BtYs[i], dt) brownian.get_BB_series_from_BM(Xts[i], BtXs[i], X0, XT, dt) brownian.get_BB_series_from_BM(Yts[i], BtYs[i], Y0, YT, dt) # ---------------------------------------------------------------- # Print time-series data. for i in xrange(0, nt): for j in xrange(0, nR): print ' %11.7f %11.7f' % (Xts[j][i], Yts[j][i]), print