(This is probably a trivial question, but I could not find the answer in the documentation.)
I would like to be able to use (functions similar to) Simplify, Factor etc. on products and sums of arbitrary symbolic matrices.
For example, I would like behavior similar to the following:
Simplify[a.b + a.c + a.d]
--> a.(b + c + d)
Simplify[Tr[a.b.c] + Tr[b.c.a] + Tr[c.a.b]]
--> 3 Tr[a.b.c]
Simplify[Tr[a.ConjugateTranspose[b] + b.ConjugateTranspose[a]]]
--> 2 Re[Tr[a.ConjugateTranspose[b]]]
I have tried adding Assumptions that a,b,c and d are matrices, as follows:
$Assumptions = {
a\[Element] Matrices[{2, 2}, Complexes, {}],
b\[Element] Matrices[{2, 2}, Complexes, {}],
c\[Element] Matrices[{2, 2}, Complexes, {}],
d\[Element] Matrices[{2, 2}, Complexes, {}]
}
but this does not work. Is there an inbuilt way to get these types of simplifications to work in Mathematica, or do I need to write my own functions to do this?
TensorReduce. See this answer: https://mathematica.stackexchange.com/a/221745/72682 – flinty Oct 06 '20 at 15:57