Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions lectures/solow.md
Original file line number Diff line number Diff line change
Expand Up @@ -510,21 +510,26 @@ plt.show()
One can also try to solve this mathematically by differentiating $c^*(s)$ and solve for $\frac{d}{ds}c^*(s)=0$ using [sympy](https://www.sympy.org/en/index.html).

```{code-cell} ipython3
from sympy import solve, Symbol
from sympy import solve, Symbol, Rational
```

```{code-cell} ipython3
# Use Rational for exact symbolic computation to avoid overflow
A_sym = Rational(2)
alpha_sym = Rational(3, 10)
delta_sym = Rational(1, 2)

s_symbol = Symbol('s', real=True)
k = ((s_symbol * A) / delta)**(1/(1 - alpha))
c = (1 - s_symbol) * A * k ** alpha
k = ((s_symbol * A_sym) / delta_sym)**(1/(1 - alpha_sym))
c = (1 - s_symbol) * A_sym * k ** alpha_sym
```

Let's differentiate $c$ and solve using [sympy.solve](https://docs.sympy.org/latest/modules/solvers/solvers.html#sympy.solvers.solvers.solve)

```{code-cell} ipython3
# Solve using sympy
s_star = solve(c.diff())[0]
print(f"s_star = {s_star}")
print(f"s_star = {float(s_star)}")
```

Incidentally, the rate of savings which maximizes steady state level of per capita consumption is called the [Golden Rule savings rate](https://en.wikipedia.org/wiki/Golden_Rule_savings_rate).
Expand Down
Loading