HP Forums

Full Version: units anomily
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Version 10077, emulator

In CAS:

5_(°F)▶_(Rankine)
returns "Some units could not be converted to MKSA Error: Bad Argument Value"

convert(5_(°F),1_(Rankine))
returns "Some units could not be converted to MKSA Error: Bad Argument Value"

While in home:

5_(°F)▶_(Rankine)
returns 464.67_(Rankine) OK

5_(°F)+5_(°F)
returns Error: Invalid input

CAS.(5_(°F)+5_(°F))
returns (10_(°F)) OK

It appears some unit operations are allowed only in CAS while other unit operations are allowed only in Home.
Hi!, roadrunner:

You can only CONVERT, for MKSA ... Meters, Kilograms, Seconds, Amperes.
Converts a complex unit, into the base components, of the MKSA system.
Example : MKSA(8.175_cm/s) returns .08175_m/s

Too, see ... http://en.hpprime.club/docs/reference/MKSA

For your example for added, in °F, (see image).



Kind Regards.
informach.
Thanks for the reply informach,

I would have expected something as simple as units conversion to be easier than that on the Prime.

-road
Hi, the following code is compiled successfully, but not run in HOME MODE. why?

Code:

#cas
  test():=
  BEGIN
    return 5_°F+5_°F;
  END;
#end

CAS MODE VIEW
test() [ENTER] 10_°F

HOME MODE VIEW
test() [ENTER] program({},{},{RETURN 10_(°F)}) ??

-------

Because when you enter the function [VAR] [CAS] does not automatically add the parentheses?

test [ENTER] (NULL)->BEGIN RETURN(5_(°F)+5_(°F)); END;

default should automatically place the brackets, otherwise placed on the history the program source code =[

test()
Hello


> I would have expected something as simple as units conversion to be easier than that on the Prime.

Unit conversion are anything BUT simple (unfortunately).

The problem of °C and °F set aside, the 'sto' shortcut as in 1_m▶_cm is quite simple and pretty much to the point with very few keystrokes (considering the possibility range of Prime).



Now, working with °C and °F, this is a whole other can of worms.
°C and °F are not technically units. This is because they are not 0 based. ie, 0°C does not denote the absolute 0 with negative units denoting anti-heat.
This is where the problem lies.
This means that 1°C is not (always) equal to 1°C.
If I say: the temperature is 1°C, I mean by that that the temperature is 247K
When I say the temperature change is 1°C, I mean that the temperature change is 1K
But, the calculator does not get the context. When you tell it to convert 1°C to °F or K, it does not know if the 1°C is the result of a previous subtraction or an 'absolute' temperature.

Bernard, in the the CAS has decided that no serious (real life) math/physics calculations will/should use °C and °F, and is basically banning them. It is a defendable position, which makes sense, and which also makes the software developer life much much easier.

In home, we recognized that some users would want to do some computation on °C and °F, so we did some extra work to allow, with restrictions, in order to reduce the occurrences of "vitum pillum" (pig latin for "javelot in foot", (sorry I forgot the declination), or, as we would say in modern english: shooting oneself in the foot).
But it still fall short of expectations, due to the problem mentioned above, the calculator can not know, when you use 1°C if this is 0 based, or 246°K based.

Cyrille
(05-04-2016 05:47 PM)roadrunner Wrote: [ -> ]It appears some unit operations are allowed only in CAS while other unit operations are allowed only in Home.
Most has been said already by Cyrille. I'd like to add a tiny bit out of the real world: In e.g. refrigeration engineering, where I work, you are required to express differences in Kelvin. No idea how the Prime handles this, but you should be able to add 5K to 5°F.
Hi!, Thomas Radke:

Today, is impossible, in HP PRIME directly.
You must program for allow result.
In Wolfram Alpha, you have the conversion (see image).

You have a single formula, for create program ...
T(°F) = T(K) × 9/5 - 459.67
Kelvin to Fahrenheit
K = 5/9 * (F - 32) + 273.15

King Regards.
informach.
(05-05-2016 01:32 PM)Thomas Radtke Wrote: [ -> ]
(05-04-2016 05:47 PM)roadrunner Wrote: [ -> ]It appears some unit operations are allowed only in CAS while other unit operations are allowed only in Home.
Most has been said already by Cyrille. I'd like to add a tiny bit out of the real world: In e.g. refrigeration engineering, where I work, you are required to express differences in Kelvin. No idea how the Prime handles this, but you should be able to add 5K to 5°F.

I'm assuming you want a 5K change starting at a temp of 5°F with the final result expressed in °F. To do this, all temp units must first be converted to K so that they have a common zero reference.

(CONVERT(5_°F,0_K)+5_K)▶_°F
(05-05-2016 05:51 AM)cyrille de brébisson Wrote: [ -> ]Unit conversion are anything BUT simple (unfortunately)

Indeed, when I used the word “simple,” that was my naiveté speaking. About the rest: understandable and reasonable.

On a side note, my 48SX thinks 5_°F + 5_°F is 469.67_°F. At least the prime gets that right.

-road
Hi!, roadrunner:

In Hp48/49/50 series, the convertion's, are incompatible, the K to °F and viceversa.

And your example, to 5_°F+5_°F isn't ... 469.67_°F.
The correct result, is ... 10_°F

Kind Regards.
informach.
For the interested, there was a recent thread discussing these issues and possible solutions:

http://www.hpmuseum.org/forum/thread-4783.html
(05-06-2016 01:55 PM)roadrunner Wrote: [ -> ]On a side note, my 48SX thinks 5_°F + 5_°F is 469.67_°F. At least the prime gets that right.

(05-06-2016 02:25 PM)informach Wrote: [ -> ]In Hp48/49/50 series, the convertion's, are incompatible, the K to °F and viceversa.

And your example, to 5_°F+5_°F isn't ... 469.67_°F.
The correct result, is ... 10_°F

Please note that the logic of temperature arithmetic is different between the 48S/SX and 48G/GX. Roadrunner is correct that the 48SX says that 5_°F + 5_°F is 469.67_°F. The 48G/GX agrees with Informach, saying that 5_°F + 5_°F is 10_°.
(05-06-2016 02:25 PM)informach Wrote: [ -> ]Hi!, roadrunner:

In Hp48/49/50 series, the convertion's, are incompatible, the K to °F and viceversa.

And your example, to 5_°F+5_°F isn't ... 469.67_°F.
The correct result, is ... 10_°F

Kind Regards.
informach.

I can confirm that a 48SX does indeed return 469.67_°F, it would seem that it messes up the units but not in an entirely random manner because 5_°F is 464.67_°R so it would seem that for some reason it converts to °R to make the calculation but does not convert back, 469.67_°R = 10°F

It does a similar thing with °C but converts to Kelvin in that case, adding degrees Rankine or Kelvin work as expected.

Paul
Paul,

Internally it converts 5_°F to 464.67_°R, then adds 464.67_°R + 464.67_°R to get 929.34_°R then converts 929.34_°R back to 469.67_°F.

Once I lost more than a couple points on a homework assignment because of that anomaly. Those were the good ol' days.

-road
Reference URL's