On 5/17/07, Wolfgang Lindner <LindnerW at t-online.de> wrote:
>
> given a m x n-matrix e.g.
> A: [1 1 -2]
> [1 -1 -3]
>
> I want to automatic construct the right 'input'list [x+y=2,x-y=3]
The easiest way is probably:
Meq: A . [x,y,1]
=> matrix([y+x-2],[-y+x+3])
To extract the equations, you can use maplist(first,Meq) or
transpose(Meq)[1] or makelist(Meq[i,1],i,1,2).
For linsolve and the other solve functions, the equation x=y is entirely
equivalent to x-y (implicitly x-y=0). If for some reason you want explicit
equations, I suppose you could do
A . [x,y,0] and A . [0,0,1]
to extract the left- and right-hand sides separately.
-s