linera solver and cas
01-01-2016, 10:25 PM
Post: #1
 hpfx Junior Member Posts: 28 Joined: Jan 2015
linera solver and cas
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 ?
01-02-2016, 08:50 AM
Post: #2
 parisse Senior Member Posts: 1,013 Joined: Dec 2013
RE: linera solver and cas
[1,0] is correct, check your equations!
01-02-2016, 04:21 PM
Post: #3
 Aries Member Posts: 131 Joined: Oct 2014
RE: linera solver and cas
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 ;-)
01-02-2016, 09:32 PM
Post: #4
 hpfx Junior Member Posts: 28 Joined: Jan 2015
RE: linera solver and cas
yes, you are right, I made mistake while copying equation.
both solve() and linsolve() perfectly works.
sorry...
 « Next Oldest | Next Newest »

User(s) browsing this thread: 1 Guest(s)