Skip to content

Commit 02dd8b3

Browse files
committed
update math symbols
1 parent 1377f9b commit 02dd8b3

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

lectures/markov_chains.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -905,12 +905,13 @@ n_state = P.shape[1]
905905
fig, axes = plt.subplots(nrows=1, ncols=n_state)
906906
ψ_star = mc.stationary_distributions[0]
907907
plt.subplots_adjust(wspace=0.35)
908+
908909
for i in range(n_state):
909910
axes[i].grid()
910911
axes[i].axhline(ψ_star[i], linestyle='dashed', lw=2, color = 'black',
911912
label = fr'$\psi^*({i})$')
912913
axes[i].set_xlabel('t')
913-
axes[i].set_ylabel(fr'average time spent at {i}')
914+
axes[i].set_ylabel(f'fraction of time spent at {i}')
914915
915916
# Compute the fraction of time spent, starting from different x_0s
916917
for x0, col in ((0, 'blue'), (1, 'green'), (2, 'red')):
@@ -970,13 +971,14 @@ mc = MarkovChain(P)
970971
n_state = P.shape[1]
971972
fig, axes = plt.subplots(nrows=1, ncols=n_state)
972973
ψ_star = mc.stationary_distributions[0]
974+
973975
for i in range(n_state):
974976
axes[i].grid()
975977
axes[i].set_ylim(0.45, 0.55)
976978
axes[i].axhline(ψ_star[i], linestyle='dashed', lw=2, color = 'black',
977979
label = fr'$\psi^*({i})$')
978980
axes[i].set_xlabel('t')
979-
axes[i].set_ylabel(fr'average time spent at {i}')
981+
axes[i].set_ylabel(f'fraction of time spent at {i}')
980982
981983
# Compute the fraction of time spent, for each x
982984
for x0 in range(n_state):
@@ -1103,9 +1105,9 @@ for x0 in x0s:
11031105
11041106
for i in range(n_state):
11051107
axes[i].axhline(ψ_star[i], linestyle='dashed', lw=2, color = 'black',
1106-
label = fr'$\psi^*(i)$')
1108+
label = fr'$\psi^*({i})$')
11071109
axes[i].set_xlabel('t')
1108-
axes[i].set_ylabel(fr'$\psi(i)$')
1110+
axes[i].set_ylabel(fr'$\psi({i})$')
11091111
axes[i].legend()
11101112
11111113
plt.show()
@@ -1142,9 +1144,9 @@ for x0 in x0s:
11421144
axes[i].plot(range(20, n), X[20:,i], alpha=0.3)
11431145
11441146
for i in range(n_state):
1145-
axes[i].axhline(ψ_star[i], linestyle='dashed', lw=2, color = 'black', label = fr'$\psi^* ({i})$')
1147+
axes[i].axhline(ψ_star[i], linestyle='dashed', lw=2, color = 'black', label = fr'$\psi^*({i})$')
11461148
axes[i].set_xlabel('t')
1147-
axes[i].set_ylabel(fr'$\psi(i)$')
1149+
axes[i].set_ylabel(fr'$\psi({i})$')
11481150
axes[i].legend()
11491151
11501152
plt.show()
@@ -1339,11 +1341,11 @@ ax.axhline(0, linestyle='dashed', lw=2, color = 'black', alpha=0.4)
13391341
13401342
13411343
for x0 in range(8):
1342-
# Calculate the average time for each worker
1344+
# Calculate the fraction of time for each worker
13431345
X_bar = (X == x0).cumsum() / (1 + np.arange(N, dtype=float))
13441346
ax.plot(X_bar - ψ_star[x0], label=f'$X = {x0+1} $')
13451347
ax.set_xlabel('t')
1346-
ax.set_ylabel(fr'average time spent in a state $- \psi^* (x)$')
1348+
ax.set_ylabel(r'fraction of time spent in a state $- \psi^* (x)$')
13471349
13481350
ax.legend()
13491351
plt.show()

0 commit comments

Comments
 (0)