API reference#

The full public surface of jaxpolylog lives in a single module, jaxpolylog.polylogs, and is re-exported through the top-level jaxpolylog package.

Top-level functions#

jax_polylog

jax_polylog_vmap(z, s, p_range[, approx, pval])

Description: Vectorized version of the polylogarithm function using JAX's vmap.

Numerical and algorithmic helpers#

Most users will only call jax_polylog() and jax_polylog_vmap(). The helpers below document the implementation choices behind the scenes – the exact Bernoulli construction of the "zero" expansion coefficients, the custom-JVP rule, and the small-\(|z|\)-safe form of \(\mathrm{Li}_1(z)/z\). They are surfaced here so that downstream authors can reason about precision and autodiff regimes without having to read the source.

polylogs._zero_branch_coeffs(s, P)

Precompute c[k] = ζ(s-k) / k! for k = 0..P-1.

polylogs._zeta_pos_int(n)

Riemann ζ(n) for integer n 2, fp64-precise.

polylogs._Li1_over_z_stable(z)

Li_1(z)/z = -log1p(-z)/z evaluated stably under nested autodiff.

polylogs._compute_pval_optimal()

Find the optimal transition parameter t* for the "patch" method.

polylogs._Li_over_z(z, s, p_range, approx, pval)

Description: Compute \(\mathrm{Li}_s(z)/z\) via a numerically stable evaluation that avoids dividing by z.

Optimal patch crossover#

_PVAL_OPTIMAL: float#

Convert a string or number to a floating-point number, if possible.

The unique positive solution of \(e^{-2\pi t} = t\), used as the default crossover between the "inf" and "zero" series in approx="patch". Approximately \(0.2322\). Precomputed once at import time by bisection.