Boost logo

Boost :

From: Andy Little (andy_at_[hidden])
Date: 2006-06-15 07:09:44


"John Phillips" wrote
> Andy Little wrote:
[..]
>>
>> OK . This seems to confirm your use of the term 'unitless' as equivalent to
>> dimensionless or numeric. If the speed of light is a numeric type in the
>> relativistic system it leads me to wonder what math constants such as pi
>> would
>> mean (if anything) in this system?
>
> Pi, and e and all the various others mean exactly the same things
> they have always meant, and have exactly the same values. All I'm doing
> is defining relationships between dimensions and selecting scales to
> measure those dimensions. No matter what scale I choose for the
> measurement, the ratio of the circumference of a circle to the diameter
> doesn't change. The values of things like pi and e are in some sense
> that I think we should avoid trying to describe in detail on this list
> more fundamental than any unit system.

OK :-) ... I'm happy to accept that. I am not a physicist! It strikes me that
what we are discussing is a conjecture.
The conjecture is(something like) The rules applied to the SI system in PQS can
be applied to the relativistic units system.
What you say above makes the alarm bells ring for me, that the conjecture is
false, because PQS has no mechanism for distinguishing dimensionless types.
However not being a physicist I dont want to go there and I probably have it
all wrong....

...so I'm happy not to try and prove or disprove the conjecture. I'll leave that
to someone else :-)

[...]

>> Actually I think I am dealing with another unit system.. the natural unit
>> system. I have assumed that it uses the same dimensions as the SI system. I
>> have
>> therefore expressed quantities in natural units in terms of their scaling to
>> SI
>> units. An energy quantity expressed in electron volts for example would be
>> expressed as an energy unit which
>> if it had the numeric value 1 would be equivalent to 1.602177e-19 joules. The
>> conversion factor is encoded in a compile time entity representing the unit.
>
> So, if I divide 1 eV by 1 s, will the answer of that computation
> automagically be in Watts (Energy / time = power)? Put a different way,
> are all calculations on that 1 eV carried out by first converting it to
> Joules, and then acting on the value in Joules?

Not quite.

The electronvolt is regarded by PQS as a so-called incoherent (non-SI) unit.
In this case the quantity is first converted to the nearest coherent unit[*].
This is achieved simply by converting to a a type with a unit which represents
1e-19 Joules (effectively getting rid of the ugly 1.602177 multiplier) Lets call
this type the 'cleaned electronvolt'. This involves scaling the internal
floating point value at runtime (either a divison or a multiplication by
1.602177 which offhand I forget. I think its a multiplication). The type of the
result is then calculated by subtracting the exponent of the denominator from
the exponent of the numerator.
The exponent of the 'cleaned electronvolt' is still -19. The exponent of
'second' is 0, so the result will have units of 1 e-19 Watts.
Finally the internal floating point value of the 'cleaned electron volt' is
multiplied by the numeric value of the second (1) and put as the numeric value
of the resulting temporary. (I think its just 1.602177). unfortunately I havent
implemented the ev unit yet to check.

[*](unfortunately my definition of coherent unit is different from the SI's
definition so I will need to rename it)

> I again need to apologize for the sloppy language, but this is what I
> mean by converting to SI units. I am not concerned about your handling
> of SI prefixes (which I think is fine) nor do I wish to force people to
> explicitly select the prefix when two quantities that have prefixes but
> are already in SI units are used in a computation (though some people
> would probably like to be able to force a certain prefix under some
> conditions). I'm more worried about things like conversions between
> pounds and Newtons, or between rods and fathoms, where there is more to
> do than keep track of a power of 10.

Yes. The best advice is to use SI units as recommended by the SI and PQS
follows this advice by favouring the SI where possible. However one major use of
PQS is in helping in the countless real everyday situations where for whatever
reason other units are being used.

[...]

>> OK. My concern is that I can add the theoretical ability for PQS to encompass
>> unit-systems other than the SI, but the only way to see if it actually works
>> is
>> to write a reasonable sized implementation for a reasonable number of
>> systems.
>> What you are asking for is I know very well a non trivial expansion of the
>> scope
>> of the project! My solution to this is not even to attempt to go there. My
>> goal
>> is simply to cover the SI system and let others extend the project to more
>> generic systems.
>
> I agree that what I'm asking for is non-trivial. And I can't promise
> that the increased use that would come from this expansion will justify
> your added time. I'm simply looking at it from the point of view of
> "what should it do to be the solution for my problems in my work" and
> adding in some of what I know is done by others in the physical sciences.

One way to proceed would be to concentrate on solving the problem satisfactorily
only in that field. It should then be possible to see if there is anything more
generic behind the different solutions.

>> BTW Thanks for all your comments and input, and I'm sorry that I keep
>> sounding
>> so negative but I have good reasons for being sceptical, some of which I hope
>> I
>> have explained .
>>
>> regards
>> Andy Little
>
> And thanks for your willingness to discuss them.
> I know that you put hours and sweat into this library, and everyone
> prefers to be told how well they did instead of get into long
> discussions of what could or should be changed, so I'm sure there are
> times when this discussion gets tiresome for you. Thanks for continuing
> to be an active part of the conversation and giving your insight as
> someone who has actually done the work to implement some of these ideas.

No problem and thanks for your time, thoughts explanations etc. Maybe someone
with a physics background will start some research on implementing a similar
scheme with other unit systems than the SI

regards
Andy Little


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk