Cosmoflow

Cosmoflow is a Python package for the integrals behind the wavefunction and correlators of a scalar field in an expanding (Friedmann–Robertson–Walker, FRW) or de Sitter universe. From a graph of sites and edges it returns the linear energy denominators of the integrand and the candidate symbol lettersthe arguments of the logarithms from which a polylogarithmic answer is built; knowing them in advance fixes the space of functions to fit built from them, as a JSON file in the input format of Ansatzer. The integrals are those studied by Benincasa, Brunello, Mandal, Mastrolia and Vazão (arXiv:2408.16386) and by Arkani-Hamed, Baumann, Hillman, Joyce, Lee and Pimentel (arXiv:2312.05303).

What it does

A wavefunction coefficient is labeled by a graph: a chain, a ring, a star or a multi-loop polygon. Each site (vertex) carries the total energy $x_v$ of the external legs attached to it, and each edge (internal line) carries an energy $y_e\ge 0$.

The singularities of the integrand are linear forms $q_g$, one for each connected subgraph $g$. Each $q_g$ is the sum of the site energies in $g$, the energy of every edge leaving $g$, and $c$ times the energy of every deleted loop edge. A deleted loop edge has both endpoints in $g$ and is itself left out of $g$.

The package defaults to $c=2$, the value its documentation argues is the consistent one. The value $c=1$, printed in one section of the reference paper (arXiv:2408.16386), can be requested by argument. At tree level (a graph with no loop) $c$ never enters.

alphabet_graph(nv, edges) enumerates the connected subgraphs of any connected graph, parallel edges allowed, and emits three classes of letters:

Each letter carries a source note saying which rule produced it. The output is marked complete: false: it is a candidate list, to be trusted only after it has been compared with the denominators of a separately derived differential equation for the same graph.

For a one-loop polygon with $n_s$ sites the loop momentum enters only through the $n_s$ edge energies, and using them as integration variables brings in the Baikov polynomial $B(y;X)$. It is the Cayley–Menger determinant of the simplex whose base edges are the external invariants $X_{ij}$ and whose remaining edges are the $y_e$, and it is quadratic in each $y_e^2$. The integrals of the family are

$$I[N,\tau]=\int_{y_e\ge 0,\;B\ge 0} d^{\,n_s}y\;B(y;X)^{-1/2+\epsilon}\,\frac{N(y)}{q_g^{\,\tau}}\,,$$

with $N$ a polynomial, $q_g$ one of the linear forms and $\epsilon$ a regulator. baikov_B(n_s, y_list, X_list) returns $B$ as a sympy polynomial for any $n_s$. For one-loop polygons the letter list can carry a separate block, disc_kallen_baikov, with the irreducible factors of the discriminant of $B$ in each $z_e=y_e^2$. The block is separate because its factors are functions of the $X_{ij}$ and $z_e$, while the letters are functions of the energies.

The worked example, in examples/triangle/, is the one-loop three-site triangle of arXiv:2408.16386. Its integral family has an elliptic sector: nine master integralsa finite set of basis integrals to which all integrals of the family reduce by exact linear relations $e_1,\dots,e_9$ whose differential equation contains an irreducible second-order operator $\mathcal L_2$ solved by complete elliptic integrals. The example has three parts:

The package has these limits:

Examples

Run the self-test. With Python, mpmath and sympy installed (see Requirements), run from inside the package directory tools/cosmoflow/:

python3 selftest.py
python3 selftest.py --deep

The first command takes about five seconds and prints one PASS or FAIL line per check. It writes SELFTEST.json beside the script, or at the path in the environment variable COSMOFLOW_SELFTEST_OUT if set, and exits 0 only if every check passes. With --deep the script instead evaluates the triangle master $e_6$ with coarse settings and compares it with a stored reference value. A shortfall against that check's targets is recorded as SKIP and does not fail the run.

Letters of an arbitrary site graph. Run these from tools/, the directory that contains cosmoflow/. Sites are numbered from 0 and a repeated pair is a parallel edge:

python3 -m cosmoflow.alphabet graph --nv 4 --edges 0-1,1-2,2-3,3-0,0-2 --out boxdiag.json
python3 -m cosmoflow.alphabet graph --nv 2 --edges 0-1,0-1 --disc
python3 -m cosmoflow.alphabet tree 2
python3 -m cosmoflow.alphabet loop 3 --out triangle.json

The first graph is a four-site ring with one diagonal, a two-loop graph. With --out the JSON goes to the file and a one-line summary gives the letter and facet counts (33 facets here). The second is the one-loop bubble, two sites joined by two edges, with --disc attaching the discriminant block. For the two-site chain the five letters are X1 + Y, X2 + Y, X1 + X2, X1 - Y, X2 - Y, under the names l_EL, l_ER, l_ET, l_FL, l_FR.

The same call from Python:

from cosmoflow import alphabet_graph
alph = alphabet_graph(4, [(0, 1), (1, 2), (2, 3), (3, 0), (0, 2)])

alph['letters'] maps names to expressions in x1..x4 and the edge energies. q_g1 is x1 + y12 + y13 + y41 (site 1 with its three edges cut), and fold_g1 is its folded partner x1 - y12 - y13 - y41. Names containing del_ mark forms with a deleted loop edge and coefficient 2, and disc_y12 and its relatives are the bare cycle-edge energies. alph['first_entry'] lists the 33 facet forms.

The triangle and the two-site chain. From tools/:

python3 -m cosmoflow.cosmoflow build 3
python3 -m cosmoflow.cosmoflow maxcut 2 3/10 2

