[
Lists Home |
Date Index |
Thread Index
]
[Roger L. Costello]
>
> Below is an approach to describing the relationship between
> units-of-measure. I invite your comments. Special thanks to
> Tom Passin, Jon Hanna and Joe Chiusano, as their comments
> inspired this approach.
> Recall that <kilometer> may be considered as a function:
>
> kilometer(length(Yangtze)) --> 6340
>
> "kilometer maps the length of the Yangtze to 6340."
>
> More generally,
>
> kilometer(Distance) --> number
>
Yes, I think this mapping is sound.
> "kilometer maps an (abstract) Distance class to a number."
>
> Now we arrive at the approach. The approach is this:
>
> This is how to define the Distance class:
>
> <Class id="Distance">
> <equivalentInstances>
> {k, m | k = m * 1.62}
> </equivalentInstances>
> </Class>
>
The expression of a mapping here is good - basically it is a lambda
(anonymous) function, which are available in many programming languages.
But there are still some problems lurking here -
A. No way to say __which__ equivalence is being specified, e.g., that it is
a miles-to-km relationship. It would be better to write something like
(roger:MilesToKilometersEquivalence,
roger:equivalenceSpec,
{k, m | k = m * 1.62}
)
(roger:MilesToCentimeterEquivalence,
roger:equivalenceSpec,
{cm, m | cm = m * 1.62 * 10^5}
)
(Class,
id,Distance;
equivalentInstances,
roger:MilesToKilometersEquivalence
roger:MilesToCentimetersEquivalence
)
Of course, as Jown Cowan said, with a reference to a canonical transform,
the others would not necessarily have to be stated.
B. The formal parameters (k,m) have to be related to their to their units,
which is critical. One has to know which formal parameter is a mile and
which a kilometer.
The following seems like it should work -
(roger:MilesToKilometersEquivalence,
roger:equivalenceSpec,
(k, roger:unitsOf, roger:kilometer)
(m, roger:unitsOf, roger:mile)
{k, m | k = m * 1.62}
)
C. Tolerance is missing. That is, applying
> represent the same Distance is a matter of checking
> for set containment:
>
> (6340 k, 3914 m) in {k, m | k = m * 1.62}
>
will almost always fail to show containment because of practical
considerations of numerical accuracy. For example, in this case, the ratio
of the numbers to four decimal places is 1.61983, not 1.6200000.....,
therefore the number pair would not be contained in the set as the test is
stated here. I am sure that the intent is that they should be rated as
equivalent, and hence some measure of tolerance is needed.
However, you have to solve the tolerance issue anyway so that you can
compare different measurements of the same physical thing. Might as well
use the same means for both, I would say.
A simple definition of a test to replace set containment would be
{k, m, tolerance | k - (m * 1.62) <= tolerance}
This would return a boolean. What is needed is a way to get from the
original statement of the (k,m) relationship to this form.
Cheers,
Tom P
|