Baker’s genus-two addition formula

Baker’s addition formula expresses a sigma ratio using only two-index Kleinian P functions [Baker1907], Chapter V, p. 100. In modern notation it reads as follows; see also [BEH2005], equation (3.9):

\[\frac{\sigma(u+v)\,\sigma(u-v)}{\sigma(u)^2\,\sigma(v)^2} = \wp_{22}(u)\wp_{12}(v)-\wp_{12}(u)\wp_{22}(v) +\wp_{11}(v)-\wp_{11}(u).\]

Here \(u,v\in\mathbb{C}^2\) are arbitrary Abelian argument vectors, with \(\sigma(u)\sigma(v)\ne0\). They do not need to be constructed from curve points using Abel maps. This particular formula is for genus two; higher generapy have different addition formulae.

A compact calculation

We use the smooth hyperelliptic curve \(y^2=4x(x^2-1)(x^2-4)\). Its automatic holomorphic basis is \((dx/y,x\,dx/y)\). Passing the curve directly to ks and kp provides the periods, Riemann characteristic and, for sigma, the canonical hyperelliptic normalization. That normalization matters because a constant multiplier of sigma changes the ratio on the left.

Baker numbers the coordinates from one; Generapy numbers them from zero. Thus \(\wp_{11},\wp_{12},\wp_{22}\) correspond to (0, 0), (0, 1), (1, 1) respectively.

from mpmath import mp

from generapy import Curve
from generapy import kleinian_p as kp
from generapy import kleinian_sigma as ks


def documentation_example():
    """Return the two sides and their residual, evaluated at 30 digits."""
    with mp.workdps(30):
        # y² = 4x(x² - 1)(x² - 4) = 4x⁵ - 20x³ + 16x
        polynomial = {(0, 2): 1, (5, 0): -4, (3, 0): 20, (1, 0): -16}
        curve = Curve(polynomial)

        # Arbitrary vectors in C²; no points on the curve or Abel maps needed.
        u = mp.matrix([mp.mpf("0.3"), mp.mpf("0.2")])
        v = mp.matrix([mp.mpf("0.1"), mp.mpf("0.4")])

        lhs = ks(u + v, curve=curve) * ks(u - v, curve=curve) / (
            ks(u, curve=curve)**2 * ks(v, curve=curve)**2)

        # Baker's indices are one-based; Generapy's indices are zero-based.
        p11_u, p12_u, p22_u = kp(u, curve=curve, indices=((0, 0), (0, 1), (1, 1)))
        p11_v, p12_v, p22_v = kp(v, curve=curve, indices=((0, 0), (0, 1), (1, 1)))
        rhs = p22_u * p12_v - p12_u * p22_v + p11_v - p11_u

        residual = rhs - lhs
        assert abs(residual) < mp.mpf("1e-24"), "Baker addition formula failed"
        return lhs, rhs, residual

The same calculation is checked by the documentation:

>>> from examples.baker_formula.baker_formula_demo import documentation_example
>>> lhs, rhs, residual = documentation_example()
>>> abs(residual) < 1e-24
True

At 30 decimal digits, a representative run gives both sides approximately \(121.270036511\) and an absolute residual \(|\mathrm{RHS}-\mathrm{LHS}|\approx6.3\times10^{-29}\). The script enforces an absolute tolerance of \(10^{-24}\) for this pair of vectors; this is a numerical check of the identity at the selected arguments.

Run it from the repository root with:

python -m examples.baker_formula.baker_formula_demo