Skip to content

Commit 81c01fc

Browse files
jstacclaude
andcommitted
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 <noreply@anthropic.com>
1 parent 1cb2924 commit 81c01fc

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

lectures/os_egm_jax.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ We'll also use JAX's `vmap` function to fully vectorize the Coleman-Reffett oper
3939

4040
Let's start with some standard imports:
4141

42-
```{code-cell} ipython
42+
```{code-cell} python3
4343
import matplotlib.pyplot as plt
4444
import jax
4545
import jax.numpy as jnp

lectures/os_stochastic.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ More information on this savings problem can be found in
6262

6363
Let's start with some imports:
6464

65-
```{code-cell} ipython
65+
```{code-cell} python3
6666
import matplotlib.pyplot as plt
6767
import numpy as np
6868
from scipy.interpolate import interp1d

lectures/os_time_iter.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ As in {doc}`os_stochastic`, we assume that
280280
This allows us to compare our results to the analytical solutions we obtained in
281281
that lecture:
282282

283-
```{code-cell} python3
283+
```{code-cell} ipython
284284
def v_star(x, α, β, μ):
285285
"""
286286
True value function
@@ -305,7 +305,7 @@ For this we need access to the functions $u'$ and $f, f'$.
305305

306306
We use the same `Model` structure from {doc}`os_stochastic`.
307307

308-
```{code-cell} python3
308+
```{code-cell} ipython
309309
class Model(NamedTuple):
310310
u: Callable # utility function
311311
f: Callable # production function
@@ -381,7 +381,7 @@ state $x$ and $σ$, the current guess of the policy.
381381

382382
Here's the operator $K$, that implements the root-finding step.
383383

384-
```{code-cell} ipython3
384+
```{code-cell} ipython
385385
def K(σ: np.ndarray, model: Model) -> np.ndarray:
386386
"""
387387
The Coleman-Reffett operator
@@ -404,7 +404,7 @@ def K(σ: np.ndarray, model: Model) -> np.ndarray:
404404

405405
Let's generate an instance and plot some iterates of $K$, starting from $σ(x) = x$.
406406

407-
```{code-cell} python3
407+
```{code-cell} ipython
408408
# Define utility and production functions with derivatives
409409
α = 0.4
410410
u = lambda c: np.log(c)
@@ -443,7 +443,7 @@ Here is a function called `solve_model_time_iter` that takes an instance of
443443
using time iteration.
444444

445445

446-
```{code-cell} python3
446+
```{code-cell} ipython
447447
def solve_model_time_iter(
448448
model: Model,
449449
σ_init: np.ndarray,
@@ -475,7 +475,7 @@ def solve_model_time_iter(
475475

476476
Let's call it:
477477

478-
```{code-cell} python3
478+
```{code-cell} ipython
479479
# Unpack
480480
grid = model.grid
481481
@@ -485,7 +485,7 @@ grid = model.grid
485485

486486
Here is a plot of the resulting policy, compared with the true policy:
487487

488-
```{code-cell} python3
488+
```{code-cell} ipython
489489
# Unpack
490490
grid, α, β = model.grid, model.α, model.β
491491
@@ -505,7 +505,7 @@ Again, the fit is excellent.
505505

506506
The maximal absolute deviation between the two policies is
507507

508-
```{code-cell} python3
508+
```{code-cell} ipython
509509
# Unpack
510510
grid, α, β = model.grid, model.α, model.β
511511
@@ -542,7 +542,7 @@ Compute and plot the optimal policy.
542542

543543
We define the CRRA utility function and its derivative.
544544

545-
```{code-cell} python3
545+
```{code-cell} ipython
546546
γ = 1.5
547547
548548
def u_crra(c):
@@ -558,7 +558,7 @@ model_crra = create_model(u=u_crra, f=f, α=α,
558558

559559
Now we solve and plot the policy:
560560

561-
```{code-cell} python3
561+
```{code-cell} ipython
562562
%%time
563563
# Unpack
564564
grid = model_crra.grid

0 commit comments

Comments
 (0)