ramanujan-qft#
Ramanujan’s Master Theorem, Mellin residue summation and arbitrary-precision Feynman integrals in pure Python.
Ramanujan’s Master Theorem
See Supported calculations and error guarantees for supported domains and error guarantees, and Release record and checklist for beta 0.3.0b5 and the historical release evidence. The implemented objectives and remaining stable-release gates are tracked in Plan for the first stable release; API stability and compatibility defines the proposed compatibility contract.
What is in the package#
ramanujan_master_theorem(phi, s) returns \(\Gamma(s)\,\varphi(-s)\), and
mellin_numeric provides a numerical cross-check for suitable non-oscillatory
integrands. The theorem’s hypotheses remain the caller’s responsibility.
product_integral(f, g, s) evaluates \(\int_0^\infty x^{s-1} f(x)\,g(x)\,dx\) for
exponentials, Gaussians, Bessel \(J_\nu\), sines, cosines and powers, and raises
an error when it cannot verify the result.
B0, C0(s, m1sq, m2sq, m3sq) \(= C_0(0,0,s;m_1^2,m_2^2,m_3^2)\) and the
\(D=3\) bubble in LoopTools conventions, precision-checked at the requested number of digits.
The imaginary part of the massive sunset and its twice-subtracted dispersion relation \(S(s)-S(0)-s\,S'(0)\), from precision-checked numerical integration.
ScalarGraph and integrate_graph: convergent massive Euclidean scalar
topologies, automatic graph polynomials and UV checks, RMT scale integration,
and numerical Hepp sectors with statistical errors.
compile_sunset_rmt generates exact Gamma families for the massive \(D=2\)
sunset, resolves pole collisions, and sums in justified Euclidean convergence
charts with arbitrary precision and an analytic tail bound.
A first calculation#
>>> from ramanujan_qft import product_integral, exponential, bessel_j, B0
>>> product_integral(exponential(1), bessel_j(0, 3)) # = 1/sqrt(10)
mpf('0.31622776601683794')
>>> B0(5, 1, 1) # LoopTools 2.16: 1.56959105903599583 + 1.40496294620814521 i
mpc(real='1.5695910590359961', imag='1.4049629462081452')
>>> import mpmath as mp
>>> mp.nstr(B0(5, 1, 1, dps=30), 30)
'(1.56959105903599596111056676705 + 1.40496294620814527863127492864j)'
Masses are squared masses, and dps= is the number of decimal digits
requested. The quickstart explains the
conventions and the printing of high-precision results.
When to use it#
You need reference values of one-loop scalar integrals to 30–100 or more digits, for example to validate a double-precision code or to evaluate an expression with large cancellations.
You need \(\int_0^\infty x^{s-1} f(x)\,g(x)\,dx\) for products of exponentials, Gaussians, Bessel functions, trigonometric functions and powers at high precision, in particular at high oscillation frequency or when no suitable closed form is available.
You want explicit, readable series representations (the Master Theorem, the Method of Brackets, residue sums) for teaching or for checking a derivation.
You need the scheme-independent part of the two-loop sunset (\(\operatorname{Im} S\), \(S(s)-S(0)-s\,S'(0)\)) as an independent check.
When not to use it#
Double-precision phenomenology. Compiled tools such as LoopTools and COLLIER provide tensor integrals and broader kinematics. The historical LoopTools benchmark was roughly 300–450 times faster for the two measured calls; no COLLIER speed ratio was measured.
Integrals with a closed form. Evaluating an available closed form can be much faster: about 86–239 times in the retained two-factor benchmark. That timing excludes finding the symbolic expression; it does not measure SymPy or Mathematica integration time.
Multiloop regulator expansions or physical-region integrals. The experimental graph backend covers convergent massive Euclidean cases only. For broader coverage, use pySecDec, FIESTA or AMFlow, and TSIL for two-loop self-energies; a precision-checked
sunset_subtractedcall takes about 10 s.Integrals at the convergence boundary.
product_integralraisesSeriesConvergenceErrorinstead of returning a value it cannot verify, for example for \(\int_0^\infty e^{-x} J_0(x)\,dx\). Use quadrature or a closed form there.
The methods are classical (Ramanujan and Hardy; Marichev and Slater; Gonzalez, Moll and Schmidt; ‘t Hooft and Veltman); none of them is new. How ramanujan-qft relates to existing tools maps the package against existing tools, with measured timings, and Prior art and originality credits the earlier work.
In memory of Srinivasa Ramanujan#
Srinivasa Ramanujan (1887–1920) stated the Master Theorem in his quarterly reports to the University of Madras. G. H. Hardy made it widely known, with a proof under explicit conditions, in Ramanujan: Twelve Lectures on Subjects Suggested by His Life and Work (1940), chapter XI. This package is dedicated to his memory.