(* Program to Calculate the Traces of Eq. 5.27 to 5.29 of QFT for Compton
   Scattering

 Last Version: 06/12/2024
 Compatible with FeynCalc 10.1.0
 Author: Jorge C. Romao
 email: jorge.romao@tecnico.ulisboa.pt
*)


Remove["Global`*"]

prop[p_,m_]:=GS[p]+m


Line1:= prop[pp,m] . GA[mu] .  prop[p+k,m] . GA[nu] . prop[p,m] . GA[nu] . 
prop[p+k,m] . GA[mu]

Line2:= prop[pp,m] . GA[mu] .  prop[p-kp,m] . GA[nu] . prop[p,m] . GA[nu] . 
prop[p-kp,m] . GA[mu]

Line12:= prop[pp,m] . GA[nu] .  prop[p+k,m] . GA[mu] . prop[p,m] . GA[nu] . 
prop[p-kp,m] . GA[mu]

Line21:= prop[pp,m] . GA[mu] .  prop[p-kp,m] . GA[nu] . prop[p,m] . GA[mu] . 
prop[p+k,m] . GA[nu]


ans1= Simplify[Contract[TR[Line1]]/(2 SP[p,k])^2]
ans2= Simplify[Contract[TR[Line2]]/(2 SP[p,kp])^2]
ans12= Simplify[Contract[TR[Line12]]/(-4 SP[p,k] SP[p,kp])]
ans21= Simplify[Contract[TR[Line21]]/(-4 SP[p,k] SP[p,kp])]


  ans= 1/4*(ans1 + ans2 + ans12 + ans21) //FCE


onshell={SP[p,p]->m^2,SP[pp,pp]->m^2,SP[k,k]->0,SP[kp,kp]->0}



res = ans /. onshell


kin={SP[p,k]->m Ek,SP[p,kp]->m Ekp,SP[k,kp]->m (Ek-Ekp),SP[p,pp]->m^2+m (Ek-Ekp),SP[pp,k]->m Ekp,SP[pp,kp]->m Ek}

aux=Expand[res/2 /. kin]

aux1=aux - Ek/Ekp -Ekp/Ek ;

aux2= Simplify[aux1 /. Ekp->Ek/(1+Ek/m*(1-Cos[teta]))]

final= 2 e^4 (Ek/Ekp + Ekp/Ek + aux2);

Print["\!\(\*FractionBox[\(1\), \(4\)]\) \!\(\*UnderscriptBox[\(\[Sum]\), \(spins\)]\)|M\!\(\*SuperscriptBox[\(|\), \(2\)]\) = ",final]



(********************* Fim do Programa **********************)
