2
$\begingroup$

It seems that there is a lot of interest in enhancing the use of units in Mathematica; various solutions in the name of brevity, correctness, and general utility have been demonstrated. I've begun treating unit conversions in a very simple manner as listed below. My question: what problems might I run into making conversions in this manner? (It saves a little typing and seems somewhat easier to read to me, at the expense of defining "in" and "to" aliases.) (Mathematica v.9.0.1.0)

in = Quantity; to = UnitConvert;

Express x "in" feet:  

x = 100.0~in~"Feet"

100. ft

Convert "to" yards:

x~to~"Yards"

33.3333 yd

Convert to SI units:

x // to

30.48 m

"One stop shop" conversion:

x = 1.0~in~"kg"~to~"lb"

2.20462 lb
$\endgroup$
  • $\begingroup$ If you really want to use this kind of syntax it would be easier to convert things using Google, IMO... Try this. $\endgroup$ – Rod Jun 7 '13 at 0:31
  • $\begingroup$ Seems fine to me $\endgroup$ – Rojo Jun 7 '13 at 1:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.