# A Model of International Trade

This exercise deals with a partial-equilibrium analysis of the 
effects of international trade and restrictions thereof. The formal
analysis begins in a way that is much like the analysis of price
controls in previous workbooks and in the text, with a price that 
is imposed from the outside. In this case, the price is determined 
in the world market. 

## The Market

The implications of this analysis do not depend on the shapes of the
domestic demand or supply curves, so we use simple linear specifications.
Also, we will not shift these curves, so we simply specify all parameters
at the begining. 

Assign the name pd to this experession: 520 - 2*X, where X is the market
quantity demanded. Assign the name ps to this expression: 20 + 3*X. In
this specification, pd and ps are the heights of the demand an supply
curves.

/*Input. Execute (ctrl-enter) for results */
kill(all)$ fpprintprec:5$ ratprint:false$
[pd, ps] : [520 - 2*X, 20 + 3*X];

Solve pd = ps to determine the equilibrium quantity in the absence 
of international trade. Label this quantity XA, where A indicates 
autarky. Also, determine pA, the autarkic price.

/*Input. Execute (ctrl-enter) for results */
solve(pd=ps,X);  XA : rhs(%[1]);  pA : subst(X=XA,pd); /*or*/ 20+3*XA;

Graph the demand and supply curves and draw a horizontal line that the 
next instruction calls the price line. The height of this line is pA. 
Extend it from 0 to XA.

/*Input. Execute (ctrl-enter) for results */
wxdraw2d(user_preamble = "set key bottom right", yrange=[0,600],
 xlabel="Domestic X",ylabel="$ per unit", line_width=2,
 key = "Domestic Demand", explicit(pd,X,0,360/2),
 color=red, key="Domestic Supply", explicit(ps,X,0,360/2),
 color=orange,key="Price Line",explicit(pA,X,0,XA),
 dimensions=[480,480])$

Define the area between the price line and the demand curve as CS (Consumer
Surplus) and the area between the price line and the demand curve as PS
(Producer Surplus). For this example, absent trade, compute CSA and PSA,
where A still indicates autarky. Also, sum the two, and label the result 
TSA (Total Surplus, Autarky).

Solve the CSA and PSA values twice. First, use integrate( ). Then use
triangle formulas.

/*Input. Execute (ctrl-enter) for results */
CSA: integrate(pd-pA, X, 0, XA);
PSA: integrate(pA-ps, X, 0, XA);
TSA: CSA + PSA;
[(520 - pA)*XA/2, (pA - 20)*XA/2];

## Exports

Suppose that the world price of this product is $410/unit and that international
trade is free of restrictions. Determine the amount that domestic buyers purchase
at this price, the amount that domestic sellers provide at this price, and the
number of units exported. Name these quantities XDE, XSE, and XE respectively, 
with the E's denoting export.  Use find_root( ) -- solve( ) would work as well.

/*Input. Execute (ctrl-enter) for results */
XDE : find_root(410 = pd,X,0,500);
XSE : find_root(410 = ps,X, 0, 5000);
XE: XSE - XDE;

Copy the preceding graph and replace the price line with a line that
indicates the world price.

/*Input. Execute (ctrl-enter) for results */
wxdraw2d(user_preamble = "set key bottom right", yrange=[0,600],
 xlabel="Domestic X",ylabel="$ per unit", line_width=2,
 key = "Domestic Demand", explicit(pd,X,0,360/2),
 color=red, key="Domestic Supply", explicit(ps,X,0,360/2),
 color=orange,key="World Price",explicit(410,X,0,XSE),
 dimensions=[480,480])$

Determine the new values of the surpluses: CSE, PSE, and TSE.
Who gains from the fact that this industry is now opened to international
trade? Who loses? What happens to the total surplus?

/*Input. Execute (ctrl-enter) for results */
CSE: integrate(pd-410, X, 0, XDE);
PSE: integrate(410-ps, X, 0, XSE);
TSE: CSE + PSE;

## Imports

Suppose that the world price of this good is $200/unit. Determine how
much domestic buyers purchase, how much domestic sellers supply, and 
how many units are imported. Label these XDI, XSI, and XI.

/*Input. Execute (ctrl-enter) for results */
XDI : find_root(200 = pd,X,0,500);
XSI : find_root(200 = ps,X, 0, 5000);
XI: XDI - XSI;

