Choose a method and check your first result#

Start with the graph, dimension and kinematics. The choice determines the normalization, available precision and meaning of an error estimate. These are distinct methods; selecting RMT never silently invokes quadrature.

Input and purpose

Method

Precision and limits

Named scalar one-loop B0 or the restricted C0(0,0,s)

B0, C0

mpmath, requested dps; LoopTools conventions; see One-loop integrals

Unit-power, positive-mass D=2 sunset; Q > m1+m2+m3 or M > ma+mb+Q

integrate_graph_rmt, or explain_sunset_rmt for the derivation

Arbitrary precision, analytic series tail bound plus estimated arithmetic error

Unit-power, equal-positive-mass D=2 sunset at finite Euclidean Q

integrate_sunset_taylor

Separate transformed Taylor method, arbitrary precision within explicit budgets

Other connected massive Euclidean scalar graphs with positive powers and convergent UV subgraphs

integrate_graph

Experimental RMT scale integration plus numerical sectors; float64/statistical errors; SciPy required

D=4 sunset discontinuity or subtracted dispersive combinations

sunset_im, sunset_subtracted, sunset_second_derivative

Named quantities in their documented dispersive normalization; not the D=2 graph value

UV-divergent graphs, regulator expansions, general tensor numerators or physical-region multiloop continuation

No general supported evaluator

Do not reinterpret a refused or partial result as a value

Here Q is the magnitude of the Euclidean external momentum; m and M are masses. API mass arguments are squared masses. See Conventions before comparing values from different programs. Use exact decimal strings for input precision beyond ordinary floats.

For series, dps requests decimal digits; work limits can still stop an otherwise valid calculation. Read the typed exception and increase the named budget only when you can afford the work. A larger budget cannot fix an invalid domain. For the hybrid method, use epsrel/epsabs and inspect statistical diagnostics; requesting tiny tolerances does not turn float64 into arbitrary precision.

Three complete calculations#

The walkthrough uses features included in beta 0.3.0b5. From a matching source checkout install pip install '.[multiloop]', then run python examples/08_first_calculations.py. It checks a one-loop value against a Feynman-parameter integral, a two-loop RMT series against a separately computed simplex reference, and a three-loop hybrid graph against a Fourier-convolution formula. Each comparison uses the same normalization on both sides. The frozen simplex reference is reproducible with tools/generate_sunset_rmt_references.py.

import json
import mpmath as mp
import scipy  # Explicit import also loads SciPy in the browser console.
from ramanujan_qft import (B0, ScalarEdge, ScalarGraph, explain_sunset_rmt,
                           integrate_graph, RMTDomainError)

# 1. B0: LoopTools finite-part convention, Delta=0, mu^2=1; p^2=-2.
# Independent Feynman-parameter reference, evaluated with extra precision.
bubble = B0(-2, 1, 4, dps=30)
with mp.workdps(45):
    reference = -mp.quad(lambda x: mp.log(x + 4*(1-x) + 2*x*(1-x)), [0, 1])
    difference = abs(bubble-reference)
    assert difference < mp.mpf('1e-29')
print('B0:', mp.nstr(bubble, 30), 'absolute reference difference:', mp.nstr(difference, 4))
print('B0 returns a precision-checked scalar, not a separate error estimate.')

# 2. D=2 sunset: positive Euclidean propagators; d^2k d^2l / pi^2.
# Q=10 > m1+m2+m3=3 selects the momentum RMT chart.
sunset = ScalarGraph([ScalarEdge(0, 1, 1)]*3, {0: [10], 1: [-10]})
trace = explain_sunset_rmt(sunset, evaluate=True, dps=25)
diagnostics = trace['evaluation']['diagnostics']
assert trace['evaluation']['status'] == 'converged'
# Reference from independent simplex quadrature at 40 and 55 digits:
# tests/data/sunset_rmt_reference.json (precision difference < 2.4e-42).
with mp.workdps(45):
    reference = mp.mpf('0.6290167075906141495908272538835833416123070767')
    encoded = diagnostics['value']
    exact_value = (-1)**encoded['sign'] * mp.ldexp(mp.mpf(int(encoded['mantissa_hex'], 16)), encoded['exponent2'])
    difference = abs(exact_value-reference)
    assert difference <= mp.mpf(diagnostics['error_estimate']['decimal']) + mp.mpf('3e-42')
print('RMT value:', diagnostics['value']['decimal'])
print('RMT chart:', trace['convergence']['chart'], 'condition:', trace['convergence']['condition'])
print('RMT tail bound:', diagnostics['truncation_bound']['decimal'])
print('RMT estimated error before display rounding:', diagnostics['error_estimate']['decimal'])
print('Gamma families:', len(trace['families']), 'terms:', diagnostics['terms'])
exported_json = json.dumps(trace, indent=2)  # Inspect without evaluating expression strings.
try:
    explain_sunset_rmt(ScalarGraph([ScalarEdge(0, 1, 1)]*3))
except RMTDomainError as error:
    print('Expected domain refusal:', error)
else:
    raise AssertionError('The RMT chart must refuse equal-mass vacuum')

# 3. D=1 three-loop banana: d^1k / sqrt(pi) for each of three loops.
# Fourier convolution gives pi^(3/2)*sum(m)/(prod(m)*(sum(m)^2+Q^2)).
banana = ScalarGraph([ScalarEdge(0, 1, m*m) for m in (1, 2, 3, 4)], {0: [2], 1: [-2]})
hybrid = integrate_graph(banana, D=1, epsrel=3e-3, max_evaluations=4000000, seed=1729)
reference = float(mp.pi**mp.mpf('1.5')*10/(24*(100+4)))
assert abs(hybrid.value-reference) <= hybrid.error_estimate
print('Hybrid value:', hybrid.value, '+/-', hybrid.error_estimate)
print('Fourier reference:', reference)
print('Hybrid method:', hybrid.method)
print('The hybrid estimate is float64 with statistical errors; it is not a full RMT series.')

The RMT trace is described in Inspect and export an RMT calculation. An expected refusal is included because the equal-mass vacuum is finite but outside the implemented RMT charts; the separate Taylor method covers that point. The hybrid assertion checks one declared seed, not a universal statistical coverage guarantee; the wider audit is in Stability audit and scientific review.

Run the same code by selecting Three reference-checked calculations on Try it in your browser. That example downloads SciPy on first use. The beta notebook is intended to run in Colab. Interactive hosted execution has not yet been verified. Its installation cell selects beta tag v0.3.0b5. Notebook calculation cells are checked locally and in CI. An interactive Google-hosted Colab session is a separate user check.