       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:= 0.0 Cos[x] Sin[x]
Out= 0. Cos[x] Sin[x]

In:= 0.0 a b
Out= 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
Same thing with In 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:= 1.0 Cos[x] Sin[x]
Out= 1. Cos[x] Sin[x]

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

In:= 0.0 a b + 1.0 a b
Out= 1. a b

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

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

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

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

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

We may conclude that in the case of  and  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