Skip to content

Commit a6ce261

Browse files
committed
Merge branch 'main' into markov-chain
2 parents 2dc6518 + e8dfb38 commit a6ce261

File tree

6 files changed

+67
-93
lines changed

6 files changed

+67
-93
lines changed

.github/workflows/cache.yml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,19 @@ jobs:
1818
python-version: 3.9
1919
environment-file: environment.yml
2020
activate-environment: quantecon
21-
- name: Install latex dependencies
22-
run: |
23-
sudo apt-get -qq update
24-
sudo apt-get install -y \
25-
texlive-latex-recommended \
26-
texlive-latex-extra \
27-
texlive-fonts-recommended \
28-
texlive-fonts-extra \
29-
texlive-xetex \
30-
latexmk \
31-
xindy \
32-
dvipng \
33-
cm-super
21+
# - name: Install latex dependencies
22+
# run: |
23+
# sudo apt-get -qq update
24+
# sudo apt-get install -y \
25+
# texlive-latex-recommended \
26+
# texlive-latex-extra \
27+
# texlive-fonts-recommended \
28+
# texlive-fonts-extra \
29+
# texlive-xetex \
30+
# latexmk \
31+
# xindy \
32+
# dvipng \
33+
# cm-super
3434
- name: Build HTML
3535
shell: bash -l {0}
3636
run: |

.github/workflows/ci.yml

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,19 @@ jobs:
1515
python-version: 3.9
1616
environment-file: environment.yml
1717
activate-environment: quantecon
18-
- name: Install latex dependencies
19-
run: |
20-
sudo apt-get -qq update
21-
sudo apt-get install -y \
22-
texlive-latex-recommended \
23-
texlive-latex-extra \
24-
texlive-fonts-recommended \
25-
texlive-fonts-extra \
26-
texlive-xetex \
27-
latexmk \
28-
xindy \
29-
dvipng \
30-
cm-super
18+
# - name: Install latex dependencies
19+
# run: |
20+
# sudo apt-get -qq update
21+
# sudo apt-get install -y \
22+
# texlive-latex-recommended \
23+
# texlive-latex-extra \
24+
# texlive-fonts-recommended \
25+
# texlive-fonts-extra \
26+
# texlive-xetex \
27+
# latexmk \
28+
# xindy \
29+
# dvipng \
30+
# cm-super
3131
- name: Display Conda Environment Versions
3232
shell: bash -l {0}
3333
run: conda list
@@ -62,11 +62,12 @@ jobs:
6262
run: |
6363
rm -r _build/.doctrees
6464
jb build lectures --path-output ./
65-
- name: Save Build as Artifact
66-
uses: actions/upload-artifact@v1
65+
- name: Upload Execution Reports (HTML)
66+
uses: actions/upload-artifact@v2
67+
if: failure()
6768
with:
68-
name: _build
69-
path: _build
69+
name: execution-reports
70+
path: _build/html/reports
7071
- name: Preview Deploy to Netlify
7172
uses: nwtgck/actions-netlify@v1.1
7273
with:

.github/workflows/publish.yml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,19 @@ jobs:
1919
python-version: 3.9
2020
environment-file: environment.yml
2121
activate-environment: quantecon
22-
- name: Install latex dependencies
23-
run: |
24-
sudo apt-get -qq update
25-
sudo apt-get install -y \
26-
texlive-latex-recommended \
27-
texlive-latex-extra \
28-
texlive-fonts-recommended \
29-
texlive-fonts-extra \
30-
texlive-xetex \
31-
latexmk \
32-
xindy \
33-
dvipng \
34-
cm-super
22+
# - name: Install latex dependencies
23+
# run: |
24+
# sudo apt-get -qq update
25+
# sudo apt-get install -y \
26+
# texlive-latex-recommended \
27+
# texlive-latex-extra \
28+
# texlive-fonts-recommended \
29+
# texlive-fonts-extra \
30+
# texlive-xetex \
31+
# latexmk \
32+
# xindy \
33+
# dvipng \
34+
# cm-super
3535
- name: Display Conda Environment Versions
3636
shell: bash -l {0}
3737
run: conda list

lectures/_config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,6 @@ sphinx:
4141
binderhub_url : https://mybinder.org # The URL of the BinderHub (e.g., https://mybinder.org)
4242
colab_url : https://colab.research.google.com
4343
thebe : false # Add a thebe button to pages (requires the repository to run on Binder)
44-
mathjax_path: https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-svg.js
44+
mathjax_path: https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js
4545
rediraffe_redirects:
4646
index_toc.md: intro.md

