# Elasticities and Comparative Statics

The preceding exercise used constant-elasticity demand and supply curves to examine
price and income elasticities. This exercise focuses on price elasticities of demand and
supply and on their implication for comparative statics analysis. 

The demand and supply curves are simplified by folding anything that might shift
at demand curve (like income) or a supply curve (like wage rates) is folded into the
intercept terms. 

Write functional expressions for constant-elasticity demand and supply curves.
Make the functional names pd(x,A,a) and ps(x,B,b), where A and B are placement
constants, and a and b are elasticities.

## The Constant-Elasticity Case

/*Input. Execute (ctrl-enter) for results */ 
kill(all)$ fpprintprec:5$ ratprint:false$
pd(x,A,a):=A*x^a; ps(x,B,b):=B*x^b;

Solve pd(x,A,a)=ps(x,B,b) for x.

/*Input. Execute (ctrl-enter) for results */ 
solnx:solve(pd(x,A,a)=ps(x,B,b),x);

Divide both sides of solnx[1] by x^a.

/*Input. Execute (ctrl-enter) for results */
solnx[1]/x^a;

Based on the result above, bind the expression (A/B)^(1/(b-a)) to the name xeq.

Determine the percentage change in xeq per one percent change in the value 
of A (this shift causes a vertical displacement of the demand curve).

/*Input. Execute (ctrl-enter) for results */ 
[xeq : (A/B)^(1/(b-a)), diff(xeq,A)*A/xeq];

Substitute xeq into both pd(x,A,a) and ps(x,B,b) and confirm that the two are equivalent.
Applying either radcan or ratsimp demonstrates that the two expressions the
equivalence, but radcan gives a simpler expression.

Also, confirm that (d(peq)/dA)(A/peq) equals b/(b-a). 

/*Input. Execute (ctrl-enter) for results */ 
[radcan(pd(xeq,A,a)), " equals ", peq: radcan(ps(xeq,B,b)),
diff(peq,A)*A/peq];

The coefficients a and b are inverses of elasticities: a = 1/Ed and b = 1/Es,
where Ed and Es are the price elasticities of demand and supply. The 
proportional effects of demand (or supply) shifts are often stated in 
terms of elasticities. Substitute b=1/Es and a = 1/Ed in the expressions
1/(b-a) and b/(b-a) that you derived above.

/*Input. Execute (ctrl-enter) for results */ 
radcan(subst([b=1/Es,a=1/Ed],[1/(b-a),b/(b-a)] ));

A horizontal demand shift can be considered as well. Suppose that the demand
curve shifts rightward by 1 percent. A -1/Ed percent increase in the price would
return the quantity demanded to the initial level. Thus, the 1 percent rightward
shift corresponds to a -1/Ed percent upward shift. 

Divide the output above by -Ed to confirm that the percentage change in 
quantity per one-percent change in demand (horizontal shift) equal Es/(Es-Ed),
a positive quantity. Also confirm that 1/(Es-Ed), another positive value, is the
percentage equilibrium price change.

/*Input. Execute (ctrl-enter) for results */ 
%/(-Ed);

Insert this list of values for use below -- [A0,B0,a0,b0]: [10,10,-1.5,1.25].

/*Input. Execute (ctrl-enter) for results */ 
[A0,B0,a0,b0]: [10,10,-1.5,1.25];

Confirm that a one-percent change in A causes the equilibrium quantity
to change by about 0.364 percent in the same direction and the equilibrium
price to change by about 0.455 percent in the same direction.

/*Input. Execute (ctrl-enter) for results */ 
[1/(b0-a0),b0/(b0-a0)];

A classmate of one of the authors waggishly asserted that comparative
statics is the analysis of what happens when nothing happens, referring to
the fact that derivatives involve very small changes. 

Confirm that, contrary to this concern, the formula above provides 
close approximations for rather large changes in A. To do this, follow 
these (or equivalent) steps:
*Use makelist to define a list of A values 5, 6, ..., 14, 15. Name this Alist.
*Convert the list of values in Alist to a list of percentage changes from A0.
 Use the midpoint formula. Name this list pctAlist.
*Create a list with (Alist/B0)^(1/(b0-a0))$. Name this xeqlist.
*Use the expression 100.0*(xeqlist-1)/((xeqlist+1)/2)$ to create a list of
 predicted percentage changes. Name this list pctxlistpredicted.

