# Whats the range of dimension exponents in the SI Units system?

I am working on a software library for Units of Measure. To represent dimensions, I need to know the required range of exponents for each of the seven base units (precisely, I need to know the required maximum number of bits for each exponent). After reading many related questions, I still have some questions.

As far as I understand, all physical quantities can be expressed as the product of the seven base units, with each base unit raised to the power of 0, +-1, +-2, +-3, and so on. So the dimension of a quantity is represented by a vector / array of 7 integers.

E.g. for volume (length ^ 3) that array would be (3, 0, 0, 0, 0, 0, 0), for acceleration (length / (time ^ 2)) it would be (1, -2, 0, 0, 0, 0, 0).

While I could calculate the square of a volume (with dimension 6,0,0,..), it doesn't make much sense, because I have never encountered any physical quantity that needs (length ^ 6).

My questions:

a) What is the maximum required exponent for Length ? Do you know any example where +-3 is not enough ?

b) Maximum exponent for Time ? Any example beyond +-4 ?
(update: raised to 4 for capacitance)

c) Maximum exponent for Mass ? Any example beyond +-1 ?

d) Maximum exponent for Electric Current ? Any example beyond +-1 ?

e) Maximum exponent for Temperature ? Any example beyond +-4 ?
(update: raised to 4 for Stefan-Boltzmann constant)

f) Maximum exponent for Amount of Substance ? Any example beyond +-1 ?

g) Maximum exponent for Luminous Intensity ? Any example beyond +-1 ?

.. plus three bonus questions:

h) Is there some required order of the seven base units ? I have seen more than one ..

i) Are those seven base units enough for everything, or is there some bleeding edge science that needs more ?

j) Are the exponents always integral ? Never ever something like ^ 1.5 or ^ e ?

Thanks.

(update)
I guess I should clarify:
I am aware that values might need rational or real exponents.
I am aware that intermediate results might need a wider range of integer exponents.
I have read the relevant SI standard document, and lots of websites about the topic.

My questions are just about the base units exponents that define the dimension of (base or derived) units.

The most precise statement i found so far was: the exponents are very small integers.

However, to exploit all filthy speed tricks of CPU or GPU assembly programming, I need to know the exact number of bits required.

