Where Goods Meet Money

IS-LM · simultaneous equations · substitution · equilibrium

The economy of Brennock has two markets that must clear at the same time. 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 and P the price level:

  • 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.

The goods market alone allows many pairs (Y, r) (the IS curve), and so does the money market (the LM curve). The IS-LM equilibrium is the one pair that clears both.

Write islm(e) that returns a tuple (Y, r, I): equilibrium output, the interest rate and planned investment, for the economy e.

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.

To see the two curves cross, make a list ys of outputs, compute the rate each curve gives at each output, and press Run with plot(ys, is_rates, label="IS") and plot(ys, lm_rates, label="LM").

Examples

Input:  e = economy(100, 0.75, 100, 300, 2000, 200, 0.5, 4000, 1300, 2)
Output: (1700.0, 0.05, 200.0)
Explanation: at r = 0.05 investment is 200 and planned spending is
100 + 0.75 * 1600 + 200 + 200 = 1700. The real money supply is 650, and
money demand is 0.5 * 1700 - 4000 * 0.05 = 650. Both markets clear.

Input:  e = economy(100, 0.75, 100, 300, 0, 200, 0.5, 4000, 1300, 2)
Output: (2100.0, 0.1, 300.0)
Explanation: with i1 = 0 the rate does not affect spending, so output is the
Keynesian cross value 525 / 0.25 = 2100, and the money market sets the rate.

Constraints

  • answers are compared with a tolerance of 1e-6; do not round

Goals

  • Write the goods market and the money market as two linear equations in output and the rate
  • Solve the pair by substitution or Cramer's rule
  • Check the answer by putting it back into both markets
Starting Python…