Existing CAS commands --> Prime discussion
11-29-2018, 05:51 PM
Post: #41
 Joe Horn Senior Member Posts: 2,005 Joined: Dec 2013
RE: Existing CAS commands --> Prime discussion
(11-29-2018 05:18 PM)ijabbott Wrote:  Looking at the Giac/Xcas source code for exact and float2rational, they follow different code paths, but do similar things. The main functional difference seems to be that exact imposes a minimum epsilon value of 1e-14, whereas float2rational imposes a minimum epsilon value of 1e-11.

Prime's exact() function can be controlled by setting epsilon to any value between 1e-6 and 1e-15. Since the output of float2rational() can therefore be obtained by exact(), there is no need to add float2rational to the Prime's vocabulary... especially now that QPI is also available:

qpi(.324532453245) --> 295/909

<0|ɸ|0>
-Joe-
11-29-2018, 07:25 PM
Post: #42
 compsystems Senior Member Posts: 1,382 Joined: Dec 2013
RE: Existing CAS commands --> Prime discussion
The problem with QPI is that I can not control the output, so it does not always throw the output in rational format.

I propose to add to QPIRLNE

QPIRLNE( EXPR, FORMAT) where FORMAT = 0/1/.../6

case 0: (Default):
qpirlne( expr, 0) -> Expression as pi or root or ln or e

case 1: output only as a expression of QUOTIENT 1:
qpirlne( expr, 1) if it does not find the equivalent to quotient (1), but without
pi, root, ln, e, it returns the same value

case 2: output only as a expression of QUOTIENT 2:
qpirlne( expr, 2) if it does not find the equivalent to quotient (2), but without
pi, root, ln, e, it returns the same value

case 3: output only as a expression of PI:
qpirlne( expr, 3) if it does not find the equivalent to PI, it returns the same value

case 4: output only as a expression of ROOT
qpirlne( expr, 4) if it does not find the equivalent to ROOT, it returns the same value

case 5: output only as a expression of LN
qpirlne( expr, 5) if it does not find the equivalent to LN, it returns the same value

case 6: output only as a expression of EXPR
qpirlne( expr, 6) if it does not find the equivalent to EXP, it returns the same value

