[HP Prime CAS] Solve Commands (Bugs and Request)



#2

Hello

for linear systems

Example #1
[HP-Prime CAS] solve( 4*x+3*y=10 and 5*x-2*y=1, {x,y} ) [Enter] return { [ 1, 2 ] }
// OK, but best

[Request] tag the answers

solve( 4*x+3*y=10 and 5*x-2*y=1, {x,y} ) [Enter] return { [ x=1, y=2 ] } OK OK and if { [ x=1, and: y=2 ] } OK, OK, OK /!\ "and:" as tag (idea)

http://www.wolframalpha.com/input/?i=solve%28+4*x%2B3*y%3D10+and+5*x-2*y%3D1%2C+%7Bx%2Cy%7D%29

purpose, use the expression (output) in a program

left(x = 3) => x // to extract the variable

right(x = 3) => 3 // to extract the result

[Request] rename left to leftPart and right to rightPart

linSolve( 4*x+3*y=10 and 5*x-2*y=1, {x,y} ) [Enter] return [ 1, 2 ] OK and if [ x=1, y=2 ] OK OK, and if [ x=1, and:y=2 ] OK OK OK

Example #2

[HP-Prime CAS] solve( 4*x+6*y=10 and 2*x-3*y=6, {x,y} ) [Enter] return {}

[Request] Better a boolean output (true/false) like TI-CAS+ calculators

solve( 4*x+6*y=10 and 2*x-3*y=6, {x,y} ) [Enter] return false

purpose use the expression (output) in a program

if solve( 4*x+6*y=10 and 2*x-3*y=6, {x,y} ) == true then ... else ...

now required a "trick" use DIM( ... ) =(

if DIM( solve( 4*x+6*y=10 and 2*x-3*y=6) )== true, {x,y} ) then // ugly use DIM(

equal with linSolve

linSolve( 4*x+6*y=10 and 2*x-3*y=6, {x,y} )return [ ] ?? empty vector, ugly and nothing didactic for teaching and learning of math

best

linSolve( 4*x+6*y=10 and 2*x-3*y=6, {x,y} )return false =)

if linSolve( 4*x+6*y=10 and 2*x-3*y=6, {x,y} ) == true then ...

//

