RE: Mathematica 3.0 - 4.0 discrepancies.

*To*: mathgroup at smc.vnet.net*Subject*: [mg20403] RE: [mg20377] Mathematica 3.0 - 4.0 discrepancies.*From*: "Ersek, Ted R" <ErsekTR at navair.navy.mil>*Date*: Tue, 26 Oct 1999 00:32:55 -0400*Sender*: owner-wri-mathgroup at wolfram.com

Jordi Igns indicated Version 3 and Version 4 gave very different results when certain calculations were done under Win9x or Linux, but not under MacOS. I found the source of the problem and simplified it to the examples below. Using Version 3 under Windows 98 we get the following: ------------------------------------- In[1]:= reflected[air] ={{1,2},{3,4}}.{E[air][1],E[air][2]} Out[1]= {E[air][1] + 2*E[air][2], 3*E[air][1] + 4*E[air][2]} In[2]:= {{1.0,2.0},{3.0,4.0}}.{E[air][1],E[air][2]} Out[2]= {1.*E[air][1] + 2.*E[air][2], 3.*E[air][1] + 4.*E[air][2]} In[3]:= reflected[air] ={{1.0,2.0},{3.0,4.0}}.{E[air][1],E[air][2]} Out[3]= {1.*E[air][1] + 2.*E[air][2], 3.*E[air][1] + 4.*E[air][2]} In[4]:= {{1.0,2},{3.0,4}}.{E[air][1],E[air][2]} Out[4]= {1.*E[air][1] + 2.*E[air][2], 3.*E[air][1] + 4.*E[air][2]} ------------------------- Using Version 4 under Windows 98 we get the same result from In[1], In[2], but not from In[3], In[4] !! Instead Version 4 gives the result below. In[4]:= reflected[air] ={{1.0,2.0},{3.0,4.0}}.{E[air][1],E[air][2]} Out[4]= {8.15485, 19.028} In[5]:= {{1.0,2},{3.0,4}}.{E[air][1],E[air][2]} Out[5]= {8.15485, 19.028} Apparently the kernel gives E[air][1], E[air][2] the numeric value of E in the lines above. I would say this is a bug in Version 4.0 under certain platforms. However, it's a bad practice to use symbols such as (E, I, Pi, D) for variables because the built-in meaning might mess things up. As we see above, your code might work with the present version of Mathematica, but not in a future version. It seems Jordi was using E, B to represent electric, magnetic fields, and that sounds like a logical choice. Now that we know this can cause problems I think a better choice would be \[ScriptCapitalE], \[ScriptCapitalB]. -------------------- Regards, Ted Ersek For Mathematica tips, tricks see http://www.dot.net.au/~elisha/ersek/Tricks.html