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
Let's find the value of $s$ that maximizes $c^*$ using [scipy.optimize.minimize_scalar](https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.minimize_scalar.html#scipy.optimize.minimize_scalar).
464
+
We will use $-c^*(s)$ since `minimize_scalar` finds the minimum value.
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).
511
+
512
+
```{code-cell} ipython3
513
+
from sympy import solve, Symbol
514
+
```
515
+
516
+
```{code-cell} ipython3
517
+
s_symbol = Symbol('s', real=True)
518
+
k = ((s_symbol * A) / delta)**(1/(1 - alpha))
519
+
c = (1 - s_symbol) * A * k ** alpha
520
+
```
521
+
522
+
Let's differentiate $c$ and solve using [sympy.solve](https://docs.sympy.org/latest/modules/solvers/solvers.html#sympy.solvers.solvers.solve)
523
+
524
+
```{code-cell} ipython3
525
+
# Solve using sympy
526
+
s_star = solve(c.diff())[0]
527
+
print(f"s_star = {s_star}")
528
+
```
529
+
496
530
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).
0 commit comments