-
A combination of these two pages may be of some use: en.wikipedia.org/wiki/SI_prefix, and en.wikipedia.org/wiki/Dimensional_analysis –  qftme Jul 1 '11 at 15:07
Take also a look at physics.nist.gov/cuu/Units/units.html , it has many examples that go beyond the limits you suggest, and is a good reading for anyone writing software related to SI units. –  Edgar Bonet Jul 1 '11 at 15:23
Do you need the SI decomposition only for checking dimensional mismatches or also for anything else? I have written a physics units library that uses cgs as its internal system, which works quite well and has less computional overhead than a full SI representation. (You can still auto-convert to better-suited units of any kind for the final output.) — What you definitely need is larger exponents than 6 (I'd recommend at least 12), and support for fractional exponents – even when no unit with an actual physical meaning has such a dimension, it may still occur in intermediate results. –  leftaroundabout Jul 1 '11 at 15:54
@leftaroundabout: Right now i use a dimension class that contains an array of seven signed bytes, so every exponent can be -128 to +127. However my gut feeling tells me that this might be way beyond whats actually needed. The Dimension class will be used at compile-time and run-time to avoid / detect doing silly things. I am curious how you solved the issue, is your library somewhere on the web ? –  MillKa Jul 1 '11 at 16:10
@MillKa: there are many open-source unit libraries out there on the web that you can look at for inspiration. A web search for [your language] units might be a good place to start. –  David Z Jul 1 '11 at 17:40

At least one common quantity I can think of has dimension with a non-integer exponent. The specific detectivity, $\text{D}^*$ is a common descriptor of photodiodes, and I'm sure one could make an analogous figure of merit for other types of sensor.

The unit of $\text{D}^*$ is the "Jones," which is equal to

$$\frac{cm \cdot \sqrt{Hz}}{W}$$

Watts in SI decompose into

$$Kg \cdot m^2 \cdot s^{-3}$$

which makes one Jones equal to:

$$\frac{s^{2.5}}{Kg \cdot m} \times 10^{-2}$$

with dimension:

$$\text{time}^{2.5} \text{mass}^{-1} \text{length}^{-1}$$

There are other quantities related to $\text{D}^*$, such as Noise Equivalent Power (NEP), which come up a lot in radiometry. Basically, any measurement which is normalized by frequency bandwidth will end up with that $\sqrt{Hz}$ in the units.

-
Seconding this, root-hertz is pretty common in spectroscopy, noise levels in electronics, etc. Common fractional power unit. –  crasic Jul 1 '11 at 20:06
Ouch. So how is the relation to SI handled ? Is there another "SI compatible" unit, e.g. square Jones ? –  MillKa Jul 1 '11 at 21:05
@MillKa: What do you mean "relation to SI"? This is SI. –  Dan Jul 1 '11 at 21:13
@Dan: Oops. Translation error. I just checked the english text of the SI brochure ( bipm.org/utils/common/pdf/si_brochure_8_en.pdf ) and it says the exponents ".. are generally small integers ..", but that got lost in the translated version I used. If I switch from integer to fixed point exponents, I could cover 1/2 and my speedups would still work. But if I have to support all possible fractions or even irrational numbers, the speedups will not be possible any more. –  MillKa Jul 1 '11 at 21:51
However, the fact that you are concerned with making dimensional calculations faster makes me think you are doing something wrong. If I've got to multiply two arrays with a million elements each, I do not want to repeat the dimensional calculations for each element of the array! It will always be sufficient to handle dimensional analysis independantly from the numerical calculations. –  Colin K Jul 1 '11 at 22:06

Regardless of whether you really need it, here's what I have found to be usable:

As I said, I represent all units internally as cgs: $$\mathrm{U} = \mathrm{cm}^c\cdot \mathrm{g}^g\cdot\mathrm{s}^s$$ Where, in general, $c,g,s\in\mathbb{Q}$. For this, I have 3 ints, defined by $$i_c = 39916800 \cdot c$$ etc., so that, $39916800$ being $11!$, I can be almost completely sure that nobody will ever come up with a unit such that $i_c\not\in\mathbb{Z}$. It also supports exponents up to $\frac{2^{31}}{11!}\approx 53$, which I'm quite sure should be enough.

You may argue that using full integer variables is a great waste of resources, but I actually think (haven't tried it, though) that it's faster than a naïvely implemented array of chars, because the processor does not even directly calculate those, if you ask it to: it first needs to cast them to int, do the calculation there, and cast them back to char.

And as I said, you probably don't need to worry at all about performance if you do the unit stuff at compile time. The quantities do not need any knowledge about their SI exponentials whatsoever then, and if you need some way to uniquely identify units, you can just put all the units that actually occur during the preprocessing in a hash map or something and let the calculable quantities store only pointers to the unit objects.

-
If you use 12252240 instead of 39916800, then you can handle all exponents up to ≈ 175 with denominators up to 18. –  Edgar Bonet Jul 2 '11 at 17:13
Because 12252240 is the least common multiple of numbers $1$ to $18$? Reasonable thought, but I deliberately chose a faculty rather than an lcm, because it seems more likely to me to get something like $\sqrt{\sqrt[3]{\sqrt{\sqrt{\sqrt[5]{\sqrt{}}}}}}=()^{\frac{1}{8\cdot 5\cdot 3\cdot 2}}$ rather than $\sqrt[13]{}$. –  leftaroundabout Jul 2 '11 at 18:52

In a paper, dated yesterday, where units are studied I can see wavelength raised to -5 , temperature raised to 4.
I do not know the actual maximum exponents in all circumstances.

Constant or Quantity --- Dimension

Planck Constant h --- $ML^{2}T^{-1}$
Stefan Constant $\sigma$ --- $MT^{-3}\theta^{-4}$
Boltzmann Constant k --- $ML^{2}T^{-2}\theta^{-1}$
Temperature $\theta$ --- $\theta$
Energy --- $ML^{2}T^{-2}$
Force --- $MLT^{-2}$
Pressure --- $ML^{-1}T^{-2}$
Luminosity --- $MT^{-3}$
Power --- $ML^{2}T^{-3}$
Velocity --- $LT^{-1}$
Electron charge --- $Q$
Proton mass --- $M$
Bohr radius --- $L$

-

I don't think you can just use integers in all cases. For example the statcoulomb, the gaussian unit of charge, is defined as

$1 \text{ statcoulomb} = \frac{g^{1/2} cm^{3/2}} {s}$.

Also,the Stefan-Boltzmann constant's units are proportional to $T^{-4}$. Specifically, from Wikipedia: $$\sigma = 5.670400 \times 10^{-8}J s^{-1}m^{-2}K^{-4}$$

-
Thanks. But isn't that a problem of the CGS unit system (and other non-SI unit systems) ? statcoulomb @ Wikipedia –  MillKa Jul 1 '11 at 19:05
I don't know of any fractional dimensions in the SI system. Is your program restricted to SI? –  Dan Jul 1 '11 at 19:10
Yes, I will stick to SI. At least in the core of the library, so that i can use integer exponents for the dimensions. Otherwise half of my speedup ideas wouldn't work. I think a pure SI library would be still useful enough. –  MillKa Jul 1 '11 at 19:26
""Thanks. But isn't that a problem of the CGS unit system (and other non-SI unit systems) ? "" Statcoulombs are statcoulombs, irrespective of cgs or mks! The "difference" is somwhere other, You should read about such things first. The fact that such things are not used today is not beause of MKS, its because textbook-writers decided to stop it, in order not to ask for too much from amateurs/beginners. I must confess, that this kind of natural units were very confusing to me when I began to learn physics. –  Georg Jul 2 '11 at 12:05
@Georg: I tend to conflate the two; I almost never see CGS unless Gaussian or natural units are also being employed. –  Dan Jul 2 '11 at 20:42

The range for the exponents you need is (- infinity , + infinity). Units for school physics will mostly use signed integer in the range of [-3,+3] but in thermodynamics and quantum mechanics one may look at many dimensions. Perhaps you can find some ideas how others solved the problem in units. http://linux.die.net/man/1/units

Keep in mind, that some values might be tensors or vectors.

-