MathGroup Archive 2000

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

Search the Archive

Re: Evaluation of functions inside Plot

  • To: mathgroup at smc.vnet.net
  • Subject: [mg22029] Re: [mg21993] Evaluation of functions inside Plot
  • From: Hartmut Wolf <hwolf at debis.com>
  • Date: Fri, 11 Feb 2000 02:38:11 -0500 (EST)
  • Organization: debis Systemhaus
  • References: <200002100725.CAA05549@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hans-Peter Kunzle schrieb:
> 
> I still do not understand well enough how expressions get
> evaluated inside a Plot or similar functions (NDSolve etc.).
> 
> This time I copied the code directly from the (quite old)
> book by T.W. Gray and J. Glynn, Exploring Mathematics with
> Mathematica (p.142):
> 
> Plot3D[
>   { Abs[x+y I], Hue[ N[(Pi+Arg[x + yI]) /(2 Pi)]]},
>   {x,-2,2},{y,-2,2}],
>   AxesLabel->{"Re","Im","Abs[z]"},PlotPoints->15
> ];
> 
> This produces several error messages
> 
> Plot3D::plnc:
>     {Abs[x + y I], Hue[(N[([Pi] + Arg[x + yI])\(2 Pi)]]} is neither a
>     machine-size real number at {x,y}={-2.,-2.} nor a list of a real number
>     and a \alid color directive.
> 
> This book was written for Mathematica 2, of course, and presumably
> the code must have worked then. Has anything changed since then?
> 
> I have tried to wrap 'Evaluate' around some of the expressions, but
> this had no effect. Since Abs and Arg only work for numerical
> arguments I also tried to replace them by explicit expressions in
> x and y. But this did not help either.
> 
Dear Hans-Peter,

if you did respect literally the error message you got, you will cut
your expression out of plot and check:

In[19]:=
{Abs[x + y I], Hue[N[(Pi + Arg[x + yI])/(2 Pi)]]} /. {x -> -2., y ->
-2.}
Out[19]=
{2.82843, Hue[0.159155 (3.14159\[InvisibleSpace] + Arg[-2. + yI])]}

...and see that you made a typo. A space between yI will repair
everything!

Kind regards, Hartmut


  • Prev by Date: Re: formula for Pi
  • Next by Date: Re: parametric equations
  • Previous by thread: Evaluation of functions inside Plot
  • Next by thread: Re: Evaluation of functions inside Plot