I want to compute ${\rm trace}(\phi\psi- \psi\phi)^2$. The answer is $2\phi\psi\phi\psi-2\phi^2\psi^2$.

So how can I do this in Cadabra?

I have declared $\phi,\psi$ to be matrices. I am not giving them ImplicitIndices.

I tried using complete(), by defining a rule, to give the trace cyclic symmetries but that does not work. It is not using the condition. So probably I am using the wrong function.

I thought of using the young tableau symmetries to define the indices of $\phi\psi$ but that gives symmetries to a specific tensor rather than the indices themselves. So cant be used in a product.

Is there a quick way to implement the trace in Cadabra. I have a very long expression I want to take the trace of?