0

(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?

user366202
  • 451
  • 2
  • 8
  • 1
    It cannot be done with built-ins without writing your own methods. You will probably want to look at the non-commutative algebra package https://github.com/NCAlgebra/NC and specifically the matrices section: http://www.math.ucsd.edu/~ncalg/DOCUMENTATION/#AdvancedMatrices – flinty Oct 06 '20 at 15:45
  • thanks, this is very helpful! – user366202 Oct 06 '20 at 15:53
  • ^ well it's a bit clunky but better than nothing. However, there is also TensorReduce. See this answer: https://mathematica.stackexchange.com/a/221745/72682 – flinty Oct 06 '20 at 15:57

0 Answers0