load(draw)$ 
set_draw_defaults(draw_realpart=false)$
 fpprintprec:5$ ratprint:false$kill(all)$

# Price-Searcher Markets

Three types of markets consist for firms whose output affects the firm's
(or firms') product price. We refer to these as price-searcher markets, 
for the firm must search for the profit-maximizing price.

The simplest type of such a market is the monopoly, in which the market
is served by a single firm, and in which no entry occurs. A second type
is monopolistic competition, in which each of many firms sells a 
slightly distinctive product, but in which entry can occur as long as 
profits are to be earned. 

In both of these cases, the firm ignores the effect of is output on the 
other firms' behavior. In the first case, no other firms exist. In the 
second case, no firm is large enough to significantly affect the price. 

This chapter treats these two cases. The next chapter addresses oligopoly, 
in which a few firms constitute the industry. In this case we must model 
the effect that each firm has on the decisions of other firms.

## Monopoly

## Upward-sloping Marginal Revenue

## Monopolistic Competition

### A Constant-Cost Industry

### Equilibrium

### Efficiency

### An Increasing-Cost Industry

### Firm-Specific Cost

Finally, suppose that each firm has a unique cost function. Each
firm's marginal cost is mc = (i^e)*(x^c), where i is an index. The
lowest-cost firms marginal cost is mc = x^c, as in the first case.

kill(all)$  assume(c+1>0)$    mc(x,c,e,i):=x^c*i^e$
VC:integrate(mc(x,c,e,i),x)$    FC: subst(x=1,i^e-VC)$    
tc(x,c,e,i):=''(radcan(FC+VC))$   ac(x,c,e,i):=''(radcan(tc(x,c,e,i)/x))$
matrix(["MC","Variable Cost","Total Cost","Average Cost"], 
    [mc(x,c,e,i), VC, tc(x,c,e,i), ac(x,c,e,i)]);

The demand and revenue functions are the same before. 

x(p, i,A,a,b,pavg,n):=A*pavg^a*(1/n - b*(p-pavg));
solve(x(p,i,A,a,b,pavg,n)-x,p)$  p(x,i,A,a,b,pavg,n):=''(rhs(%[1]));
mr(x,i,A,a,b,pavg,n):=''(ratsimp(diff(p(x, i,A,a,b,pavg,n)*x,x)));

The next cell derives expressions for the firms' profit-maximizing 
quantity. The expression exprxi is a general statement of the i-th firm's 
profit-maximizing output. The name xeq is attached to the condition 
that x equals the specified quantity. The relationship is expressed as an 
implicit function because an explicit function cannot be derived. The 
equilibrium condition is for the marginal firm. We derive the other firm's 
output rates after equilibrium values for the system are defined.

The output line shows the equilibrium condition given the system's 
parameters. It is used in the application of mnewton( ). 

[n0, A0,a0,b0,c0,e0]:[10,150,-0.25,0.10,0.5,0.1]$
xeq: solve(mr(x,i,A,a,b,pavg,n)=mc(x,c,e,i),x)[1];
xeq0:subst([A=A0,a=a0,b=b0,c=c0,e=e0, m=m0,i=n],xeq);
exprxi:rhs(xeq);

TeX:
As in the previous sections, we derive the condition for the 
number of firms by setting average cost equal to price, but now
the average cost of the marginal firm must equal price. The average 
costs of other firms will be less than the price. As with x, we
derive a general expression and then apply the system's parameters
to determine an expression to which numerical analysis can be 
applied. The output below shows only the expression stated in 
terms of the system's parameters.

solnn: solve(ac(x,c,e,n)-p(x,n,A,a,b,pavg,n),n)$
nexpr : rhs(solnn[1])$
neq0:n-(subst([A=A0,a=a0,b=b0,c=c0,e=e0],nexpr));

Finally, we derive an expression for equilibrium industry output, X. This 
expression yields a third equation, all expressed in terms of pavg, n, and 
x. Given pavg and n, we can determine the inframarginal firms' x and p. 

To derive X integrate the expression for firms' output over i from i = 1 to 
i = n. Set the resulting expression equal to A*p^a. 

assume(n>1, e >0)$  exprX:integrate(exprxi,i,1,n)$
Xeq:A*pavg^a - exprX$
Xeq0: subst([A=A0,a=a0,b=b0,c=c0,e=e0],Xeq);

As before,mnewton( ) provides the equilibrium values: pavg = 1.4844, 
and n = 76.949. The marginal firm (i = 76.946) produces x = 0.918. 

load(mnewton)$  solnpnx:mnewton(
  [neq0,Xeq0,xeq0],[pavg,n,x],[1.0,1/e0,.8]);
pavg1: rhs(solnpnx[1][1])$ n1: rhs(solnpnx[1][2])$ 
xn1: rhs(solnpnx[1][3])$

TeX: The next cell determines x for each firm. The first command 
returns an expression for the equilibrium value that is equivalent 
to the implicit function x =-0.0065*(1045.7*i^0.1*x^0.5-1688.1). 
The function f(i) uses find_root( ) to determine the requisite x, 
given i. The variable n1f is created by using floor( ) to round 
n1 to the next lowest integer. A list of x values for all integer 
values of i is created in two steps: A list of i values is created, 
and f(i) is mapped onto that list.

xeqi:subst([A=A0,a=a0,b=b0,c=c0,e=e0,n=n1,pavg=
  pavg1], xeq)$        f(i):=find_root(xeqi,x,0.01,100)$
n1f: floor(n1)$   ilist:makelist(i,i,1,n1f)$
xlist: map(f, ilist)$
matrix(["Firm number,i  ","Firm output"], 
 [ilist[1],xlist[1]],[ilist[2],xlist[2]],["...","..."],
 [ilist[n1f-1],xlist[n1f-1]],[ilist[n1f],xlist[n1f]]);

The graph shows each firm's output.

wxdraw2d(yrange=[0,2],xlabel = "i",ylabel="x[i]", 
points(xlist))$

The sum( ) command produces the industry output X and total cost
TC. 

X1:sum(xlist[i],i,1,n1f)+xn1$ TClist:tc(xlist,c0,e0,ilist)$
TC1:tc(xn1,c0,e0,n1)+sum(TClist[i],i,1,n1f)$
matrix(["X1", "TC1"],[X1, TC1]);

The next cell depicts equilibrium for the lowest-cost firm (i = 1) 
and for the marginal firm (i = n1).

wxdraw2d(yrange=[.90,2.1],xlabel="x",ylabel="$ per unit",
 line_width=2, key = "Firm Demand and mr", 
 explicit( p(x,1,A0,a0,b0,pavg1,n1),x,.1,1.25*xlist[1]), 
 key="",explicit(mr(x,1,A0,a0,b0,pavg1,n1),x,.1,1.25*xlist[1]), 
 color=black,key="ac and mc, Firm 1",
 explicit(ac(x,c0,e0,1),x,.1,1.25*xlist[1]),key="",
 explicit(mc(x,c0,e0,1),x,.1,1.25*xlist[1]),color=red,
 key="ac and mc, Firm n1",explicit(ac(x,c0,e0,n1),x,.1,2), 
 key ="", explicit(mc(x, c0, e0, n1), x, .1, 2))$

TeX: 
Information regarding prices can be derived directly. The 
table below shows the expression for the price of a firm's product in 
terms of the firm's output. It also shows the price charged by the 
lowest-cost firm and by the marginal firm. The former is lower because 
the firm with the lowest marginal cost produces more and sells at a lower 
price. A graph like the one above could be drawn for prices, but the 
fact that all firms face the same demand curve implies that its shape 
would mirror the shape in the preceding graph, providing no additional 
insight.

price :p(x,i,A0,a0,b0,pavg1,n1);
pi1: p(xlist[1], i, A0, a0, b0, pavg1, n1)$ 
pi1n1:p(xn1,i,A0,a0,b0,pavg1,n1)$     float(matrix(["Firm Price",
"Firm 1 Price","Firm n1 Price"],[price,pi1,pi1n1]));

The elasticit of demand for the marginal firm's product is -22.898$,
even though the market demand elasticity is -0.25).

