MathGroup Archive 2005

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

Search the Archive

Re: Cross results?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg63221] Re: Cross results?
  • From: "Jean-Marc Gulliet" <jeanmarc.gulliet at gmail.com>
  • Date: Mon, 19 Dec 2005 07:01:27 -0500 (EST)
  • Organization: The Open University, Milton Keynes, U.K.
  • References: <do3l7r$o0b$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

"Virgil Stokes" <virgil.stokes at it.uu.se> a écrit dans le message de news: 
do3l7r$o0b$1 at smc.vnet.net...
|I have the following
|
|  x=.
|  Cross[{10 Sin[x],-10 Cos[x],2.5},{0.12 Sin[x],-0.12 Cos[x], 0.0}]
|
| which gives,
|
|  {0.3 Cos[x], 0.3 Sin[x], 0.Cos[x]Sin[x]}
|
| why does it not set the last term to 0.0?
|

Hi Virgil,



First, note that the observed result is neither specific to the function 
*Cross* nor to the use of trigonometric functions, but on the way 
Mathematica handle the inexact (machine precision) value 0.0 mixed with 
symbolic expressions as you can see in the following examples:



In[1]:= 0.0 Cos[x] Sin[x]
Out[1]= 0. Cos[x] Sin[x]



In[2]:= 0.0 a b
Out[2]= 0. a b



One explanation that comes to mind is since a machine precision number is 
inexact by nature (o is the exact value zero whereas 0.0 is zero within the 
limit of *$MachinePrecision*) and the symbolic expression Cos[x]*Sin[x] can 
return exact or inexact values depending of its parameter x (Pi/4 vs. 0.7854 
for example) Mathematica is being conservative in terms of arithmetic 
precision and decides not to simplify the overall expression in absence of 
more information about the precision of the value return by Cos[x]Sin[x]. 
Same thing with In[2] where Mathematica has no idea about what could be 
possibly returned by the sub-expression ab.



On a similar line of thoughts, we can test this explanation with the machine 
precision number 1.0 and check that no simplification occurs:



In[3]:= 1.0 Cos[x] Sin[x]
Out[3]= 1. Cos[x] Sin[x]



The above explanation is consistent with the seemingly puzzling examples [4] 
and [5], where simplification of 0.0 * expr to 0 apparently occurs:



In[4]:= 0.0 a b + 1.0 a b
Out[4]= 1. a b



In[5]:= 0.0 Cos[x] Sin[x] + 1.0 Cos[x] Sin[x]
Out[5]= 1. Cos[x] Sin[x]



However, we can see that if the sub-expressions are different then no 
simplification to 0 occurs:



In[6]:= 0.0 a b + 1.0
Out[6]= 1. + 0. a b



In[7]:= 0.0 a b + 1.0 c d
Out[7]= 0. a b + 1. c d



In[8]:= 0.0 Cos[x] Sin[x] + 1.0 Cos[x] Tan[x]
Out[8]= 1. Sin[x] + 0. Cos[x] Sin[x]



We may conclude that in the case of [4] and [5] that Mathematica first 
factorize the expressions to a form {0.0 + 1.0) * expr, then, since it knows 
how to simplify (0.0 + 1.0) to 1.0, it return 1.0 * expr.



I hope that I have been sufficiently clear in writing these late (local 
time) explanations!



Best regards,

/J.M.



  • Prev by Date: Re: Solve Limitations
  • Next by Date: Re: Why is y a local variable here?
  • Previous by thread: Re: Re: Cross results?
  • Next by thread: Imposing boundary condition at infinity