Food trucks gather at a business park at lunchtime. The office workers' daily demand for lunches is
at a price of P dollars a lunch. Every truck is identical: serving q lunches a day (any q > 0) costs it
dollars, where F is the daily permit and lease. A truck that stays away pays nothing. Each truck is a price taker and serves the q where the price equals its marginal cost, P = MC(q) = 2c\,q. With n trucks at the park, the price is the one at which the trucks' total supply equals the quantity demanded.
Trucks arrive one at a time. The n-th truck comes if, once it is there, each of the n trucks makes a profit P\,q - C(q) of at least 0 (breaking exactly even is enough to come). As more trucks arrive the price falls, so this stops at some number of trucks.
Write free_entry(A, B, F, c) that returns a tuple (n, price, min_ac):
n: the number of trucks that end up at the park;price: the lunch price withntrucks, orNoneif not even one truck comes;min_ac: the lowest average cost C(q) / q a truck can reach over allq > 0. With more and more, smaller and smaller trucks, the price would fall towards it.
Examples
Input: A = 1200, B = 10, F = 60, c = 2
Output: (179, 21.91780821917808, 21.908902300206645)
Explanation: with 179 trucks each serves P / 4 lunches and the price is 21.918, just above the lowest
average cost; a 180th truck would push the price below it and every truck would lose money.
Input: A = 100, B = 1, F = 312.5, c = 0.5
Output: (3, 25.0, 25.0)
Explanation: with 3 trucks the price is 25, each serves 25 lunches and makes exactly 0: the 3rd comes.
Input: A = 10, B = 0, F = 101, c = 1
Output: (0, None, 20.09975124224178)
Constraints
- answers are compared with a tolerance of
1e-6
Goals
- Find the market price when a given number of identical price takers supply a linear demand
- Let firms enter one at a time while an entrant would not lose money
- Compare the long-run price with the lowest average cost a firm can reach