@@ -3,10 +3,12 @@ jupytext:
33 text_representation :
44 extension : .md
55 format_name : myst
6+ format_version : 0.13
7+ jupytext_version : 1.17.1
68kernelspec :
7- display_name : Python 3
8- language : python
99 name : python3
10+ display_name : Python 3 (ipykernel)
11+ language : python
1012---
1113
1214(lqc)=
@@ -29,10 +31,9 @@ kernelspec:
2931
3032除了Anaconda中已有的库外,本讲座还需要以下库:
3133
32- ``` {code-cell} ipython
33- ---
34- tags: [hide-output]
35- ---
34+ ``` {code-cell} ipython3
35+ :tags: [hide-output]
36+
3637!pip install quantecon
3738```
3839
@@ -70,7 +71,7 @@ tags: [hide-output]
7071
7172让我们从一些导入开始:
7273
73- ``` {code-cell} ipython
74+ ``` {code-cell} ipython3
7475import matplotlib.pyplot as plt
7576import matplotlib as mpl
7677FONTPATH = "fonts/SourceHanSerifSC-SemiBold.otf"
705706这个消费者比之前的更有耐心,因此对后期消费赋予相对更大的权重。
706707
707708``` {code-cell} ipython3
708- ---
709- tags: [output_scroll]
710- ---
709+ :tags: [output_scroll]
710+
711711# 计算解并模拟
712712lq = LQ(Q, R, A, B, C, beta=0.96, T=T, Rf=Rf)
713713x0 = (0, 1)
@@ -1296,7 +1296,6 @@ for ax in axes:
12961296 ax.grid()
12971297 ax.set_xlabel('时间')
12981298 ax.legend(ncol=2, **legend_args)
1299-
13001299plt.show()
13011300```
13021301
@@ -1436,7 +1435,6 @@ for ax in axes:
14361435 ax.grid()
14371436 ax.set_xlabel('时间')
14381437 ax.legend(ncol=2, **legend_args)
1439-
14401438plt.show()
14411439```
14421440
@@ -1528,7 +1526,7 @@ q = xp[1, :]
15281526# 绘制模拟结果
15291527fig, ax = plt.subplots(figsize=(10, 6.5))
15301528
1531- # 一些复杂的绘图设置 -- 如果你愿意可以简化
1529+ # 一些复杂的绘图设置
15321530bbox = (0., 1.01, 1., .101)
15331531legend_args = {'bbox_to_anchor': bbox, 'loc': 3, 'mode': 'expand'}
15341532p_args = {'lw': 2, 'alpha': 0.6}
@@ -1538,11 +1536,10 @@ ax.set(xlabel='时间', xlim=(0, max(time)))
15381536ax.plot(time, q_bar, 'k-', lw=2, alpha=0.6, label=r'$\bar q_t$')
15391537ax.plot(time, q, 'b-', lw=2, alpha=0.6, label='$q_t$')
15401538ax.legend(ncol=2, **legend_args)
1541- s = f'动态过程,其中 $\gamma = {γ}$'
1542- ax.text(max (time) * 0.6 , 1 * q_bar.max(), s, fontsize=14)
1539+ s = fr'给定 $\gamma = {γ}$下的动态过程 '
1540+ ax.text(min (time) + 1 , 1 * q_bar.max(), s, fontsize=14)
15431541plt.show()
15441542```
15451543
15461544``` {solution-end}
15471545```
1548-
0 commit comments