PHP Code:
ex#0: qpirlne( (2*π/3)+(3*π/4) , 0)  -> 17/12*π  qpirlne( (2*π/3)+(3*π/4) , 1)  -> 1137949/255685 // Q1 qpirlne( (2*π/3)+(3*π/4) , 2)  -> 4+(115209/255685) // Q2 qpirlne( (2*π/3)+(3*π/4) , 3)  ->  17/12*π // PI qpirlne( (2*π/3)+(3*π/4) , 4)  ->  (2*π/3)+(3*π/4) // ROOT qpirlne( (2*π/3)+(3*π/4) , 5)  ->  (2*π/3)+(3*π/4) // LN qpirlne( (2*π/3)+(3*π/4) , 6)  ->  (2*π/3)+(3*π/4) // eex#1: qpirlne( LN(3*π)-LN(√(5)), 0)  -> LN( (3*π*√(5)/5) )  qpirlne( LN(3*π)-LN(√(5)), 1)  -> 55715/38728 // Q1 qpirlne( LN(3*π)-LN(√(5)), 2)  -> 1+(16987/38728) // Q2 qpirlne( LN(3*π)-LN(√(5)), 3)  -> LN( (3*π*√(5)/5) )  // PI qpirlne( LN(3*π)-LN(√(5)), 4)  -> LN( (3*π*√(5)/5) )  // ROOT qpirlne( LN(3*π)-LN(√(5)), 5)  -> LN( (3*π*√(5)/5) ) // LN qpirlne( LN(3*π)-LN(√(5)), 6)  -> LN(3*π)-LN(√(5)) // eex#2: qpirlne( LN((2/5))-LN(√(2)), 0)  -> -LN((25/2))/2 qpirlne( LN((2/5))-LN(√(2)), 1)  -> -116599/92329 // Q1 qpirlne( LN((2/5))-LN(√(2)), 2)  -> -1+(-24270/92329) // Q2 qpirlne( LN((2/5))-LN(√(2)), 3)  -> LN((2/5))-LN(√(2)) // PI qpirlne( LN((2/5))-LN(√(2)), 4)  -> LN((2/5))-LN(√(2)) // ROOT qpirlne( LN((2/5))-LN(√(2)), 5) -> -LN((25/2))/2 // LN qpirlne( LN((2/5))-LN(√(2)), 6)  -> LN((2/5))-LN(√(2)) // eex#3: qpirlne( e^(2*π/(3*√(7))), 0)  -> e^((2*π*√(7)/21)) qpirlne( e^(2*π/(3*√(7))), 1)  -> 224192/101585 // Q1 qpirlne( e^(2*π/(3*√(7))), 2)  -> 1+(21022/101585) // Q2 qpirlne( e^(2*π/(3*√(7))), 3)  -> e^(2*π/(3*√(7))) // PI qpirlne( e^(2*π/(3*√(7))), 4)  -> e^(2*π/(3*√(7))) // ROOT qpirlne( e^(2*π/(3*√(7))), 5)  -> e^(2*π/(3*√(7))) // LN qpirlne( e^(2*π/(3*√(7))), 6)  -> e^(2*π/(3*√(7))) // eex#4: qpirlne( 7*π/√(90), 0)  -> 7*π*√(10)/30  qpirlne( 7*π/√(90), 1)  -> 171470/73971  qpirlne( 7*π/√(90), 2)  -> 260521/112387 qpirlne( 7*π/√(90), 3)  -> 7*π/√(90)ex#5: qpirlne( 1/(3+i*√(3)), 0)  -> (1/4)-i*((√(3)/12)) qpirlne( 1/(3+i*√(3)), 1)  -> (1/4)-(1/4)*i*√(1/3) // Q1 qpirlne( 1/(3+i*√(3)), 2)  -> (1/4)-(i*37829/262087) // Q1 qpirlne( 1/(3+i*√(3)), 3)  -> 1/(3+i*√(3)) // PI qpirlne( 1/(3+i*√(3)), 4)  -> (1/4)-i*((√(3)/12)) // ROOT qpirlne( 1/(3+i*√(3)), 5)  -> 1/(3+i*√(3)) // LN qpirlne( 1/(3+i*√(3)), 6)  -> 1/(3+i*√(3)) // eex#6: qpirlne( ACOS((-1/2)), 0)  -> 2/3*PI qpirlne( ACOS((-1/2)), 1)  -> 138894/66317 // Q1 qpirlne( ACOS((-1/2)), 2)  -> 2*(6260/66317) // Q2 qpirlne( ACOS((-1/2)), 3)  -> 2/3*PI // PI qpirlne( ACOS((-1/2)), 4)  -> ACOS((-1/2) // ROOT qpirlne( ACOS((-1/2)), 5)  -> ACOS((-1/2) // LN qpirlne( ACOS((-1/2)), 6)  -> ACOS((-1/2) // eex#7: qpirlne( COS((3*π/4)), 0)  -> -√(-2)/2 qpirlne( COS((3*π/4)), 1)  -> -195025/275807 // Q1 qpirlne( COS((3*π/4)), 2)  -> -195025/275807  // Q2 qpirlne( COS((3*π/4)), 3)  -> COS((3*π/4)) // PI qpirlne( COS((3*π/4)), 4)  -> -√(1/2) // ROOT qpirlne( COS((3*π/4)), 5)  -> COS((3*π/4)) // LN qpirlne( COS((3*π/4)), 6)  -> COS((3*π/4)) // eex#8: qpirlne( COS(π/12), 0)  -> (√(3)+1)*(√(2)/4) qpirlne( COS(π/12), 1)  -> 129209/133767 // Q1 qpirlne( COS(π/12), 2)  -> 272847/282472  // Q2 qpirlne( COS(π/12), 3)  -> COS((3*π/4)) // PI qpirlne( COS(π/12), 4)  -> (√(3)+1)*(√(2)/4) // ROOT qpirlne( COS(π/12), 5)  -> COS(π/12) // LN qpirlne( COS(π/12), 6)  -> COS(π/12) // eex#9: qpirlne( SIN(π/10), 0)  -> (-1+√((5)))/4 qpirlne( SIN(π/10), 1)  -> 98209/317811 // Q1 qpirlne( SIN(π/10), 2)  -> 98209/317811  // Q2 qpirlne( SIN(π/10), 3)  -> SIN(π/10) // PI qpirlne( SIN(π/10), 4)  -> (-1+√((5)))/4 // ROOT qpirlne( SIN(π/10), 5)  -> SIN(π/10) // LN qpirlne( SIN(π/10), 6)  -> SIN(π/10) // eex#10: qpirlne( SIN(π/8), 0)  -> √(2-√(2))/2 qpirlne( SIN(π/8), 1)  -> 69237/180925 // Q1 qpirlne( SIN(π/8), 2)  -> 69237/180925  // Q2 qpirlne( SIN(π/8), 3)  -> SIN(π/8) // PI qpirlne( SIN(π/8), 4)  -> √(2-√(2))/2 // ROOT qpirlne( SIN(π/8), 5)  -> SIN(π/8) // LN qpirlne( SIN(π/8), 6)  -> SIN(π/8) // eex#11: qpirlne( COS(π/5), 0)  -> (1+(√(5)))/4 qpirlne( COS(π/5), 1)  -> 98209/121393 // Q1 qpirlne( COS(π/5), 2)  -> 317811/392836  // Q2 qpirlne( COS(π/5), 3)  -> COS(π/5) // PI qpirlne( COS(π/5), 4)  ->  (1+(√(5)))/4 // ROOT qpirlne( COS(π/5), 5)  -> COS(π/5) // LN qpirlne( COS(π/5),, 6)  -> COS(π/5) // e

