FormTracer Minimal Example

Loading/Installing the FormTracer Package

Load or install FormTracer and FORM if they are not installed already:

formTracerInstalled=Quiet[Needs["FormTracer`"]];

If[formTracerInstalled===$Failed,
Import["https://raw.githubusercontent.com/FormTracer/FormTracer/master/src/FormTracerInstaller.m"]
]

Tracing

Space-Time

Define syntax for space-time

DefineLorentzTensors[δ[μ,ν](*Kronecker delta*),vec[p,μ](*vector*),p.q(*inner product*)];

Take traces:

FormTrace[vec[p+2r,μ]δ[μ,ν]vec[s,ν]]
FormTrace[δ[α,ν](δ[ν,ρ]+δ[ν,ρ]δ[σ,σ])δ[ρ,α]]
FormTrace[δ[1,ν]vec[s,ν]]

Variables/Constants

DefineExtraVars[a];
FormTrace[a vec[p+2r,μ]δ[μ,ν]vec[s,ν]]

AddExtraVars[Λ];
FormTrace[a vec[p+2r,μ]δ[μ,ν]vec[s,ν]+Λ]

Dirac-Matrices

Define syntax for space-time and Spinor space

DefineLorentzTensors[δ[μ,ν](*Kronecker delta*),vec[p,μ](*vector*),p.q(*inner product*),ϵ[](*Levi-Civita symbol*),δS[i,j](*Kronecker delta in spinor space*),γ[μ,i,j](*Gamma matrices*),γ5[i,j](*fifth gamma matrix*)];

FormTrace[γ[μ,i,j]γ5[j,k]γ[μ,k,l]γ5[l,i]]
FormTrace[γ[4,i,j]γ5[j,k]γ[4,k,l]γ5[l,i]]
FormTrace[γ[2,i,j]γ5[j,k]γ[4,k,l]γ5[l,i]]
FormTrace[vec[p,μ]γ[μ,i,j]vec[q,ν]γ[ν,j,i]]

Gauge and Flavor Symmetries

Define syntax for (gauge) group space

DefineGroupTensors[{
{SUNfund(*group type*),{color(*name of group*),Nc(*dimension of representation*)
(*(*more options for groups of type GenericGroup: *),cR(*quadratic casimir operator of representation*),NA(*dimension of adjoint representation*),cA(*quadratic casimir operator of adjoint representation*),I2R(*second order index of representation (normalisation)*)*)},
δA[a,b](*Kronecker delta in adjoint space*),f[a,b,c](*structure constants*),δF[i,j](*Kronecker delta in representation space*),T[a,i,j](*generators of representation*)}
}]

ShowGroupConstants[]

FormTrace[f[a,b,c]f[a,c,b]]
FormTrace[T[a,b,c]T[a,c,b]]
FormTrace[T[5,b,c]T[5,c,b]]
FormTrace[T[1,b,c]T[4,c,b]]

How to proceed

You can either have a look the more detailed FormTracerShowcase:

NotebookOpen[FileNameJoin[{$UserBaseDirectory,"Applications","FormTracer","Examples","FormTracerShowcase.nb"}]];

Alternatively, look into the FormTracer documentation in Mathematica’s documentation center. Select one of the following commands and press F1:

FormTrace - for general examples
DefineLorentzTensors - for Lorentz and Dirac tracing
DefineGroupTensors - for group traces
DefineExtraVars/AddExtraVars - for additional variables.

We recommend to have a look at the “See Also” sections in the help pages.