Re: Evaluate[] not needed in With[]

*To*: mathgroup at smc.vnet.net*Subject*: [mg62974] Re: Evaluate[] not needed in With[]*From*: "Jens-Peer Kuska" <kuska at informatik.uni-leipzig.de>*Date*: Fri, 9 Dec 2005 06:39:56 -0500 (EST)*Organization*: Uni Leipzig*References*: <dnbnav$5ti$1@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

Hi, With[] does a (clever) ReplaceAll[] of the constants you give, in its body before the body is evaluated. This means that the argument of ParametricPlot[] in your example is replaced by the value of hlines .. and so you don't need a Evaluate[]. Regards Jens "Steven T. Hatton" <hattons at globalsymmetry.com> schrieb im Newsbeitrag news:dnbnav$5ti$1 at smc.vnet.net... |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/ |