lectures/_toc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ parts:
1212
numbered: true
1313
chapters:
1414
- file: schelling
15-
# - file: solow
15+
- file: solow
1616
- caption: Other
1717
numbered: true
1818
chapters:

in-work/solow.md renamed to lectures/solow.md

Lines changed: 21 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,13 @@ jupytext:
33
text_representation:
44
extension: .md
55
format_name: myst
6-
format_version: 0.13
7-
jupytext_version: 1.14.1
86
kernelspec:
9-
display_name: Python 3 (ipykernel)
7+
display_name: Python 3
108
language: python
119
name: python3
1210
---
1311

12+
(solow)=
1413
# The Solow-Swan Growth Model
1514

1615
In this lecture we review a famous model due
@@ -51,7 +50,7 @@ that
5150

5251
$$
5352
F(\lambda K, \lambda L) = \lambda F(K, L)
54-
\quad \text{for all } \lambda \geq 0.
53+
\quad \text{for all } \lambda \geq 0
5554
$$
5655

5756
Production functions with this property include
@@ -73,7 +72,7 @@ becomes $1-\delta$ units tomorrow.
7372
Thus,
7473

7574
$$
76-
K_{t+1} = s F(K_t, L_t) + (1 - \delta) K_t.
75+
K_{t+1} = s F(K_t, L_t) + (1 - \delta) K_t
7776
$$
7877

7978

@@ -84,7 +83,7 @@ Setting $k_t := K_t / L$ and using homogeneity of degree one now yields
8483
$$
8584
k_{t+1}
8685
= s \frac{F(K_t, L)}{L} + (1 - \delta) k_t
87-
= s F(k_t, 1) + (1 - \delta) k_t.
86+
= s F(k_t, 1) + (1 - \delta) k_t
8887
$$
8988

9089

@@ -93,7 +92,7 @@ With $f(k) := F(k, 1)$, the final expression for capital dynamics is
9392
```{math}
9493
:label: solow
9594
k_{t+1} = g(k_t)
96-
\text{ where } g(k) := s f(k) + (1 - \delta) k.
95+
\text{ where } g(k) := s f(k) + (1 - \delta) k
9796
```
9897

9998
Our aim is to learn about the evolution of $k_t$ over time,
@@ -114,7 +113,6 @@ $\alpha=0.3$, $s=0.3$ and $\delta=0.4$.
114113
The function $g$ from {eq}`solow` is then plotted, along with the 45
115114
degree line.
116115

117-
+++
118116

119117
Let's define the constants.
120118

@@ -195,14 +193,12 @@ It solves $k = s Ak^{\alpha} + (1-\delta)k$ and hence is given by
195193

196194
```{math}
197195
:label: kstarss
198-
k^* := \left( \frac{s A}{\delta} \right)^{1/(1 - \alpha)}.
196+
k^* := \left( \frac{s A}{\delta} \right)^{1/(1 - \alpha)}
199197
```
200198
If initial capital is below $k^*$, then capital increases over time.
201199

202200
If initial capital is above this level, then the reverse is true.
203201

204-
+++
205-
206202
Let's plot the 45 degree diagram to show the $k^*$ in the plot
207203

208204
```{code-cell} ipython3
@@ -222,8 +218,6 @@ three distinct initial conditions, under the parameterization listed above.
222218

223219
At this parameterization, $k^* \approx 1.78$.
224220

225-
+++
226-
227221
Let's define the constants and three distinct intital conditions
228222

229223
```{code-cell} ipython3
@@ -268,8 +262,6 @@ simulate_ts(x0, ts_length)
268262

269263
As expected, the time paths in the figure both converge to this value.
270264

271-
+++
272-
273265
## Growth in Continuous Time
274266

275267
In this section we investigate a continuous time version of the Solow--Swan
@@ -287,7 +279,7 @@ A simple rearrangement gives the rate of change per unit of time:
287279
$$
288280
\Delta k_t = s f(k_t) - \delta k_t
289281
\quad \text{where} \quad
290-
\Delta k_t := k_{t+1} - k_t.
282+
\Delta k_t := k_{t+1} - k_t
291283
$$
292284

