units anomily
05-04-2016, 05:47 PM
Post: #1
 roadrunner Member Posts: 276 Joined: Jun 2015
units anomily
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.
05-04-2016, 07:30 PM (This post was last modified: 05-04-2016 08:02 PM by informach.)
Post: #2
 informach Member Posts: 109 Joined: Jul 2015
RE: units anomily

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

Kind Regards.
informach.

Attached File(s) Thumbnail(s)

05-04-2016, 08:56 PM
Post: #3
 roadrunner Member Posts: 276 Joined: Jun 2015
RE: units anomily

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

05-05-2016, 03:10 AM (This post was last modified: 05-05-2016 03:19 AM by compsystems.)
Post: #4
 compsystems Senior Member Posts: 1,183 Joined: Dec 2013
RE: units anomily
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()
05-05-2016, 05:51 AM
Post: #5
 cyrille de brébisson Senior Member Posts: 891 Joined: Dec 2013
RE: units anomily
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

Although I work for the HP calculator group, the views and opinions I post here are my own. I do not speak for HP.
05-05-2016, 01:32 PM
Post: #6
 Thomas Radtke Senior Member Posts: 730 Joined: Dec 2013
RE: units anomily
(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.
05-05-2016, 02:58 PM (This post was last modified: 05-05-2016 03:05 PM by informach.)
Post: #7
 informach Member Posts: 109 Joined: Jul 2015
RE: units anomily

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.

Attached File(s) Thumbnail(s)

05-06-2016, 02:32 AM
Post: #8
 Fortin Member Posts: 59 Joined: Jul 2015
RE: units anomily
(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-06-2016, 01:55 PM
Post: #9
 roadrunner Member Posts: 276 Joined: Jun 2015
RE: units anomily
(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.

05-06-2016, 02:25 PM
Post: #10
 informach Member Posts: 109 Joined: Jul 2015
RE: units anomily

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.
05-06-2016, 10:06 PM
Post: #11
 Claudio L. Senior Member Posts: 1,649 Joined: Dec 2013
RE: units anomily
For the interested, there was a recent thread discussing these issues and possible solutions:

05-07-2016, 05:14 PM (This post was last modified: 05-07-2016 05:16 PM by Joe Horn.)
Post: #12
 Joe Horn Senior Member Posts: 1,524 Joined: Dec 2013
RE: units anomily
(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_°.

<0|ɸ|0>
-Joe-
Post: #13
 Paul Berger (Canada) Senior Member Posts: 448 Joined: Dec 2013
RE: units anomily
(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
05-07-2016, 07:41 PM
Post: #14
 roadrunner Member Posts: 276 Joined: Jun 2015
RE: units anomily
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.