Skip to content

Commit 8209359

Browse files
committed
change function name
1 parent 1bcbb1d commit 8209359

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

lectures/markov_chains.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1070,7 +1070,7 @@ Let's pick an initial distribution $\psi$ and trace out the sequence of distribu
10701070
First, 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
10971097
ax.scatter(ψs[:,0], ψs[:,1], ψs[:,2], c='r', s=60)
10981098
ax.view_init(30, 210)
@@ -1151,7 +1151,7 @@ plt.subplots_adjust(wspace=0.35)
11511151
ψ_0s = generate_initial_values(n, n_state)
11521152
11531153
for ψ_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.
11771177
In the case of our periodic chain, we find the distribution is oscillating
11781178

11791179
```{code-cell} ipython3
1180-
import random
1181-
11821180
P = np.array([[0, 1],
11831181
[1, 0]])
11841182
n = 50
@@ -1190,7 +1188,7 @@ fig, axes = plt.subplots(nrows=1, ncols=n_state)
11901188
ψ_0s = generate_initial_values(n, n_state)
11911189
11921190
for ψ_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

Comments
 (0)