Re: Not a machine-size real number?
- To: mathgroup at smc.vnet.net
 - Subject: [mg9305] Re: [mg9260] Not a machine-size real number?
 - From: David Withoff <withoff>
 - Date: Mon, 27 Oct 1997 02:47:17 -0500
 - Sender: owner-wri-mathgroup at wolfram.com
 
> Hello, I am trying to do the following in Mahtematica 3.0.0 for Linux
> 
> BB[I_,a_,NN,d_,z_]= (I*NN/(2*d))*(z/Sqrt[a^2+z^2])
> Plot[BB[1,0.05,100,0.01,z],{z,-1,1}]
> 
> Instead of getting the plot, I get the following error message:
> 
> Plot::"plnr":
> BB[1,0.05,100,0.01,z] ] is not a machine-size real  number at z = -1 ..
> 
> Plot::"plnr":
> BB[1,0.05,100,0.01,z] ] is not a machine-size real  number at z =
> -0.918866
> 
> Plot::"plnr":
> BB[1,0.05,100,0.01,z] ] is not a machine-size real  number at z =
> -0.830382 ..
> 
> General::"stop":
> Further output of Plot::"plnr" will be suppressed during this 
>   calculation.
>
> ---------------------------------------------------
> 
> What does this mean?  Is the definition of my function incorrect?  
> Thank you very much in advance
> 
> -- 
> 
> --
> Pedro Soria-Rodriguez
> sorrodp at ece.wpi.edu
There are two separate problems here.
One problem is related to the fact that the symbol "I" is a built-in
symbol in Mathematica.  This symbol evaluates to the square root of
minus one.  In your example, the "I" on the left-hand side of 
BB[I_,a_,NN,d_,z_]= (I*NN/(2*d))*(z/Sqrt[a^2+z^2])
refers to your variable, but the "I" on the right-hand side  evaluates
to a number (the square root of minus one).  You can fix this part of
the problem by using a delayed assignment (lhs := rhs) rather than an
immediate assignment (lhs = rhs), which will prevent the "I" on the
right-hand side of the rule from evaluating to a number, but a much
better solution is to use some symbol other than "I" as the name of
your variable.
The other problem is that the NN on the left-hand side of this
definition is not followed by an underscore, and so will be treated
literally, rather than as a placeholder for a variable. That is, this
rule will only be used if the third argument is explicitly NN.
If you use
BB[II_,a_,NN_,d_,z_]= (II*NN/(2*d))*(z/Sqrt[a^2+z^2])
then you example should work fine.
Dave Withoff
Wolfram Research