From: SourceForge.net <no...@so...> - 2008-03-08 16:11:12
|
Bugs item #1910043, was opened at 2008-03-08 06:12 Message generated for change (Comment added) made by willisbl You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=1910043&group_id=4933 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Lisp Core - Complex Group: None Status: Open Resolution: Invalid Priority: 5 Private: No Submitted By: Nobody/Anonymous (nobody) Assigned to: Nobody/Anonymous (nobody) Summary: Wrong calculation with nested matrices Initial Comment: If I am not mistaking, these two calculations should yield the same result, but do not in Maxima: input: matrix([0,0,0,1],[0,0,1,0],[0,-1,0,0],[-1,0,0,0]).matrix([0,0,0,-%i],[0,0,%i,0],[0,%i,0,0],[ -%i,0,0,0]); output: matrix([-%i,0,0,0],[0,%i,0,0],[0,0,-%i,0],[0,0,0,%i]) input: matrix([0,matrix([0,1],[1,0])],[matrix([0,-1],[-1,0]),0]).matrix([0,matrix([0,-%i],[%i,0])],[matrix([0,%i],[-%i,0]),0]); output: matrix([matrix([0,%i],[-%i,0]),matrix([0,0],[0,0])],[matrix([0,0],[0,0]),matrix([0,%i],[-%i,0])]) thus, there is something wrong, or am I wrong with that? Maxima version: 5.12.0Maxima build date: 15:52 7/20/2007host type: i686-pc-linux-gnulisp-implementation-type: GNU Common Lisp (GCL)lisp-implementation-version: GCL 2.6.7 ---------------------------------------------------------------------- >Comment By: Barton Willis (willisbl) Date: 2008-03-08 10:11 Message: Logged In: YES user_id=895922 Originator: NO I don't think we want to default matrix_element_mult to "."; suppose a, b, c, and d are identifiers for real numbers. Then (%i23) m1 : matrix([a,b],[c,d])$ (%i25) m2 : matrix([d,-b],[-c,a])$ (%i26) matrix_element_mult : "."$ (%i27) m1 . m2; (%o27) matrix([a.d-b.c,b.a-a.b],[c.d-d.c,d.a-c.b]) With non-commutative multiplication, the off-diagonal terms are nonzero, but with commutative multiplication, the off-diagonal terms are zero. That is correct for a,b,c,d real numbers. (%i28) matrix_element_mult : "*"$ (%i29) m1 . m2; (%o29) matrix([a*d-b*c,0],[0,a*d-b*c]) ---------------------------------------------------------------------- Comment By: fabus (fgebert) Date: 2008-03-08 09:22 Message: Logged In: YES user_id=1126735 Originator: NO I did not know matrix_element_mult. Is there anything against defaulting matrix_element_mult to "."? ---------------------------------------------------------------------- Comment By: Barton Willis (willisbl) Date: 2008-03-08 08:25 Message: Logged In: YES user_id=895922 Originator: NO To work with nested (or block) matrices, you'll need to set matrix_element_mult to ".". Try this (%i17) matrix_element_mult : "."$ (%i18) matrix([0,matrix([0,1],[1,0])],[matrix([0,-1],[-1,0]),0]).matrix([0,matrix([0,-%i],[%i,0])],[matrix([0,%i],[ -%i,0]),0])$ (%i20) mat_unblocker(%); (%o20) matrix([-%i,0,0,0],[0,%i,0,0],[0,0,-%i,0],[0,0,0,%i]) ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=1910043&group_id=4933 |