11-29-2018, 07:59 PM
Post: #43
 CyberAngel Member Posts: 299 Joined: Jul 2018
RE: Existing CAS commands --> Prime discussion
(11-29-2018 07:25 PM)compsystems Wrote:  The problem with QPI is that I can not control the output, so it does not always throw the output in rational format.

I propose to add to QPIRLNE

QPIRLNE( EXPR, FORMAT) where FORMAT = 0/1/.../6

case 0: (Default):
qpirlne( expr, 0) -> Expression as pi or root or ln or e

case 1: output only as a expression of QUOTIENT 1:
qpirlne( expr, 1) if it does not find the equivalent to quotient (1), but without
pi, root, ln, e, it returns the same value

case 2: output only as a expression of QUOTIENT 2:
qpirlne( expr, 2) if it does not find the equivalent to quotient (2), but without
pi, root, ln, e, it returns the same value

case 3: output only as a expression of PI:
qpirlne( expr, 3) if it does not find the equivalent to PI, it returns the same value

case 4: output only as a expression of ROOT
qpirlne( expr, 4) if it does not find the equivalent to ROOT, it returns the same value

case 5: output only as a expression of LN
qpirlne( expr, 5) if it does not find the equivalent to LN, it returns the same value

case 6: output only as a expression of EXPR
qpirlne( expr, 6) if it does not find the equivalent to EXP, it returns the same value

