@@ -905,12 +905,13 @@ n_state = P.shape[1]
905905fig, axes = plt.subplots(nrows=1, ncols=n_state)
906906ψ_star = mc.stationary_distributions[0]
907907plt.subplots_adjust(wspace=0.35)
908+
908909for 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)
970971n_state = P.shape[1]
971972fig, axes = plt.subplots(nrows=1, ncols=n_state)
972973ψ_star = mc.stationary_distributions[0]
974+
973975for 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
11041106for 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
11111113plt.show()
@@ -1142,9 +1144,9 @@ for x0 in x0s:
11421144 axes[i].plot(range(20, n), X[20:,i], alpha=0.3)
11431145
11441146for 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
11501152plt.show()
@@ -1339,11 +1341,11 @@ ax.axhline(0, linestyle='dashed', lw=2, color = 'black', alpha=0.4)
13391341
13401342
13411343for 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
13481350ax.legend()
13491351plt.show()
0 commit comments