MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Plot Magic Voodoo ???

  • To: mathgroup at smc.vnet.net
  • Subject: [mg90949] Re: Plot Magic Voodoo ???
  • From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
  • Date: Thu, 31 Jul 2008 02:57:04 -0400 (EDT)
  • Organization: The Open University, Milton Keynes, UK
  • References: <g6q0nb$qeo$1@smc.vnet.net>

beckman wrote:

> Consider the following:
> 
> z := {L == x y, y == x, x == y}
> 
> Solve[z, {L}] --->  {{L->y^2}}
> 
> no surprises. now,
> 
> Plot[L /. Solve[z, {L}][[1]], {y, 1, 10}]
> 
> Works exactly as one would expect, BUT, this also works
> 
> Plot[L /. Solve[z, {L}][[1]], {x, 1, 10}]
> 
> BUT, the first argument of Plot is L /. Solve[z, {L}][[1]], which is
> y^2, so my brain said that
> 
> Plot[L /. Solve[z, {L}][[1]], {x, 1, 10}] ---> Plot[y^2, {x, 1, 10}]
> 
> which, of course, cannot work. Btw,
> 
> Plot[L /. Solve[z, {L}][[1]], {q, 1, 10}]
> 
> does not work, so SOMEHOW, Plot is magically peeking at the innards of
> the Solve expression, and is NOT evaluating it, and noticing that x is
> a free variable in the set of equations, z, and ... my brain is
> melting

Trace[] is to the Mathematica user what the crystal ball is to the 
magician :) Below, you can see that first a value is assigned to y, x, 
or q by Plot, only then Solve[] is called.

   z := {L == x y, y == x, x == y}

   Plot[L /. Solve[z, {L}][[1]], {y, 1, 10}] // Trace

     {Plot[L/.Solve[z,{L}][[1]],{y,1,10}],{y=.,Null},{y=.,Null},
     {{y}=.,{y=.},{y=.,Null},{Null}},{{{{z,{L==x y,y==x,x==y},
     {{{y,1.00018},x 1.00018,1.00018 x},L==1.00018},
     {{y,1.00018},1.00018==x},{{y,1.00018},x==1.00018},
     {L==1.00018 x,1.00018==x,x==1.00018}},
     Solve[{L==1.00018 x,1.00018==x,x==1.00018},{L}],{{L->1.00037}}},
     {{L->1.00037}}[[1]],{L->1.00037}},L/.{L->1.00037},1.00037},
     {y=.,Null},{y=.,Null},{y=.,Null},{y=.,Null},
     [...]

   Plot[L /. Solve[z, {L}][[1]], {x, 1, 10}] // Trace

     {Plot[L/.Solve[z,{L}][[1]],{x,1,10}],{x=.,Null},{x=.,Null},
     {{x}=.,{x=.},{x=.,Null},{Null}},{{{{z,{L==x y,y==x,x==y},
     {{{x,1.00018},1.00018 y},L==1.00018 y},
     {{x,1.00018},y==1.00018},{{x,1.00018},1.00018==y},
     {L==1.00018 y,y==1.00018,1.00018==y}},
     Solve[{L==1.00018 y,y==1.00018,1.00018==y},{L}],
     {{L->1.00037}}},{{L->1.00037}}[[1]],{L->1.00037}},
     L/.{L->1.00037},1.00037},{x=.,Null},{x=.,Null},{x=.,Null},
     [...]

   Plot[L /. Solve[z, {L}][[1]], {q, 1, 10}] // Trace

     {Plot[L/.Solve[z,{L}][[1]],{q,1,10}],{q=.,Null},{q=.,Null},
     {{q}=.,{q=.},{q=.,Null},{Null}},{{{{z,{L==x y,y==x,x==y}},
     Solve[{L==x y,y==x,x==y},{L}],{{L->y^2}}},{{L->y^2}}[[1]],
     {L->y^2}},L/.{L->y^2},y^2},{{q}=.,{q=.},{q=.,Null},{Null}},
     {{q}=.,{q=.},{q=.,Null},{Null}},{{q}=.,{q=.},{q=.,Null},{Null}},
     {{q}=.,{q=.},{q=.,Null},{Null}},{{q}=.,{q=.},{q=.,Null},
     [...]


Regards,
-- Jean-Marc



  • Prev by Date: FW: Sending Objects from Java - Mathematica
  • Next by Date: NMaximize Questions
  • Previous by thread: Plot Magic Voodoo ???
  • Next by thread: Objectica: New third-party Mathematica application for object orientation