Re: Not a machine-size real number?
- To: mathgroup at smc.vnet.net
- Subject: [mg9272] Re: [mg9260] Not a machine-size real number?
- From: seanross at worldnet.att.net
- Date: Mon, 27 Oct 1997 02:46:44 -0500
- 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}] > > 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 1) general programming practice is to evaluate your function and see what kind of object mathematica returns before you attempt plotting it. 2) Thhe message about not a machine size real number is sort of the default plot error message. It could mean that the function is complex, has symbols in it, has an error in it etc. 3) I evaluated your function at a few values. BB[1,0.05,100,0.01,1] returns itself. The reason is that you forgot the underscore after the NN. This makes BB defined if and only if the third argument is NN. Anything else will not do. If you want NN to be a variable, then you need the underscore. Also, it is more common to use the :=(delayed assignment) in one line functions. The =(immediate assignment) is normally for assigning values to constants. It is also dangerous to make a variable have the same name as a built in mathematica symbol, in your case I is normally used for the square root of -1. By making a pattern have the same name, you effectively preclude the use of complex numbers in your function. Since all mathematica built in symbols start with capital letters, it is normally a good standard practice to make yours start with small letters.