0
$\begingroup$

All you need to know about the gamma matrices for this problem is that there are four of them, $\gamma_{\mu}$ with $\mu = 0, 1, 2, 3$, and that the trace of the product of n gamma matrices (n even) obeys the following recursive relation:

Here, $\widehat{\gamma}_{\nu_k}$ signifies absence of $\gamma_{\nu_k}$ and $g_{\nu_1,\nu_k}$ is a tensor with two indices.(BTW, when n is odd the result is zero). Here's my attempt at the code:

TrGamma[z__] :=
If[Length[z] == 2, 
  4*Subscript[g, z[[1]], z[[2]]] ,

  (*Else*)
  Module[ {x = 0, n = Length[z]},
     For[i = 2, i <= n, i++,
       Module[{y = Delete[z, {{1}, {i}}]},
       x = x + (-1)^i*Subscript[g, z[[1]], z[[i]]]*TrGamma[y]]
     ];
   x
  ]
]

This gives the correct answer for n=2 and n=4:

In[4]:= TrGamma[{Subscript[\[Nu], 1],Subscript[\[Nu], 2]}]
TrGamma[{Subscript[\[Nu], 1],Subscript[\[Nu], 2],Subscript[\[Nu],3],Subscript[\[Nu], 4]}]               

Output:

However, when I try n = 6 or higher it just keeps running. I'm guess there's something about Module that I'm missing or have misunderstood. I've tried replacing Module with Block and the problem still persists.

$\endgroup$
2
  • 1
    $\begingroup$ You might be interested in Internal`DiracGammaMatrix[]: Table[Internal`DiracGammaMatrix[k], {k, 5}]. $\endgroup$ – J. M.'s torpor Jan 15 '17 at 12:32
  • $\begingroup$ Or you could study the source code of DiracTrace $\endgroup$ – Rolf Mertig Jan 15 '17 at 18:58
1
$\begingroup$

Since the formula has a sum ($\sum$), it's best to use Sum:

TrGamma[nu1_, nu2_] := 4 Subscript[g, nu1, nu2]

TrGamma[indices___] := 
  Sum[
    (-1)^k Subscript[g, {indices}[[1]], {indices}[[k]]] * 
    TrGamma @@ Delete[{indices}, {{1}, {k}}],
  {k, 2, Length[{indices}]}]
$\endgroup$
3
  • $\begingroup$ Tried it and it works! $\endgroup$ – Feynmaniac Jan 15 '17 at 19:37
  • 1
    $\begingroup$ @Feynmaniac Ok, don't forget to upvote this and other answers if you found them helpful. Mark it as accepted if it answers your question. $\endgroup$ – QuantumDot Jan 15 '17 at 21:32
  • $\begingroup$ Right. Sorry, I'm new here. $\endgroup$ – Feynmaniac Jan 15 '17 at 21:46
0
$\begingroup$

Are you just trying to understand how to get recursion working in Mathematica, or are you mainly interested in having some useful functions for dealing with gamma matrices? If the latter, there is a package GAMMA by Ulf Gran which will handle all your gamma matrix needs, in any dimension and in any signature:

https://arxiv.org/abs/hep-th/0105086

$\endgroup$
2
  • $\begingroup$ I'm interested in both, actually. I'll check out the package. $\endgroup$ – Feynmaniac Jan 15 '17 at 19:37
  • $\begingroup$ @Feynmaniac Depending on what you want to do, you may find FeynCalc quite useful. $\endgroup$ – QuantumDot Jan 15 '17 at 21:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.