Market Equilibrium

Demand and Supply for Good x1

We begin by telling Mathematica what the parameters (or constants) of the model are. Everything else will be treated as a variable.

SetAttributes[ρ, Constant]
SetAttributes[a, Constant]
SetAttributes[m, Constant]
SetAttributes[T, Constant]
SetAttributes[b, Constant]

The Clear command tells Mathematica to wipe out any previous values associated with the parameters and variables of the problem.  Notice that the semi-colons at the end of input lines suppress the display of output.

Clear[ρ, m, T, b, x1, p1d, p1s, w, equilx1, equilp1];

We copy the demand and supply functions for x1 previously derived in Consumer.nb and Firm.nb

p1d = ρ*(m/x1); 
p1s = w*(((x1/T)^(1/b))^(1 - b)/(b*T));

Then we solve for the equilibrim quantity when supply equals demand

equilx1 = Solve[p1d == p1s, x1]

We solve for the equilibrim price substituting the solution for x1 into p1d

equilp1 = p1d /. equilx1[[1]]

We assign values to the parameters and to the wage variable, and we compute the corresponding numerical values for the equilibrium quantity and price

ρ = 0.7; 
m = 0.1; 
T = 1; 
b = 0.4; 
w = 100; 
equilx1
equilp1

Then we plot jointly the supply and demand curves

Plot[{p1d, p1s}, {x1, 0.01, 0.1}, AxesLabel -> {"x1", "p1"}, 
  PlotLabel -> "Market for x1"]

We perform a comparative static exercse, changing the values of the technology parameter T

Plot[Evaluate[Table[{p1d, p1s}, {T, 1, 1.2, 0.1}]], {x1, 0.01, 0.1}, 
  AxesLabel -> {"x1", "p1"}, PlotLabel -> "Market for x1"]

Plot[Evaluate[Table[{p1d, p1s}, {ρ, 0.5, 0.9, 0.2}]], {x1, 0.01, 0.1}, 
  AxesLabel -> {"x1", "p1"}, PlotLabel -> "Market for x1"]

Finally, we perform the same comparative static exercise now with an animated plot.  Double click on the first graph of the sequence and control the spee with the buttons that will appear at the bottom of the notebook. 
Notice that here we fixed the range for the vertical axis with the option PlotRange.  Otherwise, each plot will generate variable values for that range, creating the false impression that the demand curve is shifting also (to see this, eliminate that option and see what happens). 
Warnings: 
If you perform other compartive static exercises changing any of the parameters other than T, you may have to adjust the PlotRange option accordingly.
Also, you may have to adjust the range for x1, seting different minimum and/or maximum values.

Table[Plot[{p1d, p1s}, {x1, 0.01, 0.1}, PlotRange -> {0, 8}, 
   AxesLabel -> {"x1", "p1"}, PlotLabel -> "Market for x1"], {T, 1, 1.2, 0.1}]