Mirzakhani-style recursion for intersection numbers with exact rational arithmetic and parallelization.
pip install -e .Open notebooks/Intersection_Numbers_Tutorial.ipynb. It:
- Verifies the core API.
- Builds the normalized table
R_X(g,n,alpha)viaiterate(...). - Shows how to convert to intersection numbers
⟨τ_{d1}⋯τ_{dn}⟩_gusingx_from_rx(...). - Provides helper utilities to query arbitrary
(g, n, alpha)tuples.
import wp
# Fill cache up to a degree bound and return a dict { (g,n,alpha): Fraction }
rx = wp.iterate(dmax=6, cache_path="data/wp_rx.pkl", max_workers=None, fill_missing=True)
# Convert normalized value to the actual intersection number
from fractions import Fraction
g, n, alpha = 0, 4, (1,0,0,0)
X = wp.x_from_rx(g, n, alpha, rx[(g,n,tuple(sorted(alpha, reverse=True)))])
assert X == Fraction(1,1) # ⟨τ_1 τ_0^3⟩_0 = 1- Cache file defaults to
data/wp_rx.pkl