@@ -4,7 +4,7 @@ jupytext:
44 extension : .md
55 format_name : myst
66 format_version : 0.13
7- jupytext_version : 1.16.2
7+ jupytext_version : 1.16.6
88kernelspec :
99 display_name : Python 3 (ipykernel)
1010 language : python
@@ -1205,8 +1205,6 @@ constant value attained by a constrained-to-constant $\mu_t$ Ramsey planner.
12051205
12061206Now let's write some code to plot outcomes under our three timing protocols.
12071207
1208- Then we'll use the code to explore how key parameters affect outcomes.
1209-
12101208```{code-cell} ipython3
12111209:tags: [hide-input]
12121210
@@ -1218,21 +1216,21 @@ def compare_ramsey_CR(clq, ax):
12181216 """
12191217
12201218 # Calculate CR space range and bounds
1221- min_CR, max_CR = min(clq.CR_space ), max(clq.CR_space )
1222- range_CR = max_CR - min_CR
1223- l_CR, u_CR = min_CR - 0.05 * range_CR, max_CR + 0.05 * range_CR
1219+ min_J, max_J = min(clq.J_space ), max(clq.J_space )
1220+ range_J = max_J - min_J
1221+ l_J, u_J = min_J - 0.05 * range_J, max_J + 0.05 * range_J
12241222
12251223 # Set axis limits
12261224 ax.set_xlim([clq.θ_LB, clq.θ_UB])
1227- ax.set_ylim([l_CR, u_CR ])
1225+ ax.set_ylim([l_J, u_J ])
12281226
12291227 # Plot J(θ) and v^CR(θ)
1230- J_line, = ax.plot(clq.θ_space, clq.J_space, lw=2, label=r"$J(\theta)$")
12311228 CR_line, = ax.plot(clq.θ_space, clq.CR_space, lw=2, label=r"$V^{CR}(\theta)$")
1232-
1229+ J_line, = ax.plot(clq.θ_space, clq.J_space, lw=2, label=r"$J(\theta)$")
1230+
12331231 # Mark key points
12341232 θ_points, labels, θ_colors = compute_θs(clq)
1235- markers = [ax.scatter(θ, l_CR + 0.02 * range_CR , 60,
1233+ markers = [ax.scatter(θ, l_J + 0.02 * range_J , 60,
12361234 marker='v', label=label, color=color)
12371235 for θ, label, color in zip(θ_points, labels, θ_colors)]
12381236
@@ -1257,6 +1255,8 @@ def plt_clqs(clqs, axes):
12571255 axes is a list of Matplotlib axes
12581256 """
12591257 line_handles, scatter_handles = {}, {}
1258+
1259+ if not isinstance(clqs, list): clqs, axes = [clqs], [axes]
12601260
12611261 for ax, clq in zip(axes, clqs):
12621262 lines, markers = compare_ramsey_CR(clq, ax)
@@ -1315,6 +1315,15 @@ def generate_table(clqs, dig=3):
13151315 display(Math(latex_code))
13161316```
13171317
1318+ The figure below confirms the key points we discussed above
1319+
1320+ ```{code-cell} ipython3
1321+ fig, ax = plt.subplots()
1322+ plt_clqs(ChangLQ(β=0.8, c=2), ax)
1323+ ```
1324+
1325+ Now we experiment with different $\beta$ values and check how the graph changes
1326+
13181327```{code-cell} ipython3
13191328# Compare different β values
13201329fig, axes = plt.subplots(1, 3, figsize=(12, 5))
0 commit comments