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 ?


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.

  • $\begingroup$ A combination of these two pages may be of some use: en.wikipedia.org/wiki/SI_prefix, and en.wikipedia.org/wiki/Dimensional_analysis $\endgroup$ – qftme Jul 1 '11 at 15:07
  • $\begingroup$ 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. $\endgroup$ – Edgar Bonet Jul 1 '11 at 15:23
  • 1
    $\begingroup$ 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. $\endgroup$ – leftaroundabout Jul 1 '11 at 15:54
  • $\begingroup$ @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 ? $\endgroup$ – MillKa Jul 1 '11 at 16:10
  • $\begingroup$ @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. $\endgroup$ – 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.

| cite | improve this answer | |
  • $\begingroup$ Seconding this, root-hertz is pretty common in spectroscopy, noise levels in electronics, etc. Common fractional power unit. $\endgroup$ – crasic Jul 1 '11 at 20:06
  • $\begingroup$ Ouch. So how is the relation to SI handled ? Is there another "SI compatible" unit, e.g. square Jones ? $\endgroup$ – MillKa Jul 1 '11 at 21:05
  • 2
    $\begingroup$ @MillKa: What do you mean "relation to SI"? This is SI. $\endgroup$ – Dan Jul 1 '11 at 21:13
  • $\begingroup$ @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. $\endgroup$ – MillKa Jul 1 '11 at 21:51
  • 2
    $\begingroup$ 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. $\endgroup$ – 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.

| cite | improve this answer | |
  • $\begingroup$ If you use 12252240 instead of 39916800, then you can handle all exponents up to ≈ 175 with denominators up to 18. $\endgroup$ – Edgar Bonet Jul 2 '11 at 17:13
  • $\begingroup$ 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]{}$. $\endgroup$ – 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$

| cite | improve this answer | |

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.

| cite | improve this answer | |

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}$$

| cite | improve this answer | |
  • $\begingroup$ Thanks. But isn't that a problem of the CGS unit system (and other non-SI unit systems) ? statcoulomb @ Wikipedia $\endgroup$ – MillKa Jul 1 '11 at 19:05
  • $\begingroup$ I don't know of any fractional dimensions in the SI system. Is your program restricted to SI? $\endgroup$ – Dan Jul 1 '11 at 19:10
  • $\begingroup$ 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. $\endgroup$ – MillKa Jul 1 '11 at 19:26
  • $\begingroup$ ""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. $\endgroup$ – Georg Jul 2 '11 at 12:05
  • $\begingroup$ @Georg: I tend to conflate the two; I almost never see CGS unless Gaussian or natural units are also being employed. $\endgroup$ – Dan Jul 2 '11 at 20:42

I am also working on the development of a namespace for quantities and units and I stumbled upon this old discussion.

My small and late contribution:

a)-g) The exponent for length can be as high as six (dipole-dipole interaction, such as in Fluorescence Resonance Energy Transfer). The exponent for current / charge can be +-2 (capacitance, resistance, permittivity, permeability, Coulomb constant) and I guess the same can happen to Mass. In Chemistry, the thermodynamic equilibrium constant has dimensions equal to a power of the pressure, or of the molar concentration, with an exponent equal to the difference in the stoichiometric coefficient, which is limited by the reaction order. For a single reaction, the maximum reaction order observed is 6 (https://www.quora.com/What-is-the-maximum-order-of-reaction; http://pubs.acs.org/doi/abs/10.1021/ja01304a016); for a reaction chain, it can be unlimited (think about polymers...)

h) I think the crystallised order is L M T I Θ N J with exponents

i) Maybe also units for angles and logarithmic units (bel, nit, digit, bit) could be included, but I am in doubt.

j) I never saw exponents other than integers and half-integers (square roots) but maybe they occur in mixed-order chemical reactions.

| cite | improve this answer | |
  • $\begingroup$ StackExchange sites are Question & Answer sites, not a discussion forum. As such, I've removed your 'request' as it's inappropriate for this site. Also, please don't sign your name at the bottom of your posts, as your user account is linked to the post already. $\endgroup$ – Kyle Kanos Jul 9 '18 at 14:20

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.