From: Deane Yang (deane_yang_at_[hidden])
Date: 2003-10-16 21:03:57
Jan Van Dijk wrote:
> This is not as clear-cut as it seems. Think about logarithmic units. As you
> know such units are defined as the N-log (typically 2 or 10) of the ratio of
> the value P, say, and a reference Pref. As an example, take the decibel:
> power in dB = 10log(P/Pref).
> [I forgot Pref, but that does not matter]. Anyway, the result is that
> combining two power sources of both 0dB yield 3dB: "0+0=3".
> If the library is supposed to do not only dimensional analysis, but also unit
> conversion or even arithmetics on (physical) quantities, it should be taught
> that in the above case the P's should be added, rather than the
> representations of P in the logarithmic units. The units should be marked as
> logarithmic, so that distributivity (val1*u+val2*u=(val1+val2)*u) is no
> longer assumed.
> This is probably outside the scope of the proposed library.
Yes, I have to confess that I completely forgot about logarithmic units
and am relatively unfamiliar with what the needs are when working with
such units. I have to concede that all I had in mind for the dimensional
analysis library is basically a library that just does arithmetic in a
typesafe manner. So, at least at first glance, it appears to be limited
to linear units.
It is definitely an interesting challenge on how to incorporate
nonlinear units into the whole picture.
>>But I do think it worthwhile to allow rational exponents (but NOT
>>arbitrary precision). I'd like someone to show me a real example
>>where the exponent had a numerator or denominator other than 1, 2, 3, or
>>4. (Even 4 is, for me, a stretch)
> Such high exponents are very common in physical chemistry and thermodynamics.
> As an example, the rate coefficient of a ternary process (A+B+C => whatever)
> has dimension [length]^6/[time]. These are very common. Even fourth-order
> reactions exist (giving an exponent of 9). Non-existing reactions with even
> higher arity are artificially formed in the field of theoretical/numerical
> equilibrium thermodynamics (to find out the equilibrium composition of
> complex chemical mixtures.)
> This is not only theory. This is what I do for a living. And precisely in the
> implementation of the code I have developed for these applications I would
> have used a dimension-cheking utility, were one available.
> I am sorry that we (physicists) have ruined the beauty and elegance of your
> (mathematical) world ;-)
No apology, please! This is absolutely wonderful. I had no idea this
stuff existed. It all sounds very cool to me and mathematically very
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk