# Value

These exercises relate to the concept of value. They are strictly
normative. That is, they discuss conditions that must be met if 
value is to be maximized. They do not define any sort of unit for
measuring value, and they do not suggest any method of achieving
the conditions for maximizing value. The concept of equilibrium is 
NOT part of this analysis.

Create expressions for marginal value and marginal cost of a good:
mv(x):=1200*x^(-0.5); and mc(x,a):=max(0,a+2*x);. The marginal cost
curve allows for a threshold effect below which mc < 0. For a function
of this type a < 0. Alternatively, costs can be incurred from the first
unit forward; that is the case if a > 0.

The units of value are not specified, but they are the same for 
value and  cost. Recall that cost is value foregone.

/*Input. Execute (ctrl-enter) for results */
mv(x):=1200*x^(-0.5);
mc(x,a):=max(0,a+2*x);

Draw the marginal value curve and two marginal cost curves. In the
first mc curve, let a = -50 and in the second let a = 50.

/*Input. Execute (ctrl-enter) for results */
wxdraw2d(yrange=[0,500],
explicit(mv(x),x,0.1,200),
explicit(mc(x,-50),x,0,200),
explicit(mc(x,50),x,0,200)
)$

Set floating point precision to 5. Also set ratprint to false. Then use
find_root to determine the quantity at which mv(x) - mc(x,-50)=0. Bind
this value to the name solnx1.

/*Input. Execute (ctrl-enter) for results */
fpprintprec:5$ ratprint:false$
solnx1: find_root(mv(x)-mc(x,-50),x,0.1,1000);

Use the command xList: makelist(.2*i*solnx1,i,0,10); to create a list
of 11 x values that are multiples of solnx1.

/*Input. Execute (ctrl-enter) for results */
xList: makelist(.2*i*solnx1,i,0,10);

Use the command tv1(x0):=''float(integrate(mv(x),x,0,x0)); to create a function
that shows the total value up to a quantity x0. Then map this function onto 
xList with this command: vList: map(tv1,xList);. Before these two commands
instruct Maxima to assume that x0 > 0.

/*Input. Execute (ctrl-enter) for results */
assume(x0>0)$
tv1(x0):=''float(integrate(mv(x),x,0,x0));
vList: map(tv1,xList);

The cost function contains a logical expression, so the integrate command
cannot be applied, but romberg can. Use the command
tc1(x0):=''(romberg(mc(x,-50),x,0,x0)); to create a total cost function. Map
this function onto xList.

/*Input. Execute (ctrl-enter) for results */
tc1(x0):=''(romberg(mc(x,-50),x,0,x0));
cList: map(tc1,xList);

Use the command transpose(matrix(xList,vList,cList,vList-cList)); to create
a table that shows x, total value, total cost, and net value (total value less
total cost). Confirm that net value is maximized at x = solnx1.

/*Input. Execute (ctrl-enter) for results */
numbers:transpose(matrix(xList,vList,cList,vList-cList))$
names: matrix(["x", "Value", "Cost", "Net value"]) $
addrow(names,numbers);