build 3 prints the expanded polynomial $B_3(y;X)$ in the symbols y1..y3, X1..X3. maxcut a lam c [dps] prints a one-line JSON object with the residue period at $(a,\lambda)=(2,3/10)$, $c=2$, to dps digits (default 80).

From Python, the same quantities the self-test checks:

from fractions import Fraction
from cosmoflow.examples.triangle import oracle, maxcut

v = oracle.F_twosite(2, 3, 1, eps=Fraction(-1, 4), dps=50, level=10)
r = oracle.F_twosite_certified(2, 3, 1, eps=0, which='F')
I = maxcut.period_residue(2, Fraction(3, 10), 2, dps=50)
ok = maxcut.prove_L2_varpi0_symbolic()

v is an mpmath number, $F(2,3,1;-1/4)$ at 50 working digits. r is a dictionary with value (a decimal string), certified_digits, level_agree and cross_dps_agree. F_twosite_certified repeats the computation at two precisions and two quadrature levels, and certified_digits counts only the digits on which all four runs agree. I is the residue period to 50 digits, and ok is True when sympy reduces $\mathcal L_2\varpi_0$ to zero.

Routines

Each command is run from tools/ as python3 -m followed by the entry in the table.

CommandWhat it does
cosmoflow.alphabet graph --nv N --edges u-v,u-v,...Candidate letters of any connected site graph, as JSON
cosmoflow.alphabet tree n_sThe same for the $n_s$-site chain
cosmoflow.alphabet loop n_sThe same for the one-loop $n_s$-gon, with the discriminant block
cosmoflow.cosmoflow build n_s$B$ for any $n_s$, printed as an expanded polynomial
cosmoflow.cosmoflow oracle key a lam c [dps]One triangle master integral, as one line of JSON
cosmoflow.cosmoflow maxcut a lam c [dps]The residue period of the triangle, as one line of JSON
cosmoflow.cosmoflow periods a lam$(\varpi_0,\varpi_1,k^2)$ of the triangle, as one line of JSON

The three alphabet commands take --out FILE, and --sites and --enames to rename the site and edge energies. --c C changes the coefficient of deleted loop edges, --disc attaches the discriminant block to graph, and --no-disc drops it from loop. The JSON has the fields name, graph (sites, edges, loop number, cycle edges), vars, letters, first_entry, sources, c and honesty, plus disc_kallen_baikov when the block is attached.

The functions in the first three rows are imported with from cosmoflow import .... The others belong to the worked example and are imported with from cosmoflow.examples.triangle import oracle, maxcut.

FunctionWhat it returns
alphabet_graph(nv, edges)The letters of any connected site graph; edges are 0-based (u, v) pairs, parallel edges allowed
alphabet_tree_chain(n_s), alphabet_loop_ngon(n_s)The same for the chain and the one-loop polygon, with the conventional variable names
baikov_B(n_s, y_list, X_list)$B(y;X)$ of the one-loop $n_s$-gon, with the base invariants ordered $X_{12},X_{13},\dots,X_{n-1,n}$
oracle.eval_master(n_s, key, a, lam, c)One triangle master (n_s=3, key from 'e1' to 'e9') or the two-site coefficient (n_s=2, key 'F', 'F0' or 'F1')
oracle.F_twosite(X1, X2, Y, eps=0)The two-site chain coefficient at the given $\epsilon$
oracle.F_twosite_certified(X1, X2, Y, eps=0, which='F')The same with a certified digit count; which='F1' gives the $\epsilon^1$ coefficient
maxcut.period_residue(a, lam, cq)The residue period of the elliptic sector
maxcut.K2_modulus(a, lam), maxcut.varpi0(a, lam), maxcut.varpi1(a, lam)The modulus $k^2$ and the periods $K(k^2)$, $K(1-k^2)$ over $\sqrt{1-(a+1)^2\lambda^2}$
maxcut.prove_L2_varpi0_symbolic()True if sympy reduces $\mathcal L_2\varpi_0$ to zero identically

alphabet_graph also takes the keywords c, site_names, edge_names and with_disc, the counterparts of the command-line options. eval_master also takes the keywords eps (the regulator) and dps (the working digits). It returns a 3-tuple that begins with the value and the estimated digits; with n_s=2 its three kinematic arguments are read as X1, X2, Y.

cosmoflow.examples.triangle.maxcut belongs to this example and is unrelated to the separate Maxcut package; import it by its full path. The lower-level names are listed in __init__.py and examples/triangle/__init__.py.

Used on this site

Requirements

Source and references

The code is tools/cosmoflow/ in the BootLoops repository. It is new code for the objects defined in the papers below, and it does not use the Mathematica notebooks that accompany arXiv:2312.05303. Cosmoflow is unrelated to CosmoFlow, the Python package of Werth, Pinol and Renaux-Petel for cosmological correlators (arXiv:2402.03693).

ReferenceWhat it supplies
Benincasa, Brunello, Mandal, Mastrolia and Vazão, "One-loop corrections to the Bunch-Davies wave function of the universe", arXiv:2408.16386The connected-subgraph denominators, the Cayley–Menger form of the measure, the nine triangle master integrals and $\mathcal L_2$
Arkani-Hamed, Baumann, Hillman, Joyce, Lee and Pimentel, arXiv:2312.05303; code: kinematic-flowThe two-site integral, its five letters and the closed form, eq. (3.42), used as a check
Arkani-Hamed, Benincasa and Postnikov, "Cosmological Polytopes and the Wavefunction of the Universe", arXiv:1709.02813The definition of the vertices of the cosmological polytope, used in the package's argument for $c=2$

← back to the tools index