Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a function which applied to a quantity returns its numerical value so I for instance can fill it into my Predictorfunction?

share|improve this question

Oops - found it! QuantityMagnitude[quantity] does the job. For example,

In[1]:= QuantityMagnitude[Quantity[1, "Feet"]]

Out[1]= 1
share|improve this answer
2  
If you want to remove the units in an expression regardless of what level that unit resides on, you can tack /. Quantity :> Composition[QuantityMagnitude, Quantity] (/. Quantity :> QuantityMagnitude@*Quantity in version 10) or /. Quantity[x_, y_] :> x to the end of your expression. Examples. – seismatica Aug 4 '14 at 18:18

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.