Two mills sell flour in one market. Each season mill 1 chooses its output q_1 and mill 2 its output q_2 (tonnes, any amount >= 0), at the same time. The flour sells at the price
dollars per tonne (the inverse demand curve). Mill i has a constant marginal cost c_i per tonne and no fixed cost, so its profit is \pi_i = (P - c_i)\,q_i.
Each mill's best response to the other's output is the output >= 0 that maximises its own profit, taking the other's output as given. A Cournot equilibrium is a pair (q_1, q_2) in which each output is a best response to the other. A mill whose best choice would be a negative amount produces 0 (it cannot un-mill flour); in this model the equilibrium is always unique.
Write cournot_mills(a, b, c1, c2) that returns a tuple (q1, q2, P, profit1, profit2) in the Cournot equilibrium.
Examples
Input: a = 100, b = 1, c1 = 10, c2 = 25
Output: (35.0, 20.0, 45.0, 1225.0, 400.0)
Explanation: if mill 2 makes 20, mill 1 faces P = 80 - q1 and earns (70 - q1) q1, best at 35.
If mill 1 makes 35, mill 2 earns (40 - q2) q2, best at 20. Each is a best response to the other.
Input: a = 100, b = 1, c1 = 10, c2 = 60
Output: (45.0, 0.0, 55.0, 2025.0, 0.0)
Explanation: mill 1 alone would make 45 and the price would be 55, below mill 2's cost of 60,
so mill 2 makes nothing, and mill 1's best response to 0 is 45.
Input: a = 50, b = 2, c1 = 8, c2 = 8
Output: (7.0, 7.0, 22.0, 98.0, 98.0)
Constraints
- answers are compared with a tolerance of
1e-6
Goals
- Derive each firm's best-response function under linear demand
- Solve the two best responses together for the Cournot equilibrium
- Handle the corner where the high-cost firm produces nothing