Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

It’s great that Quantity can utilize Wolfram Alpha to interpret unit strings that it doesn’t recognize, but I need my code to work on machines that do not have Internet access.

Is there a complete list of built-in (i.e. canonical) unit strings recognized by Quantity?

Better yet, is there a programmatic way to produce such a list?

share|improve this question
    
Good question! I hope Wolfram notices this question and intends to make the Quantity capability stand alone (I often use compound units and almost always run into this issue). –  David Skulsky Apr 19 '13 at 21:25
add comment

2 Answers 2

up vote 14 down vote accepted

This is certainly the optimal way of obtaining the list you are looking for

Quantity;QuantityUnits`Private`$UnitReplacementRules[[1, All, 1]]
share|improve this answer
2  
Haha, I just came here to post this! Damn you fellow spelunker! –  rm -rf Jan 26 '13 at 20:03
    
FWIW, this seems to me the optimal way to obtain this list, which incidentally is appropriate. –  Oleksandr R. Jan 27 '13 at 0:55
    
@OleksandrR. I trust your judgement, editing –  Rojo Jan 27 '13 at 1:10
1  
Haha, nice! The Dispatch object from which this list is extracted is actually built from the downvalues of CalculateUnits`UnitCommonSymbols`KnownUnit0Q, which is the canonical arbiter of whether a unit is valid or not. But since this doesn't change after the QuantityUnits` package is loaded, recovering the list as you do here is surely the most direct approach. –  Oleksandr R. Jan 27 '13 at 1:21
    
That is awesome. Thanks! –  SWB Jan 27 '13 at 6:06
add comment

As a partial answer the documentation says:

Supported units include all those specified by NIST Special Publication 811.

This is repeated in Unit Discovery. It also states:

Unit interpretation requires internet connectivity, and can entail additional evaluation time. If speed is a concern, it is advisable to use the canonical unit specification, which can be found using InputForm.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.