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.

Possible Duplicate:
Simpler input for the new unit support

Is there a way to input abbreviated units directly from the keyboard? One can get a value with abbreviated units through the Wolfram/Alpha interface (below) and then clicking on the lower box, but I'd like to be able to type it in directly.

enter image description here

share|improve this question

marked as duplicate by Szabolcs, Leonid Shifrin, Sjoerd C. de Vries, Jens, rm -rf Dec 4 '12 at 1:44

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
@Szabolcs: I think you're right--that's basically the same question. Unfortunately, I was hoping for a simple "type this" answer, but it doesn't look like that's the case. Should I withdraw this question? –  David Skulsky Dec 3 '12 at 19:15
    
I agree that this is an important question and that there's no really satisfactory answer on the other version ... Just trying to keep the site clean---and it seems this is really an exact duplicate. I'd say let's just keep this question as another Google entry point to this (soon very frequently asked) question, even if closed. –  Szabolcs Dec 3 '12 at 19:20
    
This should be reopened. The question seems very different from the proposed duplicate. I don't see it at all. This question is much more concise and has nothing to do with packages. Correspondingly, the answers are of a very different character. Itai's answer, in particular, is very good and has no parallel in the other question. –  Mark McClure Dec 4 '12 at 14:05
    
@MarkMcClure The package stuff in the other question was relatively recent and was actually an update by the OP. The core of the question is exactly the same. I've now moved the update part to the bottom. –  rm -rf Dec 4 '12 at 15:26
add comment

3 Answers 3

up vote 4 down vote accepted

If you want something that displays in abbreviated from, you can do the following:

  1. Type Quantity[number, "unitstring"], for example Quantity[5, "m"].

  2. Select that expression (pressing Ctrl. twice will do that if you haven't moved the cursor).

  3. Perform Evaluate In Place (CtrlShiftEnter on Windows and Linux, CmdEnter on OS X). This will give you something that looks like 5 m but is in fact a full Quantity expression.

share|improve this answer
add comment

You can just type "50 m/s" in a WolframAlpha box, like you have. If you want to enter it in "pure Mathematica", without going through W|A, you can use Quantity["50 m/s"]. See its documentation here: http://reference.wolfram.com/mathematica/ref/Quantity.html

share|improve this answer
1  
I think the main question was: how to avoid typing Quantity and avoid W|A (which is slow and requires an internet connection). –  Szabolcs Dec 3 '12 at 19:21
    
@Szabolcs: precisely. –  David Skulsky Dec 3 '12 at 19:38
add comment

You can abbreviate a bit by using a single string which is interpreted as the second argument of Quantity. The process might not always give you exactly what you want, however.

Quantity[50, "mps"] // InputForm
(* Out: Quantity[50, "Miles"/"Seconds"] *)

Quantity[5, "meters per s"] // InputForm
(* Out: Quantity[5, "Meters"/"Seconds"] *)
share|improve this answer
add comment

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