Search code examples
wolfram-mathematicaindices

Dummy indices and constraints in Mathematica


I would like that Mathematica simplifies an expression according to some constraints. For example:

M = p.k p.k

given the constraint:

p(mu) * p(nu) = \delta(mu,nu)

should give

M = k^2

But I don't know how to specify dummy indices, and I am also not quite sure where I should place the constraint itself. In an argument of Simplify?


Solution

  • In[1]:= FilePrint["dummyindices.m"]
    <<HighEnergyPhysics`FeynCalc`
    Print[" "];
    {$AL[1], $AL[2]} = {mu, nu};  (* $AL are predefined dummy indices *)
    M = SP[p,k] * SP[p,k];        (* this defines p.k * p.k *)
    SP[k, k] = k2;                (* abbreviate the scalar product k^2 by k2 *)
    constraint = FeynCalcInternal[ 
                   FourVector[p,mu] FourVector[p,nu] -> MetricTensor[mu, nu] 
    ];       (* this is one way of specifying the constraint *)
    (* use the Uncontract function http://www.feyncalc.org/FeynCalcBook/Uncontract/*)
    Print["uncontracting : ", FCF[ tmp = Uncontract[M, k, Pair->All, Unique->False]]];
    Print["contract and using the constraint : ",
           FeynCalcExternal @ Contract[tmp /. constraint]
    ]
    
    In[2]:= <<dummyindices.m
    Loading FeynCalc from /home/rolfm/HighEnergyPhysics
    FeynCalc 8.1.0 Type ?FeynCalc for help or visit http://www.feyncalc.org/
    $PrePrint is set to FeynCalcForm. Use FI and FC to change the display format.
    Loading FeynArts, see www.feynarts.de for documentation
    FeynArts 3.4 patched for use with FeynCalc
    
    uncontracting :  k[mu] k[nu] p[mu] p[nu]
    contract and using the constraint : k2