MathGroup Archive 2007

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

Search the Archive

Re: Apparently inconsistent behaviour of Convert[#, 1] &


Andrew Moylan wrote:
> Convert[Sqrt[Meter^2], 1]
>>> Meter
> 
> Convert[2*Sqrt[Meter^2], 1]
>>> \!\(Convert::"incomp" \(\(:\)\(\ \)\) "Incompatible units
>       in \!\(2\\ \@\(Meter\^2\)\) and \!\(1\)."\)
>>> 2*Sqrt[Meter^2]
> 
> Why does the latter conversion not succeed when the first one does?
> 
> 

One is not a unit, so the results you might get are unpredictable. The 
following works in all cases:

In[1]:=
Needs["Miscellaneous`Units`"]
Convert[Sqrt[Meter^2], Meter]
Convert[2*Sqrt[Meter^2], Meter]

Out[2]=
Meter

Out[3]=
2 Meter

Regards,
Jean-Marc


  • Prev by Date: Re: MathML 3 working group
  • Next by Date: Re: Logical comparisons of items in a two lists
  • Previous by thread: Apparently inconsistent behaviour of Convert[#, 1] &
  • Next by thread: Re: Mathematica 6.0 is released!