Re: Not a machine-size real number?
- To: mathgroup at smc.vnet.net
- Subject: [mg9275] Re: Not a machine-size real number?
- From: "P.J. Hinton" <paulh>
- Date: Mon, 27 Oct 1997 02:46:46 -0500
- Organization: Wolfram Research, Inc.
- Sender: owner-wri-mathgroup at wolfram.com
Pedro Soria-Rodriguez wrote: > > 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}] > > > --------------------------------------------------- > > What does this mean? Is the definition of my function incorrect? > Thank you very much in advance Two problems here: 1) The function definition, as you have written it above, will never get used by the Plot function because you don't have an underscore under the NN on the left hand side of the assignment rule. It probably needs to be rewritten as: BB[I_,a_,NN_,d_,z_]= (I*NN/(2*d))*(z/Sqrt[a^2+z^2]) or even better yet using SetDelayed: BB[I_,a_,NN_,d_,z_]:= (I*NN/(2*d))*(z/Sqrt[a^2+z^2]) 2) Even when the rule does evaluate inside of Plot, you will find that the values of BB are pure imaginary. In[5]:= Table[BB[1,0.05,100,0.01,z],{z,-1,1,0.2}] Out[5]= {-4993.76 I, -4990.26 I, -4982.73 I, -4961.39 I, -4850.71 I, -12 > 5.55112 10 I, 4850.71 I, 4961.39 I, 4982.73 I, 4990.26 I, 4993.76 I} Mathematica doesn't know how to plot an imaginary number over the real Cartesian plane. If you want to see the imaginary part of this expression (the coefficient of I), then we're in business: Plot[Im[BB[1,0.05,100,0.01,z]],{z,-1,1}] I get a nice graph from this. -- P.J. Hinton Mathematica Programming Group paulh at wolfram.com Wolfram Research, Inc. http://www.wolfram.com/~paulh/