I am writing a Mathematica Palette to work with units, and am wondering if anyone knows a way to define new units outside of the standard ones that come with Mathematica 9. I do know of the IndependentUnit command

Quantity[3, IndependentUnit["Boxes"]]

which in this specific case makes sense to be non-convertible, but I want to add convertible units such as Smoots, Batmans, and MingDynasties. I found an old package that seemed to do this ("Automatic Units package"), but I couldn't get any of the functions to work, even when copied from the included documentation. What I want is to be able to convert from user-defined units to more conventional ones and back again without manually doing it, i.e

Unit[Smoots,67 Inches] (*defines 1 Smoot to be equal to 67 inches*)
UnitConvert[5 Smoots, Inches] (*would return 335 inches*)
UnitConvert[335 inches,Smoots] (*would return 5 Smoots*)

Since this has been done in a package before, I don't foresee this being impossible, but I am a fairly novice Mathematica Programmer, and could be very mistaken. If anyone has any insight, it would be very much appreciated.

  • 2
    $\begingroup$ QuantityUnits` is a complete rewrite of the AutomaticUnits` package and has little in common with it, so the documentation examples are certainly not going to be compatible. To make matters difficult, the source code of QuantityUnits` is encrypted. Bottom line, I think QuantityUnits` has a fixed set of units that it can work with, and would need to look into how to circumventing this to define new ones. It requires downvalues to be defined on a number of different symbols to get it working. $\endgroup$ – Oleksandr R. May 9 '16 at 9:26
  • $\begingroup$ Same question, essentially: (39006) $\endgroup$ – Oleksandr R. May 9 '16 at 9:31
  • 2
    $\begingroup$ If any long-standing user of the site wants to have a try at implementing the custom unit, I have some information that may be valuable but which it isn't possible to give here. Email me: "1:eJxTTMoPCpZjYGDIz0nNLk7MSymKL0osLigtyczLL3OozE3MzNFLzs8FAAAzDfw=" $\endgroup$ – Oleksandr R. May 9 '16 at 9:35