[BUG#0 solve cmds] with SIMULT

simult(

[ [ 4, 6 ] [ [10]

[ 2, 3 ]], [6]]

return [ 0 ; 1 ] ?? // Bug 4*0 + 6 * 1 = 10 => 6 = 10 => false

simult(

[ [ 4, 6 ] [ [10]

[ 2, 3 ]], [6]]
return "Not Solutions Exist" // OK // or "singular matrix" like TI-CAS+ calcs or wolframAlpha

see wolframalpha
http://www.wolframalpha.com/input/?i=solve%28+4*x%2B6*y%3D10+and+2*x%2B3*y%3D6%2C+%7Bx%2Cy%7D%29

Example #3

solve( 4*x+6*y=12 and 2*x-3*y=2, {x,y} ) [Enter] return false =)

simult(

[ [ 4, 6 ] [ [12]

[ 2, 3 ]], [6]]

return [ 1 ; 0 ] ?? // Bug

simult(

[ [ 4, 6 ] [ [12]

[ 2, 3 ]], [6]]
return "Infinite Solutions" // Super OK

Thanks

///////////////////////////////
PD: [spanish]

REQUEST Se requiere un comando para etiquetar similar a ->TAG de la HP50

ejemplo

tag( "cplx1:", 3+4*i ) [Enter] cplx1: 3+4*i

tag({ "x:", "y:", "z:" }, [ 3 4 1 ] ) [Enter] [ x:3, y:4, z:1 ]

/!\ la etiqueta no afectaría los cálculos, es muy útil por ejemplo para indicar en pantalla resultados mas bonitos sin la necesidad de convertirlos a cadenas, pues se cambiaría el tipo de dato

Edited: 6 Aug 2013, 2:57 p.m. after one or more responses were posted


#3

I don't understand at all why you want the result 'false' for a system of equation with no solution. For me it's a non sense. The 'system' is not false, there is no solution -> S={}. My english is limited for such things but an empty set is not 'false'

I also don't like the solution in the format (x=xx and y=xx) or (x=xx and y=yy) : it is verbious and confusing with boolean operators.

S={s1; s2; ...} is far better (a set of solution)

or

S={} if there is no solution (an empty set)

You also not use the correct syntax for linsolve ( [] and not {} ), and solve ( idem) . The AND syntax to solve a system of equation is curious for me and not documented in on line help of the Prime


Edited: 5 Aug 2013, 2:47 a.m.


#4

>> I don't understand at all why you want the result 'false' for a system of equation with no solution

can also be infinite solutions, in a linear system

a student think when see an empty list?

while you would think if you see "false" or "true" or when return the same input?

all these details are think by TI-CAS developers

>> I also don't like the solution in the format (x=... and y=...) or (x=... and y=...) : it is verbious and confusing with boolean operators.

[Castillian]
todo lo contrario, es mucho mas "inteligente" esta respuesta, me dice que soluciones son condicionales, decir, si las dos soluciones satisfacen la ecuación o si alguna de ellas satisface la ecuación

[Eng] sorry, Google translator

on the contrary, is much "smarter" this response ((x=... and y=...) or (x=... and y=...)), I said that solutions are conditional, ie if the two or more solutions satisfy the equation or if any of them satisfies the equation

Please watch the following equation with 4 solutions

[HP-Prime CAS] solve ( x^2-10*x+y^2=-8 and x*y^2+x+10*y=-8, {x,y} ) [Enter] return

{

[1, 1],

[2.19 , 3.02 ]

}

[HP-Prime CAS++] solve ( x^2-10*x+y^2=-8 and x*y^2+x+10*y=-8, {x,y} ) [Enter] return

{

[x:1, and y:1],

[x: 2.19, and y:3.02 ]

}

(idea or request) "x:", "y:" & "and y:" as TAG (->TAG CMD HP50G), then to operate the label disappears

>> S={} if there is no solution (an empty set)

When the HP-Prime can not calculate, returns {} [BUG], should return the same expression otherwise you would think that there are no solutions or infinite solutions, etc ...

>> The AND syntax to solve a system of equation is curious for me and not documented in on line help of the Prime

[HP-Prime CAS] solve ( x^2-10*x+y^2=-8 AND x*y^2+x+10*y=-8, {x,y} )

{ x^2-10*x+y^2=-8 , x*y^2+x+10*y=-8 } == x^2-10*x+y^2=-8 AND x*y^2+x+10*y=-8 // =) TI-CAS and others CAS computer sofware style =]

and if apply this input form, why not in the output?

Edited: 5 Aug 2013, 9:51 a.m.


#5

I don't agree with you here

In the same way, when the TI returns 'false' with solve or linsolve command it is an error: There are no such things as a 'false' equation or 'false' system of equations

5=5 is true, but it's not an equation, it's an equality
6=5 is false

but the system of equation :

/
| x-y=0
| x-y-4=0
\
is not 'false'. S={}

I you search the intersection of 2 straight lines wich are // , the system is not 'false'. There is no solution and that's a different thing

The same with 2 circles you can get : {} or {[a,b]} or {[a,b],[c,d]} or the equation of circle if they are the same. But no 'false' results nor false system

EDIT :
"a student think when see an empty list?"

An emply list is a 'void set' (ensemble vide) = no solution

An infinity of solution can be :
y=f(x) ex : {y=2.x}

or All (x,y) € |R² in very special cases
Edit :in this case,Prime returns {[x,y]}

If an infinity of solution results as {}, there is a bug

The only bug I see here is (I cant test):

solve(sqrt(x^x))=x^sqrt(x))
EDIT : I get "unable to isolate x"...for this one

You can find the obvious solutions {1.,4.} with the numeric solver

And always the same thing : the Prime dont verify matrix dimensions with your simult with bad parameters

EDIT 3

Quote:
if solve( 4*x+6*y=10 and 2*x-3*y=6, {x,y} ) == true then ... else ...

now required a "trick" use DIM( ... ) =(

if DIM( solve( 4*x+6*y=10 and 2*x-3*y=6) )== true, {x,y} ) then // ugly use DIM(


you can use if solve([eq1,eq2],[x,y])<>{}


Edited: 5 Aug 2013, 2:00 p.m.


#6

Example #4

solve( x1-3*x2+x3=1 and 2*x1-x2-2*x3=-1 and x1+2*x2-3*x3=-1, {x1,x2, x3})

x1-(7/5)*x3 = 0 => x1 =7/5*x3

x2 -(4/5)x3 = 0 => x2 = (4/5)x3

0*x3 = 1 // => 0 = 1 inconsistent system (FALSE equation)

source

http://www.cengage.com/cgi-wadsworth/course_products_wp.pl?fid=M20bI&flag=instructor&product_isbn_issn=9780618783762&disciplinenumber=1

[request]

factor( [ t; 4*t; (1/2)*t ] ) => t * [ 1; 4 ; 1/2 ]

transpose([[ 1 2 ] [ a, b ]]) => [[ 1 2 ] [ a, b ]]T

concat( M1, M2) => M1|M2


Edited: 6 Aug 2013, 3:10 p.m.


#7

"0*x3 = 1 // => 0 = 1 inconsistent system (FALSE equation) "

This '0*x3=1 => 0=1' hurts my eyes ;)

0*x^3=1 is an equation without solution (altough in some case x=oo )
0=1 is a false equality, a mathematical non sense

0*x3=1 => S={} as there is no x€|R that verify this.

Is 'a*x=1' a sometimes true / sometimes false equation ?

Another example :
x/x=1 is not a 'True' equation
S=|R* or if you prefer
S=|R - {0}

That means that x/x=1 is not the same than x=x wich gives S=|R

Edited: 7 Aug 2013, 6:27 a.m.


#8

[HP-prime CAS 0.8.3] solve (sqrt(x^x))=x^sqrt(x), x) [Enter] {} // BUG

[HP-prime CAS 1.1.0] solve (sqrt(x^x))=x^sqrt(x), x) [Enter]

