I'm sorry, I forget mention, that I need to solve A.x=b by Gauss method.
LU-method - it's another method with what I should work:)
invert(A).b; <<< it's work, but is it close to Gauss?
On Thu, 2007-11-22 at 12:00 -0600, maxima-request at math.utexas.edu wrote:
> Message: 3
> Date: Wed, 21 Nov 2007 23:24:00 +0000
> From: "Paul Smith" <phhs80 at gmail.com>
> Subject: Re: [Maxima] Matrix: finding x in A.x=b
> To: maxima at math.utexas.edu
> Message-ID:
> <6ade6f6c0711211524s7fbc828clb9e784332df3e6c7 at mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1
>
> On Nov 21, 2007 10:29 PM, Mansur Marvanov <nanorobocop at gmail.com> wrote:
> > Is there any way to find vector x in A.x=b simply?
> >
> > I have:
> > (%i105) A:matrix([1,2],[3,4])$
> > (%i107) b:matrix([1],[2])$
> >
> > (%i115) solve(A.x=b,[x1,x2]);
> > (%o115) []
> > ^^^ Doesn't work:(
> >
> > How can I get vector x?
> >
> > There is function lsolve(A,b) in MathCAD. Is there the same in Maxima?
>
> A possible way:
>
> (%i1) A:matrix([1,2],[3,4])$
>
> (%i2) b:matrix([1],[2])$
>
> (%i3) invert(A).b;
> [ 0 ]
> [ ]
> (%o3) [ 1 ]
> [ - ]
> [ 2 ]
> (%i4)
>
> Paul
>
>
> ------------------------------
>
> Message: 4
> Date: Wed, 21 Nov 2007 17:25:01 -0600
> From: Peter Danenberg <pcd at wikitex.org>
> Subject: Re: [Maxima] Matrix: finding x in A.x=b
> To: maxima at math.utexas.edu
> Message-ID: <20071121232501.GC3368 at klutometis.wikitex.org>
> Content-Type: text/plain; charset=us-ascii
>
> > Is there any way to find vector x in A.x=b simply?
>
> What about something like this:
>
> (%i10) load(linearalgebra)$
> (%i11) A:matrix([1,2],[3,4])$
> (%i12) b:matrix([1],[2])$
> (%i13) lu_backsub(lu_factor(A, floatfield), b);
>
>
> ------------------------------
>
> Message: 6
> Date: Wed, 21 Nov 2007 18:32:12 -0600
> From: Barton Willis <willisb at unk.edu>
> Subject: Re: [Maxima] Matrix: finding x in A.x=b
> To: Peter Danenberg <pcd at wikitex.org>
> Cc: maxima at math.utexas.edu
> Message-ID:
> <OFD88101A8.880719B8-ON8625739B.0002F2CB-8625739B.0002F2CD at unk.edu>
> Content-Type: text/plain; charset=US-ASCII
>
> This method only works for square matrices :( For square matrices,
> you can try linsolve_by_lu. Example:
>
> (%i1) linsolve_by_lu(matrix([1,2],[3,4]), matrix([1],[2]));
> (%o1) [matrix([0],[1/2]),false]
>
> For rational numbers, the second argument is false; for floats the
> second argument is an estimate of the condition number. Multiple
> right-hand-sides are OK
>
> (%i2) linsolve_by_lu(matrix([1,2],[3,4]), matrix([1,0],[0,1]));
> (%o2) [matrix([-2,1],[3/2,-1/2]),false]
>
> And a double-float example
>
> (%i3) linsolve_by_lu(matrix([1,2],[3,4]),
> matrix([1,0],[0,1]),'floatfield);
> (%o3) [matrix([-2.0,1.0],[1.5,-0.5]),21.77777777777778]
>
> And, for fun:
>
> (%i1) f : lambda([i,j], random(10))$
> (%i2) m2(m,n) := genmatrix(f,m,n)$
>
> (%i3) m1 : matrix([m2(2,2),m2(2,2)],[m2(2,2), m2(2,2)]);
> (%o3)
> matrix([matrix([2,9],[8,0]),matrix([4,5],[7,3])],[matrix([3,9],[5,5]),matrix([2,5],[1,0])])
>
>
> (%i4) b : identfor(m1);
> (%o4)
> matrix([matrix([1,0],[0,1]),matrix([0,0],[0,0])],[matrix([0,0],[0,0]),matrix([1,0],[0,1])])
>
>
> (%i5) matrix_element_mult : "."$
> (%i6) m1_inv : first(linsolve_by_lu(m1,b, 'noncommutingring));
>
> (%o6) matrix([matrix([-43/188,25/376],[57/376,-55
> /752]),matrix([71/376,27/376],[-81/752,91/752])],
> [matrix([145/376,25/752],[-109
> /376,59/752]),matrix([-305/752,27/752],[333/752,-207/752])])
>
> (%i7) m1.m1_inv;
> (%o7)
> matrix([matrix([1,0],[0,1]),matrix([0,0],[0,0])],[matrix([0,0],[0,0]),matrix([1,0],[0,1])])
>
>
>
> BW
>
> -----maxima-bounces at math.utexas.edu wrote: -----
>
> >To: maxima at math.utexas.edu
> >From: Peter Danenberg <pcd at wikitex.org>
> >Sent by: maxima-bounces at math.utexas.edu
> >Date: 11/21/2007 05:25PM
> >Subject: Re: [Maxima] Matrix: finding x in A.x=b
> >
> >> Is there any way to find vector x in A.x=b simply?
> >
> >What about something like this:
> >
> > (%i10) load(linearalgebra)$
> > (%i11) A:matrix([1,2],[3,4])$
> > (%i12) b:matrix([1],[2])$
> > (%i13) lu_backsub(lu_factor(A, floatfield), b);
> >_______________________________________________
> >Maxima mailing list
> >Maxima at math.utexas.edu
> >http://www.math.utexas.edu/mailman/listinfo/maxima
>
>
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>
>
> End of Maxima Digest, Vol 16, Issue 35
> **************************************