 # Boost :

From: Deane Yang (deane_yang_at_[hidden])
Date: 2003-10-16 13:23:10

First, I agree with what Jan Langer wrote in his message about the
design of the library.

Jan Langer wrote:

> i think you confuse something here: quantities and units (maybe i am
> confusing the name ;-))

I am under the impression that the standard terminology is "dimensions"
(refers to things like mass, length, and time without any particular
units) and "units" (things like meters, grams, seconds).

> in an abstract sense this should be
> like points in an n-dimensional space.

(I apologize for behaving like a pedantic mathematician here going way
off-topic, but I've always wondered what the right abstract description
of dimensional analysis was and I'm very happy to have figured it out.)

For what it's worth, although your description of what a dimension
library should be is quite good, it's not really points in an
n-dimensional space.

Here is a precise mathematical description of dimensional analysis. The
thing to notice about dimensional analysis is that all of the things
being measured are 1-dimensional. Doing dimensional analysis properly
for higher dimensions (for example, dealing with position in 3-space and
force vectors) is somewhat more complicated (I do sometimes dream of a
library that
properly joins dimensional analysis with linear algebra.).

Each basic dimension corresponds to a different 1-dimensional real
vector space (i.e., the real line without the co-ordinate labeling).
Each possible "derived" dimension (which consists of a product of
fundamental dimensions raised to integer or even rational powers)
corresponds to
a tensor product of the appropriate number of the basic 1-dimensional
vector spaces or their duals (if the corresponding exponent is
negative). Rational powers are a little harder to describe, but also
have a natural mathematical description.

Defining units for a given dimension corresponds to choosing a basis
for the corresponding 1-dimensional vector space (all you need to do
is choose a single vector and declare it to be a unit vector). A fancy
way to say this is to choose an invertible linear map from the vector
space to the real line. You can do this for any of the dimensions,
whether they are fundamental or derived. However, if you choose units
for each of the fundamental dimensions, then they naturally induce units
for each of the derived dimensions. Mathematically, this corresponds to
saying that if you choose linear maps from each fundamental vector space
to the real line, then there is a naturally induced linear maps from a
derived vector space (i.e., a tensor product involving the fundamental
vector spaces and their duals) to the real line.

None of this helps anyone do anything; nobody really needs to know any
of this. But one way to distinguish between dimensions and units is that
dimensions corresponds to doing abstract linear algebra and units
corresponds to doing linear algebra with respect to fixed bases.
Changing units (like from meters to feet) corresponds to changing the
basis of the corresponding vector space.