Esempio n. 1
0
    def setUp(self):
        # load c++ library
        self.lib = IntegralLibrary(
            '../regulator_in_powerlist/regulator_in_powerlist_pylink.so')

        # set global options
        self.maxeval = 10**7
        self.epsrel = 1e-3
        self.epsabs = 1e-4
        self.lib.use_Cuhre(self.epsrel,
                           self.epsabs,
                           flags=2,
                           real_complex_together=True,
                           maxeval=self.maxeval)
        self.lib.use_CQuad(self.epsrel, self.epsabs, verbose=True)

        # expected result
        self.target_result_without_prefactor_without_kinematics = sp.sympify(
            '''
             + 7/3        * eps ** -4
             + 0          * eps ** -3
             - 30.7054359 * eps ** -2
        ''')
        self.target_prefactor = sp.sympify('''
                (-s)**(-4*eps - 1)*exp(-I*pi*(2*eps + 3))*gamma(4*eps + 1)/gamma(eps)**2
            ''').series(sp.symbols('eps'), n=5)
        self.order_min = -2
        self.order_max = 0
Esempio n. 2
0
    def setUp(self):
        # load c++ library
        self.lib = IntegralLibrary(
            '../tadpole2L_rank2/tadpole2L_rank2_pylink.so')

        # set global options
        self.real_parameters = [1., 1., 1.]
        self.complex_parameters = []
        self.maxeval = 10**6
        self.epsrel = 1e-8
        self.epsabs = 1e-10

        self.target_result_without_prefactor = \
        {
              -1:  10.0,
               0: - 4.0,
               1: -34.5127841
        }

        self.target_prefactor = \
        {
              -1:  -0.25,
               0:  -0.461392167549234,
               1:  -1.87323249797567
        }
Esempio n. 3
0
    def setUp(self):
        # load c++ library
        self.lib = IntegralLibrary('../easy_sum/easy_sum_pylink.so')

        # set global options
        self.real_parameters = [0.1]
        self.complex_parameters = []
        self.maxeval = 10**6
        self.epsrel = 1e-4
        self.epsabs = 1e-7

        self.target_result_with_prefactor_1 = \
        {
              -1:                     0.2 + 0.0j, # eps ** -1
               0:  0.22962348064032504712 + 0.0j, # eps **  0
        }
        self.order_min_1 = -1
        self.order_max_1 = 0

        self.target_result_with_prefactor_2 = \
        {
              -2:                     0.05 + 0.0j, # eps ** -2
              -1:  0.015342640972002734529 + 0.0j, # eps ** -1
               0: 0.0033313156240476989125 + 0.0j, # eps **  0
        }
        self.order_min_2 = -2
        self.order_max_2 = 0
Esempio n. 4
0
 def setUp(self):
     # load c++ library
     self.lib = IntegralLibrary(
         '../one_integration_variable/one_integration_variable_pylink.so')
     self.target_result = {-1: 0.0, 0: -0.5, 1: -0.25}
     self.epsrel = 1e-11
     self.epsabs = 1e-10
     self.maxeval = 10**5
Esempio n. 5
0
 def setUp(self):
     # load c++ library
     self.lib = IntegralLibrary(
         '../userdefined_cpp/userdefined_cpp_pylink.so')
     self.target_result = {-2: 0.095206, -1: -2.561, 0: 21.120, 1: -78.7}
     self.real_parameters = [0.77]
     self.epsrel = 1e-3
     self.maxeval = 10**8
Esempio n. 6
0
 def setUp(self):
     # load c++ library
     self.lib = IntegralLibrary('../difference/difference_pylink.so')
     self.target_result = {
                               0:  1.64493406684822643647241516664602518923 + 3.1415926535897932384626433832795028842j,
                               1:  2.08781123053685858754509217178101012328 - 6.2831853071795864769252867665590057684j,
                               2: -5.94029019737039970544633397517750766917 + 4.2570651807194096861418776386549427857j
                          }
     self.epsrel = 1e-2
