The island council of Orrin can set the share s of output that is saved and invested. Its economy follows the Solow model: output per worker y = A\,k^{\alpha} (0 < \alpha < 1), depreciation rate delta and workforce growth n (fractions: 5 % is 0.05), and capital per worker settles at the steady state
Once there, each worker consumes what is not saved: c^*(s) = (1 - s)\,A\,k^*(s)^{\alpha}. Saving more means more capital and more output, but a smaller share of it eaten.
The council compares the saving rates in the list rates by their steady-state consumption only (it ignores the years of transition). Write best_saving(A, alpha, delta, n, rates) that returns a tuple (s_best, c_best): the rate in rates with the highest c^*, and that consumption. Two rates whose consumptions differ by at most 1e-9 count as tied; on a tie, return the smaller rate.
Press Run with plot(rates, cs, kind="scatter") on a fine grid of rates to see the hump.
Examples
Input: A = 1, alpha = 0.5, delta = 0.05, n = 0.05, rates = [0.1, 0.2, 0.3, 0.5, 0.7]
Output: (0.5, 2.5)
Explanation: here k* = (10 s)^2 and y* = 10 s, so c* = (1 - s) * 10 s:
0.9, 1.6, 2.1, 2.5, 2.1. Saving 70 % leaves less to eat than saving 50 %.
Input: A = 1, alpha = 0.5, delta = 0.05, n = 0.05, rates = [0.6, 0.4]
Output: (0.4, 2.4)
Explanation: 0.4 * 6 = 0.6 * 4 = 2.4: a tie, so the smaller rate.
Input: A = 1, alpha = 0.5, delta = 0.05, n = 0.05, rates = [1, 0]
Output: (0, 0.0)
Explanation: saving nothing leaves no capital; saving everything leaves nothing to eat.
Constraints
- answers are compared with a tolerance of
1e-6
Goals
- Compute steady-state consumption per worker for a given saving rate
- Search a list of saving rates for the one with the most steady-state consumption
- See that saving more is not always better: the golden rule