# How to determine the units of a value

Given e1..e5 as the exponents of the base units, are there any well known methods for producing a simplified form?

As an example m^2*kg*s^-1 simplifies to W*s^2.

I have a set of derived units as Name/exponent-vector pairs as input and it can be assumed all exponents are rational (and in fact most being integers and almost all not having a denominator more than about 3-4).

I know this can be reduced to a linear algebra problem but it is VERY under defined and in fact has several possible solutions.

-
So take the least squares solution, or something. – Qiaochu Yuan Aug 26 '10 at 0:28
least squares is for over constrained (i.e no-solution), this is under constrained (inf-solutions). – BCS Aug 26 '10 at 1:11
Sorry, I guess that was bad terminology. I meant take the solution whose distance to the origin is smallest. (Or you can switch to the L^1 norm, or something. It really depends on what you're trying to accomplish.) – Qiaochu Yuan Aug 26 '10 at 3:21
@Qiaochu, @BCS: Unfortunately, the expression $\text{J}^{1/2}\text{kg}^{-1/2}$ has a lower norm than the much more desirable $\text{ms}^{-1}$ in any norm. It seems to me that one would have to restrict the exponents to integers to get sensible results. I don't know what to do about rational exponents in the input. – Rahul Oct 25 '10 at 3:18
I have no idea what you are trying to ask. The concept of "simple" in this case is highly subjective. I personally think that working with (physical) units of M,L,T, and Q is the most simple way to do dimensional analysis. Memorizing a host of identities such as $[W]=[M\frac{L^2}{T^2}]$ doesn't make anything simpler for me personally. – Matt Calhoun Nov 24 '10 at 3:28

In general the problem of "simplifying" units (mathematical expressions in general) has no well defined solution - it is not even a well-defined process, in most cases. For example, there are multiple ways of reducing your given example:

m^2 kg s^-1 => N m s

m^2 kg s^-1 => J s

m^2 kg s^-1 => W s^2

The best you can really do is recursively enumerate over all such possibilities and use some heuristic to choose the "best" (or give the option of using any of them).

(Note: intuitively I would guess that these units are representing angular momentum, in which case N m s probably makes most sense, though it's quite subjective.)

-
I was kinda looking for some solutions that have already thought that one out. Any suggestions as to a heuristic and/or a enumeration strategy that will will allow good pruning? – BCS Aug 26 '10 at 1:13