["Unable to isolate x in exp(1/2*x*ln(x))-exp(exp(1/2*ln(x))*ln(x))"] // OK // I hope in the coming months, that CAS can solve this =)

... [Spn] =(

translate.google.en

Se ha corregido MAL un BUG que reporte recientemente, el cual es que si un sistema lineal no tiene solución, o infinitas soluciones SIMULT, retornaba como salida el vector columna final de la operación RREF, este resultado o vector no satisface las ecuaciones, por lo tanto como lo hacen otros CAS, debe arrojar un mensaje de error, ahora la HP-Prime CAS, retorna un BAD mensaje de error

M1: = [[1,-3,1],[2,-1,-2],[1,2,-3]]
V1:= [[1],[2],[-1]] => // [Request] Me gustaría que el CAS aceptara V1:= [ 1; 2; -1 ]

[HP-prime CAS 0.8.3] simult( M1, V1 ) => [ ] // BUG

[HP-prime CAS 1.1.0] simult( M1, V1 ) =>
Error: Bad Argument Value" <= ???

simult( M1, V1 ) =>
[ solution ], "Infinitas soluciones" or "no hay solución" dependiendo de las ecuaciones finales// OK

"Infinitas soluciones" o "no hay solución" pero no "Bad Argument Value" como que "Mal Valor de Argumento"??, cual el primero o el segundo argumento es un mal valor?, Acá no hay error en los argumentos, por lo tanto lo considero nuevamente como un BUG

Es muy fácil detectar si hay "Infinitas soluciones" o "no hay solución" se realiza RREF( CONCAT( M1,V1 )) y se analiza las ecuaciones de salida, para determinar si hay "solución única", "Infinitas soluciones" or "no hay solución", yo programe esto hace mucho tiempo en la HP48GX

[Request] permitir el operador | como concatenación de matrices/vectores

CONCAT( M1,V1 ) == M1|V1, otros CAS usan barra vertical punteada

RREF( CONCAT( M1,V1 )) => RREF( M1 | V1 )


Edited: 7 Aug 2013, 6:45 p.m.


#9

El TI-CAS es un CAS mas "inteligente" que el HP-CAS, por que se aproxima mas a como un ser humano lo haría, mientras que el HP-CAS sus respuestas no son tan intuitivas y como es para un mercado estudiantil pre-universitario, dudo que tenga buena acogida, casi siempre en la HP-Prime hay que estar re-escribiendo las expresiones para obtener algo mas facil de manipular

Ejemplo: Sistemas de ecuaciones lineales con "Soluciones infinitas"

x1-3*x2+x3 = 1

2*x1-x2-2*x3 = -1

2*x1-6*x2+2*x3 = 2

en forma A*x=b

[[1,-3,1,1], [ x1; x2; x3 ] = [ 1; -1; 2 ]

[2,-1,-2,-1], *

[2,-6,2,2]]

M1:=

[[1,-3,1],

[2,-1,-2],

[2,-6,2]]

x:= [[ x1],[x2][x3]]

b: = [[1], [-1],[2]]

sol:={}

Aplicando RREF (reduced row echelon form)

rref( concat( M1, b ) ) [Enter] =>

[[1,0,-7/5,-4/5],

[0,1,-4/5,-3/5],

[0,0,0,0]]

x1=(7/5)*x3-4/5

x2=(4/5)*x3-3/5

x3=x3

[TI-CAS] solve( x1 -3*x2 +x3 = 1 and 2*x1 -x2 -2*x3 = -1 and 2*x1 -6*x2 +2*x3 = 3), { x1, x2, x3 } )

