A valley's gravel comes from many small quarries. Together their marginal cost of supplying Q tonnes a day (any Q >= 0) is
MC(Q) = c + d\,Q
dollars per tonne, and the builders' inverse demand is P(Q) = a - b\,Q. There are no fixed costs. Compare two ways the same quarries could be run:
- Competition. Each quarry is a price taker, so the industry's supply curve is its marginal cost curve: the market settles where P(Q) = MC(Q).
- Monopoly. One company buys every quarry and chooses
Qwhere marginal revenue MR(Q) = a - 2b\,Q equals MC(Q), charging the demand price P(Q) for that quantity.
For an outcome with quantity Q and price P:
- the consumer surplus is the area between the demand curve and the price, from 0 to
Q: CS = \tfrac{1}{2}(a - P)\,Q; - the producer surplus is the area between the price and the marginal cost curve, from 0 to
Q: PS = (P - c)\,Q - \tfrac{1}{2} d\,Q^2; - the deadweight loss of monopoly is the total surplus CS + PS under competition minus the total surplus under monopoly.
Write monopoly_cost(a, b, c, d) that returns a tuple (competition, monopoly, dwl), where competition and monopoly are each a tuple (Q, P, CS, PS).
Examples
Input: a = 100, b = 1, c = 10, d = 2
Output: ((30.0, 70.0, 450.0, 900.0), (22.5, 77.5, 253.125, 1012.5), 84.375)
Explanation: competition: 100 - Q = 10 + 2Q at Q = 30. Monopoly: 100 - 2Q = 10 + 2Q at Q = 22.5.
Total surplus falls from 1350 to 1265.625; the owner gains 112.5 of surplus while builders lose 196.875.
Input: a = 50, b = 2, c = 10, d = 0
Output: ((20.0, 10.0, 400.0, 0.0), (10.0, 30.0, 100.0, 200.0), 100.0)
Constraints
- answers are compared with a tolerance of
1e-6
Goals
- Find the competitive and the monopoly outcome on the same demand and cost curves
- Measure consumer and producer surplus as areas between straight lines
- Compute the deadweight loss as the total surplus monopoly destroys