feynlag.pheno.lorentz.dirac_trace

feynlag.pheno.lorentz.dirac_trace(expr)[source]

Trace of a Dirac chain, tolerating scalar (identity) pieces.

sympy.physics.hep.gamma_trace handles only pure gamma products, so a spin-sum factor p̸ + m breaks it. Here the expression is expanded and each additive term is traced separately: terms carrying gamma matrices go to SymPy, purely scalar terms use Tr[c·I₄] = 4c.