 # Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2003-04-27 09:30:32

Terje Slettebø <tslettebo_at_[hidden]> writes:

>>From: "David Abrahams" <dave_at_[hidden]>
>
>> These are my (only slightly informed) opinions. I've heard Walter
>> Brown talk about angle in this context, which was a big influence.
>>
>> Terje Slettebø <tslettebo_at_[hidden]> writes:
>>
>> > Regarding this angle dimension, should it be treated like the other
>> > SI-dimensions? That is, say that you represent an SI quantity/unit
>> > with an integer vector giving the exponents:
>> >
>> > template<int kg,int m,int s,int A,int K,int mol,int cd,int angle>
>> > class quantity;
>> >
>> > If you multiply two quantities, you multiply the value and add the
>> > exponents, so quantity<0,1,0,0,0,0,0,0>(10) *
> quantity<0,1,0,0,0,0,0,0>(10)
>> > = quantity<0,2,0,0,0,0,0,0>(100) (m * m = m^2)
>> >
>> > Would this hold for angle, as well?
>>
>> Yes. Angle is a dimensionless scalar (length/length). All its
>> exponents are zero.
>
> Yes, Renej (in the posting I replied to) also pointed out that angle is a
> dimensionless quantity. However, in their real-life experience, they found
> it useful not to have it dimensionless, but instead having it as an
> additional dimension, to be able to distinguish things like velocity and
> angular velocity.

They are distinguished!

Velocity is l/t and angular velocity is 1/t - the same as frequency.
Makes perfect sense to me.

> It was in this context that I wondered how angle - as a
> dimension - should be treated.
>
>> > That is, does it make sense to say angle * angle = angle^2?
>>
>> Probably not, but only because angle * angle doesn't make much
>> sense. Does that ever come up in real life?
>
> If it's a dimensionless quantity, it wouldn't matter (all exponents
> would still be zero). However, as a dimension, it would give
> angle^2. That's what I wondered about.
>
>> > I understand that e.g. angle/s (angular velocity) makes sense, but
>> > should a library allow any combination with angle and the other
>> > dimensions?
>>
>> Not arbitrarily:
>
> I meant - should it allow the same combinations as the other dimensions are
> allowed. That is (simplified, using only one dimension):
>
> quantity<d1> * quantity<d2> = quantity<d1+d2>
> quantity<d1> / quantity<d2> = quantity<d1-d2>
> quantity<d> + quantity<d> = quantity<d>
> quantity<d> - quantity<d> = quantity<d>
>
>> angle(pi/2) / mass(40); // OK
>> angle(pi/2) + mass(40); // error
>
> Let's again cast it in the quantity<> example template I gave in the last
> posting, to examine it. Let's say that the angle is expressed in radians. We
> then have:
>
> template<int kg,int m,int s,int A,int K,int mol,int cd,int rad>
> class quantity;
>
> typedef quantity<1,0,0,0,0,0,0,0> mass;
> typedef quantity<0,0,0,0,0,0,0,1> angle;
>
> angle(pi/2) * mass(40) = quantity<1,0,0,0,0,0,0,1>(pi/2*40) (rad * kg)
> angle(pi/2) + mass(40)
>
> The last one will be an error, as you said.
>
> I'm guessing that the answer to my question is, yes, angle, when expressed
> as a dimension, may be treated like the other dimensions.

I guess I can't play in that mind-space, because I can't get away from
what seems to me like a clear truth: angle is dimensionless. If you
give it dimension, you'll get confusing results (like no relationship
between angular velocity and frequency). I wonder what happens to
physics calculations when frequency is expressed as rad/t?

```--
Dave Abrahams
Boost Consulting
www.boost-consulting.com
```