|
Boost : |
From: Dan W. (danw_at_[hidden])
Date: 2004-01-11 16:52:22
Deane Yang wrote:
> Allowed calculations involving just one dimension:
> (A dimension is like a 1-dimensional vector space.)
> You are allowed to do the following:
> a) Add or subtract two quantities of the same dimension. (vector addition)
> b) Multiply a quantity by a pure number (scalar multiplication)
> c) Divide one quantity by another (find the scalar factor that
> scales one quantity into the other)
>
> (Note that multiplication of two quantities is NOT in this list.)
>
> Allowed calculations involving more than one dimension:
> (Tensor products and dualization)
> a) If you multiply two dimensioned quantities, the result
> is a quantity in the appropriate derived dimension (e.g., speed * time =
> distance).
> If one dimension is the reciprocal of the other, you get a pure number.
> b) If you divide two different dimensioned quantities, the result
> is a quantity in the appropriate derived dimension.
> c) If you raise a quantity to a power (which is always a pure number),
> you get a quantity in the appropriate derived dimension (e.g., distance
> squared = area). (By the way, I have never seen any example involving
> irrational powers. Rational powers, as many have observed, do occur
> often enough.)
>
> Allowed calculations involving an absolute dimension:
> (An absolute dimension is a 1-dimensional affine space)
> a) Associated to any absolute dimension (say, calendar date) is
> a relative dimension (time difference).
> b) You can take the difference between two absolute quantities
> (two dates) and get a quantity in the corresponding relative dimension
> (time difference).
> c) You can add or subtract a relative quantity to an absolute quantity
> (I prefer to call this a "shift", to distinguish it from
> the addition of relative quantitites).
> d) You are NEVER allowed to multiply an absolute quantity by any
> other quantity or even a pure number. (ever want to multiply a
> calendar date by a factor of 2 or by another date?)
>
> The properties of relative dimensions form the fundamental principles of
> dimensional analysis as created by the physicists. I have never
> seen the properties of absolute dimensions elucidated as above,
> but calendar time is a clearcut example. The boost date-time library
> contains an effort to implement in that specific case the properties
> described above.
Good analysis. I'd say that, more generally, any quantity type, physical
or not, has the potential of being used in "absolute mode" if I may coin
a term till someone tells me what the actual term should be.
How does 'days' become absolute? By identifying points by measuring
their 'days' time relative to some 'absolute date', which is often a
realtive term.. :)
The fact that dates cannot be added is due to the fact that two dates
represent two overlapping vectors, with their origin at that absolute
point. Addition would most often imply that we are placing the
beginning of one vector at the end of the other, then deleting the
common vertex to come up with a sum vector. But a date is like a time
vector whose origin is firmly attached, disallowing addition.
Note that if the absolute point happens to be absolute in more than just
a relative sense, it may actually enable addition: Adding degrees
Celsius or Farenheit makes no sense; but adding Kelvins does, at least
in some contexts.
> Complex quanitities are for me clearly beyond the scope of
> the current unit libraries. Higher dimensional analysis
> is probably useful, but a lot trickier to implement.
> 1-dimensional analysis serves 90% of the needs.
This I take issue with: Complex numbers are used everywhere to describe
time-changing phenomena, be it voltage, force, current or motion or
acceleration. And there's nothing that a units library shouldn't be
able to handle about it. If v = t * u, where all have complex
representations, boils down to four v = t * u operations using double,
say, an addition and a subtraction.
In fact, the units library doesn't even care that a complex
multiplication is taking place; all it needs to do is decorate the
complex result to the right type of units, which is the same type as if
the operation were simple.
Cheers!
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk