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
Improve cake eating time iteration lecture: fix alpha parameter handling and code style (#729)
This commit improves the cake_eating_time_iter.md lecture with several important fixes and enhancements:
1. **Fix alpha parameter inconsistency**: Changed f and f_prime to take α as an explicit parameter instead of capturing it from global scope. This ensures the α stored in the Model is actually used by the functions.
2. **Fix spelling and grammatical errors**:
- Fixed "first order" to "first-order" (compound adjective)
- Removed extra spaces in punctuation
- Fixed "Use same" to "Use the same"
- Removed inappropriate period after "that solves"
3. **Improve code readability**: Unpacked model attributes at the beginning of code blocks instead of repeatedly accessing them via model.attribute notation.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude <noreply@anthropic.com>
Differentiating with respect to $x$, and then evaluating at the optimum yields {eq}`cpi_env`.
123
+
Differentiating with respect to $x$, and then evaluating at the optimum yields {eq}`cpi_env`.
124
124
125
125
(Section 12.1 of [EDTC](https://johnstachurski.net/edtc.html) contains full proofs of these results, and closely related discussions can be found in many other texts.)
126
126
127
127
Differentiability of the value function and interiority of the optimal policy
128
-
imply that optimal consumption satisfies the firstorder condition associated
128
+
imply that optimal consumption satisfies the first-order condition associated
129
129
with {eq}`cpi_fpb30`, which is
130
130
131
131
```{math}
@@ -179,7 +179,7 @@ that are continuous, strictly increasing and interior.
179
179
Henceforth we denote this set of policies by $\mathscr P$
180
180
181
181
1. The operator $K$ takes as its argument a $\sigma \in \mathscr P$ and
182
-
1. returns a new function $K\sigma$, where $K\sigma(x)$ is the $c \in (0, x)$ that solves.
182
+
1. returns a new function $K\sigma$, where $K\sigma(x)$ is the $c \in (0, x)$ that solves
183
183
184
184
```{math}
185
185
:label: cpi_coledef
@@ -194,7 +194,7 @@ We call this operator the **Coleman-Reffett operator** to acknowledge the work o
194
194
In essence, $K\sigma$ is the consumption policy that the Euler equation tells
195
195
you to choose today when your future consumption policy is $\sigma$.
196
196
197
-
The important thing to note about $K$ is that, by
197
+
The important thing to note about $K$ is that, by
198
198
construction, its fixed points coincide with solutions to the functional
Time iteration runs faster than value function iteration, as discussed in {doc}`cake_eating_stochastic`.
484
514
485
-
This is because time iteration exploits differentiability and the firstorder conditions, while value function iteration does not use this available structure.
515
+
This is because time iteration exploits differentiability and the first-order conditions, while value function iteration does not use this available structure.
486
516
487
517
At the same time, there is a variation of time iteration that runs even faster.
488
518
@@ -519,7 +549,7 @@ def u_crra(c):
519
549
def u_prime_crra(c):
520
550
return c**(-γ)
521
551
522
-
# Use same production function as before
552
+
# Use the same production function as before
523
553
model_crra = create_model(u=u_crra, f=f, α=α,
524
554
u_prime=u_prime_crra, f_prime=f_prime)
525
555
```
@@ -528,13 +558,16 @@ Now we solve and plot the policy:
0 commit comments