# Functions determining the walkers where to go (right-left or up-down)
# 2 independent walkers are considered
def right_left(step_rl):
return (step_rl-1)*(step_rl+1)*(3-step_rl)/3
def up_down(step_ud):
return step_ud*(step_ud-2)*(step_ud-4)/3
# *************************************************
P1 = []
P2 = []
step_x1 = 0
step_y1 = 0
step_x2 = 0
step_y2 = 0
for i in range(40000):
rand_xy1 = np.random.random_integers(0,3)
step_x1 = step_x1 + right_left(rand_xy1)
step_y1 = step_y1 + up_down(rand_xy1)
P1.append([step_x1, step_y1])
rand_xy2 = np.random.random_integers(0,3)
step_x2 = step_x2 + right_left(rand_xy2)
step_y2 = step_y2 + up_down(rand_xy2)
P2.append([step_x2, step_y2])
W2d_1 = list_plot(P1, color = "red", plotjoined = True, axes = False)
W2d_2 = list_plot(P2, color = "black", plotjoined = True, axes = False)
W2d_1 + W2d_2