The central bank of Quill has just raised the money supply, but firms set this period's prices expecting the old price level. Output Y is in millions of base-year crowns per year, the interest rate r is a fraction (5 % is 0.05), T is a fixed tax, G government purchases, M the money supply (fixed from now on) and P the price level. Demand comes from IS-LM:
- goods market: output equals planned spending, Y = C + I + G, with consumption C = c_0 + c_1 \, (Y - T) and investment I = i_0 - i_1 \, r;
- money market: the real money supply equals real money demand, \dfrac{M}{P} = k \, Y - h \, r.
For each price level these give one output: the aggregate demand (AD). In period t (t = 0, 1, 2, ...) supply follows the short-run aggregate supply line
where P^e_t is the price level firms expect, Y_n is natural output and a > 0. In period 0 firms expect P^e_0 = Pe0; in every later period they expect last period's price level, P^e_t = P_{t-1}. In each period, (Y_t, P_t) is the positive price level and output at which AD and SRAS hold together. The model has no floor on r or I. In the long run expectations are right, P_t = P^e_t, so output equals Y_n.
Write back_to_normal(e, Pe0, a, Y_n, tol) that returns a tuple (t, Y, P, P_long): the first period t >= 0 with |Y_t - Y_n| \le tol, that period's output and price level, and the long-run price level. The economy's own e["P"] is not used.
The tests build each economy with the helper economy(c0, c1, T, i0, i1, G, k, h, M, P), which returns the dict {"c0": c0, "c1": c1, "T": T, "i0": i0, "i1": i1, "G": G, "k": k, "h": h, "M": M, "P": P}; you may use it too.
Collect the outputs and prices in lists and press Run with plot(ys) and plot(ps, new=True) to watch output fall back as prices climb.
Examples
Input: e = economy(100, 0.75, 100, 300, 2000, 200, 0.5, 4000, 1560, 2), Pe0 = 2, a = 0.002, Y_n = 1700, tol = 1
Output: (10, 1700.8344522676073, 2.3969228957759077, 2.4)
Explanation: period 0 gives (1775.35, 2.1507): output jumps above Y_n. Period 1 expects
2.1507 and gives (1745.75, 2.2422), and so on; in period 10 output is within 1 of 1700.
Input: e = economy(100, 0.75, 100, 300, 2000, 200, 0.5, 4000, 1560, 2), Pe0 = 2.4, a = 0.002, Y_n = 1700, tol = 1
Output: (0, 1700.0, 2.4, 2.4)
Constraints
- answers are compared with a tolerance of
1e-6; do not round - the tests reach the tolerance within 5000 periods
Goals
- Simulate the short-run AD-AS equilibrium period by period with expectations that update
- Stop at the first period within a tolerance of natural output
- Find the long-run price level, where output equals natural output