# [Maxima] augcoefmatrix and linsolve

Wolfgang Lindner LindnerW at t-online.de
Thu May 17 13:59:00 CDT 2007

```Dear Stavros, dear Kostas,

thank you both for your insightful help. That was just what I needed.
Once again I can learn much from your hints and programs.
Really wonderful group.

HTH Wolfgang

Oikonomou" <ko at research.att.com> schrieb:
> Wolfgang,
>
> I had the same situation, and I wrote this function:
>
> mlinsolve(A,x,b) := block([m,eqs],
>    matrixp(A) or error("A must be a matrix!"),
>    (listp(x) and listp(b)) or error("x,b must be lists!"),
>    m : length(A),
>    eqs : [],
>    for i : 1 thru m do eqs : cons(row(A,i) . x = b[i], eqs),
>    linsolve(eqs,x)
> )
>
> 				Kostas
>
> Wolfgang Lindner wrote:
> > dear group,
> >
> > given a linear system m:[x+y=2,x-y=3] one gets the augmented system matrix via
> >
> > augcoefmatrix(m)= [1  1 -2]
> >                   [1 -1 -3].
> >
> > Working with matrices and solving linear systems I need the 'inverse' procedure:
> > 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] to feed
> > linsolve([x+y=2,x-y=3],[x,y]).
> >
> > Is there a maxima function who can do this?
> >
> > HTH Wolfgang
> > _______________________________________________
> > Maxima mailing list
> > Maxima at math.utexas.edu
> > http://www.math.utexas.edu/mailman/listinfo/maxima
>
>  "Stavros Macrakis" <macrakis at alum.mit.edu> schrieb:
> 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
```