Bottled Water From Every Spring

Cournot competition · oligopoly · best response · Nash equilibrium · linear demand

A valley has n identical springs, each owned by a different family that bottles water for the town. Every week each family chooses how many crates q_i to bottle (any amount >= 0, not only whole crates), all at the same time. The crates all sell at one price, set by the inverse demand curve

P = a - b\,Q, \qquad Q = q_1 + q_2 + \dots + q_n

dollars per crate, where Q is the total brought to town. Every crate costs c dollars to bottle (a constant marginal cost, no fixed cost), so family i earns the profit \pi_i = (P - c)\,q_i.

This is Cournot competition: each family picks its own quantity to make its profit as large as possible, taking the other families' quantities as given. A Cournot equilibrium is a list of quantities in which every family's quantity is already its best choice against the others'. With identical families, all choose the same quantity q in the equilibrium.

Write cournot_crowd(a, b, c, n) that returns a tuple (q, Q, P, profit): each family's quantity, the total, the price and each family's profit, in the Cournot equilibrium. With n = 1 this is a monopoly. Press Run with plot([cournot_crowd(120, 1, 20, k)[2] for k in range(1, 41)]) to watch the price approach the marginal cost.

Examples

Input:  a = 120, b = 1, c = 20, n = 4
Output: (20.0, 80.0, 40.0, 400.0)
Explanation: if the three other families bottle 60 in all, one family's best amount is 20:
it faces P = 60 - q and earns (40 - q) * q, largest at q = 20. Then P = 120 - 80 = 40.

Input:  a = 120, b = 1, c = 20, n = 1
Output: (50.0, 50.0, 70.0, 2500.0)
Explanation: a single family is a monopoly.

Input:  a = 30, b = 0.5, c = 6, n = 2
Output: (16.0, 32.0, 14.0, 128.0)

Constraints

  • answers are compared with a tolerance of 1e-6

Goals

  • Write one firm's profit when the price depends on everyone's output
  • Find the symmetric Cournot equilibrium of `n` identical firms
  • See the price fall from the monopoly price towards marginal cost as `n` grows
Starting Python…