Optional: Use the commands below to produce a table. Doing so will
make the values easier to compare.
transpose(matrix(Alist,pctAlist,xeqlist,pctxchglist,  pctxlistpredicted))$
addrow(matrix(["A" ,pctA_chg,"xeq","pctxeq_chg", "pctxeq_chg_pred"]),%);

/*Input. Execute (ctrl-enter) for results */ 
Alist: makelist(A0*i/10,i,5,15)$
pctAlist: 100.0*(Alist-A0)/((Alist+A0)/2)$
xeqlist: (Alist/B0)^(1/(b0-a0))$
pctxchglist: 100.0*(xeqlist-1)/((xeqlist+1)/2)$
pctxlistpredicted: pctAlist/(b0-a0)$
transpose(matrix(Alist,pctAlist,xeqlist,pctxchglist,
          pctxlistpredicted))$
addrow(matrix(["A" ,pctA_chg,"xeq","pctxeq_chg",
"pctxeq_chg_pred"]),%);

## The Linear Case

McAfee (p2-32) says of the expression above, "The beauty of this 
claim (regarding xeq and peq) is that it holds even when demand and 
supply do not have constant elasticities, because the effect considered is
local, and locally, the elasticity is approximately constant if the demand
curve is "smooth."

This assertion is correct, but one might be concerned about how good
the approximation remains if the change is not very small.

Repeat the exercises for linear case with same elasticities at x = 1, p = 10.

Discussion
a = 1/Ed = -1.5 and b = 1/Es = 1.25 in the example above. Use these values so that 
these statements apply to the linear demand and supply curves when
x = 1 and p = 10.

a = (dp/dx)(1/A0) at x = 1, so m = dp/dx = a*A0.    
b = (dp/dx)(1/B0) at x = 1, so n = dp/dx = b*B0. Also, A0 = B0.

The linear demand curve is pdlinear: (A + a*A *(-1)) + a*A*x (a < 0). 
The linear supply curve is  pslinear:  (B0 + b*B*(-1)) + b*B*x (b > 0).

Use this expression to express x in terms of the parameters:
solve(A-a*A+a*A*x = B-b*B + b*B*x,x);.  Assign the name xeqlinear
to the right-hand side of the item in the list that results from the command.

Confirm that when A = A0, B = B0, a = a0, and b = b0, x = 1.

/*Input. Execute (ctrl-enter) for results */ 
solve(A-a*A+a*A*x = B-b*B + b*B*x,x);
xeqlinear: rhs(%[1]);
solve(A0-a0*A0+a0*A0*x = B0-b0*B0 + b0*B0*x,x);
subst([A=A0,a=a0,B=B0,b=b0],xeqlinear);

Create a function fA(A) by substituting a=a0, B=B0, and b=b0 in xeqlinear.
This function is applied below to determine the equiibrium values for a list
of A values.

/*Input. Execute (ctrl-enter) for results */ 
fA(A):= ''(subst([a=a0,B=B0,b=b0],xeqlinear));

Copy the cell of commands above that created the lists of actual and 
predicted values and paste it below.

Replace the third and fourth lines with these:
xeqlist2: map(fA,Alist)$
pctxchglist2: 100.0*(xeqlist-1)/((xeqlist+1)/2)$.

Note the name changes. If you created the table, make the name changes in 
the transpose(matrix( ... )) command. 

/*Input. Execute (ctrl-enter) for results */ 
Alist: makelist(A0*i/10,i,5,15)$
pctAlist: 100.0*(Alist-A0)/((Alist+A0)/2)$
xeqlist2: map(fA,Alist)$
pctxchglist2: 100.0*(xeqlist2-1)/((xeqlist2+1)/2)$
pctxlistpredicted: pctAlist/(b0-a0)$
transpose(matrix(Alist,pctAlist,xeqlist2,pctxchglist2,
          pctxlistpredicted))$
addrow(matrix(["A" ,pctA_chg,"xeq2","pctxeq_chg2",
"pctxeq_chg_pred"]),%);

It is no surprise that the constant-elasticity approximation works less
well when the functional form does not exhibit constant elasticities.
The closeness of the approximation might, however, be surprising.