PHP Code:
ex#0: qpirlne( (2*π/3)+(3*π/4) , 0)  -> 17/12*π  qpirlne( (2*π/3)+(3*π/4) , 1)  -> 1137949/255685 // Q1 qpirlne( (2*π/3)+(3*π/4) , 2)  -> 4+(115209/255685) // Q2 qpirlne( (2*π/3)+(3*π/4) , 3)  ->  17/12*π // PI qpirlne( (2*π/3)+(3*π/4) , 4)  ->  (2*π/3)+(3*π/4) // ROOT qpirlne( (2*π/3)+(3*π/4) , 5)  ->  (2*π/3)+(3*π/4) // LN qpirlne( (2*π/3)+(3*π/4) , 6)  ->  (2*π/3)+(3*π/4) // eex#1: qpirlne( LN(3*π)-LN(√(5)), 0)  -> LN( (3*π*√(5)/5) )  qpirlne( LN(3*π)-LN(√(5)), 1)  -> 55715/38728 // Q1 qpirlne( LN(3*π)-LN(√(5)), 2)  -> 1+(16987/38728) // Q2 qpirlne( LN(3*π)-LN(√(5)), 3)  -> LN( (3*π*√(5)/5) )  // PI qpirlne( LN(3*π)-LN(√(5)), 4)  -> LN( (3*π*√(5)/5) )  // ROOT qpirlne( LN(3*π)-LN(√(5)), 5)  -> LN( (3*π*√(5)/5) ) // LN qpirlne( LN(3*π)-LN(√(5)), 6)  -> LN(3*π)-LN(√(5)) // eex#2: qpirlne( LN((2/5))-LN(√(2)), 0)  -> -LN((25/2))/2 qpirlne( LN((2/5))-LN(√(2)), 1)  -> -116599/92329 // Q1 qpirlne( LN((2/5))-LN(√(2)), 2)  -> -1+(-24270/92329) // Q2 qpirlne( LN((2/5))-LN(√(2)), 3)  -> LN((2/5))-LN(√(2)) // PI qpirlne( LN((2/5))-LN(√(2)), 4)  -> LN((2/5))-LN(√(2)) // ROOT qpirlne( LN((2/5))-LN(√(2)), 5) -> -LN((25/2))/2 // LN qpirlne( LN((2/5))-LN(√(2)), 6)  -> LN((2/5))-LN(√(2)) // eex#3: qpirlne( e^(2*π/(3*√(7))), 0)  -> e^((2*π*√(7)/21)) qpirlne( e^(2*π/(3*√(7))), 1)  -> 224192/101585 // Q1 qpirlne( e^(2*π/(3*√(7))), 2)  -> 1+(21022/101585) // Q2 qpirlne( e^(2*π/(3*√(7))), 3)  -> e^(2*π/(3*√(7))) // PI qpirlne( e^(2*π/(3*√(7))), 4)  -> e^(2*π/(3*√(7))) // ROOT qpirlne( e^(2*π/(3*√(7))), 5)  -> e^(2*π/(3*√(7))) // LN qpirlne( e^(2*π/(3*√(7))), 6)  -> e^(2*π/(3*√(7))) // eex#4: qpirlne( 7*π/√(90), 0)  -> 7*π*√(10)/30  qpirlne( 7*π/√(90), 1)  -> 171470/73971  qpirlne( 7*π/√(90), 2)  -> 260521/112387 qpirlne( 7*π/√(90), 3)  -> 7*π/√(90)ex#5: qpirlne( 1/(3+i*√(3)), 0)  -> (1/4)-i*((√(3)/12)) qpirlne( 1/(3+i*√(3)), 1)  -> (1/4)-(1/4)*i*√(1/3) // Q1 qpirlne( 1/(3+i*√(3)), 2)  -> (1/4)-(i*37829/262087) // Q1 qpirlne( 1/(3+i*√(3)), 3)  -> 1/(3+i*√(3)) // PI qpirlne( 1/(3+i*√(3)), 4)  -> (1/4)-i*((√(3)/12)) // ROOT qpirlne( 1/(3+i*√(3)), 5)  -> 1/(3+i*√(3)) // LN qpirlne( 1/(3+i*√(3)), 6)  -> 1/(3+i*√(3)) // eex#6: qpirlne( ACOS((-1/2)), 0)  -> 2/3*PI qpirlne( ACOS((-1/2)), 1)  -> 138894/66317 // Q1 qpirlne( ACOS((-1/2)), 2)  -> 2*(6260/66317) // Q2 qpirlne( ACOS((-1/2)), 3)  -> 2/3*PI // PI qpirlne( ACOS((-1/2)), 4)  -> ACOS((-1/2) // ROOT qpirlne( ACOS((-1/2)), 5)  -> ACOS((-1/2) // LN qpirlne( ACOS((-1/2)), 6)  -> ACOS((-1/2) // eex#7: qpirlne( COS((3*π/4)), 0)  -> -√(-2)/2 qpirlne( COS((3*π/4)), 1)  -> -195025/275807 // Q1 qpirlne( COS((3*π/4)), 2)  -> -195025/275807  // Q2 qpirlne( COS((3*π/4)), 3)  -> COS((3*π/4)) // PI qpirlne( COS((3*π/4)), 4)  -> -√(1/2) // ROOT qpirlne( COS((3*π/4)), 5)  -> COS((3*π/4)) // LN qpirlne( COS((3*π/4)), 6)  -> COS((3*π/4)) // eex#8: qpirlne( COS(π/12), 0)  -> (√(3)+1)*(√(2)/4) qpirlne( COS(π/12), 1)  -> 129209/133767 // Q1 qpirlne( COS(π/12), 2)  -> 272847/282472  // Q2 qpirlne( COS(π/12), 3)  -> COS((3*π/4)) // PI qpirlne( COS(π/12), 4)  -> (√(3)+1)*(√(2)/4) // ROOT qpirlne( COS(π/12), 5)  -> COS(π/12) // LN qpirlne( COS(π/12), 6)  -> COS(π/12) // eex#9: qpirlne( SIN(π/10), 0)  -> (-1+√((5)))/4 qpirlne( SIN(π/10), 1)  -> 98209/317811 // Q1 qpirlne( SIN(π/10), 2)  -> 98209/317811  // Q2 qpirlne( SIN(π/10), 3)  -> SIN(π/10) // PI qpirlne( SIN(π/10), 4)  -> (-1+√((5)))/4 // ROOT qpirlne( SIN(π/10), 5)  -> SIN(π/10) // LN qpirlne( SIN(π/10), 6)  -> SIN(π/10) // eex#10: qpirlne( SIN(π/8), 0)  -> √(2-√(2))/2 qpirlne( SIN(π/8), 1)  -> 69237/180925 // Q1 qpirlne( SIN(π/8), 2)  -> 69237/180925  // Q2 qpirlne( SIN(π/8), 3)  -> SIN(π/8) // PI qpirlne( SIN(π/8), 4)  -> √(2-√(2))/2 // ROOT qpirlne( SIN(π/8), 5)  -> SIN(π/8) // LN qpirlne( SIN(π/8), 6)  -> SIN(π/8) // eex#11: qpirlne( COS(π/5), 0)  -> (1+(√(5)))/4 qpirlne( COS(π/5), 1)  -> 98209/121393 // Q1 qpirlne( COS(π/5), 2)  -> 317811/392836  // Q2 qpirlne( COS(π/5), 3)  -> COS(π/5) // PI qpirlne( COS(π/5), 4)  ->  (1+(√(5)))/4 // ROOT qpirlne( COS(π/5), 5)  -> COS(π/5) // LN qpirlne( COS(π/5),, 6)  -> COS(π/5) // e

