From: Matthias Troyer (troyer_at_[hidden])
Date: 2006-08-24 00:13:11
On Aug 23, 2006, at 8:40 PM, Andy Little wrote:
> "Matthias Troyer" <troyer_at_[hidden]> wrote in message
>> I have a question here: what is the purpose of these named quantities
>> - is it to output J instead of kgm^2s^2 for energy and Nm instead
>> of kgm^2s^2 for torque?
> Basically yes. Way back someone requested that they be
> differentiated, so I
> differentiated them and hence (BTW) the notion of an anonymous
> quantity was born
> as a logical result of not being able to distinguish the two in
> some cases.
> After all torque is a vector quantity and energy is a scalar
> quantity, so they
> are quite different.
> One could output energy units as N.m , but the joule is the more
> well known SI
> energy unit, so it helps to put things in a familiar context.
> Also there are various non SI units which specifically mean
> torque, such as
> (reading from the SI manual) dyne centimeter, kilogram-force meter,
> And for energy: erg per square centimeter second, watt per square
> inch etc..
OK, to be able to output specific unit symbols is a good thing.
>> - is it to prevent adding energy and torque?
> It could be in Quan, by more querying of the unit and disallowing the
> calculation in this case. At one point Quan (in a previous
> incarnation) did do
> this, but then maybe there are situations where adding or comparing
> torque and
> energy is appropriate, so I opted for the freer semantics. If there
> is a proof
> of some sort that they can never be compared or added then I will
> change the
> current semantics, but I am not enough of an expert to say for sure.
I am strictly against any disallowing of calculations. Just consider
the following pseudo code (I do not refer to any specific
implementation but hope the types are self-explanatory
energy = force*distance; // should this be allowed?
torque = force*distance; // should this be allowed?
I think that in both cases the implicit conversion from the
(annonymous?) quantity force*distance to either energy or torque. I
think that to make the library usable one needs to allow these
If one want to prevent the operations then because one is a vector
scalar product (the energy) and the other a vector cross product (the
torque) then this should be done at the level of the value_type of
the quantity and not at the unit level.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk