def Ht_AFE_B(z, t): """ This is the much more accurate approx functional eqn posted by Terry at https://terrytao.wordpress.com/2018/02/02/polymath15-second-thread-generalising-the-riemann-siegel-approximate-functional-equation/#comment-492182 :param z: point at which H_t is computed :param t: the "time" parameter :return: the B part in Ht """ z, t = mp.mpc(z), mp.mpc(t) s = (1 + 1j * z.real - z.imag) / 2 tau = mp.sqrt(s.imag / (2 * mp.pi())) M = int(tau) B_pre = (1 / 16.0) * s * (s - 1) * mp.power(mp.pi(), 0.5 * (s - 1)) * mp.gamma(0.5 * (1 - s)) B_sum = 0.0 for m in range(1, M + 1): if t.real > 0: B_sum += mp.exp( (t / 16.0) * mp.power(mp.log( (5 - s) / (2 * mp.pi() * m * m)), 2)) / mp.power(m, 1 - s) else: B_sum += 1 / mp.power(m, 1 - s) return B_pre * B_sum
def abtoyx_e3(z, t): x = z.real xdash = x + mp.pi() * t / 4.0 y = z.imag sigma1, sigma2 = 0.5 * (1 + y), 0.5 * (1 - y) s1, s2 = sigma1 + 0.5j * xdash, sigma2 + 0.5j * xdash N = int(mp.sqrt(0.25 * x / mp.pi())) sum1_L, sum1_R = 0.0, 0.0 factor2 = 1 - 1 / mp.power(2.0, s1 + (t / 4.0) * mp.log(N * N / 2.0)) factor3 = 1 - 1 / mp.power(3.0, s1 + (t / 4.0) * mp.log(N * N / 2.0)) factorN = mp.power(N, -0.4) for n in range(1, N + 1): n = float(n) sum1_L += mp.power(n, -1 * s1 - (t / 4.0) * mp.log(N * N / n)) sum1_R += mp.power(n, -1 * s2 - (t / 4.0) * mp.log(N * N / n)) sum1_R = sum1_R * factorN sum12_L, sum12_R = sum1_L * factor2, sum1_R * factor2 sum123_L, sum123_R = sum12_L * factor3, sum12_R * factor3 absum1_L, absum1_R, absum12_L, absum12_R, absum123_L, absum123_R = abs( sum1_L), abs(sum1_R), abs(sum12_L), abs(sum12_R), abs(sum123_L), abs( sum123_R) abdiff1, abdiff12, abdiff123 = absum1_L - absum1_R, absum12_L - absum12_R, absum123_L - absum123_R return [ sum1_L, sum1_R, absum1_L, absum1_R, abdiff1, sum12_L, sum12_R, absum12_L, absum12_R, abdiff12, sum123_L, sum123_R, absum123_L, absum123_R, abdiff123 ]
def Ht_AFE_A(z, t): """ This is the much more accurate approx functional eqn posted by Terry at https://terrytao.wordpress.com/2018/02/02/polymath15-second-thread-generalising-the-riemann-siegel-approximate-functional-equation/#comment-492182 :param z: point at which H_t is computed :param t: the "time" parameter :return: the A part in Ht """ z, t = mp.mpc(z), mp.mpc(t) s = (1 + 1j * z.real - z.imag) / 2 tau = mp.sqrt(s.imag / (2 * mp.pi())) N = int(tau) A_pre = (1/16) * s * (s-1) \ * mp.power(mp.pi(), -1*s/2) * mp.gamma(s/2) A_sum = 0.0 for n in range(1, N + 1): if t.real > 0: A_sum += mp.exp( (t / 16) * mp.power(mp.log( (s + 4) / (2 * mp.pi() * n * n)), 2)) / mp.power(n, s) else: A_sum += 1 / mp.power(n, s) return A_pre * A_sum
def F0(s): # works only for x > 14 approx due to the sqrt(x/4PI) factor term1 = mp.power(mp.pi(), -0.5 * s) * mp.gamma(0.5 * (s + 4)) x = 2 * s.imag N = int(mp.sqrt(x / (4 * mp.pi()))) running_sum = 0 for n in range(1, N + 1): running_sum += 1 / mp.power(n, s) return term1 * running_sum
def Ht_Effective(z, t): """ This uses the effective approximation of H_t from Terry's blog :param z: point at which H_t is computed :param t: the "time" parameter :return: H_t as a sum of two terms that are analogous to A and B, but now also with an efffective error bound (returned as percentage of |H_t| """ z, t = mp.mpc(z), mp.mpc(t) sigma = (1 - z.imag) / 2.0 T = (z.real) / 2.0 Tdash = T + t * mp.pi() / 8.0 s1 = sigma + 1j * T s2 = 1 - sigma + 1j * T N = int((mp.sqrt(Tdash / (2 * mp.pi()))).real) alph1 = alpha1(s1) alph2 = alpha1(s2).conjugate() A0_expo = (t / 4.0) * alph1 * alph1 B0_expo = (t / 4.0) * alph2 * alph2 H01_est1 = H01(s1) H01_est2 = H01(s2).conjugate() #begin main estimate block A0 = mp.exp(A0_expo) * H01_est1 B0 = mp.exp(B0_expo) * H01_est2 A_sum = 0.0 B_sum = 0.0 for n in range(1, N + 1): A_sum += 1 / mp.power(n, s1 + (t / 2.0) * alph1 - (t / 4.0) * mp.log(n)) B_sum += 1 / mp.power( n, 1 - s1 + (t / 2.0) * alph2 - (t / 4.0) * mp.log(n)) A = A0 * A_sum B = B0 * B_sum H = (A + B) / 8.0 #end main estimate block #begin error block A0_err_expo = (t / 4.0) * (abs(alph1)**2) #A0_expo.real may also work B0_err_expo = (t / 4.0) * (abs(alph2)**2) #B0_expo.real may also work epserr_1 = mp.exp(A0_err_expo) * abs(H01_est1) * abs(eps_err(s1, t)) / ( (T - 3.33) * 8.0) epserr_2 = mp.exp(B0_err_expo) * abs(H01_est2) * abs(eps_err(s2, t)) / ( (T - 3.33) * 8.0) epserr = epserr_1 + epserr_2 C0 = mp.sqrt(mp.pi()) * mp.exp(-1 * (t / 64.0) * (mp.pi()**2)) * mp.power( Tdash, 1.5) * mp.exp(-1 * mp.pi() * T / 4.0) C = C0 * vwf_err(s1, t) / 8.0 toterr = epserr + C #print(epserr_1, epserr_2, C0, vwf_err(s1, t), C, toterr.real) #end error block if z.imag == 0: return (H.real, toterr.real / abs(H.real)) else: return (H, toterr.real / abs(H))
def w(sigma, s, t): T = s.imag T0 = T T0dash = T0 + mp.pi() * t / 8.0 Tdash = T + mp.pi() * t / 8.0 wterm1 = 1 + (sigma**2) / (T0dash**2) wterm2 = 1 + ((1 - sigma)**2) / (T0dash**2) wterm3 = (sigma - 1) * mp.log(wterm1) / 4.0 + nonnegative( (T0dash / 2.0) * mp.atan(sigma / T0dash) - sigma / 2.0) + 1 / (12.0 * (Tdash - 0.33)) return mp.sqrt(wterm1) * mp.sqrt(wterm2) * mp.exp(wterm3)
def Ft(s, t): # works only for x > 14 approx due to the sqrt(x/4PI) factor term1 = mp.power(mp.pi(), -0.5 * s) * mp.gamma(0.5 * (s + 4)) x = 2 * s.imag N = int(mp.sqrt(x / (4 * mp.pi()))) running_sum = 0 for n in range(1, N + 1): running_sum += mp.exp( (t / 16.0) * mp.power(mp.log( (s + 4) / (2 * mp.pi() * n * n)), 2)) / mp.power(n, s) # main eqn return term1 * running_sum
def v(sigma, s, t): T0 = s.imag T0dash = T0 + mp.pi() * t / 8.0 a0 = mp.sqrt(T0dash / (2 * mp.pi())) if (sigma >= 0): return 1 + 0.4 * mp.power(9, sigma) / a0 + 0.346 * mp.power( 2, 3 * sigma / 2.0) / (a0**2) if (sigma < 0): K = int(mp.floor(-1 * sigma) + 3) ksum = 0.0 for k in range(1, K + 2): ksum += mp.power(1.1 / a0, k) * mp.gamma(mp.mpf(k) / 2.0) return 1 + mp.power(0.9, mp.ceil(-1 * sigma)) * ksum
def eps_err(s, t): sigma = s.real T = s.imag N = int((mp.sqrt((T - (t * mp.pi() / 8.0)) / (2 * mp.pi()))).real) alph = alpha1(s) term1 = sigma + (t / 2.0) * (alph.real) - (t / 4.0) * mp.log(N) neg_term1 = -1 * term1 term2 = (t * t / 4.0) * (abs(alph)**2) + (1 / 3.0) + t if term1.real > 1: zsum = mp.zeta(term1) else: zsum = 0.0 for n in range(1, N + 1): zsum += mp.power(n, neg_term1) return 0.5 * zsum * mp.exp(term2 / (2 * (T - 3.33))) * term2
def Nt(t, T): '''Estimates number of H_t zeroes expected to be found upto height T''' t, T = mp.mpf(t), mp.mpf(T) Tsmall = T / (4 * mp.pi()) N0 = Tsmall * mp.log(Tsmall) - Tsmall extra = (t / 16.0) * mp.log(Tsmall) return (N0 + extra).real
def xmultibound(x): N = int(mp.sqrt(0.25 * x / mp.pi())) sum1_1, sum1_2, sum12_1, sum12_2, sum123_1, sum123_2, sum1235_1, sum1235_2 = [ 0.0 for i in range(8) ] factor2 = 1 - 1 / mp.power(2.0, 0.7 + 0.1 * mp.log(N * N / 2.0)) factor3 = 1 - 1 / mp.power(3.0, 0.7 + 0.1 * mp.log(N * N / 3.0)) factor5 = 1 - 1 / mp.power(5.0, 0.7 + 0.1 * mp.log(N * N / 5.0)) factorN = 1 / mp.power(N, 0.4) pow2, pow3, pow5, pow6, pow10, pow15, pow30 = [ mp.power(j, 0.4) for j in [2, 3, 5, 6, 10, 15, 30] ] expo2, expo3, expo5 = 0.2 * mp.log(2), 0.2 * mp.log(3), 0.2 * mp.log(5) expo6, expo10, expo15, expo30 = expo2 + expo3, expo2 + expo5, expo3 + expo5, expo2 + expo3 + expo5 exp23, exp25, exp35 = mp.exp(0.2 * mp.log(2) * mp.log(3)), mp.exp( 0.2 * mp.log(2) * mp.log(5)), mp.exp(0.2 * mp.log(3) * mp.log(5)) exp235 = exp23 * exp25 * exp35 for n in range(1, 30 * N + 1): L1 = deltaN(n, N) L2 = deltaN(n, 2 * N) * divdelta(n, 2) if L2 > 0: L2 /= mp.power((n / 2.0), expo2) L3 = deltaN(n, 3 * N) * divdelta(n, 3) if L3 > 0: L3 /= mp.power((n / 3.0), expo3) L5 = deltaN(n, 5 * N) * divdelta(n, 5) if L5 > 0: L5 /= mp.power((n / 5.0), expo5) L6 = deltaN(n, 6 * N) * divdelta(n, 6) if L6 > 0: L6 /= (mp.power((n / 6.0), expo6) * exp23) L10 = deltaN(n, 10 * N) * divdelta(n, 10) if L10 > 0: L10 /= (mp.power((n / 10.0), expo10) * exp25) L15 = deltaN(n, 15 * N) * divdelta(n, 15) if L15 > 0: L15 /= (mp.power((n / 15.0), expo15) * exp35) L30 = deltaN(n, 30 * N) * divdelta(n, 30) if L30 > 0: L30 /= (mp.power((n / 30.0), expo30) * exp235) R1 = L1 R2 = L2 / pow2 R3 = L3 / pow3 R5 = L5 / pow5 R6 = L6 / pow6 R10 = L10 / pow10 R15 = L15 / pow15 R30 = L30 / pow30 n = float(n) denom1 = mp.power(n, 0.7 + 0.1 * mp.log(N * N / n)) denom2 = mp.power(n, 0.3 + 0.1 * mp.log(N * N / n)) sum1_1 += abs(L1) / denom1 sum1_2 += abs(R1) / denom2 sum12_1 += abs(L1 - L2) / denom1 sum12_2 += abs(R1 - R2) / denom2 sum123_1 += abs(L1 - L2 - L3 + L6) / denom1 sum123_2 += abs(R1 - R2 - R3 + R6) / denom2 sum1235_1 += abs(L1 - L2 - L3 - L5 + L6 + L10 + L15 - L30) / denom1 sum1235_2 += abs(R1 - R2 - R3 - R5 + R6 + R10 + R15 - R30) / denom2 finalsum1 = sum1_1 - 1 + sum1_2 * factorN finalsum12 = (sum12_1 - 1 + sum12_2 * factorN) / factor2 finalsum123 = (sum123_1 - 1 + sum123_2 * factorN) / (factor2 * factor3) finalsum1235 = (sum1235_1 - 1 + sum1235_2 * factorN) / (factor2 * factor3 * factor5) return [finalsum1, finalsum12, finalsum123, finalsum1235]
def vwf_err(s_orig, t, lim=10, h=0.01): '''This is the new optimized vwf function where v,w,f are passed only the relevant parameters''' def v(sigma, t, a0, ksumcache): if (sigma >= 0): return 1 + 0.4 * mp.power(9, sigma) / a0 + 0.346 * mp.power( 2, 3 * sigma / 2.0) / (a0**2) if (sigma < 0): K = int(mp.floor(-1 * sigma) + 3) return 1 + mp.power(0.9, mp.ceil(-1 * sigma)) * ksumcache[K] def w(sigma, t, T0dash): wterm1 = 1 + (sigma**2) / (T0dash**2) wterm2 = 1 + ((1 - sigma)**2) / (T0dash**2) wterm3 = (sigma - 1) * mp.log(wterm1) / 4.0 + nonnegative( (T0dash / 2.0) * mp.atan(sigma / T0dash) - sigma / 2.0) + 1 / (12.0 * (T0dash - 0.33)) return mp.sqrt(wterm1) * mp.sqrt(wterm2) * mp.exp(wterm3) def f(sigma, t, sigma0): fterm1 = 0.5 / mp.sqrt(mp.pi() * t) fterm2 = mp.exp((-1 / t) * ((sigma - sigma0)**2)) + mp.exp( (-1 / t) * ((1 - sigma - sigma0)**2)) return fterm1 * fterm2 sigma0 = s_orig.real T = s_orig.imag T0 = T T0dash = T0 + mp.pi() * t / 8.0 a0 = mp.sqrt(T0dash / (2 * mp.pi())) ktermcache = [ mp.power(1.1 / a0, k) * mp.gamma(mp.mpf(k) / 2.0) for k in range(1, lim + 5) ] ksumcache = list(accumulate(ktermcache)) lower_limit, higher_limit = -1.0 * lim, 1.0 * lim integral_sum = 0.0 sigma = lower_limit while (sigma <= higher_limit): sumterm = v(sigma, t, a0, ksumcache) * w(sigma, t, T0dash) * f( sigma, t, sigma0) if ((sigma == lower_limit) or (sigma == higher_limit)): sumterm /= 2 integral_sum += sumterm sigma += h integral_sum *= h return integral_sum
def phi_decay(u, n_max=100): """ Computes Phi(u) in Terry' blog at https://terrytao.wordpress.com/2018/02/02/polymath15-second-thread-generalising-the-riemann-siegel-approximate-functional-equation/ :param u: input complex number :param n_max: upper limit for summation. It has to be a positive integer :return: Phi(u) """ running_sum = 0 u = mp.mpc(u) for n in range(1, n_max + 1): term1 = 2 * mp.pi() * mp.pi() * mp.power(n, 4) * mp.exp(9*u) \ - 3 * mp.pi() * mp.power(n, 2) * mp.exp(5*u) term2 = mp.exp(-1 * mp.pi() * mp.power(n, 2) * mp.exp(4 * u)) running_sum += term1 * term2 return running_sum
def RSZ_plain(x): x = mp.mpf(x.real) tau = mp.sqrt(x / (2 * mp.pi())) N = int(tau.real) z = 2 * (x - N) - 1 running_sum = 0 for n in range(1, N + 1): running_sum += mp.cos(RStheta(x) - (x * mp.log(n))) / mp.sqrt(n) return (2 * running_sum).real
def RSZ_upto_c0(x): x = mp.mpf(x.real) tau = mp.sqrt(x / (2 * mp.pi())) N = int(tau.real) p = tau - N running_sum = 0 for n in range(1, N + 1): running_sum += mp.cos(RStheta(x) - (x * mp.log(n))) / mp.sqrt(n) return (2 * running_sum + mp.power(-1, N - 1) * mp.power(tau, -0.5) * c0(p)).real
def abeff_trianglebound(N, y, t, cond): sigma1 = 0.5 * (1 + y) sum1, sum2, sum3, sum5 = [0.0 for _ in range(4)] b1 = 1 a1 = mp.power(N, -0.4) xN = 4 * mp.pi() * N * N - mp.pi() * t / 4.0 xNp1 = 4 * mp.pi() * (N + 1) * (N + 1) - mp.pi() * t / 4.0 delta = mp.pi() * y / (2 * (xN - 6 - (14 + 2 * y) / mp.pi())) + 2 * y * ( 7 + y) * mp.log(abs(1 + y + 1j * xNp1) / (4 * mp.pi)) / (xN * xN) expdelta = mp.exp(delta) for n in range(1, 30 * N + 1): nf = float(n) denom = mp.power(nf, sigma1 + (t / 4.0) * mp.log(N * N)) common1 = mp.exp((t / 4.0) * mp.power(mp.log(nf), 2)) common2 = common1 * mp.power(nf / N, y) * expdelta * mp.exp( t * y * mp.log(n) / (2 * (xN - 6))) bn, bn2, bn3, bn5 = [ common1 * abs(cond[n][2 * i - 1]) for i in range(1, 5) ] an, an2, an3, an5 = [ common2 * abs(cond[n][2 * i]) for i in range(1, 5) ] sum1 += (bn + an) / denom sum2 += (bn2 + an2) / denom sum3 += (bn3 + an3) / denom sum5 += (bn5 + an5) / denom return [N, expdelta] + [2 - j for j in [sum1, sum2, sum3, sum5]]
def abeff_lemmabound(N, y, t, cond): sigma1 = 0.5 * (1 + y) sum1, sum2, sum3, sum5 = [0.0 for _ in range(4)] b1 = 1 a1 = mp.power(N, -0.4) xN = 4 * mp.pi() * N * N - mp.pi() * t / 4.0 xNp1 = 4 * mp.pi() * (N + 1) * (N + 1) - mp.pi() * t / 4.0 delta = mp.pi() * y / (2 * (xN - 6 - (14 + 2 * y) / mp.pi())) + 2 * y * ( 7 + y) * mp.log(abs(1 + y + 1j * xNp1) / (4 * mp.pi)) / (xN * xN) expdelta = mp.exp(delta) for n in range(2, 30 * N + 1): nf = float(n) denom = mp.power(nf, sigma1 + (t / 4.0) * mp.log(N * N)) #print([cond[n][i] for i in range(1,9)]) common1 = mp.exp((t / 4.0) * mp.power(mp.log(nf), 2)) common2 = common1 * mp.power(nf / N, y) common3 = expdelta * (mp.exp(t * y * mp.log(n) / (2 * (xN - 6))) - 1) bn, bn2, bn3, bn5 = [common1 * cond[n][2 * i - 1] for i in range(1, 5)] an, an2, an3, an5 = [common2 * cond[n][2 * i] for i in range(1, 5)] en, en2, en3, en5 = an * common3, an2 * common3, an3 * common3, an5 * common3 sum1 += (en + max( (1 - a1) * abs(bn + an) / (1 + a1), abs(bn - an))) / denom sum2 += (en2 + max( (1 - a1) * abs(bn2 + an2) / (1 + a1), abs(bn2 - an2))) / denom sum3 += (en3 + max( (1 - a1) * abs(bn3 + an3) / (1 + a1), abs(bn3 - an3))) / denom sum5 += (en5 + max( (1 - a1) * abs(bn5 + an5) / (1 + a1), abs(bn5 - an5))) / denom return [N, expdelta] + [1 - a1 - j for j in [sum1, sum2, sum3, sum5]]
def BoysValue_Asymptotic(n, x): F = [] if x == mp.mpf("0"): for i in range(0, n+1): F.append(mp.mpf(1.0)/(mp.mpf(2.0*i+1))) else: for i in range(0, n+1): val = mp.sqrt( mp.pi() / mp.power(x, 2*i+1) ) val *= ( mp.fac2(2*i-1) / mp.power("2", i+1) ) F.append(val) return F
def adjusted_AB_analysis(z, t): z, t = mp.mpc(z), mp.mpc(t) s = (1 + 1j * z.real - z.imag) / 2 tau = mp.sqrt(s.imag / (2 * mp.pi())) N = int(tau) M = int(tau) s_like1 = (s + 4) / 2 s_like2 = (5 - s) / 2 initial_term = (1 / 4) * mp.sqrt(2 * mp.pi()) A_pre = initial_term * mp.power(mp.pi(), -1 * s / 2) * mp.exp( (s_like1 - 0.5) * mp.log(s_like1) - s_like1) A_sum = 0.0 for n in range(1, N + 1): if t.real > 0: A_sum += mp.exp( (t / 16) * mp.power(mp.log(s_like1 / (mp.pi() * n * n)), 2)) / mp.power( n, s) else: A_sum += 1 / mp.power(n, s) A = A_pre * A_sum B_pre = initial_term * mp.power( mp.pi(), (s - 1) / 2) * mp.exp((s_like2 - 0.5) * mp.log(s_like2) - s_like2) B_sum = 0.0 ddxB_sum = 0.0 for m in range(1, M + 1): if t.real > 0: mth_term = mp.exp( (t / 16) * mp.power(mp.log(s_like2 / (mp.pi() * m * m)), 2)) / mp.power( m, 1 - s) else: mth_term = 1 / mp.power(m, 1 - s) B_sum += mth_term ddxB_sum += mth_term * mp.log(m) B = B_pre * B_sum B_common_term = mp.exp((t / 16) * mp.power(mp.log(s_like2 / mp.pi()), 2)) B0 = B_pre * B_common_term ddxBB0 = 0.5j * ddxB_sum / B_common_term AplusB = A + B ABB0 = AplusB / B0 return (AplusB, B0, ABB0, abs(ABB0), ddxBB0, abs(ddxBB0))
def Ht_AFE_C(z, t): """ This is the much more accurate approx functional eqn posted by Terry at https://terrytao.wordpress.com/2018/02/02/polymath15-second-thread-generalising-the-riemann-siegel-approximate-functional-equation/#comment-492182 :param z: point at which H_t is computed :param t: the "time" parameter :return: the C part in Ht """ z, t = mp.mpc(z), mp.mpc(t) s = (1 + 1j * z.real - z.imag) / 2 tau = mp.sqrt(s.imag / (2 * mp.pi())) N = int(tau) M = int(tau) C_pre1 = -(1 / 16.0) * s * (s - 1) * mp.power(mp.pi(), -0.5 * s) * mp.gamma(0.5 * s) C_pre2 = mp.gamma(1 - s) * mp.exp(-1j * mp.pi() * s) / (2j * mp.pi()) C_pre3 = mp.power(2j * mp.pi() * M, s - 1) * mp.exp( -1 * t * mp.pi() * mp.pi() / 64.0) C_psi = psi((s / (2j * M * mp.pi())) - N) return C_pre1 * C_pre2 * C_pre3 * C_psi
def Ht_AFE_ADJ_AB(z, t): """ This uses the adjusted A'+B' estimate from Terry's blog to compute H_t for moderate to large T, where the C term is small. Also, there are some rearrangements to the A' and B' formulas to make them faster to compute :param z: point at which H_t is computed :param t: the "time" parameter :return: Ht as A'+B' """ z, t = mp.mpc(z), mp.mpc(t) s = (1 + 1j * z.real - z.imag) / 2.0 tau = mp.sqrt(s.imag / (2 * mp.pi())) N = int(tau) M = int(tau) s_like1 = (s + 4) / 2.0 s_like2 = (5 - s) / 2.0 log_sp1 = mp.log(s_like1 / mp.pi()) log_sp2 = mp.log(s_like2 / mp.pi()) initial_term = 0.25 * mp.sqrt(2 * mp.pi()) A0 = initial_term * mp.power(mp.pi(), -1 * s / 2.0) * mp.exp( (s_like1 - 0.5) * mp.log(s_like1) - s_like1 + (t / 16.0) * mp.power(log_sp1, 2)) B0 = initial_term * mp.power( mp.pi(), (s - 1) / 2.0) * mp.exp((s_like2 - 0.5) * mp.log(s_like2) - s_like2 + (t / 16.0) * mp.power(log_sp2, 2)) A_sum_exponent = s + (t / 4.0) * log_sp1 B_sum_exponent = 1 - s + (t / 4.0) * log_sp2 A_sum = 0.0 for n in range(1, N + 1): A_sum += mp.power(n, (t / 4.0) * mp.log(n) - A_sum_exponent) A = A0 * A_sum B_sum = 0.0 for m in range(1, M + 1): B_sum += mp.power(m, (t / 4.0) * mp.log(m) - B_sum_exponent) B = B0 * B_sum H = A + B if z.imag == 0: return H.real else: return H
def AB_analysis(z, t): z, t = mp.mpc(z), mp.mpc(t) s = (1 + 1j * z.real - z.imag) / 2 tau = mp.sqrt(s.imag / (2 * mp.pi())) N = int(tau) M = int(tau) A_pre = (1 / 16) * s * (s - 1) * mp.power(mp.pi(), -1 * s / 2) * mp.gamma( s / 2) A_sum = 0.0 for n in range(1, N + 1): if t.real > 0: A_sum += mp.exp( (t / 16) * mp.power(mp.log( (s + 4) / (2 * mp.pi() * n * n)), 2)) / mp.power(n, s) else: A_sum += 1 / mp.power(n, s) A = A_pre * A_sum B_pre = (1 / 16) * s * (s - 1) * mp.power(mp.pi(), (s - 1) / 2) * mp.gamma( (1 - s) / 2) B_sum = 0.0 for m in range(1, M + 1): if t.real > 0: B_sum += mp.exp( (t / 16) * mp.power(mp.log( (5 - s) / (2 * mp.pi() * m * m)), 2)) / mp.power(m, 1 - s) else: B_sum += 1 / mp.power(m, 1 - s) B = B_pre * B_sum B0 = B_pre * mp.exp((t / 16) * mp.power(mp.log( (5 - s) / (2 * mp.pi())), 2)) AplusB = A + B ABB0 = AplusB / B0 return (AplusB, B0, ABB0, abs(ABB0))
def alpha1(s): return 0.5 / s + 1 / (s - 1) + 0.5 * mp.log(s / (2 * mp.pi()))
def c1(p): return (-1 / (96 * mp.pi() * mp.pi())) * mp.diff(lambda x: c0(x), p, 3)
def c0(p): return mp.cos(2 * mp.pi() * (p * p - p - 1 / 16.0)) / mp.cos(2 * mp.pi() * p)
def RStheta(x): return (x / 2.0) * (mp.log(x / (2 * mp.pi())) - 1) - mp.pi() / 8.0 + 1 / ( 48.0 * x) + 7 / (5760.0 * mp.power(x, 3))
def f(sigma, t, sigma0): fterm1 = 0.5 / mp.sqrt(mp.pi() * t) fterm2 = mp.exp((-1 / t) * ((sigma - sigma0)**2)) + mp.exp( (-1 / t) * ((1 - sigma - sigma0)**2)) return fterm1 * fterm2
def f(sigma, s, t): sigma0 = s.real fterm1 = 0.5 / mp.sqrt(mp.pi() * t) fterm2 = mp.exp((-1 / t) * ((sigma - sigma0)**2)) + mp.exp( (-1 / t) * ((1 - sigma - sigma0)**2)) return fterm1 * fterm2
def psi(p): term1 = 2 * mp.pi() term2 = mp.cos(mp.pi() * (p * p / 2 - p - 1 / 8.0)) term3 = mp.exp(0.5j * mp.pi() * p * p - 5j * mp.pi() / 8.0) term4 = mp.cos(mp.pi() * p) return term1 * term2 * term3 / term4
def H01(s): return 0.5 * s * (s - 1) * mp.power(mp.pi(), -0.5 * s) * mp.sqrt( 2 * mp.pi()) * mp.exp((0.5 * s - 0.5) * mp.log(0.5 * s) - 0.5 * s)