-
-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Where to apply an Absolute/Relative distinction? #140
Comments
Is it possible to answer this? |
A) Define the absolute/relative indicator in |
B) Define it in |
C) Define it somewhere else, please comment where you prefer. |
As demonstrated with [1], the Mathematica way of handling this seems almost trivial to implement. That's not my vote, because I'm not sure how well the other options could be implemented. But I have a feeling, that option c) could be the most simple one. |
We also need to carefully consider impact on Unit formatting and parsing. E.g. currently I'm using this JAXB-Adapter to allow for Quantities to be marshaled/unmarshaled ...
Having different Units that yield the same format, would break this code. So even if we choose option c) an additional flag indicating 'absolute' vs 'relative' would be required somewhere. |
Absolute/relative indicator in
This is the same approach than |
@andi-huber Thanks a lot for demonstrating this. |
Thank you andi-huber, the Wolfram article made me change my mind. It is elegant and makes senses mathematically (indeed Wolfram is a reference for that matter). |
@andi-huber @dautelle Thanks for helping with the decision making and showing how the Wolfram calculations may best work here. A property (not really biassed towards |
I'm not convinced by the Wolfram examples. They are mathematically inconsistent (they said themselves that their operations are not commutative) and their approach would bring new problems in JSR-363 context, discussed below. The Wolfram example stating 3°F + 2°C as illegal but 3°F + 2°F = 5°F as legal is inconsistent: for 3°F + 2°F they implicitly handle at least one °F value as a temperature difference despite the two units declared as "DegreesFahrenheit" (and not "DegreesFahrenheitDifference"). In addition of bringing the mathematical problems described in #95, this is inconsistent with the distinction they make between "DegreesFahrenheit" and "DegreesFahrenheitDifference" in other examples, and is also inconsistent with the fact that they do not handle any value as a temperature difference in 3°F + 2°C. The examples they provide can be practically the same with absolute/difference flag in
We would have (in Java syntax)
Having "DegreesCelciusDifference" and "DegreesCelcius" as two different
|
Based on @andi-huber's sample it would be Btw, what about |
That is my point: putting this flag at By contrast, if we add this flag in About |
While it currently sits on For
With the Just one example |
What Wolfram shows is that to be mathematically consistent some operations may be forbidden. |
I believe Martin aims for higher goals, but as a user of UOM I'm satisfied with what Mathematica has to offer. If certain operations are not allowed, at least if I understand why, than I'm fine with it. Also Wolfram's TemperatureUnits guide is short and easy to comprehend. The discussion whether or not the math with Mathematica is 'consistent', in my opinion depends on how one defines 'consistent'. I do have a feeling, that avoiding surprises for the UOM user is more important. So, regarding the big picture, it appears to me that we have 2 competing ideas:
As a user, I have no strong preference for 1) or 2), all I'm saying is that for me 1) is sufficient. ... regarding exceptions: One way to deal with operations, that are not allowed, is to return a special class like |
Also note, with Mathematica ...
|
@keilw: The Mathematica examples are inconsistent in the following ways:
@dautelle: Mathematica is not showing that to be mathematically consistent some operations must be forbidden. We can be mathematically consistent by requiring all operations to be performed in system units - which is also consistent with thermodynamic laws. Furthermore Mathematica approach is not mathematically consistent - see above-cited contradictions, which I guess have historical roots. @andi-huber: I fully agree about the goal to not be surprising to the user. This is precisely the problem I see with Mathematica approach. They have a whole section warnings the user that their operations are not commutative (A*B*C != C*B*A). If a user write (from thermodynamic equations):
If we can not rely on commutativity and associativity laws, rearranging those equations as |
@desruisseaux, thanks for the examples. These could be key to understanding, what the discussion is all about. I suggest we translate your examples into Mathematica syntax for having concrete cases we can focus the discussion. Otherwise I feel the subject is too abstract to comprehend. (At least for me.) Best outcome would be, that we all come to an agreement, what we mean by 'consistent' or 'surprising' and/or identify cases, where we agree Mathematica does something 'wrong' and we can do better. |
No objection for |
Just by simple synonym search, shortest first ...
I have no objection to |
Sorry, but I hate all generic words which do not bring much informative value. In this particular case, I would go with MeasurementScale (e.g. Absolute Scale, Incremental Scale). Other words would apply to almost anything and applied to measurement don't say much. |
As Martin managed to work out in great detail here Wiki Page, we do have 2 enums to distinguish and not to confuse with one another. One is a property associated with
I guess the challenge now is to find a good terminology, that also accounts for the distinct purpose of the two enums above. I have a feeling, that the term |
Since an "incremental quantity" should be stated using an interval unit (LevelOfMeasurement). Do we need a property "MeasurementType" on quantity? |
An incremental quantity can be stated with both
We can convert an It may be possible to use the same |
However, as said previously, a |
If only the absolute/relative |
I hope, some of us are able to start implementing what's necessary also over Christmas? We should file a Public Review no later than first thing in January. @filipvanlaenen and I have a talk at OOP in Munich late January, so it would be great to have the Public Review ongoing by then. Given the SI redefinition milestone, PFD (practically final) and a Final Release should take place in the first half of Q2 at the latest. There are only 2 EC F2F meetings in 2019, one is scheduled on May 15 in Tokyo: https://jcp.org/en/whatsnew/calendar2019. Which would be a great opportunity to report to the EC after the JSR went final or immediately before (The SI does on May 20, 2019) |
@andi-huber @dautelle I mentioned earlier, that |
Found on the web: "The clock is an absolute measurement system, it will tell you a point in time. A stop watch is an incremental system, it will tell you how many seconds (increments) have gone by since the start of the measurement. " - What about MeasurementSystem ? |
IMO it sounds to close to |
If this goes strictly into |
I added a static |
Hi, Hope somebody can do something with that enum over the holidays? Unless the |
Hello Werner. I'm in a very big rush at work those time, including weekends. When I will start having some weekends free, I will implement the new feature in Seshat. Sorry for the delay… |
Hi Martin. No worries, it is similar here (not on weekends yet;-) If nobody needs |
Btw, LevelOfMeasurement was removed now. And all places that referred to a |
Based on input from https://reference.wolfram.com/language/tutorial/TemperatureUnits.html
or https://www.quora.com/What-are-absolute-units (the latter contradicts itself quite a bit because after saying "Measurement units can be either absolute or relative… " it continues like "However, physical measurements are often relative. ") Let's figure out, if
Unit
orQuantity
are the best place for suchAbsolute/Relative
indicator?It is drafted in
Quantity
(mainly to find out the payload it adds on top of other elements like the measurement level) but e.g. the Mathematica/Wolfram examples are pretty clear about using specializedUnit
definitions likeKelvin
vs.KelvinDifference
for that.Not entirely sure, which is best, something like an attribute on
Unit
which could allowUnits.KELVIN
vs.Units.KELVIN_DIFFERENCE
(I recall @desruisseaux mentioned that option once in an earlier thread) or an attribute onQuantity
?Also how should it be defined either statically or dynamically and how does it affect unit and quantity operations?
Needs #95
Needs #131
The text was updated successfully, but these errors were encountered: