Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cases doesn't support Heads->True option #1302

Closed
vsht opened this issue Apr 22, 2021 · 0 comments · Fixed by #1350
Closed

Cases doesn't support Heads->True option #1302

vsht opened this issue Apr 22, 2021 · 0 comments · Fixed by #1350

Comments

@vsht
Copy link

vsht commented Apr 22, 2021

Minimal working example (cf. https://wolfram.com/xid/0giraq-6woldg)

Cases[FeynCalc`Contract`Private`times[
  Pair[LorentzIndex[mu], Momentum[p]], 
  Pair[LorentzIndex[mu], 
   Momentum[p]]], (LorentzIndex | CartesianIndex)[
   FeynCalc`Contract`Private`i_, ___] :> 
  FeynCalc`Contract`Private`i, Infinity, Heads -> True]

MMa:

In[1]:= Cases[FeynCalc`Contract`Private`times[                                                                                               
          Pair[LorentzIndex[mu], Momentum[p]],                                                                                               
          Pair[LorentzIndex[mu],                                                                                                             
           Momentum[p]]], (LorentzIndex | CartesianIndex)[                                                                                   
           FeynCalc`Contract`Private`i_, ___] :>                                                                                             
          FeynCalc`Contract`Private`i, Infinity, Heads -> True]                                                                              

Out[1]= {mu, mu}

Mathics

In[5]:= Cases[FeynCalc`Contract`Private`times[
          Pair[LorentzIndex[mu], Momentum[p]], 
          Pair[LorentzIndex[mu], 
           Momentum[p]]], (LorentzIndex | CartesianIndex)[
           FeynCalc`Contract`Private`i_, ___] :> 
          FeynCalc`Contract`Private`i, Infinity, Heads -> True]
Out[5]= Cases[FeynCalc`Contract`Private`times[Pair[LorentzIndex[mu], Momentum[p]], Pair[LorentzIndex[mu], Momentum[p]]], (LorentzIndex | CartesianIndex)[FeynCalc`Contract`Private`i_, ___] :> FeynCalc`Contract`Private`i, Infinity, Heads -> True]


Relevant for #1174

@mmatera mmatera mentioned this issue Apr 24, 2021
@rocky rocky added the Feyncalc label May 2, 2021
rocky added a commit that referenced this issue May 3, 2021
And run black over the file.
Fixes #1302
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants