def test_K6_objects(self): """Test K6 product simplifications""" #K6(m,i,j)K6Bar(m,k,l) = 1/2(T(l,i)T(k,j) # + T(k,i)T(l,j) my_K6 = color.K6(1,101,102) my_K6Bar = color.K6Bar(1,103,104) col_str1 = color.ColorString([color.T(104,101), color.T(103,102)]) col_str2 = color.ColorString([color.T(103,101), color.T(104,102)]) col_str1.coeff = fractions.Fraction(1, 2) col_str2.coeff = fractions.Fraction(1, 2) self.assertEqual(my_K6.pair_simplify(my_K6Bar), color.ColorFactor([col_str1, col_str2])) #K6(m,i,j)K6Bar(n,j,i) = delta6(m,n) my_K6 = color.K6(1,101,102) my_K6Bar = color.K6Bar(2,102,101) self.assertEqual(my_K6.pair_simplify(my_K6Bar), color.ColorFactor([\ color.ColorString([color.T6(1,2)])])) #K6(m,i,j)K6Bar(n,i,j) = delta6(m,n). my_K6 = color.K6(1,101,102) my_K6Bar = color.K6Bar(2,101,102) self.assertEqual(my_K6.pair_simplify(my_K6Bar), color.ColorFactor([\ color.ColorString([color.T6(1,2)])]))
def test_delta3_pair_simplify(self): """Test delta3 simplify""" self.assertEqual(color.K6(1,101,103).pair_simplify(color.T(101,102)), color.ColorFactor([color.ColorString([color.K6(1,103,102)])])) self.assertEqual(color.K6(1,103,102).pair_simplify(color.T(102,101)), color.ColorFactor([color.ColorString([color.K6(1,103,101)])])) self.assertEqual(color.K6Bar(1,101,103).pair_simplify(color.T(102,101)), color.ColorFactor([color.ColorString([color.K6Bar(1,103,102)])])) self.assertEqual(color.K6Bar(1,103,101).pair_simplify(color.T(102,101)), color.ColorFactor([color.ColorString([color.K6Bar(1,103,102)])]))
def get_color_flow_string(my_color_string, octet_indices): """Return the color_flow_string (i.e., composed only of T's with 2 indices) associated to my_color_string. Take a list of the external leg color octet state indices as an input. Returns only the leading N contribution!""" # Create a new color factor to allow for simplification my_cf = color_algebra.ColorFactor([my_color_string]) # Add one T per external octet for indices in octet_indices: if indices[0] == -6: # Add a K6 which contracts the antisextet index to a # pair of antitriplets my_cf[0].append( color_algebra.K6(indices[1], indices[2], indices[3])) if indices[0] == 6: # Add a K6Bar which contracts the sextet index to a # pair of triplets my_cf[0].append( color_algebra.K6Bar(indices[1], indices[2], indices[3])) if abs(indices[0]) == 8: # Add a T which contracts the octet to a # triplet-antitriplet pair my_cf[0].append( color_algebra.T(indices[1], indices[2], indices[3])) # Simplify the whole thing my_cf = my_cf.full_simplify() # If the result is empty, just return if not my_cf: return my_cf # Return the string with the highest N coefficient # (leading N decomposition), and the value of this coeff max_coeff = max([cs.Nc_power for cs in my_cf]) res_cs = [cs for cs in my_cf if cs.Nc_power == max_coeff] # If more than one string at leading N... if len(res_cs) > 1 and any([not cs.near_equivalent(res_cs[0]) \ for cs in res_cs]): raise ColorBasis.ColorBasisError, \ "More than one color string with leading N coeff: %s" % str(res_cs) res_cs = res_cs[0] # If the result string does not contain only T's with two indices # and Epsilon/EpsilonBar objects for col_obj in res_cs: if not isinstance(col_obj, color_algebra.T) and \ not col_obj.__class__.__name__.startswith('Epsilon'): raise ColorBasis.ColorBasisError, \ "Color flow decomposition %s contains non T/Epsilon elements" % \ str(res_cs) if isinstance(col_obj, color_algebra.T) and len(col_obj) != 2: raise ColorBasis.ColorBasisError, \ "Color flow decomposition %s contains T's w/o 2 indices" % \ str(res_cs) return res_cs
def test_color_flow_string_epsilon(self): """Test the color flow decomposition of strings including Epsilon and color sextets""" # g q > trip q my_cs = color.ColorString( [color.Epsilon(-1000, 2, 3), color.T(1, 4, -1000)]) goal_cs = color.ColorString( [color.T(4, 2001), color.Epsilon(1001, 2, 3)]) goal_cs.coeff = fractions.Fraction(1, 2) self.assertEqual( color_amp.ColorBasis.get_color_flow_string(my_cs, [(8, 1, 1001, 2001)]), goal_cs) # g q > six q~ my_cs = color.ColorString( [color.K6(3, -1000, 4), color.T(1, -1000, 2)]) goal_cs = color.ColorString( [color.T(1001, 2), color.T(1003, 4), color.T(3003, 2001)]) goal_cs.coeff = fractions.Fraction(1, 4) self.assertEqual( color_amp.ColorBasis.get_color_flow_string(my_cs, [(8, 1, 1001, 2001), (6, 3, 1003, 3003)]), goal_cs) # g q~ > trip > q~ q q~ my_cs = color.ColorString([ color.Epsilon(-1000, 2, 4), color.EpsilonBar(-1001, 3, 5), color.T(1, -1001, -1000) ]) goal_cs = color.ColorString( [color.Epsilon(1001, 2, 4), color.EpsilonBar(2001, 3, 5)]) goal_cs.coeff = fractions.Fraction(1, 2) self.assertEqual( color_amp.ColorBasis.get_color_flow_string(my_cs, [(8, 1, 1001, 2001)]), goal_cs)
def test_T6_simplify(self): """Test T6 simplify""" # T6(a,i,j) = 2(K6(i,ii,jj)T(a,jj,kk)K6Bar(j,kk,ii)) my_T6 = color.T6(1,101,102) color.T6.new_index = 10000 k6 = color.K6(101, 10000, 10001) t = color.T(1, 10001, 10002) k6b = color.K6Bar(102, 10002, 10000) col_string = color.ColorString([k6, t, k6b]) col_string.coeff = fractions.Fraction(2, 1) self.assertEqual(my_T6.simplify(), color.ColorFactor([col_string])) my_T6 = color.T6(1,101,102) k6 = color.K6(101, 10003, 10004) t = color.T(1, 10004, 10005) k6b = color.K6Bar(102, 10005, 10003) col_string = color.ColorString([k6, t, k6b]) col_string.coeff = fractions.Fraction(2, 1) self.assertEqual(my_T6.simplify(), color.ColorFactor([col_string]))
def test_sextet_products(self): """Test non trivial product of sextet operators""" # T6[2, 101, 102] T6[2, 102, 103] = (-1 + Nc) (2 + Nc) delta6[101, 103])/Nc my_color_factor = color.ColorFactor([\ color.ColorString([color.T6(2, 101, 102), color.T6(2, 102, 103)])]) col_str1 = color.ColorString([color.T6(101,103)]) col_str1.Nc_power = 1 col_str2 = copy.copy(col_str1) col_str2.Nc_power = 0 col_str3 = copy.copy(col_str1) col_str3.Nc_power = -1 col_str3.coeff = fractions.Fraction(-2, 1) self.assertEqual(my_color_factor.full_simplify(), color.ColorFactor([col_str1, col_str2, col_str3])) # T6[2, 101, 102] T6[3, 102, 101] = 1/2 (2 + Nc) delta8[2, 3] my_color_factor = color.ColorFactor([\ color.ColorString([color.T6(2, 101, 102), color.T6(3, 102, 101)])]) col_str1 = color.ColorString([color.Tr(2,3)]) col_str1.Nc_power = 1 col_str1.coeff = fractions.Fraction(1) col_str2 = copy.copy(col_str1) col_str2.Nc_power = 0 col_str2.coeff = fractions.Fraction(2) self.assertEqual(my_color_factor.full_simplify(), color.ColorFactor([col_str1, col_str2])) # K6[1, 101, 102] T[2, 102, 103] T[2, 103, 104] K6Bar[1, 104, 101] # = 1/4 (-1 + Nc) (1 + Nc)^2 # = 1/4 (-1 - Nc + Nc^2 + Nc^3) my_color_factor = color.ColorFactor([\ color.ColorString([color.K6(1, 101, 102), color.T(2, 102, 103), color.T(2, 103, 104), color.K6Bar(1, 104, 101)])]) col_str1 = color.ColorString() col_str1.Nc_power = 3 col_str1.coeff = fractions.Fraction(1, 4) col_str2 = color.ColorString() col_str2.Nc_power = 2 col_str2.coeff = fractions.Fraction(1, 4) col_str3 = color.ColorString() col_str3.Nc_power = 1 col_str3.coeff = fractions.Fraction(-1, 4) col_str4 = color.ColorString() col_str4.Nc_power = 0 col_str4.coeff = fractions.Fraction(-1, 4) self.assertEqual(my_color_factor.full_simplify(), color.ColorFactor([col_str1, col_str3, col_str2, col_str4])) # T6[2, 101, 102] T6[2, 102, 103] K6[103, 99, 98] K6Bar[101, 98, 99] # = 1/2 (-1 + Nc) (1 + Nc) (2 + Nc) # = 1/2 (Nc^3 + 2 Nc^2 - Nc - 2) my_color_factor = color.ColorFactor([\ color.ColorString([color.T6(2, 101, 102), color.T6(2, 102, 103), color.K6(103,99, 98), color.K6Bar(101, 98, 99)])]) col_str1 = color.ColorString() col_str1.Nc_power = 3 col_str1.coeff = fractions.Fraction(1, 2) col_str2 = color.ColorString() col_str2.Nc_power = 2 col_str2.coeff = fractions.Fraction(1, 1) col_str3 = color.ColorString() col_str3.Nc_power = 1 col_str3.coeff = fractions.Fraction(-1, 2) col_str4 = color.ColorString() col_str4.Nc_power = 0 col_str4.coeff = fractions.Fraction(-1, 1) self.assertEqual(my_color_factor.full_simplify(), color.ColorFactor([col_str2, col_str1, col_str3, col_str4])) # K6[103, 99, 98] T[80, 98, 100] K6Bar[103, 100, 97] T[80, 99, 97] # = -(1/4) + Nc^2/4 my_color_factor = color.ColorFactor([\ color.ColorString([color.K6(103, 99, 98), color.T(80, 98, 100), color.K6Bar(103, 100, 97), color.T(80, 99, 97)])]) col_str1 = color.ColorString() col_str1.Nc_power = 2 col_str1.coeff = fractions.Fraction(1, 4) col_str2 = color.ColorString() col_str2.Nc_power = 0 col_str2.coeff = fractions.Fraction(-1, 4) self.assertEqual(my_color_factor.full_simplify(), color.ColorFactor([col_str1, col_str2]))