Maxima: Transforming solutions obtained by linsolve.
Subject: Maxima: Transforming solutions obtained by linsolve.
From: Barton Willis
Date: Sat, 17 Nov 2007 05:41:15 -0600
Try this:
(%i1) [x1 = -(%r1*a13+%r2*a12)/a11,x2 = %r2,x3 = %r1]$
(%i2) map('rhs,%);
(%o2) [(-%r1*a13-%r2*a12)/a11,%r2,%r1]
(%i3) coefmatrix(%,[%r1,%r2]);
(%o3) matrix([-a13/a11,-a12/a11],[0,1],[1,0])
Why map rhs on to the equations? Consider:
(%i4) coefmatrix([x+y=z, x-y=q],[x,y]);
(%o4) matrix([1,1],[1,-1])
(%i5) augcoefmatrix([x+y=z, x-y=q],[x,y]);
(%o5) matrix([1,1,-z],[1,-1,-q])
BW
-----maxima-bounces at math.utexas.edu wrote: -----
>To: maxima at math.utexas.edu
>From: Constantine Frangos <cfrangos at telkomsa.net>
>Sent by: maxima-bounces at math.utexas.edu
>Date: 11/17/2007 03:45AM
>Subject: Maxima: Transforming solutions obtained by linsolve.
>
>I am using linsolve() for the solution of linear equations. For example:
>
>
>(%i513) ysol : linsolve([a11*x1+a12*x2+a13*x3],[x1,x2,x3]);
>
>(%o513) [x1 = -(%r1*a13+%r2*a12)/a11,x2 = %r2,x3 = %r1]
>(%i514)
>
>I want to transform the obtained solution to the following form:
>
>xsol = A . r
>
>where r = matrix([%r1],[%r2])
>
>and A = matrix([-a13/a11,-a12/a11],[0,1],[1,0])
>
>Its not clear how to construct or extract the matrix A (and the matrix r)
>from the list ysol.
>
>I could not extract the %r1 and %r2 as these seem to be different each
>time
>linsolve() is called, eg %r3, %r4, etc
>
>Any assistance would be appreciated.
>
>TIA
>
>C. Frangos.
>_______________________________________________
>Maxima mailing list
>Maxima at math.utexas.edu
>http://www.math.utexas.edu/mailman/listinfo/maxima