MathGroup Archive 2005

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

Search the Archive

Evaluate[] not needed in With[]

  • To: mathgroup at smc.vnet.net
  • Subject: [mg62966] Evaluate[] not needed in With[]
  • From: "Steven T. Hatton" <hattons at globalsymmetry.com>
  • Date: Fri, 9 Dec 2005 05:10:44 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

I started looking at Dr. Maeder's _Programming in Mathematica_, and was
doing quite well understanding everything until I got to the first example
in the first section of the first chapter.  He gives an example of using
ParametricPlot and tells us "Because ParametricPlot evaluates its arguments
in a nonstandard way, we need to force evaluation of the variable hline by
wrapping in into Evaluate[]."  He later tells me I don't need to do that
for a "constant" in a With[] expression.  The following is a cobbled
together example showing both forms:

Clear[z, x, y, cz, hlines, vlines];
z = x + y I;
cz = {Re[z], Im[z]};
hg = With[{hlines = Table[N[cz], {y, -1, 1, 2/8}]},
      ParametricPlot[hlines, {x, -Pi/2, Pi/2}, 
          DisplayFunction -> Identity][[1]]
      ];
vlines = Table[N[cz], {x, -Pi/2, Pi/2, Pi/12}];
vg = ParametricPlot[Evaluate[vlines], {y, -1, 1}, 
        DisplayFunction -> Identity][[1]];
Show[Graphics[Join[hg, vg], AspectRatio -> Automatic, Axes -> True]]

I can read the words, and follow the instructions, but I still don't
understand _why_ the version in the With[] expression doesn't need the
Evaluate[].  Is there a way to _explain_ this behavior, or do I simply need
to memorize the rule by rote?
-- 
The Mathematica Wiki: http://www.mathematica-users.org/
Math for Comp Sci http://www.ifi.unizh.ch/math/bmwcs/master.html
Math for the WWW: http://www.w3.org/Math/


  • Prev by Date: Re: UpValues for expressions headed by a string
  • Next by Date: Re: Using The Random Function to predict Things
  • Previous by thread: Re: Solve Limitations
  • Next by thread: Re: Evaluate[] not needed in With[]