Post Reply 
Problem with convert
10-27-2015, 06:04 PM (This post was last modified: 10-27-2015 06:05 PM by Natoe.)
Post: #1
Problem with convert
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 !
Find all posts by this user
Quote this message in a reply
10-27-2015, 06:17 PM
Post: #2
RE: Problem with convert
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) = ***********
Find all posts by this user
Quote this message in a reply
10-27-2015, 09:42 PM
Post: #3
RE: Problem with convert
(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.
Visit this user's website Find all posts by this user
Quote this message in a reply
10-27-2015, 09:48 PM
Post: #4
RE: Problem with convert
That's because "min" is the minimum function. I believe "mn" is the minute unit, if memory serves me correctly.

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
10-27-2015, 10:23 PM
Post: #5
RE: Problem with convert
(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.
Visit this user's website Find all posts by this user
Quote this message in a reply
10-27-2015, 11:28 PM (This post was last modified: 10-27-2015 11:31 PM by Han.)
Post: #6
RE: Problem with convert
(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

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
10-28-2015, 12:40 AM (This post was last modified: 10-28-2015 12:43 AM by epp.)
Post: #7
RE: Problem with convert
(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.

   

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.
Visit this user's website Find all posts by this user
Quote this message in a reply
10-28-2015, 01:37 AM (This post was last modified: 10-28-2015 01:38 AM by Han.)
Post: #8
RE: Problem with convert
(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)

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
10-28-2015, 01:44 AM
Post: #9
RE: Problem with convert
Thanks, Han. I appreciate the time you spent explaining the environment. And 1_mn does work with "convert" as you indicated..
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)