Esempio n. 7
0
class CheckLib(unittest.TestCase):
    def setUp(self):
        # load c++ library
        self.lib = IntegralLibrary('../bubble1L_ebr/bubble1L_ebr_pylink.so')

        # set global options
        self.real_parameters = [4., 0.002, 1.]
        self.complex_parameters = []
        self.maxeval = 10**6
        self.epsrel = 1e-4
        self.epsabs = 1e-7

        self.target_result_with_prefactor = \
        {
              -2:                   0    +                     0j,
              -1:                 1.0    +                   0.0j,
               0:  4.509087643808781e-02 + 3.138451060936178e+00j # obtained from high precision run of pysecdec
        }
        self.order_min = -2
        self.order_max =  0

    def check_result(self, computed_series, target_series, epsrel, epsabs):
        # convert result to sympy expressions
        computed_series = sp.sympify(  computed_series.replace(',','+I*').replace('+/-','*value+error*')  )

        for order in range(self.order_min, self.order_max+1):
            value = complex( computed_series.coeff('eps',order).coeff('value') )
            error = complex( computed_series.coeff('eps',order).coeff('error') )

            # check that the uncertainties are reasonable
            self.assertLessEqual(error.real, abs(2*epsrel * target_series[order].real))
            if target_series[order].imag != 0.0:
                self.assertLessEqual(error.imag, abs(2*epsrel * target_series[order].imag))

            # check that the desired uncertainties are reached
            self.assertLessEqual(error.real, abs(epsrel * value.real) )
            if target_series[order].imag == 0.0:
                self.assertLessEqual(error.imag, max( abs(epsrel * value), epsabs) )
            else:
                self.assertLessEqual(error.imag, abs(epsrel * value.imag) )

            # check integral value
            self.assertAlmostEqual(  value.real, target_series[order].real, delta=3.*epsrel*abs(target_series[order].real)  )
            if target_series[order].imag == 0.0:
                self.assertAlmostEqual(  value.imag, target_series[order].imag, delta=max( 3.*epsrel*abs(target_series[order]), 3.*epsabs)  )
            else:
                self.assertAlmostEqual(  value.imag, target_series[order].imag, delta=3.*epsrel*abs(target_series[order].imag)  )

    def test_Qmc(self):
        # choose integrator
        self.lib.use_Qmc(epsrel=self.epsrel, maxeval=self.maxeval, epsabs=self.epsabs, verbosity=0, seed=143, transform='korobov3')

        # integrate
        str_integral_without_prefactor, str_prefactor, str_integral_with_prefactor = self.lib(self.real_parameters, self.complex_parameters)

        # check integral
        self.check_result(str_integral_with_prefactor, self.target_result_with_prefactor, self.epsrel, self.epsabs)
Esempio n. 8
0
    def setUp(self):
        # load c++ library
        self.lib = IntegralLibrary('../userdefined_cpp/userdefined_cpp_pylink.so')

        # full analytic result for func(y)=1:
        #   (4^-eps (-2 + 2^eps))/((-1 + eps) eps^2)
        # = 1/eps^2 + (1 - Log[2] - Log[4])/eps +  1/2 (2 - 2 Log[2] - Log[2]^2 - 2 Log[4] + 2 Log[2] Log[4] + Log[4]^2) + O[eps]
        # = 1.0000000000000000000/eps^2 - 1.0794415416798359283/eps + 0.60214400703386905808 + O[eps]
        self.target_result = {
                                 -2:   1.0,
                                 -1:  -1.0794415416798359283,
                                  0:   0.60214400703386905808
                             }
        self.epsrel = 1e-4
        self.maxeval = 10**8
Esempio n. 9
0
    def setUp(self):
        # load c++ library
        self.lib = IntegralLibrary('../issue7/issue7_pylink.so')

        # set global options
        self.real_parameters = [0.1]
        self.complex_parameters = []
        self.maxeval = 10**6
        self.epsrel = 1e-4
        self.epsabs = 1e-7

        self.target_result_with_prefactor = \
        {
              -1: -3.1415926535897932385 + 0.0j, # eps ** -1
        }
        self.order_min_1 = -1
        self.order_max_1 = -1
Esempio n. 10
0
    def setUp(self):
        # load c++ library
        self.lib = IntegralLibrary('../bubble1L_dot_rank4/bubble1L_dot_rank4_pylink.so')

        # set global options
        self.real_parameters = [1.275, 1.275]
        self.complex_parameters = [30.886875, 30.886875, 123.5475]
        self.maxeval = 10**6
        self.epsrel = 1e-4
        self.epsabs = 1e-7

        self.target_result_with_prefactor = \
        {
              -1:  1.0    + 0.0j,
               0: -1.2708 + 2.4179j
        }
        self.order_min = -1
        self.order_max =  0
