def parse_reduze_file(reduze_file, families, args): list_package_args = [] coefficients = [] with open(reduze_file) as f: for line in f.readlines(): # Count spaces, indicates the type of line to be parsed spaces = sum(1 for _ in it.takewhile(lambda c: c == ' ', line)) line = line.strip() if spaces == 0: assert line.strip() == '' or line.strip() == ';' elif spaces == 2: #Get LHS integral name integral_pattern = re.compile(r"(\S*)\s*[0-9]*\s*[0-9]*\s*[0-9]*\s*[0-9]*\s*(.*)", re.IGNORECASE) integral_match = integral_pattern.findall(line) integral_name = integral_match[0][0]+ '_' + integral_match[0][1].replace(' ','_').replace('-','m') elif spaces == 3: assert line.strip() == '1' elif spaces == 4: # RHS integral list_package_args.append(parse_integral(line, families, args)) elif spaces == 5: # Coefficient coefficients.append(parse_coefficient(line, 'd', args)) assert len(list_package_args) == len(coefficients) # get real_parameters real_parameters=list_package_args[0].real_parameters for package_args in list_package_args: assert package_args.real_parameters == real_parameters sum_package(integral_name, list_package_args, ['eps'], [args['requested_order']],real_parameters=real_parameters,coefficients=[coefficients])
coefficients = [ [ # sum1 Coefficient(['2*s'], ['1'], ['s']), # easy1 Coefficient(['3*s'], ['1'], ['s']) # easy2 ], [ # sum2 Coefficient(['s'], ['2*eps'], ['s']), # easy1 Coefficient(['s*eps'], ['3'], ['s']) # easy2 ] ] integrals = [ MakePackage('easy1', integration_variables=['x', 'y'], polynomials_to_decompose=['(x+y)^(-2+eps)'], **common_args), MakePackage('easy2', integration_variables=['x', 'y'], polynomials_to_decompose=['(2*x+3*y)^(-1+eps)'], polynomial_names=['F'], contour_deformation_polynomial='F', **common_args) ] # generate code sum of (int * coeff) sum_package('easy_sum_complex', integrals, coefficients=coefficients, **common_args)
('p1*p2', 's/2-(m1sq+m2sq)/2'), ('p1*p3', 't/2-(m1sq+m3sq)/2'), ('p1*p4', 'u/2-(m1sq+m4sq)/2'), ('p2*p3', 'u/2-(m2sq+m3sq)/2'), ('p2*p4', 't/2-(m2sq+m4sq)/2'), ('p3*p4', 's/2-(m3sq+m4sq)/2'), ('u', '(m1sq+m2sq+m3sq+m4sq)-s-t'), # relations for our specific case: ('mt**2', 'mtsq'), ('m1sq',0), ('m2sq',0), ('m3sq','mHsq'), ('m4sq','mHsq'), ('mHsq', 0), ]) # find the regions generators_args = loop_regions( name = "box1L_ebr", loop_integral=li, smallness_parameter = "mtsq", expansion_by_regions_order=0) # write the code to sum up the regions sum_package("box1L_ebr", generators_args, li.regulators, requested_orders = [0,0], real_parameters = ['s','t','mtsq'], complex_parameters = [])
#!/usr/bin/env python3 import pySecDec as psd if __name__ == "__main__": # this object represents the Feynman graph li = psd.LoopIntegralFromGraph(internal_lines=[['m', [1, 2]], ['m', [2, 1]]], external_lines=[['p', 1], ['p', 2]], replacement_rules=[('p*p', 's'), ('m*m', 'msq')]) # find the regions and expand the integrals using expansion by regions regions_generator_args = psd.loop_regions(name='bubble1L_ebr_small_mass', loop_integral=li, smallness_parameter='msq', expansion_by_regions_order=2) # generate code that will calculate the sum of all regions and all orders in # the smallness parameter psd.sum_package('bubble1L_ebr_small_mass', regions_generator_args, regulators=['eps'], requested_orders=[0], real_parameters=['s', 'msq'], complex_parameters=[])
# Here we demonstrate the method where we expand in z*msq, # expand in z and then set z=1. from pySecDec import sum_package, loop_regions, LoopIntegralFromPropagators if __name__ == "__main__": # define the loop integral for the case where we expand in z li_z = LoopIntegralFromPropagators(propagators=("((k+p)**2)", "(k**2-msq_)"), loop_momenta=["k"], powerlist=[1, 2], regulators=['eps'], replacement_rules=[('p*p', 'psq'), ('msq_', 'z*msq')]) # find the regions and expand the integrals using expansion by regions regions_generator_args = loop_regions(name="bubble1L_dotted_z", loop_integral=li_z, smallness_parameter="z", expansion_by_regions_order=1) # generate code that will calculate the sum of all regions and the requested # orders in the smallness parameter sum_package("bubble1L_dotted_z", regions_generator_args, li_z.regulators, requested_orders=[0], real_parameters=['psq', 'msq', 'z'], complex_parameters=[])
3]], ['0', [2, 3]], ['m', [1, 2]]], external_lines=[['p1', 1], ['p2', 2], ['p3', 3]], replacement_rules=[ ('p1*p1', '0'), ('p2*p2', '0'), ('p3*p3', '-Qsq'), ('m**2', 't*Qsq'), ('Qsq', '1'), ]) # find the regions generators_args = psd.loop_regions( name='formfactor1L_massive_ebr', loop_integral=li, smallness_parameter='t', expansion_by_regions_order=0, decomposition_method='geometric', additional_prefactor=f"Qsq**({li.exponent_F})", add_monomial_regulator_power="n", ) # write the code to sum up the regions psd.sum_package('formfactor1L_massive_ebr', generators_args, li.regulators, requested_orders=[0, 0], real_parameters=['Qsq', 't'], complex_parameters=[])
powerlist=[1, 2], regulators=['eps'], replacement_rules=[('p*p', 'psq'), ('msq_', 'msq')]) # define the loop integeral for the case where we expand in z li_z = LoopIntegralFromPropagators(propagators=li_m.propagators, loop_momenta=li_m.loop_momenta, regulators=li_m.regulators, powerlist=li_m.powerlist, replacement_rules=[('p*p', 'psq'), ('msq_', 'msq*z')]) for name, real_parameters, smallness_parameter, li in ( ("bubble1L_dotted_z", ['psq', 'msq', 'z'], "z", li_z), ("bubble1L_dotted_m", ['psq', 'msq'], "msq", li_m)): # find the regions and expand the integrals using expansion by regions generators_args = loop_regions(name=name, loop_integral=li, smallness_parameter=smallness_parameter, expansion_by_regions_order=1) # generate code that will calculate the sum of all regions and all orders in # the smallness parameter sum_package(name, generators_args, li.regulators, requested_orders=[0], real_parameters=real_parameters, complex_parameters=[])
# example is 2-loop bubble with five propagators, two of them massive if __name__ == "__main__": # define Feynman Integral li = psd.LoopIntegralFromPropagators(propagators=[ 'k1**2-msq_', '(k1+k2)**2-msq_', '(k1+p1)**2', 'k2**2', '(k1+k2+p1)**2' ], loop_momenta=['k1', 'k2'], external_momenta=['p1'], replacement_rules=[('p1*p1', 'psq'), ('msq_', 'msq')]) # find the regions and expand the integrals using expansion by regions regions_generator_args = psd.loop_regions( name='bubble2L_smallm', loop_integral=li, smallness_parameter='msq', expansion_by_regions_order=1 ) # this has to be 1 to catch the ultra-soft region # generate code that will calculate the sum of all regions and all orders in # the smallness parameter psd.sum_package('bubble2L_smallm', regions_generator_args, regulators=['eps'], requested_orders=[0], real_parameters=['psq', 'msq'], complex_parameters=[])