Message Boards Message Boards

11 Replies
9 Total Likes
View groups...
Share this post:

Bug in interpreting units in UnitConvert

Dear All,

I tried the following code:

In[43]:= Quantity[0.0007,"Inches"]
Out[43]= 0.0007 in
During evaluation of In[43]:= Quantity::compat: Inches and MicrometersOfMercury are incompatible units >>
Out[44]= $Failed

I think that micrometer should be interpreted as 10^-6 meters (or ?m). However UnitConvert[%, "[Mu]Meter"] does work. Is this intentional or am I missing something? I think it is strange that is 'comes up' with Mercury.

POSTED BY: Sander Huisman
11 Replies

I get the same result on my Macbook Pro running v10. Note when using the Palette or Keyboard shortcuts in you can see what is happening. The issue is the interpretation of "MicroMeter" which somehow becomes mm of Hg. Mathematica does work correctly when you use "Micron" but "MicroMeter" should work.

enter image description here

POSTED BY: Terrence Honan

Yes, that seems to be a problematic interpretation. "Micrometers" works fine:

In[3]:= UnitConvert[Quantity[0.0007, "Inches"], "Micrometers"]

Out[3]= Quantity[17.78, "Micrometers"]
POSTED BY: Ilian Gachevski

The standard naming for multiples and subdivisions of the meter are (for example) the Kilometer, Decimeter, Centimeter etc., where the "meter" part is never capitalized. Could this be a case of misinterpretation when a non-standard unit is asked for, rather than a bug?

POSTED BY: Isaac Abraham

The premise of the clunky unit discovery system is that one shouldn't need to know the precise form of the unit. It should correctly interpret these things. For instance, "Feet", "Foot", "feet", "foot" and even "Foots" work. "MicroMeter" should work.

POSTED BY: Terrence Honan
Posted 10 years ago

I like that Mathematica works with prefixes and units in lower case, except for a unit symbol "derived from the name of a person." ("NIST Guide to the SI," 6.1.2). I also like Mathematica works with units in the singular.

In[9]:= Quantity[0.0007, "inch"]
UnitConvert[%, "micrometer"]

Quantity[101325., "Pa"]
UnitConvert[%, "psi"]

Out[9]= Quantity[0.0007, "Inches"]

Out[10]= Quantity[17.78, "Micrometers"]

Out[11]= Quantity[101325., "Pascals"]

Out[12]= Quantity[14.6959, ("PoundsForce")/("Inches")^2]
POSTED BY: Glenn Carlson

The default forms in Mathematica do not follow that convention. They are always capitalized and plural. It does correctly interpret the other forms but with an Alpha query. This is what I find awkward about the discovery approach; it looks ugly and requires an internet connection. I find the palette and keyboard shortcut approach much quicker and it looks much better.

enter image description here

POSTED BY: Terrence Honan
Posted 10 years ago

I see what you mean.

I will probably avoid features/functions that require internet connectivity since I can foresee using Mathematica offline.

My preference would be that Mathematica accept standard (i.e., NIST/SI) unit abbreviations by default (i.e., w/o internet connectivity).

POSTED BY: Glenn Carlson

To me the interpretation of Mercury (Hg) is the weird thing, and I guess they accidentally 'classified' 'MicroMeter" as ?m of Hg.

But I agree with all the posts above that Feet, foot, feet, Foot et cetera should all work. In general it should not be case sensitive, because I don't think you can confuse two units by their case.

What I still don't get; if these queries get handled by Wolfram|Alpha, why are we not getting this piece of script in Mathematica? Why send these queries over the internet, unnecessarily waste their server-resources, and give the end-users (us) a slow experience (that requires internet connection)?

Can one of the developers please explain why this decision has been made?

POSTED BY: Sander Huisman

Dear Ilian,

As you are a developer; any idea why this could happen, is it because of the usage of a 'Classify' that fails to work? Or is it because someone just wrote one of the 'synonyms' of pressure wrong? I'm quite curious how it can happen...

I was wondering why there is such a hard lowercase/uppercase check for 'known' units inside Mathematica. Because Meters will be interpreted without internet, but if I type meters, it all of a sudden has no clue and has to query the mothership?! Can't we add an IgnoreCase -> True ? haha

I already found out that Micrometers and ?Meter just work fine! Thanks!

POSTED BY: Sander Huisman

Or is it because someone just wrote one of the 'synonyms' of pressure wrong? I'm quite curious how it can happen...

Someone who works on Wolfram|Alpha would have a much better idea than me. Looking at what


does, it seems to know about both the pressure and length units as possible interpretations and it is a matter of which disambiguation takes priority.

I believe the relevant developers are already aware of this issue and have made an adjustment. Thank you for your feedback!

POSTED BY: Ilian Gachevski

That is a very good find! So the bug is in Wolfram|Alpha, not in Mathematica. Thanks for having a look, it must be quite complicated the entire code...

But to interpret as a pressure is completely wrong. One has dimensions meter, and one has dimensions of Pascal or kg/(m*s^2). I think this is just a bug, i've never seen micrometer be interpreted as micrometers of mercury...

POSTED BY: Sander Huisman
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract