ColorMath—a package for color summed calculations in SU(N _{ c })
Authors
Open AccessArticle
 First Online:
 Received:
 Revised:
DOI: 10.1140/epjc/s1005201323104
Abstract
A Mathematica package for color summed calculations in QCD (SU(N _{ c })) is presented. Color contractions of any color amplitude appearing in QCD may be performed, and the package uses a syntax which is very similar to how color structure is written on paper. It also supports the definition of color vectors and bases, and special functions such as scalar products are defined for such color tensors.
1 Introduction
With the LHC follows an increased demand of exact calculations in QCD involving many color charged partons. Due to the nonabelian nature of QCD this poses a nontrivial computational problem.
This is the issue the Mathematica^{®} package ColorMath is set out to tackle. The main feature of ColorMath is thus the ability to automatically perform color summed calculations starting from a QCD color structure which is expressed using a syntax very similar to how the color structure would have been written on paper.
Each squared amplitude can in principle can be calculated like this. However, ColorMath also facilitates the usage of color vectors and bases and has special functions for the calculations of scalar products and gluon exchanges.
This paper, which is intended to be the main reference, is organized as follows: First a general introduction to the basic color building blocks is given in Sect. 2. In Sect. 3 the computational strategy is presented, whereas basic examples are given in Sect. 4, and the usage of vectors and their functions are presented in Sect. 5. In Sect. 6 some remarks concerning validation and scalability are made and in Sect. 7 conclusions are drawn.
2 QCD building blocks
Due to confinement, we never observe individual colors and it therefore suffices to calculate color summed/averaged quantities for making predictions in quantum chromodynamics. We may thus constrain ourselves to treat QCD amplitudes carrying a set of external indices with values that need never be specified, as they are always summed over in the end.
Along with the number of colors, Nc, and the trace of an SU(N _{ c }) generator squared, TR, the basic building blocks are as below. Note that o ^{{g1,g2,…,gk}} represents a trace over gluons with indices g1…gk, \(\operatorname {tr} [t^{g1}t^{g2}\cdots t^{gk}]\), and that t ^{{g1,g2,…,gk}q1} _{ q2} represent the q1,q2component in a trace over generators that has been cut open, (t ^{ g1} t ^{ g2}⋯t ^{ gk })^{ q1} _{ q2}. For convenience, also the totally symmetric “structure constants” d ^{{g1,g2,g3}} are defined. Note the Mathematica FullForm. ColorMath is built on pattern matching, and it is therefore essential that the expressions have the correct FullForm. In particular, Power may not be used instead of Superscript. To get the right FullForm it is recommended to use the function form, which is just a function returning the corresponding ColorMath object
Pictorial representation 
ColorMath 
Function form 
Mathematica FullForm 


δ ^{ q1} _{ q2} 
δ[q1, q2] 
Subscript[Superscript[∖[Delta], q1], q2] 

Δ ^{{g1,g2}} 
Δ[g1, g2] 
Superscript[∖[CapitalDelta], List[g1, g2]] 

f ^{{g1,g2,g3}} 
f[g1, g2, g3] 
Superscript[f, List[g1, g2, g3]] 

d ^{{g1,g2,g3}} 
d[g1, g2, g3] 
Superscript[d ,List[g1, g2, g3]] 

t ^{{g1,…,gk}q1} _{ q2} 
t[{g1,…, gk}, q1, q2] 
Subscript [Superscript[Superscript[t, List[g1,…, gk]], q1], q2] 

o ^{{g1,…,gk}} 
o[{g1,…, gk}] 
Superscript[o, List[g1, …, gk]] 
In this context we also remark that the color tensors defined in Table 1 are color scalars, i.e., they are invariant under SU(N _{ c }) transformations. This imposes no restriction for our purposes as, for any QCD amplitude, the overall color structure, including both incoming and outgoing particles, always is a color singlet. As the basic building blocks are invariant, each tensor built out of these objects, i.e., each tensor needed for color summed calculations in perturbative QCD is a actually a color scalar.
3 Basic computational strategy
Having defined all the color carrying objects, we turn to describing the basic strategy for carrying out calculations.
 (i)
Rewrite the triple gluon vertices using Eq. (8). This results in a color structure which is a sum of products of open and closed quarklines, connected to each other via repeated gluon indices.
 (ii)Contract all internal gluon indices using the Fierz or completeness relation(13)
 (iii)If present, remove Kronecker deltas (for quarks and gluons), and internal quark indices using(14)
 (iv)Use the tracelessness of the SU(N _{ c }) generators, and contract quark and gluon delta functions with repeated indices(15)
By applying these rules, any amplitude square and any interference term appearing in QCD can be calculated [6, 11]. To successfully square an arbitrary QCD amplitude using the above set of rules we see that steps (i)–(ii) have to be performed while keeping the relative order, i.e., by first applying rule (i) and then rule (ii). We also note that these rules increase the number of terms, whereas the rules (iii)–(iv) decrease the number of terms or keep it fixed. In order not to unnecessarily inflate an expression it may therefore be useful to apply the latter rules at any time during the computation. ColorMath utilizes this and tries to contract indices using (iii)–(iv) at any time, while rules (i)–(ii) are used only when needed, i.e., when the nonexpanding rules fail.
 (v)Two neighboring gluons attached to the same (closed or open) quarkline are contracted. In this case the result is simply \(c_{F} = T_{R} ( N_{c} ^{2}1)/ N_{c} \) times the color structure where the two involved gluons have been contracted,(16)
 (vi)Similarly, it is easy to show, using the Fierz identity, Eq. (13), that the contraction of two next to neighboring gluons results in only one term(17)
4 Basic calculations
The color contractions corresponding to the basic manipulations from Sect. 3 are carried out using Mathematica Rules, i.e., a set of replacement rules based on pattern matching. As always, the rules may be applied using “Expr/.TheRules”, and may be applied repeatedly using “Expr//.TheRules”.
The rules defined in (v)–(vi), acting on t and o, are similarly contained in OTSimpleRules, and the union of SimpleRules and OTSimpleRules and a few rules for rewriting closed quarklines with zero to two gluons, are contained in AllSimpleRules.
The special rules for gluon index contraction in structure constants, exemplified in Eqs. (18)–(19) are defined in FDRules. The complete set of rules are stated in Table 2.
Rather than thinking about how individual rules have to be applied, it is convenient to have a standard procedure for contracting color indices. This is embodied in the function CSimplify, which does what its name suggests; simplifies the color structure as far as possible. For color structures which do not contain structure constants this always implies contracting all repeated indices.
For color structure involving the structure constants CSimplify first attempts simplification using the FDRules. If, after this, the expression still contains structure constants, the structure constants are by default rewritten in terms of traces using Eq. (9), and the indices are fully contracted, resulting in a sum of products of open and closed quarklines. Sometimes it may, however, be desirable not to rewrite the structure constants, as expressions may be more compact if they are kept. This can be achieved by using the option RemoveFD→False.
The most useful set of functions are given in Table 3. Apart from CSimplify we especially note the function ReplaceDummyIndices for replacing all repeated indices in a color structure with a new unique set of color indices.
Sometimes more detailed control over the calculation may be desired. For this purpose, and for internal usage, functions manipulating indices and probing the color structure are given in Table 4, in the Appendix.
While each squared amplitude in principle can be calculated as outlined above, ColorMath also offers more efficient tools for dealing with vectors in color space.
5 Defining and using vectors
For the purpose of studying color space it is often convenient to define a basis for the color space, and sometimes also projection operators. Both of these are examples of color (singlet) tensors, and ColorMath has a set of tools for working directly with such tensors.
From a Mathematica perspective we note a few things. First, on the left hand side, we see that the indices inside the List in the Subscript are followed by underscore to indicate pattern matching. This is standard in Mathematica and makes it possible to use any symbol to denote the indices in later calculations. Then we note that the last two tensors in Eq. (25) are defined using Module. This is to ensure that each time the tensor is used, it comes with a fresh set of dummy indices. This is also the reason why set delayed “:=” is used.
6 Validation and scalability
The computational rules and functions in this package have been used for calculating the three gluon projection operators presented in [15]. This imposes highly nontrivial consistency checks, as it is verified that every projector square equals itself, which at intermediate steps often involve several ten thousand terms. Additional consistency checks on the color contraction rules have been made by using the CGamma function which checks that vectors square and basis decomposed vectors square agree, and by changing the order in which the color structure contraction rules are applied. The scalar product matrices have also been compared to the ColorFull code [16] for tree level trace bases with up to six partons out of which one parton is a quark and one an antiquark. Selected results have been compared against [13], and the package has been tested both in Mathematica 7, 8 and 9.
The computational effort needed for exact treatment of the color space grows very quickly with the number of partons. The dimension of the vector space grows roughly as a factorial in the number of gluons plus \(q\overline{q} \)pairs [15] (strictly speaking an exponential for finite N _{ c } in a multiplet basis). The computational effort for ColorMath, or any program operating by direct manipulation of quarklines, tend to grow roughly as the square of this, as the quarklines are nonorthogonal. ColorMath (in its current form) is thus rather intended to be an easy to use package for calculations of low and intermediate complexity than a competitive tool for processes with very many colored partons.
7 Conclusion
In this paper a Mathematica package ColorMath for performing color summed calculations in QCD is presented. This package allows for simple evaluation of QCD color amplitudes which are expressed in a format which very much resembles how the color structure would have been written on paper, see Table 1. The idea is that the user—for simple cases—just should give the expression, and then run CSimplify[Expr] rather than Simplify[Expr]. The package is based on advanced pattern matching rules, and a list of rules is given in Table 2, whereas functions acting on color structures are given in Table 3.
For calculations of intermediate or high complexity it is often beneficial to use a basis for performing color space calculations. ColorMath allows for definition of color tensors of form C1 _{{i1_,i2_,…,ik_}}:=…, carrying an arbitrary set of quark, antiquark and gluon indices. Special functions for calculating scalar products, and investigating the effect of gluon exchange, are given in Table 5. ColorMath is, however, not intended for high speed calculations involving many colored partons. For this purpose a separate C++ package is written [16].
To enhance the similarity with usage inside Mathematica, we here use the somewhat unorthodox notation q1 etc. for single quark and gluon indices.
In this user guide indices representing incoming quarks and outgoing antiquarks are placed upstairs, whereas outgoing quarks and incoming antiquarks are placed downstairs. Note, however, that we could as well have used the opposite convention.
Acknowledgements
Terrance Figy, Johan Grönqvist, Simon Plätzer, Stefan Prestel, Johan Rathsman and Konrad Tywoniuk are thanked for useful comments on the ColorMath code and/or paper. This work was supported by a Marie Curie Experienced Researcher fellowship of the MCnet Research Training network, contract MRTNCT2006035606, by the Helmholtz Alliance “Physics at the Terascale” and by the Swedish Research Council, contract number 62120103326.
Open Access
This article is distributed under the terms of the Creative Commons Attribution License which permits any use, distribution, and reproduction in any medium, provided the original author(s) and the source are credited.
Appendix: Rules and functions
In this appendix rules and functions for index and color structure probing are stated. First the basic rules for manipulations are stated in Table 2, then the most important functions, operating directly on the basic color objects from Table 1 are listed in Table 3, whereas special functions for indices and color structure probing are stated in Table 4, and the functions dealing with color vector objects are stated in Table 5.
The complete set of rules used by ColorMath to contract indices. These rules are applied as always in Mathematica, by using “Expr/.TheRules”. To ensure that all indices which can be contracted by the rules actually are contracted, apply the rules repeatedly,“Expr//.TheRules”. Note that all rules have names ending with Rules
Rule 
Effect 

AllSimpleRules 
AllSimpleRules is the set of all rules involving Δ ^{{g1,g2}}, δ ^{ q1} _{ q2}, o ^{{g1,…,gk}} and t ^{{g1,…,gk}q1} _{ q2} which do not increase the number of terms, i.e., the union of SimpleRules and OTSimpleRules 
ExpandThenRules 
The rules ExpandThenRules first uses Expand, then applies OTThenAllSimpleRules and finally restores default index order with the SortIndices function 
FDRules 
Rules for gluon contraction for terms involving up to three structure constants, f ^{{g1,g2,g3}} or d ^{{g1,g2,g3}}, i.e., expressions of form Eqs. (18) and (19). The terms resulting after contraction are expressed in terms of structure constants and gluon deltas, Δ ^{{g1,g2}} 
FDToORules 
Rules for replacing structure constants, f ^{{g1,g2,g3}} and d ^{{g1,g2,g3}}, with sums of closed quarklines o ^{{g1,g2,g3}} using the intermediate expression in Eq. (9) 
FDToTRules 
Replaces structure constants, f ^{{g1,g2,g3}} and d ^{{g1,g2,g3}}, with a sum of products of SU(N _{ c }) generators t ^{{g1}q1} _{ q2} using the last form in Eq. (9) 
OTGluonRules 
Rules for contracting repeated gluon indices in o ^{{g1,…,gk}} and t ^{{g1,…,gk}q1} _{ q2}. The Fierz identity, Eq. (13), is included in these rules 
OTSimpleRules 
Rules for contracting neighboring and next to neighboring gluons in closed and open quarklines, o ^{{g1,…,gk}} and t ^{{g1,…,gk}q1} _{ q2}, Eqs. (16) and (17) 
OTThenAllSimpleRules 
The rules OTThenAllSimpleRules first applies OTGluonRules and then repeatedly AllSimpleRules 
OTToTRules 
Rules for replacing open and closed quarklines, o ^{{g1,…,gk}} and t ^{{g1,…,gk}q1} _{ q2}, with products of SU(N _{ c }) generators t ^{{g1}q1} _{ q2} 
Remove0ORules 
Rule for simplifying closed quarklines with 0 gluons, o ^{{}}=Nc 
Remove0To1ORules 
Rules for simplifying closed quarklines with 0 or 1 gluons, o ^{{}}=Nc, o ^{{g1}}=0 
Remove0To2ORules 
Rules for simplifying closed quarklines with 0 to 2 gluons, o ^{{}}=Nc, o ^{{g1}}=0 and o ^{{g1,g2}}=TR Δ ^{{g1,g2}} 
SimpleRules 
Basic rules for quark and gluon contraction. These rules involve Δ ^{{g1,g2}}, δ ^{ q1} _{ q2} or quark contraction, and never increase the number of terms. These rules thus contain the rules in (iii)–(iv) as well as in Eq. (6) 
The most useful functions, to be used on any expression carrying color structure of the form given in Table 1. Recall to relabel dummy indices, manually, or by using ReplaceDummyIndices, and to place quark indices that are to be contracted such that one index sits upstairs and one downstairs. Furthermore, check that the correct FullForm is used, cf. Table 1. The function WhatIsWrong may be useful for identifying common input mistakes in the basic color objects
Function with usage 
Effect 

CSimplify [Expr] Options with default value: RemoveFD→True 
The most general function for simplifying color structure. If Expr contains structure constants, f ^{{g1,g2,g3}} or d ^{{g1,g2,g3}}, FDRules are first applied. If, after this, the expression still contains structure constants they are—by default—removed using FDToORules, and all repeated indices are subsequently contracted by repeatedly using AllSimpleRules, then OTThenAllSimpleRules, and finally ExpandThenRules. For color structure containing structure constants, it could happen that it is desired not to replace the structure constants. This can be achieved by setting the option RemoveFD → False 
GluonContract[Expr, Gs] 
Contracts a set (List) of gluons Gs={g1,…,gn} or a single gluon Gs=g1, in the expression Expr, while leaving other indices uncontracted. This function is intended for quarklines and will replace structure constants with quarklines 
ReplaceDummyIndices[Expr] 
Replaces the dummy indices in Expr with a new set of unique dummy indices 
SortIndices[Expr] 
Sorts the gluon indices appearing in Δ ^{{g1,g2}}, f ^{{g1,g2,g3}} or d ^{{g1,g2,g3}} and o ^{{g1,…,gk}} such that they stand in Mathematica default order. This is needed to ensure that one color structure only is represented in one form 
SplitConstAndColor[Expr] 
Splits an expression Expr into a List of Lists of color structures and corresponding multiplicative factors {{constants 1, color structure 1},{constants 2, color structure 2},…}. This is done by first expanding the expression and then splitting the terms separately 
WhatIsWrong[Expr] 
Checks if anything is obviously wrong with an expression, for example if Power is used instead of Superscript or if gluon indices are placed downstairs. The check is performed by first expanding the expression, and then checking each term. Read error messages from above 
The below set of functions are used for probing the color structure, and identifying indices. Concerning the convention of what (lower or upper) quarkindices are referred to as incoming quarks and outgoing antiquarks, as opposed to incoming antiquarks and outgoing quarks, ColorMath does not specify any preference, but simply refers to the indices as upper quarks and lower quarks when needed
Function 
Effect 

AllIndices[Expr] 
Returns a List of all (external and dummy) indices in Expr 
ContainsColor[Expr] 
Returns True if the expression Expr contains any color structure, i.e., any of the terms in Table 1, and False otherwise 
ContainsFD[Expr] 
Returns True if the expression Expr contains structure constants and False otherwise 
ContainsGluonDelta[Expr] 
Returns True if the expression Expr contains a gluon deltafunction, Δ ^{{g1,g2}}, and False otherwise 
ContainsO[Expr] 
Returns True if the expression Expr contains closed quarklines, o ^{{g1,…,gk}}, and False otherwise 
ContainsQuarkDelta[Expr] 
Returns True if the expression Expr contains a quark deltafunction, δ ^{ q1} _{ q2}, and False otherwise 
ContainsT[Expr] 
Returns True if the expression Expr contains open quarklines, t ^{{g1,…,gk}q1} _{ q2}, and False otherwise 
DummyIndices[Expr] 
Finds the dummy indices in an expression Expr, by first expanding it and then finding all dummy indices in all terms 
GluonIndices[Expr] 
Returns a List of all gluon indices (external and dummy) in the expression Expr 
LowerQuarkIndices[Expr] 
Returns a List of all (external and dummy) quarktype indices placed downstairs, i.e., q2 in t ^{{g1,…,gk}q1} _{ q2} and δ ^{ q1} _{ q2} 
UpperQuarkIndices[Expr] 
Returns a List of all (external and dummy) quarktype indices placed upstairs, i.e., q1 in t ^{{g1,…,gk}q1} _{ q2} and δ ^{ q1} _{ q2} 
Special functions for color structures expressed in the form of Eq. (25), i.e., the corresponding tensors need to be defined using the pattern matching underscores, potential dummy indices should be hidden inside Modules, and the evaluation should be delayed for expressions containing dummy indices, i.e. “:=” should be used. The vector indices should sit inside a List in the Subscript. Additional options may be supplied to these functions to control for example the verbosity. Thus, CNorm may for example be called using CDot[{C1,…,Cn},Verbose→True], to get progress information or simply as CDot[{C1,…,Cn}] to use the default options
Vector function with usage 
Effect 

CDot[C1, C2, Options] Options with default value: NcMin→3 
Calculates the scalar product between two color tensors C1 and C2. Before using CDot the color tensors C1 _{{i1_,i2_,…,ik_}} and C2 _{{i1_,i2_,…,ik_}} should have been defined. For simplifications (in particular of roots) it is by default assumed that Nc is at least 3. However, this may be manually changed by setting the option NcMin, for example CDot[C1, C2, NcMin → 100] 
CDot[{C1,…,Cn}, Options] Options with default value: NcMin → 3 Verbose → False 
Similar to CDot[C1, C2] but calculates the scalar product of a set of color tensors and themselves and returns the result as a List where the ith element is CDot[Ci, Ci]. In addition to assuming a minimal value of Nc for simplifications, it is also possible to get progress information by setting the option Verbose to True 
CDotMatrix[{C1,…,Cn}, Options] Options with default value: NcMin → 3 Verbose → False 
Calculates the scalar product matrix given a List of color vectors, i.e., element ij is CDot[Ci, Cj]. If the list contains a basis, this function thus returns the scalar product matrix 
CNorm[C1, Options] Options with default value: NcMin → 3 
Calculates the norm of a color tensors using CDot. For simplifying the result, it may be useful to set the option NcMin to a large value 
CNorm[{C1,…,Cn} , Options] Options with default value: NcMin → 3 Verbose → False 
Similar to CNorm above, but calculates the norms of a List of color vectors {C1,…,Cn}, and returns a List containing the norms. Progress information is available by supplying the option Verbose→ True 
CGamma[{C1,…,Cn}, p1, p2, Options] Options with default value: NcMin → 3 Verbose → True MakeChecks → True BasisType → GeneralBasis 
Describes the effect of gluon exchange between partons p1 and p2, on basis vector Cj as a column vector j in a resulting matrix (technically List of List), i.e., element ij is the resulting color structure’s ith component. The BasisType option should assume one of the values GeneralBasis, OrthogonalBasis, OrthonormalBasis or TraceBasis. The latter is defined to be any basis where the basis vectors consist of one product of closed and open quarklines, not a sum. By default it is checked that the color tensor, resulting after gluon exchange, is the same when squared directly, as when basis decomposed, and then squared. This checks that the basis is complete and that the basis decomposition is correct. For orthonormal bases, it is also checked that the resulting matrix is symmetric. Using MakeChecks → False these checks are turned off. By default, progress information is also written out, which can be changed with Verbose → False 