HP Forums
Problem with convert - 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: Problem with convert (/thread-5016.html)



Problem with convert - Natoe - 10-27-2015 06:04 PM

When i tryed to convert :
20°F to °C = the prime gived me a beautiful reset !


But in the prime-emulator this work :/


And Why The USIMPLIFY Command doesn't work ? Like the exemple :

USIMPLIFY (5_kg*1_M²/1_s²) = 5_J

For me : USIMPLIFY (5_kg*1_M²/1_s²) = Error Bad Argument ...


Thanks !


RE: Problem with convert - Natoe - 10-27-2015 06:17 PM

Now i do

2 years in seconds this work
ex : Convert(20_yr,1_s) = ***********

2 years in minutes doesn't work (the "min" variable in the prime units don't work)
ex : Convert(20_yr,1_min) = "Error Bad Argument"

2 years in hours this works
ex : Convert(20_yr,1_h) = ***********


RE: Problem with convert - epp - 10-27-2015 09:42 PM

(10-27-2015 06:17 PM)Natoe Wrote:  Now i do
2 years in minutes doesn't work (the "min" variable in the prime units don't work)
ex : Convert(20_yr,1_min) = "Error Bad Argument"

Works OK in HOME, but not in CAS. Note that temperature is not properly implemented at this point.


RE: Problem with convert - Han - 10-27-2015 09:48 PM

That's because "min" is the minimum function. I believe "mn" is the minute unit, if memory serves me correctly.


RE: Problem with convert - epp - 10-27-2015 10:23 PM

(10-27-2015 09:48 PM)Han Wrote:  That's because "min" is the minimum function. I believe "mn" is the minute unit, if memory serves me correctly.

Actually, _min is a unit, while min is a function.


RE: Problem with convert - Han - 10-27-2015 11:28 PM

(10-27-2015 10:23 PM)epp Wrote:  
(10-27-2015 09:48 PM)Han Wrote:  That's because "min" is the minimum function. I believe "mn" is the minute unit, if memory serves me correctly.

Actually, _min is a unit, while min is a function.

I was referring to the CAS view


RE: Problem with convert - epp - 10-28-2015 12:40 AM

(10-27-2015 11:28 PM)Han Wrote:  
(10-27-2015 10:23 PM)epp Wrote:  Actually, _min is a unit, while min is a function.

I was referring to the CAS view

Interesting. I'll describe the list, top-down. All run under CAS. The CNV program is described here.

[attachment=2703]

CONVERT(1_h,1_s): yielded 3600_s
CONVERT(1_h,1_mn): error
CONVERT(1_h,1_'min'): entered from command-line, note the quotes that were added by the calculator
CNV(1_h): program calls CONVERT(1_h,1_min), OK
CNV(1_h): program calls CONVERT(1_h,1_mn), error

In a nutshell, from the command-line I can't get minutes to work. From a program min works but mn does not.


RE: Problem with convert - Han - 10-28-2015 01:37 AM

(10-28-2015 12:40 AM)epp Wrote:  CONVERT(1_h,1_s): yielded 3600_s
CONVERT(1_h,1_mn): error
CONVERT(1_h,1_'min'): entered from command-line, note the quotes that were added by the calculator
CNV(1_h): program calls CONVERT(1_h,1_min), OK
CNV(1_h): program calls CONVERT(1_h,1_mn), error

In a nutshell, from the command-line I can't get minutes to work. From a program min works but mn does not.

CNV() is an HPPPL program and therefore a non-CAS program. HPPPL programs assume that all commands are "non-CAS" so that even when one types: convert(1_h, 1_min) the command is interpreted as CONVERT(1_h, 1_min). And since this is considered to be evaluated in the Home view (i.e. non-CAS side), all is well. Even calling CNV() from the CAS view using "min" for minutes would be fine because the command line parser sends all the inputs to CNV() and everything is treated as if it were run from the Home view (since CNV() is a non-CAS program).

The CAS side runs on XCAS/GIAC which also has support for units. XCAS comes with a command called convert(). It also has a min() command. Thus, to avoid conflict, I believe the minutes unit has been renamed to "mn" -- within XCAS. So, in the CAS view, if one types: convert(1_h, 1_mn) the calculator will return: 60._mn. However if one types CONVERT(1_h, 1_mn) in the CAS view, then the parser uses the Home version of the command, which does _NOT_ recognize "mn" as a proper unit. As far as CONVERT() is concerned, there is no such unit as "mn" and the minute unit is "min". This is what you are seeing insofar as discrepancies are concerned.

In general, if you look in the catalogue of commands, commands that show up in all caps tend to be non-CAS commands. They will usually be copied to the command line in upper-case. Similarly, the lower-case commands are usually CAS commands (i.e. commands that are meant to be run from the CAS view). However, some commands have two versions. Generally speaking, if you are on the CAS side, and you select and all-caps command _and_ it is copied to the command line in lower case, then you have an instance of a command that has both CAS and non-CAS versions (example: MAKEMAT and makemat). I say generally speaking because CONVERT unfortunately does not behave as just described (only the upper-case command is ever copied from the catalogue to the command line).

Lastly, a shorthand for unit conversion is to use the "STO>" arrow. For example: 1_h > _s (note that the second unit does not have a scalar value -- it's just the unit itself)


RE: Problem with convert - epp - 10-28-2015 01:44 AM

Thanks, Han. I appreciate the time you spent explaining the environment. And 1_mn does work with "convert" as you indicated..