You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 5efda54
Browse filesBrowse the repository at this point in the historyBrowse files
Fix inconsistent code-cell language specifications (#756)
* misc
* Fix inconsistent code-cell language specifications in optimal savings lectures
Standardize code-cell language specifications to eliminate jupytext UserWarnings:
- os_egm_jax.md: Change ipython to python3 (no IPython magics used)
- os_stochastic.md: Change ipython to python3 (no IPython magics used)
- os_time_iter.md: Change all cells to ipython (uses !pip install magic)
These changes ensure consistent language specifications within each notebook,
resolving warnings during jupytext conversion while maintaining functionality.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
---------
Co-authored-by: Claude <[email protected]>
Copy file name to clipboardExpand all lines: lectures/os_stochastic.md
+15-22Lines changed: 15 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -62,7 +62,7 @@ More information on this savings problem can be found in
62
62
63
63
Let's start with some imports:
64
64
65
-
```{code-cell}ipython
65
+
```{code-cell}python3
66
66
import matplotlib.pyplot as plt
67
67
import numpy as np
68
68
from scipy.interpolate import interp1d
@@ -270,7 +270,7 @@ The term $\int v(f(x - c) z) \phi(dz)$ can be understood as the expected next pe
270
270
* the state is $x$
271
271
* consumption is set to $c$
272
272
273
-
As shown in [DP1](https://dp.quantecon.org/), Theorem 10.1.11 and a range of other texts,
273
+
As shown in [DP1](https://dp.quantecon.org/) and a range of other texts,
274
274
the value function $v^*$ satisfies the Bellman equation.
275
275
276
276
In other words, {eq}`fpb30` holds when $v=v^*$.
@@ -313,10 +313,9 @@ function.
313
313
314
314
In our setting, we have the following key result
315
315
316
-
* A feasible consumption policy is optimal if and only if it is $v^*$-greedy.
317
-
318
-
The intuition is similar to the intuition for the Bellman equation, which was
319
-
provided after {eq}`fpb30`.
316
+
```{prf:theorem}
317
+
A feasible consumption policy is optimal if and only if it is $v^*$-greedy.
318
+
```
320
319
321
320
See, for example, Theorem 10.1.11 of [EDTC](https://johnstachurski.net/edtc.html).
322
321
@@ -359,7 +358,7 @@ v(x)
359
358
= Tv(x)
360
359
= \max_{0 \leq c \leq x}
361
360
\left\{
362
-
u(c) + \beta \int v^*(f(x - c) z) \phi(dz)
361
+
u(c) + \beta \int v(f(x - c) z) \phi(dz)
363
362
\right\}
364
363
$$
365
364
@@ -515,20 +514,18 @@ def create_model(
515
514
We set up the right-hand side of the Bellman equation
Copy file name to clipboardExpand all lines: lectures/os_time_iter.md
+18-16Lines changed: 18 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -84,22 +84,23 @@ Recall the Bellman equation
84
84
```{math}
85
85
:label: cpi_fpb30
86
86
87
-
v^*(x) = \max_{0 \leq c \leq x}
87
+
v(x) = \max_{0 \leq c \leq x}
88
88
\left\{
89
-
u(c) + \beta \int v^*(f(x - c) z) \phi(dz)
89
+
u(c) + \beta \int v(f(x - c) z) \phi(dz)
90
90
\right\}
91
91
\quad \text{for all} \quad
92
92
x \in \mathbb R_+
93
93
```
94
94
95
-
Let the optimal consumption policy be denoted by $\sigma^*$.
95
+
Let $v^*$ be the value function and let $\sigma^*$ be the optimal consumption policy.
96
96
97
-
We know that $\sigma^*$ is a $v^*$-greedy policy so that $\sigma^*(x)$ is the maximizer in {eq}`cpi_fpb30`.
97
+
We know that $\sigma^*$ is a $v^*$-greedy policy.
98
98
99
99
The conditions above imply that
100
100
101
101
* $\sigma^*$ is the unique optimal policy for the optimal savings problem
102
-
* the optimal policy is continuous, strictly increasing and also **interior**, in the sense that $0 < \sigma^*(x) < x$ for all strictly positive $x$, and
102
+
* the optimal policy is continuous, strictly increasing and also **interior**,
103
+
in the sense that $0 < \sigma^*(x) < x$ for all strictly positive $x$, and
103
104
* the value function is strictly concave and continuously differentiable, with
104
105
105
106
```{math}
@@ -108,7 +109,8 @@ The conditions above imply that
The last result is called the **envelope condition** due to its relationship with the [envelope theorem](https://en.wikipedia.org/wiki/Envelope_theorem).
112
+
The last result is called the **envelope condition** due to its relationship
113
+
with the [envelope theorem](https://en.wikipedia.org/wiki/Envelope_theorem).
112
114
113
115
To see why {eq}`cpi_env` holds, write the Bellman equation in the equivalent
114
116
form
@@ -278,7 +280,7 @@ As in {doc}`os_stochastic`, we assume that
278
280
This allows us to compare our results to the analytical solutions we obtained in
279
281
that lecture:
280
282
281
-
```{code-cell}python3
283
+
```{code-cell}ipython
282
284
def v_star(x, α, β, μ):
283
285
"""
284
286
True value function
@@ -303,7 +305,7 @@ For this we need access to the functions $u'$ and $f, f'$.
303
305
304
306
We use the same `Model` structure from {doc}`os_stochastic`.
305
307
306
-
```{code-cell}python3
308
+
```{code-cell}ipython
307
309
class Model(NamedTuple):
308
310
u: Callable # utility function
309
311
f: Callable # production function
@@ -379,7 +381,7 @@ state $x$ and $σ$, the current guess of the policy.
379
381
380
382
Here's the operator $K$, that implements the root-finding step.
0 commit comments