I suggest a modification: pi, root, e, ln
should each have a value of 1,2,4,8 or zero
and the combination includes the selected separatable operations or values accordingly .
Testing binaries in a progran is easy.
It's also an easy syntax for humans to learn and memorize.
What do you say?
11-29-2018, 08:56 PM
Post: #44
 ijabbott Senior Member Posts: 1,306 Joined: Jul 2015
RE: Existing CAS commands --> Prime discussion
(11-29-2018 05:51 PM)Joe Horn Wrote:
(11-29-2018 05:18 PM)ijabbott Wrote:  Looking at the Giac/Xcas source code for exact and float2rational, they follow different code paths, but do similar things. The main functional difference seems to be that exact imposes a minimum epsilon value of 1e-14, whereas float2rational imposes a minimum epsilon value of 1e-11.

Prime's exact() function can be controlled by setting epsilon to any value between 1e-6 and 1e-15. Since the output of float2rational() can therefore be obtained by exact(), there is no need to add float2rational to the Prime's vocabulary... especially now that QPI is also available:

qpi(.324532453245) --> 295/909

I don't know if the minimum values of epsilon for exact() and float2rational() are different on the Prime, but the values I gave are accurate for the upstream Xcas source. I.e. for float2rational(), setting epsilon to anything less than 1e-11 behaves the same as setting it to 1e-11. Similarly for exact() with an epsilon less than 1e-14.

The float2rational() function sometimes "gives up" and gives you the float back, which is another reason for not implementing it!

— Ian Abbott
12-06-2018, 05:27 PM (This post was last modified: 12-09-2018 05:10 PM by compsystems.)
Post: #45
 compsystems Senior Member Posts: 1,382 Joined: Dec 2013
RE: Existing CAS commands --> Prime discussion
Other function type commands to incorporate: equal2diff, list2exp

Sample
c:=circle(0,2); a:=equation(c); b:=4x^2+3x*y+y^2-8;
a:=equal2diff(equation(c));
r:=resultant(a,b,x);
sy:=solve(r=0,y,'='); sx:=sy:;
list2exp(sy,y);

