Welcome to Cadabra Q&A, where you can ask questions and receive answers from other members of the community.
+1 vote

The concrete problem I want to solve: I want to replace a product of two gamma matrices by the one in reverse order using the Clifford relation. i.e. $\gamma\mu \gamma\nu -> 2 \eta{\mu \nu} - \gamma\nu \gamma_\mu $

When I use a substitution it's applied to all products of 2 gamma matrices, even if they already have the 'right' order. Since patterns select both terms, I cannot zoom into one of the terms selectively. Regexp does not seem to help either (or at least not without knowing the internal represantation of a placeholder like M??). Your trick works fine in your example, but I cannot ditinguish the order of the Dirac matrices by contracting with a vecor/tensor, so it does not help here.

Instead trying to sort the terms appropriately and then applying $\gamma\mu \gamma\nu + \gamma\nu \gamma\mu -> 2 \eta_{\mu \nu} $ instead seems not to work either, so I'm lost - should be a trivial exercise in gamma matrices...

Added: I found an analogous trick: Contract with a tensor $F^{\mu \nu} $ then one can match with a pattern containing $\gamma\mu \gamma\nu F^{\mu \nu}$. Due to non-commutativity of Dirac matrices this patterns really matches only one of the two terms.

However, considering that this is essnetially the most trvial transformation with Dirac matrices, it is surprising that such a painfull worakround seems to be needed. Hopefully, I'm overlooking some easy solution.

related to an answer for: Pattern matching based on free index?
in General questions by (220 points)
edited by

1 Answer

+1 vote

The problem with referring to explicit index names is always that computations tend to break quickly when you change things slightly. My usual approach is to replace each product by "half the symmetric product plus half the anti-symmetric product", and then replace the symmetric product by the metric.

But I admit that sometimes that's making things more complicated. I think the right way to go is to add this functionality to substitute's conditionals, so that you can write

substitute(ex, $\gamma^{a?} \gamma^{b?} | a? < b? -> \gamma^{b?}\gamma^{a?} + 2\eta^{a? b?}$);

That does not work yet, but I have added an issue on the github tracker: https://github.com/kpeeters/cadabra2/issues/265

by (83.1k points)
...