Esempio n. 11
0
    def setUp(self):
        # load c++ library
        self.lib = IntegralLibrary('../mixed_packages/mixed_packages_pylink.so')

        # set global options
        self.real_parameters = [10., 2.]
        self.complex_parameters = []
        self.maxeval = 10**7
        self.epsrel = 1e-4
        self.epsabs = 1e-7
        
        # s/msq * bub(s,msq,msq) + msq/s* Integrate[1/(s z1 + msq z2 z3), {z1, 0, 1}, {z2, 0, 1}, {z3, 0, 1}]
        self.target_result_with_prefactor = \
        {
              -1:  5.0              +  0.0j,
               0: 10.63956085778167 +  7.024814731040726j,
        }
        self.order_min = -1
        self.order_max =  0
Esempio n. 12
0
    def setUp(self):
        # load c++ library
        self.lib = IntegralLibrary(
            '../bubble2L_factorizing/bubble2L_factorizing_pylink.so')

        # set global options
        self.maxeval = 10**6
        self.epsrel = 1e-7
        self.epsabs = 1e-15

        self.target_result_with_prefactor = \
        {
              -2: 1.0/36.0 + 0.0j
        }

        self.target_prefactor = \
        {
              0: 1.0 + 0.0j
        }
Esempio n. 13
0
    def setUp(self):
        # load c++ library
        self.lib = IntegralLibrary('../bubble1L_ebr/bubble1L_ebr_pylink.so')

        # set global options
        self.real_parameters = [4., 0.002, 1.]
        self.complex_parameters = []
        self.maxeval = 10**6
        self.epsrel = 1e-4
        self.epsabs = 1e-7

        self.target_result_with_prefactor = \
        {
              -2:                   0    +                     0j,
              -1:                 1.0    +                   0.0j,
               0:  4.509087643808781e-02 + 3.138451060936178e+00j # obtained from high precision run of pysecdec
        }
        self.order_min = -2
        self.order_max =  0
Esempio n. 14
0
    def setUp(self):
        # load c++ library
        self.lib = IntegralLibrary(
            '../make_regions_ebr/make_regions_ebr_pylink.so')

        # set global options
        self.real_parameters = [0.01]
        self.complex_parameters = []
        self.maxeval = 10**6
        self.epsrel = 1e-4
        self.epsabs = 1e-7

        self.target_result_with_prefactor = \
        {
              -1:                     0.0 + 0.0j, # eps ** -1
               0: 4.60517018598809091e+00 + 0.0j,    # eps ** 0  # obtained from high precision run of pysecdec
        }
        self.order_min = -1
        self.order_max = 0
Esempio n. 15
0
    def setUp(self):
        # load c++ library
        self.lib = IntegralLibrary('../box1L_rank4/box1L_rank4_pylink.so')
        self.real_parameters = [16.0, -75.0, 1.0]
        self.maxeval = 10**8
        self.epsrel = 1e-10
        self.epsabs = 1e-13

        self.target_result_without_prefactor = \
        {
              -1:   97.52083333333 +  0.0j,
               0: -181.22792152123 - 11.903058327787j
        }
        self.target_prefactor = \
        {
               0:  1.0
        }
        self.target_result_with_prefactor = \
        {
              -1:   97.52083333333 +  0.0j,
               0: -181.22792152123 - 11.903058327787j
        }
Esempio n. 16
0
class CheckQmcErrorMessages(unittest.TestCase):
    def setUp(self):
        # load c++ library
        self.lib = IntegralLibrary(
            '../one_integration_variable/one_integration_variable_pylink.so')

    def test_setting_errormode(self):
        self.assertRaisesRegex(ValueError,
                               'Unknown `errormode` "foo"',
                               self.lib.use_Qmc,
                               transform='korobov3',
                               errormode='foo')

        # test known errormodes
        self.lib.use_Qmc(errormode='default', transform='korobov3')
        self.lib.use_Qmc(errormode='all', transform='korobov3')
        self.lib.use_Qmc(errormode='largest', transform='korobov3')
#!/usr/bin/env python3

from pySecDec.integral_interface import IntegralLibrary
import sympy as sp

if __name__ == "__main__":

    # load c++ library
    elliptic2L_euclidean = IntegralLibrary(
        'elliptic2L_euclidean/elliptic2L_euclidean_pylink.so')

    # choose integrator
    elliptic2L_euclidean.use_Vegas(epsrel=1e-5, maxeval=10**7)

    # integrate
    s, t, pp4, msq = [-4. / 3., -16. / 5., -100. / 39., 1.]  # Euclidean point
    str_integral_without_prefactor, str_prefactor, str_integral_with_prefactor = elliptic2L_euclidean(
        [s, t, pp4, msq])

    # convert complex numbers from c++ to sympy notation
    str_integral_with_prefactor = str_integral_with_prefactor.replace(
        ',', '+I*')
    str_prefactor = str_prefactor.replace(',', '+I*')
    str_integral_without_prefactor = str_integral_without_prefactor.replace(
        ',', '+I*')

    # convert result to sympy expressions
    integral_with_prefactor = sp.sympify(
        str_integral_with_prefactor.replace('+/-', '*value+error*'))
    integral_with_prefactor_err = sp.sympify(
        str_integral_with_prefactor.replace('+/-', '*value+error*'))
Esempio n. 18
0
class CheckLib(unittest.TestCase):
    def setUp(self):
        # load c++ library
        self.lib = IntegralLibrary(
            '../bubble2L_factorizing/bubble2L_factorizing_pylink.so')

        # set global options
        self.maxeval = 10**6
        self.epsrel = 1e-7
        self.epsabs = 1e-15

        self.target_result_with_prefactor = \
        {
              -2: 1.0/36.0 + 0.0j
        }

        self.target_prefactor = \
        {
              0: 1.0 + 0.0j
        }

    def check_integral(self, computed_series, target_series, epsrel, epsabs,
                       order_min, order_max):
        # convert result to sympy expressions
        computed_series = sp.sympify(
            computed_series.replace(',',
                                    '+I*').replace('+/-', '*value+error*'))

        for order in range(order_min, order_max + 1):
            value = complex(computed_series.coeff('eps', order).coeff('value'))
            error = complex(computed_series.coeff('eps', order).coeff('error'))

            # check that the uncertainties are reasonable
            self.assertLessEqual(error.real,
                                 abs(2 * epsrel * target_series[order].real))
            if target_series[order].imag != 0.0:
                self.assertLessEqual(
                    error.imag, abs(2 * epsrel * target_series[order].imag))

            # check that the desired uncertainties are reached
            self.assertLessEqual(error.real, abs(epsrel * value.real))
            if target_series[order].imag == 0.0:
                self.assertLessEqual(error.imag, epsabs)
            else:
                self.assertLessEqual(error.imag, abs(epsrel * value.imag))

            # check integral value
            self.assertAlmostEqual(value.real,
                                   target_series[order].real,
                                   delta=3. * epsrel *
                                   abs(target_series[order].real))
            if target_series[order].imag == 0.0:
                self.assertAlmostEqual(value.imag,
                                       target_series[order].imag,
                                       delta=3. * epsabs)
            else:
                self.assertAlmostEqual(value.imag,
                                       target_series[order].imag,
                                       delta=3. * epsrel *
                                       abs(target_series[order].imag))

    def check_prefactor(self, computed_series, target_series, order_min,
                        order_max):
        # convert result to sympy expressions
        computed_series = sp.sympify(computed_series.replace(',', '+I*'))

        for order in range(order_min, order_max + 1):
            value = complex(computed_series.coeff('eps', order))

            # check value
            self.assertAlmostEqual(value.real, target_series[order].real)
            self.assertAlmostEqual(value.imag, target_series[order].imag)

    def check_Cuhre(self, es12):
        # choose integrator
        self.lib.use_Cuhre(epsrel=self.epsrel,
                           maxeval=self.maxeval,
                           epsabs=self.epsabs,
                           real_complex_together=True,
                           flags=0)

        # integrate
        str_integral_without_prefactor, str_prefactor, str_integral_with_prefactor = self.lib(
            [es12])

        # check integral
        self.check_integral(str_integral_with_prefactor,
                            self.target_result_with_prefactor,
                            self.epsrel,
                            self.epsabs,
                            order_min=-2,
                            order_max=-2)

        # check prefactor
        self.check_prefactor(str_prefactor,
                             self.target_prefactor,
                             order_min=0,
                             order_max=0)

    def test_Cuhre_Euclidean(self):
        self.check_Cuhre(-1.)

    def test_Cuhre_physical(self):
        self.check_Cuhre(1.)
Esempio n. 19
0
#!/usr/bin/env python3

from pySecDec.integral_interface import IntegralLibrary

if __name__ == "__main__":

    # load c++ library
    box2L = IntegralLibrary('Nbox2L_split_b/Nbox2L_split_b_pylink.so')

    # choose integrator
    box2L.use_Qmc(verbosity=0,
                  minn=10**9,
                  maxeval=1,
                  transform='korobov6',
                  fitfunction='polysingular')

    # integrator settings used to run the timings
    #box2L.use_Qmc(verbosity=2,minn=10**7,maxeval=1,transform='korobov6',fitfunction='polysingular')
    #box2L.use_Qmc(verbosity=2,minn=10**6,maxeval=1,transform='korobov6',fitfunction='polysingular',devices=[-1])
    #box2L.use_Vegas(flags=2,maxeval=10**7,epsrel=1e-100,epsabs=1e-100)

    # integrate
    str_integral_without_prefactor, str_prefactor, str_integral_with_prefactor = box2L(
        real_parameters=[-1.0, -0.8, 0.1], verbose=True)

    # print results
    print('Numerical Result')
    print('integral without prefactor', str_integral_without_prefactor)
    print('prefactor', str_prefactor)
    print('integral with prefactor', str_integral_with_prefactor)
Esempio n. 20
0
#!/usr/bin/env python3

from pySecDec.integral_interface import IntegralLibrary
import sympy as sp

if __name__ == "__main__":

    # load c++ library
    bowtie = IntegralLibrary('bowtie/bowtie_pylink.so')

    # choose integrator
    bowtie.use_Qmc(verbosity=3,
                   devices=[-1, 0, 1, 2, 3],
                   minn=10**8,
                   transform='korobov3')
    #bowtie.use_Vegas(flags=2,epsrel=1e-2,epsabs=1e-10,nstart=10000,nincrease=1000,maxeval=10000000) #

    # integrate
    str_integral_without_prefactor, str_prefactor, str_integral_with_prefactor = bowtie(
        real_parameters=[10.0, -0.75, 1.0])

    # convert complex numbers from c++ to sympy notation
    str_integral_with_prefactor = str_integral_with_prefactor.replace(
        ',', '+I*')
    str_prefactor = str_prefactor.replace(',', '+I*')
    str_integral_without_prefactor = str_integral_without_prefactor.replace(
        ',', '+I*')

    # convert result to sympy expressions
    integral_with_prefactor = sp.sympify(
        str_integral_with_prefactor.replace('+/-', '*value+error*'))
Esempio n. 21
0
#!/usr/bin/env python3

from pySecDec.integral_interface import IntegralLibrary, series_to_sympy
import sympy as sp

if __name__ == "__main__":

    # load c++ library
    I73_1 = IntegralLibrary('I73_1/I73_1_pylink.so')

    # choose integrator
    #I73_1.use_Qmc(verbosity=3,devices=[-1,0,1,2,3],minn=10**8,transform='korobov3')
    I73_1.use_Vegas(flags=2, epsrel=1e-3, maxeval=10**7)

    # integrate non-Euclidean point;
    v1, v2, v3, v4, v5 = [-3., -3., -1., -1., -1.]
    str_integral_without_prefactor, str_prefactor, str_integral_with_prefactor = I73_1(
        [v1, v2, v3, v4, v5])

    # convert result to sympy expressions
    integral_with_prefactor, integral_with_prefactor_err = series_to_sympy(
        str_integral_with_prefactor)
    integral_with_prefactor = sp.sympify(integral_with_prefactor)
    integral_with_prefactor_err = sp.sympify(integral_with_prefactor_err)

    # numerical result
    print('eps^0:', integral_with_prefactor.coeff('eps', 0), '+/- (',
          integral_with_prefactor_err.coeff('eps', 0), ')')
    print('eps^-1:', integral_with_prefactor.coeff('eps', -1), '+/- (',
          integral_with_prefactor_err.coeff('eps', -1), ')')
    print('eps^-2:', integral_with_prefactor.coeff('eps', -2), '+/- (',
Esempio n. 22
0
#!/usr/bin/env python3

from pySecDec.integral_interface import IntegralLibrary
from math import pi
import sympy as sp

if __name__ == "__main__":

    # load c++ library
    two_regulators = IntegralLibrary('two_regulators/two_regulators_pylink.so')

    # choose integrator
    #two_regulators.use_Vegas()
    two_regulators.use_Qmc(transform='korobov3x1')

    # integrate
    str_integral_without_prefactor, str_prefactor, str_integral_with_prefactor = two_regulators(verbose=True)

    # convert complex numbers from c++ to sympy notation
    str_integral_with_prefactor = str_integral_with_prefactor.replace(',','+I*')
    str_prefactor = str_prefactor.replace(',','+I*')
    str_integral_without_prefactor = str_integral_without_prefactor.replace(',','+I*')

    # convert result to sympy expressions
    integral_with_prefactor = sp.sympify(str_integral_with_prefactor.replace('+/-','*value+error*'))
    integral_with_prefactor_err = sp.sympify(str_integral_with_prefactor.replace('+/-','*value+error*'))
    prefactor = sp.sympify(str_prefactor)
    integral_without_prefactor = sp.sympify(str_integral_without_prefactor.replace('+/-','*value+error*'))
    integral_without_prefactor_err = sp.sympify(str_integral_without_prefactor.replace('+/-','*value+error*'))

    # numerical result
Esempio n. 23
0
#!/usr/bin/env python3
from pySecDec.integral_interface import IntegralLibrary
import sympy as sp

if __name__ == "__main__":

    # load c++ library
    pentabox = IntegralLibrary('pentabox_fin/pentabox_fin_pylink.so')

    # choose integrator
    pentabox.use_Qmc(verbosity=0,
                     minn=10**8,
                     maxeval=1,
                     transform='korobov3',
                     fitfunction='polysingular')

    # integrator settings used to run the timings
    #pentabox.use_Qmc(verbosity=2,minn=10**6,maxeval=1,transform='korobov3',fitfunction='polysingular')
    #pentabox.use_Qmc(verbosity=2,minn=10**5,maxeval=1,transform='korobov3',fitfunction='polysingular',devices=[-1])
    #pentabox.use_Vegas(flags=2,maxeval=10**6,epsrel=1e-100,epsabs=1e-100)

    # integrate non-Euclidean point;
    s12, s23, s34, s45, s51 = [5., -4., 2., -6., 3.]
    str_integral_without_prefactor, str_prefactor, str_integral_with_prefactor = pentabox(
        [s12, s23, s34, s45, s51],
        deformation_parameters_maximum=0.1,
        verbose=True)

    # convert complex numbers from c++ to sympy notation
    str_integral_with_prefactor = str_integral_with_prefactor.replace(
        ',', '+I*')
Esempio n. 24
0
class CheckLib(unittest.TestCase):
    def setUp(self):
        # load c++ library
        self.lib = IntegralLibrary(
            '../tadpole2L_rank2/tadpole2L_rank2_pylink.so')

        # set global options
        self.real_parameters = [1., 1., 1.]
        self.complex_parameters = []
        self.maxeval = 10**6
        self.epsrel = 1e-8
        self.epsabs = 1e-10

        self.target_result_without_prefactor = \
        {
              -1:  10.0,
               0: - 4.0,
               1: -34.5127841
        }

        self.target_prefactor = \
        {
              -1:  -0.25,
               0:  -0.461392167549234,
               1:  -1.87323249797567
        }

    def check_result(self, computed_series, target_series, epsrel, epsabs,
                     order_min, order_max):
        # convert result to sympy expressions
        if '+/-' in computed_series:
            computed_series = sp.sympify(
                computed_series.replace(',',
                                        '+I*').replace('+/-', '*value+error*'))
        else:
            computed_series = (
                sp.sympify(computed_series.replace(',', '+I*')) *
                sp.sympify('value')).expand()

        for order in range(order_min, order_max + 1):
            value = complex(computed_series.coeff('eps', order).coeff('value'))
            error = complex(computed_series.coeff('eps', order).coeff('error'))

            # check that the uncertainties are reasonable
            self.assertLessEqual(error.real,
                                 abs(2 * epsrel * target_series[order].real))
            if target_series[order].imag != 0.0:
                self.assertLessEqual(
                    error.imag, abs(2 * epsrel * target_series[order].imag))

            # check that the desired uncertainties are reached
            self.assertLessEqual(error.real, abs(epsrel * value.real))
            if target_series[order].imag == 0.0:
                self.assertLessEqual(error.imag, epsabs)
            else:
                self.assertLessEqual(error.imag, abs(epsrel * value.imag))

            # check integral value
            self.assertAlmostEqual(value.real,
                                   target_series[order].real,
                                   delta=3. * epsrel *
                                   abs(target_series[order].real))
            if target_series[order].imag == 0.0:
                self.assertAlmostEqual(value.imag,
                                       target_series[order].imag,
                                       delta=3. * epsabs)
            else:
                self.assertAlmostEqual(value.imag,
                                       target_series[order].imag,
                                       delta=3. * epsrel *
                                       abs(target_series[order].imag))

    def test_Cuhre(self):
        # choose integrator
        self.lib.use_Cuhre(epsrel=self.epsrel,
                           maxeval=self.maxeval,
                           epsabs=self.epsabs,
                           real_complex_together=True)

        # integrate
        str_integral_without_prefactor, str_prefactor, str_integral_with_prefactor = self.lib(
            self.real_parameters, self.complex_parameters)

        # check integral
        self.check_result(str_integral_without_prefactor,
                          self.target_result_without_prefactor,
                          self.epsrel,
                          self.epsabs,
                          order_min=-1,
                          order_max=1)

        # check prefactor
        self.check_result(str_prefactor,
                          self.target_prefactor,
                          self.epsrel,
                          self.epsabs,
                          order_min=-1,
                          order_max=1)

    def test_Cuhre_CQuad(self):
        # choose integrator
        self.lib.use_Cuhre(epsrel=self.epsrel,
                           maxeval=self.maxeval,
                           epsabs=self.epsabs,
                           real_complex_together=True)
        self.lib.use_CQuad(epsrel=self.epsrel, epsabs=self.epsabs)

        # integrate
        str_integral_without_prefactor, str_prefactor, str_integral_with_prefactor = self.lib(
            self.real_parameters, self.complex_parameters)

        # check integral
        self.check_result(str_integral_without_prefactor,
                          self.target_result_without_prefactor,
                          self.epsrel,
                          self.epsabs,
                          order_min=-1,
                          order_max=1)

        # check prefactor
        self.check_result(str_prefactor,
                          self.target_prefactor,
                          self.epsrel,
                          self.epsabs,
                          order_min=-1,
                          order_max=1)
Esempio n. 25
0
#!/usr/bin/env python3

from pySecDec.integral_interface import IntegralLibrary
import sympy as sp
import os

if __name__ == "__main__":

    # load c++ library
    integral = IntegralLibrary('bubble/bubble_pylink.so')

    # choose integrator
    integral.use_Qmc(verbosity=2,
                     minn=10**5,
                     maxeval=0,
                     minm=10,
                     transform='korobov3')

    # integrate
    str_integral_without_prefactor, str_prefactor, str_integral_with_prefactor = integral(
        real_parameters=[-0.01],
        number_of_presamples=10000,
        deformation_parameters_maximum=0.01,
        deformation_parameters_minimum=0.00000001)

    # convert complex numbers from c++ to sympy notation
    str_integral_with_prefactor = str_integral_with_prefactor.replace(
        ',', '+I*')
    str_prefactor = str_prefactor.replace(',', '+I*')
    str_integral_without_prefactor = str_integral_without_prefactor.replace(
        ',', '+I*')
#!/usr/bin/env python3

from pySecDec.integral_interface import IntegralLibrary
import sympy as sp

if __name__ == "__main__":

    # load c++ library
    elliptic2L_physical = IntegralLibrary(
        'elliptic2L_physical/elliptic2L_physical_pylink.so')

    # choose integrator
    elliptic2L_physical.use_Qmc(verbosity=0,
                                minn=2147483647,
                                maxeval=1,
                                transform='korobov1',
                                fitfunction='polysingular')

    # integrator settings used to run the timings
    #elliptic2L_physical.use_Qmc(verbosity=2,minn=3*10**6,maxeval=3*10**6,transform='korobov1',fitfunction='polysingular')
    #elliptic2L_physical.use_Qmc(verbosity=2,minn=3*10**6,maxeval=3*10**6,transform='korobov1',fitfunction='polysingular',devices=[-1])
    #elliptic2L_physical.use_Vegas(flags=2,maxeval=3*10**7,epsrel=1e-100,epsabs=1e-100)

    # integrate non-Euclidean point;
    s, t, pp4, msq = [90., -2.5, 1.6, 1.]
    str_integral_without_prefactor, str_prefactor, str_integral_with_prefactor = elliptic2L_physical(
        [s, t, pp4, msq], verbose=True)

    # convert complex numbers from c++ to sympy notation
    str_integral_with_prefactor = str_integral_with_prefactor.replace(
        ',', '+I*')
Esempio n. 27
0
#!/usr/bin/env python3

from pySecDec.integral_interface import IntegralLibrary
from math import log

if __name__ == "__main__":

    #fix expansion parameter
    t = 0.01

    # load c++ library
    intlib = IntegralLibrary('make_regions_ebr/make_regions_ebr_pylink.so')

    # integrate
    _, _, result = intlib(real_parameters=[t])

    # print result
    print('Numerical Result:' + result)
    print('Analytic Result:' + ' (%f) + O(delta)' % (-log(t)))
Esempio n. 28
0
#!/usr/bin/env python3

from pySecDec.integral_interface import IntegralLibrary

if __name__ == "__main__":

    # load c++ library
    box2L = IntegralLibrary('Nbox2L_split_c/Nbox2L_split_c_pylink.so')

    # choose integrator
    box2L.use_Qmc(verbosity=0,
                  minn=15173222401,
                  maxeval=1,
                  transform='korobov3',
                  generatingvectors='cbcpt_cfftw1_6')

    # integrate
    str_integral_without_prefactor, str_prefactor, str_integral_with_prefactor = box2L(
        real_parameters=[-1.0, -0.8, 0.1], verbose=True)

    # print results
    print('Numerical Result')
    print('integral without prefactor', str_integral_without_prefactor)
    print('prefactor', str_prefactor)
    print('integral with prefactor', str_integral_with_prefactor)
Esempio n. 29
0
#!/usr/bin/env python3

from pySecDec.integral_interface import IntegralLibrary, series_to_sympy
import sympy as sp

if __name__ == "__main__":

    # load c++ library
    name = "bubble1L_ebr_large_mass"
    bubble1L = IntegralLibrary(f"{name}/{name}_pylink.so")
    bubble1L.use_Qmc(transform="korobov3", verbosity=1)

    # integrate
    str_integral_without_prefactor, str_prefactor, str_integral_with_prefactor = bubble1L(
        real_parameters=[0.002, 4])

    # convert the result to sympy expressions
    result, error = map(sp.sympify,
                        series_to_sympy(str_integral_with_prefactor))

    # examples how to access individual orders
    print('Numerical Result')
    for power in [-1, 0]:
        valreal, valimg = result.coeff('eps', power).as_real_imag()
        errreal, errimg = error.coeff('eps', power).as_real_imag()
        print("eps^{:<2} {: .15f}{:+.15f}*I +/- {:.15f}{:+.15f}*I".format(
            power, float(valreal), float(valimg), float(errreal),
            float(errimg)))
#!/usr/bin/env python3

from pySecDec.integral_interface import IntegralLibrary
import sympy as sp

if __name__ == "__main__":

    # load c++ library
    name = "formfactor1L_massive_ebr"
    intlib = IntegralLibrary(f"{name}/{name}_pylink.so")
    intlib.use_Qmc(transform="korobov3", verbosity=1)

    # integrate
    str_integral_without_prefactor, str_prefactor, str_integral_with_prefactor = intlib(
        real_parameters=[100, 0.01])

    # convert complex numbers from c++ to sympy notation
    str_integral_with_prefactor = str_integral_with_prefactor.replace(
        ',', '+I*')

    # convert result to sympy expressions
    integral_result = sp.sympify(
        str_integral_with_prefactor.replace('+/-', '*value+error*'))
    integral_result_err = sp.sympify(
        str_integral_with_prefactor.replace('+/-', '*value+error*'))

    # examples how to access individual orders
    print('Numerical Result')
    for power in [-2, -1, 0]:
        valreal, valimg = integral_result.coeff(
            'eps', power).coeff('value').as_real_imag()