:)

x1=(7* c1 -4)/5 and

x2=(4*c1-3 /5) and

x3=c1

sol:= Ans

sol:= x1=(7* c1 -4)/5 and x2=(4*c1-3 /5) and x3=c1

reemplaza x3 = c1, en la parte derecha de las expresiones, salida en función de un parámetro, el cual tiene un propósito evaluar las expresiones sin afectar la variable parametro

x1=(7* c1 -4)/5 and x2=(4*c1-3 /5) and x3=c1 | (c1 =2) =>

x1=1 and x2 = 1 and x3=2

pueden observar con mas detalle la solución en:

http://www.math.odu.edu/~bogacki/cgi-bin/lat.cgi?cmd=sys;m1_1=1;m1_2=-3;m1_3=1;m1_4=1;m2_1=2;m2_2=-1;m2_3=-2;m2_4=-1;m3_1=2;m3_2=-6;m3_3=2;m3_4=2;curn=3;curn=4;vdat=3;vdat=R3;whid=V;whid=1;submit21=Submit;hideops=1

[HP-CAS] solve( x1 -3*x2 +x3 = 1 and 2*x1 -x2 -2*x3 = -1 and 2*x1 -6*x2 +2*x3 = 3), { x1, x2, x3 } )
:(
{ [ x1, -1/35*(-20*x1+5), -1/4*(5/35*(-20*x1+5)-3) ] }

Comparen las dos respuestas anteriores, por cual calculadora se inclinarían?

sol:= Ans

sol:= { [ x1, -1/35*(-20*x1+5), -1/4*(5/35*(-20*x1+5)-3) ] }

re-escribiendo las expresiones anterior

sol := simplify( Sol )

sol := simplify( { [ x1, -1/35*(-20*x1+5), -1/4*(5/35*(-20*x1+5)-3)] } =>

sol := [ x1, (4*x1-1)/7, (5*x1+4)/7]

reescribiendo para que sea útil dentro de un programa

x := sol // fail

transpose(x) := sol // fail

vx : = [ x1, x2, x3 ] // se requiere una nueva definición del vector x como vector fila

sol: = (vx = sol) =>

sol:= ([ x1, x2, x3 ] = [ x1, (4*x1-1)/7, (5*x1+4)/7 ])

sol:=([ x1 = x1, x2 = (4*x1-1)/7, x3=(5*x1+4)/7 ] )

todos los pasos anteriores para poder tener una respuesta mejor :(

en resulmen en la HP-Prime

[ x1, x2, x3 ] = simplify ( solve ( x1 -3*x2 +x3 = 1 and 2*x1 -x2 -2*x3 = -1 and 2*x1 -6*x2 +2*x3 = 3), { x1, x2, x3 } ) )

[ x1 = x1, x2 = (4*x1-1)/7, x3=(5*x1+4)/7 ]

mientras que en la TI-CAS

solve ( x1 -3*x2 +x3 = 1 and 2*x1 -x2 -2*x3 = -1 and 2*x1 -6*x2 +2*x3 = 3), { x1, x2, x3 } )

x1=(7* c1 -4)/5 and x2=(4*c1-3 /5) and x3=c1

con el comando LInSolve las cosas son mejores

[ x1, x2, x3 ] = solve ( x1 -3*x2 +x3 = 1 and 2*x1 -x2 -2*x3 = -1 and 2*x1 -6*x2 +2*x3 = 3), { x1, x2, x3 } )

[ x1=(7/5* x3 -4), x2=(4/5*x3-3 ), x3=x3 ]