Epn1: diff(x(p,n1,A0,a0,b0,pavg1,n1),p)*pi1n1/xn1;

### Economic Efficiency

This type of industry can generate inefficient results for three reasons:
(1) Allocative inefficieny: for each firm p > mc.
(2) Inefficiency due to underproduction: Each firm fails to exploit economies
    of scale.
(3) The allocation of output among firms does not result in equal mc values
    in all firm, so that redistribution of output among firms could reduce
    industry cost.

This section does not treat (1), which has been treated in the earlier cases.

First, consider (3). Suppose that we could redistribute the equilibrium X 
among firms so that each on has the same marginal cost.

Begin by defining a common marginal cost value MC. The result implies
that each firm's output must equal MC^2/i^(1/5), so that higher-cost
firms produce less.

The last two input lines show how MC relaes to x.

assume(MC>0, i>1)$    
solve(mc(x,c0,e0,i)-MC, x);
xMC(i, MC) := ''(rhs(%[1]));    

xMClist:xMC(ilist,MC)$

XMC : float(xMC(n1,MC) + sum(xMC(i,MC),i,1,n1f));
matrix(["Industry output as function of common mc =",XMC]);

X1 has been determined, so the expression above defines 
the value MC1.

MC1:find_root(XMC-X1,MC,0.1,10)$ 
matrix(["MC1 = ",MC1]);
xMClist2 : float(subst(MC=MC1,xMClist))$
Xcheck:float(xMC(n1,MC1)+sum(xMC(i,MC1),i,1,n1f))$
matrix(["Xcheck =", Xcheck, "=", X1, "= X1"]);
numbers1:[ilist[1], xlist[1], xMClist2[1] ]$
numbers2:[ilist[2], xlist[2], xMClist2[2] ]$
numbers_2:[ilist[n1f-2],xlist[n1f-2],xMClist2[n1f-2]]$
numbers_1:[ilist[n1f-1],xlist[n1f-1],xMClist2[n1f-1]]$
numbers_0:[ilist[n1f],xlist[n1f],xMClist2[n1f] ]$
numbers: [n1, xn1, xMC(n1,MC1) ]$
matrix(["i","x","xMC"],numbers1,numbers2,["...","...",
"..."],numbers_2,numbers_1,numbers_0,numbers);

