HP Forums
linera solver and cas - 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: linera solver and cas (/thread-5432.html)



linera solver and cas - hpfx - 01-01-2016 10:25 PM

Hi,
happy new year !

I know there is a linear solver app, but it's limited to number, and I wanted to see how I can play with cas with linear system.
system is :
2x-a*y=2
-x-2y=-1
I typed linsolve([2*x-a*y=2 -x-2*y=-1],[x y])
and cas gave me : [1 0]
But expected result was -1/(2+a) and (a+4)/(a+2)


Ok... let's try with solve() that is a little bit the swiss knife of cas.
first of all, lets try with a basic system :
solve(3*x+2*y=1 AND 3*x-y=2 , {x,y})
return {[5/9 -1/3]} which is correct !
I was very enthousiatic!

then I tried :
solve(2*x-a*y=2 AND -x-2*y=-1, {x,y})
but I got {[1 0]}

something look wrong, any idea ?


RE: linera solver and cas - parisse - 01-02-2016 08:50 AM

[1,0] is correct, check your equations!


RE: linera solver and cas - Aries - 01-02-2016 04:21 PM

Solving by substitution, we have x=(1-2*y).
"Plugging" x=(1-2*y) into the other equation and solving for "y", we have:
2*(1-2*y)-a*y=2 --> 2-4*y-a*y=2 --> (-4-a)*y=0 --> y=0 (a<>-4).
Now "plugging" this y-value back into either equation and solving for "x", we have x=1.
Hence the Prime is correct.
Best,

Aries ;-)


RE: linera solver and cas - hpfx - 01-02-2016 09:32 PM

yes, you are right, I made mistake while copying equation.
both solve() and linsolve() perfectly works.
sorry...