Copy the preceding graph and replace the price line with a line
at p = 200. Label this line "World Price". 

/*Input. Execute (ctrl-enter) for results */
wxdraw2d(user_preamble = "set key bottom right", yrange=[0,600],
 xlabel="Domestic X",ylabel="$ per unit", line_width=2,
 key = "Domestic Demand", explicit(pd,X,0,360/2),
 color=red, key="Domestic Supply", explicit(ps,X,0,360/2),
 color=orange,key="World Price",explicit(200,X,0,XDI),
 dimensions=[480,480])$

Determine the surpluses as before. Label them CSI, PSI,and TSI.

/*Input. Execute (ctrl-enter) for results */
CSI: integrate(pd-200, X, 0, XDI);
PSI: integrate(200-ps, X, 0, XSI);
TSI: CSI + PSI;

### Tariff

Suppose that a $60/unit tariff is imposed on imports. An ad valorem
tariff could be used; the analysis would be much the same.

The domestic price is $260/unit. Determine the quantity demanded,
the quantity supplied domestically, and the quantity imported. Label
these values XDQ, XSQ, and XIQ. Also, determine the amount of 
revenue that the government receives.

/*Input. Execute (ctrl-enter) for results */
values;
XDQ: find_root(pd-260,X,0,500);
XSQ: find_root(ps-260,X,0,500);
XIQ: XDQ - XSQ;  Revenue: XIQ*60;

Copy the graph above and add a fourth expression, the tariff-laden price,
260.

/*Input. Execute (ctrl-enter) for results */
wxdraw2d(user_preamble = "set key bottom right", yrange=[0,600],
 xlabel="Domestic X",ylabel="$ per unit", line_width=2,
 key = "Domestic Demand", explicit(pd,X,0,360/2),
 color=red, key="Domestic Supply", explicit(ps,X,0,360/2),
 color=orange,key="World Price",explicit(200,X,0,XDI),
 color=black, key="Tariff-laden Price", explicit(260,X,0,XDQ),
 dimensions=[480,480])$

The graph shows that the reduction in Consumer Surplus due to the
imposition of a tariff, the trapezoid defined by the two price 
lines and the segment of the demand curve between them. 
Determine the value of this reduction and label that value.

/*Input. Execute (ctrl-enter) for results */
CSloss: integrate(pd - 200, X, 0, XDI) - integrate(pd-260, X, 0, XDQ);
/*or by directly calculating the area of the trapezoid */
["check",60*(XDI + XDQ)/2];

Copy the graph once more. Now use points( ) to draw line segments
between the two price lines at XSQ and XDQ.

/*Input. Execute (ctrl-enter) for results */
wxdraw2d(user_preamble = "set key bottom right", yrange=[0,600],
 xlabel="Domestic X",ylabel="$ per unit", line_width=2,
 key = "Domestic Demand", explicit(pd,X,0,360/2),
 color=red, key="Domestic Supply", explicit(ps,X,0,360/2),
 color=orange,key="World Price",explicit(200,X,0,XDI),
 color=black, key="Tariff-laden Price", explicit(260,X,0,XDQ),
 line_width=1, line_type=dots,key="",points_joined=true,
 points([[XSQ,200 ], [XSQ,260 ]  ]), points([[XDQ,200 ], [XDQ,260 ]  ]),

 dimensions=[480,480])$

The line segments in the graph define four areas, reading from left to right:
1. Added Producer Surplus due to the higher price that domestic sellers receive.
2. Deadweight loss because the opportunity cost of the units between XSI and XSQ
   cost more when produced domestically.
3. The tariff revenue.
4. Deadweight loss because units between XDQ and XDI are worth more to domestic
   buyers than the world price.

Determine the values of areas (1), (2) and (4). Confirm that the sum of these
and the tariff revenue equal the reduction in Consumer Surplus.

/*Input. Execute (ctrl-enter) for results */
/*Area 1 */ Area1: 60*(XSQ+XSI)/2;
/*Area 2 */ Area2: 60*(XSQ-XSI)/2;
/*Area 4 */ Area4: 60*(XDI-XDQ)/2;
[Area1+Area2+Revenue+Area4, CSloss];