jaxpolylog.polylogs._compute_pval_optimal

jaxpolylog.polylogs._compute_pval_optimal#

_compute_pval_optimal() float[source]#

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

The "patch" method switches between two series expansions of Li_s(z):

  • “inf” series: Li_s(z) = Σ z^k / k^s, convergent for |z| < 1. After N terms the truncation error scales as |z|^N.

  • “zero” expansion: Laurent series in μ = log z around μ = 0 (z = 1), convergent for |μ| < . After N terms the error scales as (|μ|/(2π))^N = t^N where t = |μ|/(2π).

For real positive z < 1 both errors are equal when

\[|z|^N = t^N \;\Longrightarrow\; |z| = t \;\Longrightarrow\; e^{-|μ|} = \frac{|μ|}{2π} \;\Longrightarrow\; e^{-2πt} = t \,.\]

The unique positive solution of e^{-2πt} = t is computed here by bisection and stored as the module constant _PVAL_OPTIMAL ≈ 0.2322. This fixed point is independent of N (the p_range parameter), so the optimal crossover does not change with the number of series terms.

Returns:

float – Optimal transition parameter t* ≈ 0.2322.