示例#1
0
	def _g2_ref(x):
		return fp.polylog(2, x)
示例#2
0
 def _g2_ref(x):
     return fp.polylog(2, x)
示例#3
0
def g2_fp_(x):
    return fp.polylog(2, x)
示例#4
0
                (76.15547620296046 +
                 (444.122940985332 +
                  (2811.9797322897193 +
                   (18914.876429627224 +
                    (133270.98508606057 + res) * xp) * xp) * xp) * xp) * xp) *
               xp) * xp) * xp) * xp) * xp


# g2_1 = np.pi**2 / 6


def g2(x):
    """A fast low precision g2 function consisting of pure numpy methods with maximum absolute error less than 2e-7 in [0, 1]"""

    x2 = (x - 1)**2
    x2 = np.where(x2 == 0.0, 1, x2)
    return np.log(x2) * (147 + x*(-360 + x*(450 + x*(-400 + x*(225 + x*(-72 + 10*x)))))) / 120 + \
     (x*(3.449999063335036 + x*(-0.4456054920387016 + x*(3.487269066832465 + (0.4252955732587594 + 0.5134963397675447*x)*x)))) / \
      (1. + x*(1.1823891304976333 + x*(0.9895338694930508 + (0.7780195910263893 + 0.5672317771956916*x)*x)))


def g2_fp_(x):
    return fp.polylog(2, x)


g2_fp = np.vectorize(g2_fp_)
g2_old = np.vectorize(g_two)
g52 = np.vectorize(g5halves)
g3 = np.vectorize(g_three)
g2_1 = fp.polylog(2, 1)
g3_1 = fp.polylog(3, 1)
示例#5
0
def g2_fp_(x):
	return fp.polylog(2, x)
示例#6
0
	if (x<1e-4):
		return x
	elif (x<=0.82):
		xp = -0.35+x
		res = (0.0396957603891595 + (0.04670760669864216 + (0.05617680434859797 + (0.0688359037828904 + (0.08570894194968269 + (0.10821263549305878 + (0.13830133228577052 + (0.17867204142073595 + (0.2330529526732962 + 0.30661105212057754*xp)*xp)*xp)*xp)*xp)*xp)*xp)*xp)*xp)*xp
		return 0.367187924868168 + (1.1045884033159612 + (0.18031418339537875 + (0.07512020410242393 + (0.04611846771665166 + (0.03499328210626231 + (0.030332383657974384 + (0.02880387961885722 + (0.02922889312039987 + (0.031193119279524506 + (0.03463242361601278 + res)*xp)*xp)*xp)*xp)*xp)*xp)*xp)*xp)*xp)*xp
	else:
		xp = -0.9+x
		res = (974070.3442266576 + (7.3341159458162645e6 + (5.6594271749896556e7 + (4.458241497102925e8 + (3.574350156223386e9 + (2.909525474975562e10 + (2.399887262219758e11 + (2.002668066305938e12 + (1.6885002547479885e13 + 1.4367625078064384e14*xp)*xp)*xp)*xp)*xp)*xp)*xp)*xp)*xp)*xp
		return 1.04965895018644 + (1.4441274700055098 + (0.6190557839438808 + ( 1.0726278388266532 + (3.399516567907888 + (14.692090448926841 + (76.15547620296046 + (444.122940985332 + (2811.9797322897193 + (18914.876429627224 + ( 133270.98508606057 + res)*xp)*xp)*xp)*xp)*xp)*xp)*xp)*xp)*xp)*xp

# g2_1 = np.pi**2 / 6

def g2(x):
	"""A fast low precision g2 function consisting of pure numpy methods with maximum absolute error less than 2e-7 in [0, 1]"""

	x2 = (x - 1) ** 2
	x2 = np.where(x2==0.0, 1, x2)
	return np.log(x2) * (147 + x*(-360 + x*(450 + x*(-400 + x*(225 + x*(-72 + 10*x)))))) / 120 + \
		(x*(3.449999063335036 + x*(-0.4456054920387016 + x*(3.487269066832465 + (0.4252955732587594 + 0.5134963397675447*x)*x)))) / \
 		(1. + x*(1.1823891304976333 + x*(0.9895338694930508 + (0.7780195910263893 + 0.5672317771956916*x)*x)))

def g2_fp_(x):
	return fp.polylog(2, x)

g2_fp = np.vectorize(g2_fp_)
g2_old = np.vectorize(g_two)
g52 = np.vectorize(g5halves)
g3 = np.vectorize(g_three)
g2_1 = fp.polylog(2, 1)
g3_1 = fp.polylog(3, 1)