Room for One More Food Truck?

free entry · long-run equilibrium · minimum average cost · market clearing · while loop

Food trucks gather at a business park at lunchtime. The office workers' daily demand for lunches is

Q = A - B\,P

at a price of P dollars a lunch. Every truck is identical: serving q lunches a day (any q > 0) costs it

C(q) = F + c\,q^2

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):

  1. n: the number of trucks that end up at the park;
  2. price: the lunch price with n trucks, or None if not even one truck comes;
  3. min_ac: the lowest average cost C(q) / q a truck can reach over all q > 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
Starting Python…