Evaluate, /., {{...}}, etc.
- To: mathgroup at smc.vnet.net
 - Subject: [mg70719] Evaluate, /., {{...}}, etc.
 - From: misha <iamisha1 at comcast.net>
 - Date: Tue, 24 Oct 2006 02:24:31 -0400 (EDT)
 
I'm having trouble figuring out how either Evaluate works or /. works 
(with the logical understanding of "or"), as well as the asymmetric 
appearance of curly brackets {} in what appears to me to be analogous 
conditions.
In the example below, I expect r1[x1_]:=Evaluate[x1/.solution1] to 
produce a function r1 as a function of x1 from the equation provided by 
solution1.  Similar for r2.  I notice that solution1 is {{x1 -> 5 - 
x2/2}}, whereas solution2 is {x1 -> 10 - 2*x2}.  Why "->" instead of "=" 
or "=="?  Why two curly brackets in the first case {{...}} and only one 
in the second case {...}?
More important,
r1 produces what I expect,
In[...]:= ?r1
	Global`r1
	r1[x2_]:={5 - x2/2}
while r2 does not.
In[...]:=?r2
	Global'r2
	r2[x1_]:=x2
I would expect the following
r2[x1_]:=10-2*x2
(i.e., since this problem is symmetric, firm 1's "reaction function" 
(r1) should be symmetric w.r.t. firm 2's "reaction function" (r2). 
Again, why curly brackets in one case, but not in the other?
Here is the full example (from 
http://library.wolfram.com/infocenter/MathSource/551/):
p1[x1_,x2_] := 10 - b1 x1 - c x2
p2[x1_,x2_] := 10 - b2 x2 - c x1
profit1[x1_,x2_] := Evaluate[p1[x1,x2]*x1]
profit2[x1_,x2_] := Evaluate[p2[x1,x2]*x2]
solution1=Solve[D[profit1[x1,x2],x1]==0,x1][[1]]
solution2=Solve[D[profit2[x1,x2],x2]==0,x2][[1]]
r1[x2_] := Evaluate[x1/.solution1]
r2[x1_] := Evaluate[x2/.solution2]
c=b1
b1=b2=c=1
isoprofitLines=ContourPlot[profit1[x1,x2],{x1,0,7},{x2,0,7},ContourShading->False]
reactionCurves=ParametricPlot[{{r1[t],t},{t,r2[t]}},{t,0,7}]
Show[isoprofitLines,reactionCurves]