pero hay un problema [ x1=(7/5* x3 -4), x2=(4/5*x3-3 ), x3=x3 ] | x=3 =>

[ x1 = 2, x2=1, 2=2 ] ver tercer elemento ( 2 =2 )

Si linsolve arrojara en función de un parámetro seria fabuloso y si incluyera las variables, se igualria al CAS de las TI-calculators

linSolve ( x1 -3*x2 +x3 = 1 and 2*x1 -x2 -2*x3 = -1 and 2*x1 -6*x2 +2*x3 = 3), { x1, x2, x3 } )

[ x1=(7/5* t -4), x2=(4/5*t-3 ), x3=t ] // Super CAS

[ x1=(7/5* t -4), x2=(4/5*t-3 ), x3=t ] | t = 2

[ x1 = 2, x2=1, x3=2 ]

Edited: 8 Aug 2013, 10:11 a.m.


#10

Quote:
[TI-CAS] solve( x1 -3*x2 +x3 = 1 and 2*x1 -x2 -2*x3 = -1 and 2*x1 -6*x2 +2*x3 = 3), { x1, x2, x3 } )

:)

x1=(7* c1 -4)/5 and

x2=(4*c1-3 /5) and

x3=c1

sol:= Ans

sol:= x1=(7* c1 -4)/5 and x2=(4*c1-3 /5) and x3=c1

reemplaza x3 = c1, en la parte derecha de las expresiones, salida en función de un parámetro, el cual tiene un propósito evaluar las expresiones sin afectar la variable parametro

x1=(7* c1 -4)/5 and x2=(4*c1-3 /5) and x3=c1 | (c1 =2) =>

x1=1 and x2 = 1 and x3=2


What a complex way to do !
Why not :

s:=linsolve([x1-3*x2+x3=1,2*x1-x2-2*x3=-1,2*x1-6*x2+2*x3=2],[x1,x2,x3])

s|x3=2

Edit : Your system of equation is not the same in the beginning and the end of your post. I take the first one.
To HP -> The spaces between equations is too small in this release

Edited: 8 Aug 2013, 12:32 p.m. after one or more responses were posted


#11

I think as you would do in a program, not in the entry line

Please can create a program that made the steps above, detecting the parameter


Edited: 8 Aug 2013, 12:33 p.m.


#12

Sorry but I don't understand spanish, I dont'see see any program

Cheers,

EDIT :

For what I understand of your TI example, to do the same on the HP

linsolve([x1-3*x2+x3=1,2*x1-x2-2*x3=-1,2*x1-6*x2+2*x3=2],[x1,x2,x3])

STO> s

s|x3=c1

STO> s

s|c1=2

But I don't see any interest to replace x3 with c1

The last rev has auto-simplification options in CAS setup

Edited: 8 Aug 2013, 5:11 p.m.


Possibly Related Threads...
Thread Author Replies Views Last Post
  HP Prime: CAS taylor Alberto Candel 5 459 12-13-2013, 09:45 PM
Last Post: Alberto Candel
  HP Prime CAS curiosity bluesun08 11 722 12-10-2013, 01:03 PM
Last Post: Han
  [HP-Prime CAS] "Warning, ^ (Command) Is ambiguous on non square matrices"?? CompSystems 1 283 12-07-2013, 07:15 PM
Last Post: CompSystems
  HP Prime: complex numbers in CAS. Alberto Candel 1 248 12-06-2013, 02:36 PM
Last Post: parisse
  HP Prime: Proper Use of Home View and CAS View James Williams 9 631 12-05-2013, 02:44 PM
Last Post: James Williams
  [HP Prime] plotfunc() bug in CAS Chris Pem10 2 286 12-04-2013, 02:46 PM
Last Post: Chris Pem10
  HP Prime: Home/CAS? Alasdair McAndrew 11 652 11-26-2013, 02:48 PM
Last Post: Alberto Candel
  HP Prime numerical precision in CAS and HOME Javier Goizueta 5 374 11-16-2013, 03:51 AM
Last Post: Paul Dale
  Digging for bugs Stefan Dröge (Germany) 2 222 11-13-2013, 04:39 PM
Last Post: Stefan Dröge (Germany)
  Need CAS help Michael de Estrada 6 388 11-13-2013, 01:29 AM
Last Post: cyrille de Brébisson

Forum Jump: