Existing CAS commands --> Prime discussion
|
12-24-2018, 03:15 AM
Post: #61
|
|||
|
|||
RE: Existing CAS commands --> Prime discussion
importance of UNQUOTE CMD, evaluate subparts of expressions.
y:=3; x:=5; a:=quote(x+unquote(y)); [enter] returns x+3 b:=quote(unquote(x)+y) [enter] returns y+5 eval(a); eval(a,1); eval(a,2); [enter] returns 8, y+5, 8 |
|||
02-19-2019, 02:52 AM
(This post was last modified: 11-08-2019 12:46 AM by compsystems.)
Post: #62
|
|||
|
|||
RE: Existing CAS commands --> Prime discussion
undocumented functions and operators
1: increment at 1 PHP Code: a:=15; 2: decrement at 1 PHP Code: a:=a-1; // a -> 18 3: increment PHP Code: b:=20; 4: decrement PHP Code: a:=a-b; // a -> 55 5: multcrement PHP Code: a:=a*b; // a -> 300, 15*20 6: divcrement PHP Code: a:=a/b; // a -> 6000, 120000/20 7: float("3.14") [enter] 3.14 float(10) [enter] 10.0 8: bool( 1 ) [enter] true bool( 0 ) [enter] false bool( -1 ) [enter] true |
|||
02-22-2019, 08:36 PM
(This post was last modified: 04-25-2019 08:46 PM by compsystems.)
Post: #63
|
|||
|
|||
RE: Existing CAS commands --> Prime discussion
getType command
The XCas getType() command is not synonymous with type or TYPE cmds, the important thing about this command that is not included in the hpprime is that it groups several types of objects by common characteristics, for example getType(5.0 ), getType( 5 ), getType( 3/4 ) [enter] "NUM", "NUM", "NUM" Mathematical expressions as"EXPR" and math constants getType( 3+4*i ), getType( x+i*y ), getType( 3*pi ), getType( sqrt(-1) ) , getType( e ) [enter]"EXPR", "EXPR", "EXPR", "EXPR", "EXPR" Lists, sequences, sets and polynomials as “LIST" seq1:=(1,2,3) getType( seq1), getType( [9,[8,7],[6,5,4]]), getType( [9 ,8 ,7] ), getType( set[a , b, c, a] ), getType( poly1[1 ,-6 , 11 ,-6] ) [enter] "LIST", "LIST","LIST","LIST","LIST" Difference matrix of lists getType( [[1,2],[3,4]] ), getType( [[1,2,3,4]], getType( [[1],[2],[3],[4]] ) [enter] "MAT", "MAT", "MAT" getType( var01 ) [enter] "VAR" getType( "Hello" ) [enter] "STR" getType( f(x):=x+1) [enter] "FUNC" getType(5.0 ), getType( 5 ), getType( 3+4*i ), getType( x+i*y ), getType( [9,[8,7],[6,5,4]]), getType( [9 ,8 ,7] ), getType( set[a , b, c, a] ), getType( poly1[1 ,-6 , 11 ,-6] ), getType( [[1,2],[3,4]] ), getType( var01 ), getType( "Hello" ), getType( f(x):=x+1) "NUM","NUM","EXPR","EXPR","LIST","LIST","LIST","LIST","MAT","VAR","STR","FUNC" Example of use of the getType function. PHP Code: #Xcas 1/8*(12*x^2-4), 1/8*(12*y^2-4), poly1[3/2,0,-1/2],2 99/2, 1/8*(12*cos(t)**2-4) |
|||
04-25-2019, 08:35 PM
Post: #64
|
|||
|
|||
RE: Existing CAS commands --> Prime discussion
Please HpPrime team attach the console command help() to the catalog
Xcas: help( abs ) [enter] returns "Returns the absolute value or the norm of its argument. abs( -4 ); abs( 1+2*i ); abs( (1+2*i)^2); abs( [-2, 1+i, -4]);" |
|||
11-06-2019, 04:50 PM
Post: #65
|
|||
|
|||
RE: Existing CAS commands --> Prime discussion
There commands that are very important within a program, for example, changing the display of exponents in polynomials (increasing-decreasing) without having to do it manually [shift]+[mode-cas], but from the source code.
◉ increasing_power(False) [↵] ◉ x^3 - 6*x² + 11*x -6 [↵] Xcas returns x^3 - 6*x^2 + 11*x -6 ◉ increasing_power() [↵] Xcas returns 0 ◉ increasing_power(True) [↵] ◉ x^3 - 6*x² + 11*x -6 [↵] Xcas returns -6+11*x-6*x^2+x^3 ◉ increasing_power() [↵] returns 1 |
|||
11-06-2019, 10:40 PM
Post: #66
|
|||
|
|||
RE: Existing CAS commands --> Prime discussion
(02-19-2019 02:52 AM)compsystems Wrote: undocumented functions and operators I'd love to be able to use these in non-CAS programs! Tom L Cui bono? |
|||
11-07-2019, 01:41 AM
(This post was last modified: 11-08-2019 12:49 AM by compsystems.)
Post: #67
|
|||
|
|||
RE: Existing CAS commands --> Prime discussion
a:=15; [ENTER] 15 // ok
a+=1; [ENTER] increment(a,1) => 16, a:=a+1, a:=15+1 // ok increment(a,1) [ENTER] increment(a,1) ? // expected 17 now a:=16; b:=20; a/=b [ENTER] a/▣ ? // expected 4/5 textbook => off a/=b [ENTER] 4/5 // ok |
|||
11-07-2019, 02:41 AM
(This post was last modified: 11-07-2019 02:42 AM by toml_12953.)
Post: #68
|
|||
|
|||
RE: Existing CAS commands --> Prime discussion
(11-07-2019 01:41 AM)compsystems Wrote: a:=15; [ENTER] 15 // ok Try a:=increment(a,1) Parameters are passed by value, not reference so the variable a can't be changed when used as a parameter. Tom L Cui bono? |
|||
11-08-2019, 12:57 AM
(This post was last modified: 11-08-2019 12:58 AM by compsystems.)
Post: #69
|
|||
|
|||
RE: Existing CAS commands --> Prime discussion
increment(a,1) stores the result of a: = a+1 the problem is that the hpprime does not update the history view engine, the xCAS evolves but when the CAS is updated within the firmware it is necessary to update the expression interpreter, otherwise not It will work many things.
|
|||
11-08-2019, 01:00 AM
Post: #70
|
|||
|
|||
RE: Existing CAS commands --> Prime discussion
(11-08-2019 12:57 AM)compsystems Wrote: increment(a,1) stores the result of a: = a+1 No, it doesn't. It increments a temporary copy of a, not a itself. That's why you have to store the result back to the variable a yourself. a:=increment(a,1) Tom L Cui bono? |
|||
11-08-2019, 08:12 AM
Post: #71
|
|||
|
|||
RE: Existing CAS commands --> Prime discussion
(11-08-2019 01:00 AM)toml_12953 Wrote:(11-08-2019 12:57 AM)compsystems Wrote: increment(a,1) stores the result of a: = a+1 In Xcas, increment(a,1) gets turned into a+=1, incrementing a in place. — Ian Abbott |
|||
11-08-2019, 10:59 AM
Post: #72
|
|||
|
|||
RE: Existing CAS commands --> Prime discussion
(11-08-2019 08:12 AM)ijabbott Wrote:(11-08-2019 01:00 AM)toml_12953 Wrote: No, it doesn't. It increments a temporary copy of a, not a itself. That's why you have to store the result back to the variable a yourself. Really? On Prime when I try it, it does this: I type a:=5 Prime shows 5 I type increment(a,1) Prime shows increment(5,1) I type a Prime shows 5 Prime has not incremented a. Tom L Cui bono? |
|||
11-08-2019, 03:00 PM
Post: #73
|
|||
|
|||
RE: Existing CAS commands --> Prime discussion
(11-08-2019 10:59 AM)toml_12953 Wrote:(11-08-2019 08:12 AM)ijabbott Wrote: In Xcas, increment(a,1) gets turned into a+=1, incrementing a in place. In Home Settings, page 2 (not page 1), turn ON "Textbook Display". Now in CAS type: a:=5 a+=1 You'll see that your a+=1 gets displayed as increment(a,1) ... but if you turn Textbook Display mode OFF, it's displayed as a:=a+1 However, typing increment() on the command line does not work; it's not recognized, like typing foobar() or any other nonexistent command. <0|ɸ|0> -Joe- |
|||
11-09-2019, 03:28 PM
Post: #74
|
|||
|
|||
RE: Existing CAS commands --> Prime discussion
Testing the four "crement" commands in programming:
Code: EXPORT TEST7788() The results may show why these four commands are not in the catalog: Code:
|
|||
11-09-2019, 03:51 PM
Post: #75
|
|||
|
|||
RE: Existing CAS commands --> Prime discussion
Hello
If you write on the entry line a: = 15; a + = 1; [enter] is shown in the history view [a: = 15, increment(a, 1)] [15,16] where a+=1 is interpreted as increment (a, 1) but the entry line of this sentence is not interpreted. increment(a, 1) [enter] increment(a, 1)? expected 17 A command that is not in the catalog does not imply that the command internally is not within the functions of the Xcas source code, they may not make it visible yet, like many that I have reported and have ignored. For example bool( 1 ); [enter] true bool( 0 ); [enter] false bool( -1 ); [enter] true |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 3 Guest(s)