@@ -1070,7 +1070,7 @@ Let's pick an initial distribution $\psi$ and trace out the sequence of distribu
10701070First, we write a function to simulate the sequence of distributions for ` n ` period
10711071
10721072``` {code-cell} ipython3
1073- def simulate_ψ (ψ_0, P, n):
1073+ def iterate_ψ (ψ_0, P, n):
10741074 ψs = np.empty((n, P.shape[0]))
10751075 ψ = ψ_0
10761076 for t in range(n):
@@ -1092,7 +1092,7 @@ ax.set(xlim=(0, 1), ylim=(0, 1), zlim=(0, 1),
10921092 yticks=(0.25, 0.5, 0.75),
10931093 zticks=(0.25, 0.5, 0.75))
10941094
1095- ψs = simulate_ψ (ψ_0, P, 20)
1095+ ψs = iterate_ψ (ψ_0, P, 20)
10961096
10971097ax.scatter(ψs[:,0], ψs[:,1], ψs[:,2], c='r', s=60)
10981098ax.view_init(30, 210)
@@ -1151,7 +1151,7 @@ plt.subplots_adjust(wspace=0.35)
11511151ψ_0s = generate_initial_values(n, n_state)
11521152
11531153for ψ_0 in ψ_0s:
1154- ψs = simulate_ψ (ψ_0, P, n)
1154+ ψs = iterate_ψ (ψ_0, P, n)
11551155
11561156 # Obtain and plot distributions at each state
11571157 for i in range(n_state):
@@ -1177,8 +1177,6 @@ The convergence to $\psi^*$ holds for different initial values.
11771177In the case of our periodic chain, we find the distribution is oscillating
11781178
11791179``` {code-cell} ipython3
1180- import random
1181-
11821180P = np.array([[0, 1],
11831181 [1, 0]])
11841182n = 50
@@ -1190,7 +1188,7 @@ fig, axes = plt.subplots(nrows=1, ncols=n_state)
11901188ψ_0s = generate_initial_values(n, n_state)
11911189
11921190for ψ_0 in ψ_0s:
1193- ψs = simulate_ψ (ψ_0, P, n)
1191+ ψs = iterate_ψ (ψ_0, P, n)
11941192
11951193 # Obtain and plot distributions at each state
11961194 for i in range(n_state):
0 commit comments