HP Forums
Another CAS.part() oddity - 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: Another CAS.part() oddity (/thread-12118.html)

Another CAS.part() oddity - BruceH - 01-06-2019 07:09 PM

Please see attached screenshot.
The top line was me entering []==[] but it displays as [[]]==[[]]

Build 2018-10-16

RE: Another CAS.part() oddity - compsystems - 01-06-2019 09:35 PM

Xcas with GIAC kernel
[]==[] [enter] returns true , ok compare two objects and these are equal

HP-Prime with GIAC kernel, and CAS MODE
[]==[] [enter] returns 1 =( Synonym of true, Although I do not know why the history shows [] as [[]] it seems to be another BUG related to the visualization of objects in the history view

[up][up][copy] ([]) = [] [enter] [[]] ??
This is an BUG with the COPY function that I already reported a long time ago and do not a solution.

Sometimes copy well
[]==[] [enter] [up][up][copy] (([])==[]) [enter] true

part('RANDOM',2) [enter] "error the first argument must be a valid math expression"

part('RANDOM(a)') [enter] 2, another BUG founds, must return 1
part('RANDOM(a)',0) [enter] "of" Another BUG founds, must return "RANDOM"
part('RANDOM(a)',1) [enter] BUG, a ok

part('5!') [enter] 1 ok, one parts
part('5!',0) [enter] "factorial" ok (operator)
part('5!',1) [enter] 5 ok (operating)

part('abs(-a)') [enter] 1 ok, one parts
part('abs(-a)',0) [enter] "ABS"
part('abs(-a)',1) [enter] -a ok

part(-a) [enter] 1 ok, one parts, - it is an internal sign
part(-a,0) [enter] "-" ok
part(-a,1) [enter] a ok

test online part cmd
session Xcas

RE: Another CAS.part() oddity - parisse - 01-07-2019 07:14 PM

RANDOM is not a CAS command, try type('RANDOM')

RE: Another CAS.part() oddity - compsystems - 01-07-2019 10:55 PM

RANDOM is a NUMERIC command (HOME mode), type recognizes it as IDENTIFIER and it does not work, this BUG is caused by not incorporating the complete GIAC commands, this is an argument for the development group of the numerical part, try to incorporate the complete catalog of GIAC, except for what is impossible due to hardware or license problems

random is a CAS cmd, but it is not visible in the hpprime, like others, this causes inconsistencies, failures

RE: Another CAS.part() oddity - BruceH - 01-08-2019 01:19 AM

(01-07-2019 07:14 PM)parisse Wrote:  RANDOM is not a CAS command, try type('RANDOM')

I'm not sure what you're suggesting here.

I can't test for type('RANDOM') because I'm not in control of what users might supply as a parameter when they use my program. My program expects an expression (DOM_SYMBOLIC) as its parameter and type(part('expression',0)) is DOM_STRING for every expression.

RE: Another CAS.part() oddity - BruceH - 01-08-2019 01:40 AM

PS: part('NOT 5') --> DOM_SYMBOLIC as expected but part('NOT',0) gives a Syntax Error.

(Which is one for Tim, not parisse, I suspect.)

RE: Another CAS.part() oddity - BruceH - 01-08-2019 01:45 AM

(01-06-2019 09:35 PM)compsystems Wrote:  part('RANDOM(a)') [enter] 2, another BUG founds, must return 1

part(expr), i.e. with just one parameter, seems to be a synonym for length(expr). So an undocumented feature rather than a bug.

RE: Another CAS.part() oddity - informach - 01-09-2019 03:59 PM

Hi!, BruceH :
Conceptually the 'part' signify ...

Returns the nth subexpression of an expression. part(Expr, Integer)
part(sin(x)+cos(x),1) returns sin(x)
part(sin(x)+cos(x),2) returns cos(x)