The table above and the graph below show that lower-cost firms
should produce more than the equilibrium quantities and higher-
cost firms should produce less than the equilibrium quantities.

wxdraw2d(xlabel="i", ylabel="Output by Firm i",
point_size=0,points_joined=true,key="Equilibrium x",
points(xlist), color = red, key= "Efficient x",
points(xMClist2)

)$

Finally, we determine the saving from output redistribution
by computing a second total cost function. The result is that 
total cost is reduced but only by about 0.01 percent given the
system's parameters.

tclist: tc(xlist,c0,e0,ilist)$    
TC2 : tc(xMC(n1,MC1),c0,e0,n1)+sum(tclist[i],i,1,n1f)$
matrix(["TC2", "TC1", "Percent Change"], 
  [TC2, TC1, 50*(TC2-TC1)/(TC1+TC2)]);

In the previous cases, overcapacity generated excess cost of 
around 1%. Determining excess cost in this industry is more
involved. We proceed by dtermining the total cost at each 
value of n. This requires a bit of programming to determine
total cost at each value of I (0 <= I <= n1).

The next to last input line recalls the costs at equilibrium 
(117.06) and when marginal costs are equalized (117.0). 

The last input line shows the effect of reducing n to the 
highest integer value (very slight cost reduction) and 
the reducing n to the next highest integer value (cost 
rises). Thus, overcapacity seems to be a negigible source of
ineffiency in this market.

assume(I>1,MCI>0,i>0)$   solve(mc(x,c0,e0,i)=MCI,x)$  
xMCI(i, MCI):=''(rhs(%[1]));  /*start block*/

F(I) :=  block(
 Ilist:makelist(i,i,1,I),XMCIlist:xMCI(Ilist,MCI),
 XMCI:sum(xMCI(i,MCI),i,1,I),
 MCI1: find_root(XMCI-X1,MCI,0,10),
 xMCI1list: xMCI(Ilist, MCI1),
 TC3:sum(tc(xMCI(i,MCI1),c0,e0,i),i,1,n1))$ 


matrix(["TC1 =", TC1, "and TC2 =", TC2]);
matrix(["TC_n1f = ",F(floor(n1))," and TC_n1f-1 =", 
 F(floor(n1)-1) ]);

The graph generalizes the results above, showing total cost for 
a range of n values. As expected from the preceding result, cost
rises as n decreases.

TCMCIlist:map(F,ilist)$      wxdraw2d(yrange=[0, 5.0*TC1],
  xrange=[/*.1*n1f*/0,n1f+1],xlabel="Number of Firms",ylabel=
"Industry Cost, $",key ="Total Cost",point_type=circle,
  points(ilist,TCMCIlist))$