y=(-(sqrt((sqrt(17)+7)/3) or y=(-(sqrt((-(sqrt(17))+7)/3) or y=(sqrt((-(sqrt(17))+7)/3) or (y=(sqrt((sqrt(17)+7)/3)

Test on-line
https://xcas.univ-grenoble-alpes.fr/foru...28&p=10708
12-08-2018, 01:31 PM (This post was last modified: 12-08-2018 03:22 PM by compsystems.)
Post: #46
 compsystems Senior Member Posts: 1,382 Joined: Dec 2013
RE: Existing CAS commands --> Prime discussion
.
On GIAC kernel

(function operator)
not(0) [↵] true
not(1) [↵] false
NOT(false) [↵] true
NOT(true) [↵] false

(prefix operator)
not false [↵] // It does not interpret.
NOT false [↵] true
NOT true [↵] false

not(0), not(1), NOT(false), NOT(true), NOT false, NOT true [↵] true,false,true,false,true,false

test on-line then press [ok], then [exec] button
https://www-fourier.ujf-grenoble.fr/~par...20true&;

HP Prime CAS

not(0), not(1), NOT(false), NOT(true), NOT false, NOT true [↵]
1,0,1,0,1,0 // numerical output in a symbolic environment =(
12-09-2018, 05:07 PM (This post was last modified: 12-09-2018 08:34 PM by compsystems.)
Post: #47
 compsystems Senior Member Posts: 1,382 Joined: Dec 2013
RE: Existing CAS commands --> Prime discussion
the subtype() command is required to identify the following types of objects

Xcas/HPprime
type(set[a,a,b]),type(poly1[0,0,3,-1]),type(a,a,b) [↵] returns
DOM_LIST,DOM_LIST,DOM_LIST

Xcas
subtype(set[a,a,b]),subtype(poly1[0,0,3,-1]),subtype(a,a,b) [↵] returns
2,10,1

according to XCAS help
subtype() cmd
Returns 1 for a sequence: for example (a,a,b),
2 for a set: set[a,a,b],
10 for a polynomial: poly1[0,0,3,-1]
and 0 otherwise.

PHP Code:
purge(a,b) ↵// +0 to obtain the numeric value of the reserved word or constantDOM_FLOAT+0,DOM_INT+0,DOM_COMPLEX+0,DOM_IDENT+0,DOM_LIST+0,DOM_SYMBOLIC+0,DOM_RAT+0,DOM_STRING+0,DOM_FUNC+0 ↵1,2,4,6,7,8,10,12,13type(3.0) ↵ DOM_FLOATtype(3.0)+0 ↵ 1  type(3) ↵ DOM_INTtype(3)+0 ↵ 2 type(3+4*i) ↵ DOM_COMPLEXtype(3+4*i)+0 ↵ 4type(abc) ↵ DOM_IDENTtype(abc)+0  ↵ 6type({a,a,b}) ↵ DOM_LISTtype({a,a,b})+0 ↵ 7type(a+b)↵ DOM_SYMBOLICtype(a+b)+0 ↵ 8type(3/4)↵ DOM_RATtype(3/4)+0 ↵ 10type("3/4")↵ DOM_STRINGtype("3/4")+0↵ 12type(f(x):=x+1)↵ DOM_FUNCtype(f(x):=x+1)+0 ↵ 13 set1 := set[a,a,b]; type(set1) ↵ DOM_LISTtype(set[a,a,b]);↵ DOM_LISTtype(poly1[0,0,3,-1]); ↵ DOM_LISTtype(a,a,b); ↵ DOM_LISTtype(set[a,a,b]),type(poly1[0,0,3,-1]),type(a,a,b)DOM_LIST,DOM_LIST,DOM_LISTsubtype(set[a,a,b]),subtype(poly1[0,0,3,-1]),subtype(a,a,b),subtype(a+b*i)2,10,1,0
12-09-2018, 05:19 PM (This post was last modified: 12-15-2018 03:02 PM by compsystems.)
Post: #48
 compsystems Senior Member Posts: 1,382 Joined: Dec 2013
RE: Existing CAS commands --> Prime discussion
op() function command: Transform a list into a object type sequence (undocumented command) . Please, make it visible in the catalog menu.

Source:
https://www-fourier.ujf-grenoble.fr/~par...akesuiteop

Sample: (Disable Textbook display for better understanding)
Input: (0,1,2)
Output : 0,1,2

Input: seq1:=0,1,2
Output : 0,1,2

Input : op([0,1,2])
Output: 0,1,2

---------------
the inverse command to op() is required

makevector() function command: Transform a sequence object into a list object
Source: https://www-fourier.ujf-grenoble.fr/~par...de367.html

Input: makevector(0,1,2)
Output: [0,1,2]

Input: seq1:=0,1,2
Output : 0,1,2

Input: makevector(seq1)
Output: [0,1,2]
12-09-2018, 11:47 PM
Post: #49
 John P Member Posts: 219 Joined: Dec 2013
RE: Existing CAS commands --> Prime discussion
(12-09-2018 05:19 PM)compsystems Wrote:  op() function command: Transform a list into a object type sequence (undocumented command)
Source:
https://www-fourier.ujf-grenoble.fr/~par...akesuiteop

Sample: (Disable Textbook display for better understanding)
Input: (0,1,2)
Output : 0,1,2

Input: seq1:=0,1,2
Output : 0,1,2

Input : op([0,1,2])
Output: 0,1,2

---------------
the inverse command to op() is required

makevector() function command: Transform a sequence object into a list object
Source: https://www-fourier.ujf-grenoble.fr/~par...de367.html

Input: makevector(0,1,2)
Output: [0,1,2]

Input: seq1:=0,1,2
Output : 0,1,2

Input: makevector(seq1)
Output: [0,1,2]

There is no makevector command on HP Prime as described in the cascmd_en. I think I used it a while ago but, somehow it misteriously disappeared from HP Prime.
12-10-2018, 01:43 AM
Post: #50
 Joe Horn Senior Member Posts: 2,005 Joined: Dec 2013
RE: Existing CAS commands --> Prime discussion
(12-09-2018 11:47 PM)John P Wrote:  There is no makevector command on HP Prime as described in the cascmd_en. I think I used it a while ago but, somehow it misteriously disappeared from HP Prime.

It was never included in Prime's vocabulary.

<0|ɸ|0>
-Joe-
12-10-2018, 05:45 AM
Post: #51
 John P Member Posts: 219 Joined: Dec 2013
RE: Existing CAS commands --> Prime discussion
(12-10-2018 01:43 AM)Joe Horn Wrote:
(12-09-2018 11:47 PM)John P Wrote:  There is no makevector command on HP Prime as described in the cascmd_en. I think I used it a while ago but, somehow it misteriously disappeared from HP Prime.

It was never included in Prime's vocabulary.

Probably not, but I think I used it after reading, a while ago, the cascmd_en. Now when I type makevector(1,2,3) nothing happens on my HP Prime with the latest firmware. Maybe you have different one.
12-10-2018, 08:26 AM
Post: #52
 CyberAngel Member Posts: 299 Joined: Jul 2018
RE: Existing CAS commands --> Prime discussion
(12-10-2018 05:45 AM)John P Wrote:
(12-10-2018 01:43 AM)Joe Horn Wrote:  It was never included in Prime's vocabulary.

Probably not, but I think I used it after reading, a while ago, the cascmd_en. Now when I type makevector(1,2,3) nothing happens on my HP Prime with the latest firmware. Maybe you have different one.
It seems that we always have to state the hardware platform as well as the firmware version.
12-11-2018, 03:49 AM
Post: #53
 Joe Horn Senior Member Posts: 2,005 Joined: Dec 2013
RE: Existing CAS commands --> Prime discussion
(12-10-2018 05:45 AM)John P Wrote:
(12-10-2018 01:43 AM)Joe Horn Wrote:  It was never included in Prime's vocabulary.

Probably not, but I think I used it after reading, a while ago, the cascmd_en. Now when I type makevector(1,2,3) nothing happens on my HP Prime with the latest firmware. Maybe you have different one.

Although I meant that no version of the HP Prime firmware, ever, has had a 'makevector' command (I checked a bunch of versions, from beta versions before Prime was even announced, through the most recent version, including my 8 Primes which have different official firmware versions installed in each), it is possible that 'makevector' was introduced at some point and then removed again in a subsequent firmware version. Although I wouldn't bet on that, I'd be happy to be proven wrong.

<0|ɸ|0>
-Joe-
12-11-2018, 04:56 AM
Post: #54
 John P Member Posts: 219 Joined: Dec 2013
RE: Existing CAS commands --> Prime discussion
(12-11-2018 03:49 AM)Joe Horn Wrote:
(12-10-2018 05:45 AM)John P Wrote:  Probably not, but I think I used it after reading, a while ago, the cascmd_en. Now when I type makevector(1,2,3) nothing happens on my HP Prime with the latest firmware. Maybe you have different one.

Although I meant that no version of the HP Prime firmware, ever, has had a 'makevector' command (I checked a bunch of versions, from beta versions before Prime was even announced, through the most recent version, including my 8 Primes which have different official firmware versions installed in each), it is possible that 'makevector' was introduced at some point and then removed again in a subsequent firmware version. Although I wouldn't bet on that, I'd be happy to be proven wrong.

Hello,
You could be right. I remember when reading 'cascmd_en' about that command. I was probably trying to see how it worked on HP Prime. Did I used the command? Not sure. Maybe I did not find it and this is probably how I remember it. It is OK. I will not start some big commotion because of the 'makevector' and if I really, really needed it I would probably already write some little prgm. to substitute for it.
Cheers, John.
12-11-2018, 06:07 AM
Post: #55
 Joe Horn Senior Member Posts: 2,005 Joined: Dec 2013
RE: Existing CAS commands --> Prime discussion
(12-11-2018 04:56 AM)John P Wrote:  I will not start some big commotion because of the 'makevector' and if I really, really needed it I would probably already write some little prgm. to substitute for it.

Unless I am mistaken, its functionality can be achieved simply by using square brackets. Example (with Textbook Display turned off):

a:=3,4,5
a --> 3,4,5
[a] --> [3,4,5] which is the same output as makevector(a).

or:

mat2list(a) --> {3,4,5} if you prefer a list instead of a vector.

<0|ɸ|0>
-Joe-
12-11-2018, 03:28 PM (This post was last modified: 12-15-2018 03:00 PM by compsystems.)
Post: #56
 compsystems Senior Member Posts: 1,382 Joined: Dec 2013
RE: Existing CAS commands --> Prime discussion
Another alternative way is: eval(seq(a,1))

but the important thing is to have a functional command, makevector(), dedicated for that purpose.
For example QR() returns a sequence Q,R, with makevector() returns a vector

makevector(QR([[1,2],[3,4]]))

There is also a need to document the lowercase qr() function command
makevector(qr([[1,2],[3,4]]))
12-14-2018, 02:16 AM (This post was last modified: 12-15-2018 03:00 PM by compsystems.)
Post: #57
 compsystems Senior Member Posts: 1,382 Joined: Dec 2013
RE: Existing CAS commands --> Prime discussion
The index functional command is not documented but it works. Please, make it visible in the catalog menu.

Help text.

Index acts as a system variable and as a functional command,

For functional command:
Index() returns the first position of an object in a list, a string or a set, if it does not find the object returns an error message.

index( List/String/Set, Object )

Examples:
LIST:
index:=0:; index([9,8,-1,8,9,8,7],8) [↵] returns 1
index:=1:; index([9,8,-1,8,9,8,7],8) [↵] returns 2

SET:
index:=0:; F_ := set[ H_,E_,L_,L_,O_];
F_ => set[ H_,E_,L_,O_]; the multiplicity of L_ is eliminated
index(F_,O_) [↵] returns 3
index(F_,L_) [↵] returns 2
12-14-2018, 02:30 AM (This post was last modified: 12-15-2018 03:01 PM by compsystems.)
Post: #58
 compsystems Senior Member Posts: 1,382 Joined: Dec 2013
RE: Existing CAS commands --> Prime discussion
The find functional command, is not documented but it works. Please, make it visible in the catalog menu.
Help text:
List of positions of an object in a list, a string or a set.

find(Object/List/String/Set)

index:=1:; F_:=[H_,E_,L_,L_,O_]; find(L_,F_) [↵] returns [ 3, 4 ]
12-15-2018, 02:58 PM (This post was last modified: 12-15-2018 03:01 PM by compsystems.)
Post: #59
 compsystems Senior Member Posts: 1,382 Joined: Dec 2013
RE: Existing CAS commands --> Prime discussion
The minus functional command, is not documented but it works. Please, make it visible in the catalog menu.

set[ "H", "E", "L", "L", "O"] minus set[ "H", "E" ]; [↵]
set["L", "O" ]
12-17-2018, 02:22 PM (This post was last modified: 12-17-2018 02:27 PM by compsystems.)
Post: #60
 compsystems Senior Member Posts: 1,382 Joined: Dec 2013
RE: Existing CAS commands --> Prime discussion
is_included() function synonym of ⊂ is not yet visible in the hp-prime catalog.

is_included(set[ "a", "d" ], set[ "b", "a", "c", "a" ]) [↵] 0

For a more intuitive output the numeric value [>0]/0 should be symbolix true/false, in this way the use of the EVALB() command is avoided.

evalb(is_included(set[ "a", "d" ], set[ "b", "a", "c", "a" ])) [↵] false

test online
session Xcas

more on sets