The island of Wend produces y = A\,k^{\alpha} per person from capital k. In the Solow model the island saves a fixed share of output. Here a planner chooses instead. Each period the resources are output plus the capital left after wear, A\,k^{\alpha} + (1 - \delta)\,k; the planner splits them into consumption c and next period's capital k':
and values the infinite future by \sum_t \beta^t \ln c_t. Capital lives on the grid k \in \{h, 2h, \ldots, n\,h\} (in Python, [h * i for i in range(1, n + 1)]), and k' must be a grid point too. The value function solves
Solve it by value function iteration: start from V_0 = 0 on the whole grid, update all grid points at once, and stop after the first update whose largest change \max_k |V_{\text{new}}(k) - V_{\text{old}}(k)| is below 1e-6. The policy is the best k' for each k found in that last update; when several k' come within 1e-9 of the best value, take the smallest.
Then start at grid point number start (k_0 = h * start) and follow the policy for T periods. The saving rate of period t is gross investment over output:
Write optimal_saving(A, alpha, delta, beta, h, n, start, T) that returns a tuple (iterations, path, rates): the number of updates, the capital levels [k_0, \ldots, k_T] and the rates [s_0, \ldots, s_{T-1}]. Press Run with plot(rates) to compare them with a flat Solow line.
Examples
Input: A = 1, alpha = 0.3, delta = 1, beta = 0.9, h = 0.01, n = 30, start = 1, T = 6
Output: (132, [0.01, 0.07, 0.12, 0.14, 0.15, 0.15, 0.15],
[0.27867502, 0.26647215, 0.26446832, 0.27055331, 0.26501099, 0.26501099])
Explanation: with full wear (delta = 1) and log utility the best rate is exactly
alpha * beta = 0.27 at every capital level; the grid rounds it a little.
Input: A = 1, alpha = 0.3, delta = 0.1, beta = 0.9, h = 0.1, n = 30, start = 2, T = 6
Output: (115, [0.2, 0.4, 0.6, 0.8, 1.0, 1.1, 1.2],
[0.35654445, 0.31593173, 0.30305955, 0.29938569, 0.2, 0.20408049])
Explanation: a poor island saves a large share and saves less as it grows.
Input: A = 1, alpha = 0.3, delta = 0.1, beta = 0.9, h = 0.1, n = 30, start = 30, T = 6
Output: (115, [3.0, 2.7, 2.5, 2.3, 2.2, 2.1, 2.0],
[0.0, 0.05196237, 0.03798289, 0.10125699, 0.09472278, 0.08804950])
Explanation: an island with too much capital lets it wear down.
Constraints
A * h ** (alpha - 1) > delta, so even the smallest capital can keep itself, and every grid point has a choice withc > 0iterationsis compared exactly, the numbers with a tolerance of1e-6
Goals
- Solve an optimal growth problem by value function iteration on a grid of capital levels
- Follow the optimal policy from a starting capital and compute the saving rate it implies each period
- Compare the chosen saving rate with Solow's fixed one: constant with full depreciation, changing otherwise