MathGroup Archive 2005

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

Search the Archive

Puzzling HoldFirst behaviour


Hello,

Given the following:

Clear[indyVar,t,depVar,y,interval,outOne,eqnOut];
<< "Graphics`PlotField`"
indyVar = t;
depVar = y;
interval = {indyVar, 0, 4};
outOne = {eqnOut -> {Derivative[1][y][t]} == {y[t]}};


This works (notice the lack of a call to 'Evaluate' on the first
argument to PlotVectorField):

(eqnOut /. outOne)[[2,1]] /. {depVar[indyVar] -> depVar} (* the output
of this is y *)

PlotVectorField[{1, (eqnOut /. outOne)[[2,1]] /. {depVar[indyVar] ->
depVar}}, interval, {depVar, 0, 10}];


However, if outOne is instead this-
outOne = {eqnOut -> {Derivative[1][y][t]} == {t}};

then the same call fails in this form:

(eqnOut /. outOne)[[2,1]] /. {depVar[indyVar] -> depVar} (* the output
of this is t *)

PlotVectorField[{1, (eqnOut /. outOne)[[2,1]] /. {depVar[indyVar] ->
depVar}}, interval, {depVar, 0, 10}];

but works in this form:

PlotVectorField[Evaluate[{1, (eqnOut /. outOne)[[2,1]] /.
{depVar[indyVar] -> depVar}}], interval, {depVar, 0, 10}];

I don't understand why Evaluate is necessary in the 2nd case but not
the 1st.

Thanks for any insight,

Matt


  • Prev by Date: Re: general nth term of series
  • Next by Date: Pattern matching question and answer
  • Previous by thread: Re: How to compute this sum?
  • Next by thread: Pattern matching question and answer