Re: Matrix equations
- To: mathgroup at smc.vnet.net
- Subject: [mg53925] Re: Matrix equations
- From: Paul Abbott <paul at physics.uwa.edu.au>
- Date: Fri, 4 Feb 2005 04:11:23 -0500 (EST)
- Organization: The University of Western Australia
- References: <ctnhce$ero$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
In article <ctnhce$ero$1 at smc.vnet.net>, Jamie Vicary <jamievicary at gmail.com> wrote: > I'm using Mathematica 5.1 and trying to solve equations like the > following: > > A.{{1,0},{0,2}} == -{{1,0},{0,2}}.A > > i.e. I want to find the matrix that anticommutes with {{1,0},{0,2}}. The > only matrix that solves this is the zero matrix {{0,0},{0,0}} but > Mathematica refuses to solve the above equation for A, giving the usual > "The equations appear to involve the variables to be solved for in an > essentially non-algebraic way." > > If I set A={{a,b},{c,d}} and then solve the above equation for > {{a,b},{c,d}} then Mathematica correctly tells me {{a->0, b->0, c->0, > d->0}}, but this isn't what I want. I want to give Mathematica equations > in terms of matrices, not in terms of their components. > > In summary: why, when I give Mathematica the above equation to > solve for A, does it not solve it giving A->{{0,0},{0,0}} which is the > trivial, unique solution to the equation? Because Solve has not been designed to do this. However, it is easy to use Solve to obtain this functionality: AntiCommutingMatrix[m_?MatrixQ, sym_:a] := Module[{n = Length[m], b}, b = Table[Subscript[sym, i, j], {i, n}, {j, n}]; b /. First[Solve[b . m == -m . b, Flatten[b]]] ] For example, AntiCommutingMatrix[{{1,0},{0,2}}] The following command correctly produces a Solve::svars warning message (this can be turned off using Off[Solve::svars] if you like) AntiCommutingMatrix[DiagonalMatrix[{a, a, -a}]] Cheers, Paul -- Paul Abbott Phone: +61 8 6488 2734 School of Physics, M013 Fax: +61 8 6488 1014 The University of Western Australia (CRICOS Provider No 00126G) 35 Stirling Highway Crawley WA 6009 mailto:paul at physics.uwa.edu.au AUSTRALIA http://physics.uwa.edu.au/~paul