HP Forums
Working with units - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: Working with units (/thread-8119.html)



Working with units - tdh79 - 04-05-2017 04:40 PM

Why can't i add or subtract from values with units?
Ex. I have 8_m on the stack and i want to add one minute.
Also i can not add two temperatures even with corresponding units?


RE: Working with units - KeithB - 04-05-2017 04:45 PM

Could it be because _m is meter and _min is minute?


RE: Working with units - tdh79 - 04-05-2017 05:36 PM

(04-05-2017 04:45 PM)KeithB Wrote:  Could it be because _m is meter and _min is minute?
You're right about the wrong unit but the problem remains the same. If i have 8_min and want to add 1 more do i really have to set the unit before adding?


RE: Working with units - KeithB - 04-05-2017 05:43 PM

Yes, you do. It is all tied up with the Prime concept of a measurement.

Pretend you are the calculator, you see 4_min + 3

What do you do? Should you assume that 3 is minutes and add them? Use a default time unit of fortnights and add that? Give an error saying that you don't have enough info to solve the problem?

1 and 3 are probably the most reasonable, the Prime chooses 3. If you don't want to use units, leave them off. If you want to work with them, they are required.


RE: Working with units - tdh79 - 04-05-2017 06:21 PM

(04-05-2017 05:43 PM)KeithB Wrote:  Yes, you do. It is all tied up with the Prime concept of a measurement.

Pretend you are the calculator, you see 4_min + 3

What do you do? Should you assume that 3 is minutes and add them? Use a default time unit of fortnights and add that? Give an error saying that you don't have enough info to solve the problem?

1 and 3 are probably the most reasonable, the Prime chooses 3. If you don't want to use units, leave them off. If you want to work with them, they are required.
Ok, it's just that this was never an issue with the 50g. How do i easily remove units from a value if i don't want to continue with units?
Also, why won't it add 2 temperatures when they're both including the unit?


RE: Working with units - KeithB - 04-05-2017 06:34 PM

Because it makes no physical sense.

Adding Kelvin temperatures is allowed.


RE: Working with units - Han - 04-05-2017 07:35 PM

(04-05-2017 06:21 PM)tdh79 Wrote:  Also, why won't it add 2 temperatures when they're both including the unit?

This comes up quite often. Here's an example of why adding temperatures does not make too much sense.

1°C + 1°C = 2°C

However, if we convert to an absolute scale and do:

1°C + 1°C = 274.15K + 274.15K = 548.3K = 275.15°C

Clearly 2°C is not the same as 275.15°C.

Almost all physical units have the common minimal value of 0. (For example, 0 degrees is the same as 0 radians, which is also the same as 0 gradians. And 0 meters is the same as 0 inches, or 0 feet, etc.) However, 0°C is not the same as 0°F, and neither are equal to 0K. This is why adding Kelvin temperatures is not a problem (it is an absolute scale with no temperature less than 0) but it will not work for °C or °F. The same can be said for scalar multiplication of a unit. Multiplication by scalars only make sense if there is some fixed notion of "0" -- there is no fixed "0" for the various temperature units.

That said, if one of the two temperatures is a change in temperature, then the sum makes sense. But even then, the use of mixed units still requires a lot of care on the part of the user (which can be avoided by converting to Kelvin).


RE: Working with units - toml_12953 - 04-05-2017 07:37 PM

(04-05-2017 06:34 PM)KeithB Wrote:  Because it makes no physical sense.

Adding Kelvin temperatures is allowed.

But I want to add 3 degrees Fahrenheit to 20 degrees Celsius to come up with a total of 18 meters, 4.7 inches.

Tom L

"If God had wanted us to use the Metric system, Jesus would've had 10 apostles"


RE: Working with units - Tim Wessman - 04-05-2017 07:58 PM

(04-05-2017 06:21 PM)tdh79 Wrote:  Ok, it's just that this was never an issue with the 50g.

I think you are remembering wrong. Trying to add 1_m and 1 returns an error.


RE: Working with units - tdh79 - 04-05-2017 08:09 PM

(04-05-2017 07:58 PM)Tim Wessman Wrote:  
(04-05-2017 06:21 PM)tdh79 Wrote:  Ok, it's just that this was never an issue with the 50g.

I think you are remembering wrong. Trying to add 1_m and 1 returns an error.
You're right, adding two values in Celsius however worked fine..
But I can see why it doesn't make that much sense by the post by Han.


RE: Working with units - cyrille de brébisson - 04-06-2017 05:52 AM

Hello,

>> add 1 to 3_m
This hits into one of the major issue between math and computer science, human language and computers.
Both math and human language are littered with non explicit-ed, contextually shared assumptions/understanding and loosely defined "items" (sometimes, even symbols/words like plus or minus have different meanings than the basic addition/subtraction ones)
In the (rare) cases where there is a possible misunderstanding, then we see human using convoluted sentences to explicit their words...
Unfortunately, the calculator does not have enough IA to deduce these "non explicit-ed, contextually shared assumptions/understanding" which would allow it to deduce what is meant by a user. It therefore forces you, the user, to explicitly state them, at the cost of extra typing time...
One of the best example is users entering in the graphing app:
F1(X)=sin(X)
F2(X)=dF1(X)/dX
and not understanding why it does not work...


>> "If God had wanted us to use the Metric system, Jesus would've had 10 apostles"
Now, this is such a quintessentially American statement that I had to clean all the coffee from my screen after reading it!

Cyrille


RE: Working with units - klesl - 04-06-2017 07:09 AM

"How do i easily remove units from a value if i don't want to continue with units?"
Well, you can divide the value with units by 1_unit, e.g. 10_m/1_m=10.

My personal notice: Being chemist I also don't know how to calculate the example posted above- 4_min + 3. I used units for all values during my exams and calculations. If I forgot unit the teacher marked this mistake with explanation: How do I know what did you mean.


RE: Working with units - Claudio L. - 04-07-2017 02:25 PM

(04-05-2017 08:09 PM)tdh79 Wrote:  You're right, adding two values in Celsius however worked fine..
But I can see why it doesn't make that much sense by the post by Han.

If you want to expand on Han's answer, there was a deeper discussion of temperature units not too long ago in the following thread:

http://www.hpmuseum.org/forum/thread-4783.html