Skip to content

Commit 064c47b

Browse files
authored
[two_computation] Embed Data in Lecture into Hidden code cell (#811)
* embed data into the lecture * updates
1 parent ac29181 commit 064c47b

File tree

3 files changed

+31
-3
lines changed

3 files changed

+31
-3
lines changed

lectures/eff.npy

-480 Bytes
Binary file not shown.

lectures/psurv.npy

-648 Bytes
Binary file not shown.

lectures/two_computation.md

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,36 @@ UNIT_GRID = jnp.linspace(0.0, 1.0, N_GRID_SS)
557557
AGE_INDICES = jnp.arange(T0 + 2)
558558
```
559559

560-
We load the age-efficiency profile $\{\varepsilon_t\}$ and the survival probabilities $\{\alpha_t\}$ from data files based on {cite:t}`faber1982life` and {cite:t}`hansen1993cyclical`.
560+
The hidden code cell below defines the age-efficiency profile $\{\varepsilon_t\}$ and the survival probabilities $\{\alpha_t\}$ based on {cite:t}`faber1982life` and {cite:t}`hansen1993cyclical`.
561+
562+
```{code-cell} ipython3
563+
:tags: [hide-cell]
564+
565+
ε_arr = jnp.array([
566+
0.59031284, 0.62902188, 0.66773093, 0.70643996, 0.745149,
567+
0.78385804, 0.82256708, 0.86127611, 0.89998515, 0.92861368,
568+
0.94716179, 0.9657099, 0.98425792, 1.002806, 1.0211928,
569+
1.0399022, 1.0584503, 1.0769984, 1.0955465, 1.1056269,
570+
1.1072398, 1.1088527, 1.1104656, 1.1120784, 1.1136913,
571+
1.1153042, 1.116917, 1.1185299, 1.1201428, 1.1185299,
572+
1.1136913, 1.1088527, 1.1040141, 1.0991755, 1.0943368,
573+
1.0894981, 1.0846595, 1.0798209, 1.0749823, 1.0611115,
574+
1.0382087, 1.0153058, 0.99240301, 0.96958081
575+
])
576+
577+
α_arr = jnp.array([
578+
1.0, 0.99851, 0.99844, 0.99838, 0.99832, 0.99826, 0.9982,
579+
0.99816, 0.99815, 0.99819, 0.99826, 0.99834, 0.9984, 0.99843,
580+
0.99841, 0.99835, 0.99828, 0.99818, 0.99807, 0.99794, 0.99778,
581+
0.99759, 0.99737, 0.99712, 0.99684, 0.99653, 0.99619, 0.9958,
582+
0.99535, 0.99481, 0.99419, 0.9935, 0.99278, 0.99209, 0.99148,
583+
0.99088, 0.99021, 0.98942, 0.98851, 0.98746, 0.98625, 0.98495,
584+
0.9835, 0.98178, 0.97974, 0.97743, 0.97489, 0.97226, 0.96965,
585+
0.96715, 0.96466, 0.962, 0.95907, 0.9559, 0.95246, 0.94872,
586+
0.9446, 0.94017, 0.93555, 0.93077, 0.9257, 0.9203, 0.91431,
587+
0.90742, 0.89948
588+
])
589+
```
561590

562591
```{code-cell} ipython3
563592
---
@@ -566,7 +595,6 @@ mystnb:
566595
caption: Age-efficiency profile and survival probabilities
567596
name: two_comp_profiles
568597
---
569-
ε_arr, α_arr = jnp.load("eff.npy"), jnp.load("psurv.npy")
570598
571599
fig, axs = plt.subplots(1, 2, figsize=(10, 6))
572600
@@ -1239,7 +1267,7 @@ ss1 = ss_target_debt2gdp_exo(
12391267
ss0.debt2gdp, (τ_a_0, τ_0_0, 0, G_0), (RR_exo, w_exo), hh, tech
12401268
)
12411269
1242-
print(f"\nTerminal Steady State (s ≥ s₃):")
1270+
print(f"\nTerminal Steady State (s >= s3):")
12431271
print(f" Labor tax τ_l = {ss1.τ_l:.4f}")
12441272
print(f" Benefits θ = 0")
12451273
print(f" Capital/GDP = {ss1.k2gdp:.4f}")

0 commit comments

Comments
 (0)