293285
Taking the time step to zero gives the continuous time limit
@@ -296,7 +288,7 @@ Taking the time step to zero gives the continuous time limit
296288
:label: solowc
297289
k'_t = s f(k_t) - \delta k_t
298290
\qquad \text{with} \qquad
299-
k'_t := \frac{d}{dt} k_t.
291+
k'_t := \frac{d}{dt} k_t
300292
```
301293

302294
Our aim is to learn about the evolution of $k_t$ over time,
@@ -324,8 +316,6 @@ When $g(k) < 0$, the opposite occurs. Once again, high marginal returns to
324316
savings at low levels of capital combined with low rates of return at high
325317
levels of capital combine to yield global stability.
326318

327-
+++
328-
329319
To see this in a figure, let's define the constants
330320

331321
```{code-cell} ipython3
@@ -395,7 +385,7 @@ linear differential equation
395385

396386
```{math}
397387
:label: xsolow
398-
x'_t = (1-\alpha) (sA - \delta x_t).
388+
x'_t = (1-\alpha) (sA - \delta x_t)
399389
```
400390

401391
This equation has the exact solution
@@ -406,7 +396,7 @@ $$
406396
k_0^{1-\alpha} - \frac{sA}{\delta}
407397
\right)
408398
\mathrm{e}^{-\delta (1-\alpha) t} +
409-
\frac{sA}{\delta}.
399+
\frac{sA}{\delta}
410400
$$
411401

412402
(You can confirm that this function $x_t$ satisfies {eq}`xsolow` by
@@ -424,41 +414,34 @@ Converting back to $k_t$ yields
424414
\right)
425415
\mathrm{e}^{-\delta (1-\alpha) t} +
426416
\frac{sA}{\delta}
427-
\right]^{1/(1-\alpha)}.
417+
\right]^{1/(1-\alpha)}
428418
```
429419

430420
Since $\delta > 0$ and $\alpha \in (0, 1)$, we see immediately that $k_t \to
431421
k^*$ as $t \to \infty$ independent of $k_0$.
432422

433423
Thus, global stability holds.
434424

435-
+++
436-
437425
## Exercises
438426

439-
```{exercise-start}
440-
:label: ex1
441-
```
442-
### Exercise 1
427+
```{exercise}
428+
:label: solow_ex1
443429
444-
plot per capita consumption $c$ at the steady state, as a function of the savings rate $s$, where $0 \leq s \leq 1$.
430+
Plot per capita consumption $c$ at the steady state, as a function of the savings rate $s$, where $0 \leq s \leq 1$.
445431
446432
Use the Cobb--Douglas specification $f(k) = A k^\alpha$.
447433
448434
Set $A=2.0, \alpha=0.3,$ and $\delta=0.5$
449435
450436
Also, find the approximate value of $s$ that maximizes the $C^*(s)$ and show it in the plot.
451437
452-
```{exercise-end}
453438
```
454439

455-
```{solution-start} ex1
440+
```{solution-start} solow_ex1
456441
:class: dropdown
457442
```
458443

459-
+++
460-
461-
Steady state consumption at savings rate $s$ is given by
444+
Steady state consumption at savings rate $s$ is given by
462445

463446

464447
$$
@@ -515,14 +498,10 @@ Incidentally, the rate of savings which maximizes steady state level of per capi
515498
```{solution-end}
516499
```
517500

518-
+++
519-
520501
```{exercise-start}
521-
:label: ex2
502+
:label: solow_ex2
522503
```
523-
### Exercise 2
524-
525-
#### Stochastic Productivity
504+
**Stochastic Productivity**
526505

527506
To bring the Solow--Swan model closer to data, we need to think about handling
528507
random fluctuations in aggregate quantities.
@@ -540,7 +519,7 @@ Dynamics are now
540519

541520
```{math}
542521
:label: solowran
543-
k_{t+1} = s A_{t+1} f(k_t) + (1 - \delta) k_t.
522+
k_{t+1} = s A_{t+1} f(k_t) + (1 - \delta) k_t
544523
```
545524

546525
We suppose $f$ is Cobb--Douglas and $(A_t)$ is IID and lognormal.
@@ -555,9 +534,7 @@ Generate and plot the time series $k_t$.
555534
```{exercise-end}
556535
```
557536

558-
+++
559-
560-
```{solution-start} ex2
537+
```{solution-start} solow_ex2
561538
:class: dropdown
562539
```
563540

@@ -614,7 +591,3 @@ ts_plot(x0, 50)
614591

615592
```{solution-end}
616593
```
617-
618-
```{code-cell} ipython3
619-
620-
```

0 commit comments

Comments
 (0)