Skip to content

Commit 3b03fbb

Browse files
committed
add some notes
1 parent 63d440d commit 3b03fbb

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

lectures/olg.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,13 @@ Plot the equilibrium quantity and equilibrium price in the equilibrium plot with
746746
:class: dropdown
747747
```
748748

749-
To solve the equation we need to turn to Newton's method. `find_Rstar` is used to find $R^*_{t+1}$ by finding the zero of equation [](equilibrium_crra) using the helper function `find_Rstar_newton` for a given value of $K_t$. Similary, `find_Kstar` finds the equilibrium quantity $K^*_{t+1}$ using the value of $R^*_{t+1}$.
749+
To solve the equation we need to turn to Newton's method.
750+
751+
The function `find_Rstar` is used to find $R^*_{t+1}$ by finding
752+
the zero of equation [](equilibrium_crra) using the helper
753+
function `find_Rstar_newton` for a given value of $K_t$.
754+
755+
Similary, `find_Kstar` finds the equilibrium quantity $K^*_{t+1}$ using the value of $R^*_{t+1}$.
750756

751757
```{code-cell} ipython3
752758
def find_Rstar_newton(x, K_prev, model):
@@ -765,6 +771,8 @@ def find_Kstar(R_star, model):
765771
return model.L * (R_star / model.α)**(1/(model.α-1))
766772
```
767773

774+
The following function plots the equilibrium quantity and equilibrium price.
775+
768776
```{code-cell} ipython3
769777
def plot_ks_rs(K_t_vals, model):
770778
n = len(K_t_vals)
@@ -820,6 +828,7 @@ With the quasilinear preference the Euler equation becomes
820828
Let $k_t := K_t / L$.
821829

822830
Since [](aggregate_supply_capital_log_olg), [](wage_2) and [](interest_rate_2) the Euler equation becomes
831+
823832
```{math}
824833
:label: euler_quasilinear1
825834
1 + \theta ((1-\alpha)k^{\alpha}_t - k_{t+1})^{\theta-1} = \beta \alpha k^{\alpha - 1}_t + \beta (\alpha k^{\alpha - 1}_t)^{\theta} \theta k_{t+1}^{\theta - 1}
@@ -836,6 +845,11 @@ def u_quasilinear(c, θ=4):
836845
return c + c**θ
837846
```
838847

848+
849+
The function `find_k_next` is used to find $k_{t+1}$ by finding
850+
the root of equation [](euler_quasilinear1) using the helper
851+
function `solve_for_k_t1` for a given value of $k_t$.
852+
839853
```{code-cell} ipython3
840854
def solve_for_k_t1(x, k_t, model):
841855
α, β, L, θ = model.α, model.β, model.L, model.u.__defaults__[0]
@@ -850,6 +864,8 @@ def find_k_next(k_t, model):
850864
return optimize.newton(solve_for_k_t1, k_t, args=(k_t, model))
851865
```
852866

867+
Let's simulate and plot the time path capital $\{k_t\}$.
868+
853869
```{code-cell} ipython3
854870
def simulate_ts(k0_values, model, ts_length=10):
855871

0 commit comments

Comments
 (0)