Message Boards Message Boards

0
|
35691 Views
|
6 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Simplification of simple matrix expressions

Can Mathematica Simplify simple matrix expressions like

$Assumptions = Element[C1, Matrices[{4, 4}]]
$Assumptions = Element[C2, Matrices[{4, 4}]]
Simplify[Transpose[C1.C2] - Transpose[C2].Transpose[C1]]
Simplify[TensorReduce[TensorTranspose[C1.C2]] - TensorTranspose[C2].TensorTranspose[C1]]

Running this code does not yield 0 for either expression.

More generally, how can I use Mathematica do simplify more complicated matrix expressions involving sums and products of matrices, some of which are symmetric, self-adjoint, etc...?

Thanks!

POSTED BY: Eric Michielssen
6 Replies

Great! Still struggling to have Mathematica simplify matrix expressions though. See the very simple example below. How do I simplify A1.A2 + A1.A3 with A2+A3 == 0 to 0 (or a zero matrix)? How can I make Mathematica scour through a collection of matrix assumptions and have it simplify matrix expressions very much like it does so well for scalar expressions? Thank you!!

ass = {Element[A1, Matrices[{4, 4}]],
   Element[A2, Matrices[{4, 4}]], 
   Element[A3, Matrices[{4, 4}]],
   A2 + A3 == 0};
FullSimplify[A1.A2 + A1.A3, Assumptions -> ass]
Simplify[x y + x z, Assumptions -> {y + z == 0}]

Out[1836]= A1.A2 + A1.A3

Out[1837]= 0
POSTED BY: Eric Michielssen

Hi Eric, Assumptions you can use outside of TensorReduce[] ; use inside Simplify[], and you don´t even have to specify directly Assumptions inside Simplify as a rule. Or you can set $Assumptions globally:

ClearAll[J, Jp, Z, Zp, Ib, V, Vp, ass, n];
n = 4;
ass = {Element[J, Matrices[{n, n}]], Element[Ib, Matrices[{n, n}]], 
   Element[V, Matrices[{n, n}]], J - Ib.V == 0};
Simplify[TensorReduce[Ib.V - J], ass]
Simplify[TensorReduce[Ib.V - J], ass]
Simplify[Ib.V - J, ass]

..or:

ClearAll[J, Jp, Z, Zp, Ib, V, Vp, ass, n];
n = 4;
$Assumptions = {Element[J, Matrices[{n, n}]], 
   Element[Ib, Matrices[{n, n}]], Element[V, Matrices[{n, n}]], 
   J - Ib.V == 0};
Simplify[TensorReduce[Ib.V - J]]
Simplify[TensorReduce[Ib.V - J]]
Simplify[Ib.V - J]
POSTED BY: Claudio Chaib

Thank you Claudio, and I apologize for not catching the typo. I remain a little confused about how to robustly simplify matrix expressions, though.

Here are a few examples:

ClearAll[J, Jp, Z, Zp, Ib, V, Vp, ass, n];
n = 4;
ass = {
   Element[J, Matrices[{n, n}]],
   Element[Ib, Matrices[{n, n}]],
   Element[V, Matrices[{n, n}]],
   J - Ib.V == 0
   };
TensorReduce[Ib.V - J, Assumptions -> ass]
Simplify[TensorReduce[Ib.V - J, Assumptions -> ass]]
Simplify[Ib.V - J, Assumptions -> ass]

Out[314]= -J + Ib.V
Out[315]= -J + Ib.V
Out[316]= 0

Likewise,

ClearAll[J, Jp, Z, Zp, Ib, V, Vp, ass, n];
n = 4;
ass = {
   Element[J, Matrices[{n, n}]],
   Element[Ib, Matrices[{n, n}]],
   Element[V, Matrices[{n, n}]],
   J - Ib.V == 0
   };
TensorReduce[Transpose[V + J], Assumptions -> ass]
TensorReduce[Conjugate[V + J], Assumptions -> ass]
TensorReduce[ConjugateTranspose[V + J], Assumptions -> ass]

Out[324]= TensorTranspose[J, {2, 1}] + TensorTranspose[V, {2, 1}]
Out[325]= Conjugate[J] + Conjugate[V]
Out[326]= ConjugateTranspose[J + V]

For the last example, I guess I could add another rule to make it work... Though generally speaking, I wonder how robustly these simplifications are being applied and how to specify rules to make the process more robust.

POSTED BY: Eric Michielssen

There is a typo in "ass", it´s missing one: ",". So the first part should work.

Then, if you add A4==ConjugateTranspose[A1.A2] to the Assumption, the second part works, as expected.

ass = {Element[A1, Matrices[{4, 4}]], Element[A2, Matrices[{4, 4}]], 
  Element[A3, Matrices[{4, 4}]], Element[A4, Matrices[{4, 4}]], 
  A4 == ConjugateTranspose[A1.A2]}
TensorReduce[Transpose[A1.A2] - Transpose[A2].Transpose[A1], 
 Assumptions -> ass]
TensorReduce[
 Transpose[A1.A2.A3] - Transpose[A3].Transpose[A2].Transpose[A1], 
 Assumptions -> ass]

Simplify[TensorReduce[ConjugateTranspose[A1.A2] - A4], 
 Assumptions -> ass]

i2

POSTED BY: Claudio Chaib

Thank you for answering my beginners question!

I now have some followup questions. Still very basic.

ass = {Element[A1, Matrices[{4, 4}]],
  Element[A2, Matrices[{4, 4}]], 
  Element[A3, Matrices[{4, 4}]]
   Element[A4, Matrices[{4, 4}]]}
TensorReduce[Transpose[A1.A2] - Transpose[A2].Transpose[A1], 
 Assumptions -> ass]
TensorReduce[
 Transpose[A1.A2.A3] - Transpose[A3].Transpose[A2].Transpose[A1], 
 Assumptions -> ass]

The first simplification works. The second one fails...

Furthermore, I'd like to simplify expressions like

TensorReduce[ConjugateTranspose[A1.A2] - A4, Assumptions -> ass]...

where there is a relationship between A1, A2, and A4, and the matrices themselves exhibit some symmetries. For example, A4 could be self-adjoint, and A1.A2 == A4... in which case the reduction should produce 0...

POSTED BY: Eric Michielssen

Hi Eric, is this what you want?

$Assumptions = {Element[C1, Matrices[{4, 4}]] && 
   Element[C2, Matrices[{4, 4}]]}
TensorReduce[Transpose[C1.C2] - Transpose[C2].Transpose[C1]]
TensorReduce[TensorTranspose[C1.C2]] - 
 TensorTranspose[C2].TensorTranspose[C1]

i1

POSTED BY: Claudio Chaib
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract