back to table · edit · history · where entries came from · files · download
1158 bytes, as of the version from 2026-10-27 08:39 (current). Recorded here, not run.
"""General pF(p-1)(1) summation by a Gamma-ratio asymptotic tail.
The asymptotic series is NOT a rigorous enclosure. The user must independently
vary cutoff, truncation and precision. Positive rational parameters only.
"""
import mpmath as mp
from math import comb
def hyper_tail(A, B, cutoff, terms):
# t_k = C k^(-rho) exp(sum_j l_j/k^j), DLMF 5.11.8.
bb=list(B)+[mp.mpf(1)]
rho=sum(bb)-sum(A)
assert rho>1
bern=[mp.bernoulli(k) for k in range(terms+2)]
def bernpoly(n,x):
return sum(comb(n,k)*bern[k]*x**(n-k) for k in range(n+1))
logs=[mp.mpf(0)]
for j in range(1,terms+1):
logs.append((-1)**(j+1)*(sum(bernpoly(j+1,a) for a in A)-sum(bernpoly(j+1,b) for b in bb))/(j*(j+1)))
coeff=[mp.mpf(1)]
for j in range(1,terms+1):
coeff.append(sum(k*logs[k]*coeff[j-k] for k in range(1,j+1))/j)
t=mp.mpf(1); total=t
for k in range(1,cutoff):
t*=mp.fprod(k-1+a for a in A)/mp.fprod(k-1+b for b in bb)
total+=t
C=mp.fprod(mp.gamma(b) for b in B)/mp.fprod(mp.gamma(a) for a in A)
tail=C*sum(coeff[j]*mp.zeta(rho+j,cutoff) for j in range(terms+1))
return total+tail