FeynCalc / feyncalc

Mathematica package for algebraic calculations in elementary particle physics.
https://feyncalc.github.io
GNU General Public License v3.0
310 stars 87 forks source link

Incorrect substitution within `DiracSimplify` #49

Closed JP-Ellis closed 4 years ago

JP-Ellis commented 4 years ago

The output of DiracSimplify appears to replace certain patterns in its input. I have a trivial example below showing the issue. I don't know if i is the only culprit though.

DiracSimplify[SpinorU[p[i], m[i]]]

produces

Spinor[Momentum[p[2]], m[2], 1]

which is incorrect (the simplification is trivial), and it should instead be returning:

Spinor[Momentum[p[i]], m[i], 1]

Mathematica Version 12.0.0 for Linux x86 (64-bit) (April 7, 2019)
FeynCalc Version Latest commit on master as of writing this issue
vsht commented 4 years ago

Does your minimal example work on a fresh kernel? I've just tried to reproduce it (also switching to the latest master commit on GitHub) but got only Spinor[Momentum[p[i]], m[i], 1] as expected.

Bildschirmfoto vom 2019-10-08 12-53-41

JP-Ellis commented 4 years ago

Yes, using a fresh kernel:

image

This is strange that you can't reproduce it...


EDIT

The fact that you couldn't reproduce it would suggest that something in my init.m might be the issue, and I narrowed it down to:

Begin["System`"]
Enumerate::usage = "Enumerate anything that is indexable.";
Enumerate[l_] := Table[{i, l[[i]]}, {i, Length@l}];
Enumerate[l_, f_]  := Table[{i, f[l[[i]]]}, {i, Length@l}];
Protect[Enumerate];
End[]

As to why this code is causing the issue, I don't know, but this then isn't an issue with FeynCalc. Sorry for the false bug report!

For anyone curious, changing System` with Global` fixed the issue.

vsht commented 4 years ago

No problem, glad you figured it out.