Skip to main content

Hypra

Python tests Python quality

Native Python/SymPy hypergeometric epsilon expansions, inspired by HypExp 2.

Native HPL functionality is also informed by HPL 2.0. No Mathematica installation is required. Hypra is an academic partial native implementation, not yet a full replacement for HypExp/HPL. It computes exact symbolic coefficients using recurrence relations and preserves unevaluated HPL words. Unsupported cases fail explicitly; there is no silent external fallback.

What works now

The implementation now has general-purpose native components, rather than a list of hard-coded low-order answers:

  • Integer-base pF(p-1) with exact rational or guarded symbolic polynomial slopes: strict nested sums, contiguous parameter shifts, and finite-prefix/tail reindexing for moving negative upper bases. Moving singular lower parameters retain their poles.
  • Matched-half pF(p-1): equal counts of half-integer upper/lower parameters, colored strict sums and HPLs at sqrt(z), with integer-offset reductions.
  • Four canonical half-integer differential patterns, including unmatched and all-half families. Combined with the sum kernels, their canonical parameter-count coverage matches the HypExp 2 whitelist; this is not a claim of complete upstream API or analytic-continuation parity.
  • Exact terminating sums and convergent z=1 values for Gauss 2F1 and supported higher-rank integer and half-integer families. An explicit meromorphic mode continues supported unit endpoints in the parameters.
  • Exact definite logarithmic moments through beta_log_moment and hypergeometric_log_moment, including supported real mixed-log kernels.
  • HPL shuffle products, rational-HPL integration with a verified finite origin constant, exact local HPL series, shuffle logarithm extraction, convergent binary endpoints/MZVs, and branch-explicit negation/reflection transforms.

The default nonterminating interior domain is real 0 < z < 1. Use exact affine parameters and explicit nonzero assumptions for singular symbolic lower slopes. See the capability map for parameter families, principal complex domains and resource limits.

The complete expression may include Gamma functions, rational singular prefactors, products and sums. Pole-aware order planning expands each hypergeometric factor deeply enough before final Laurent truncation. Exact HPL serialization, differentiation, selected elementary reductions, cache, provenance, CLI and LaTeX output are included.

Start

cd ~/projects/hypra
uv sync
uv run hypra backend-info
uv run python scripts/validate.py --output-dir reports/local

Local development and documentation builds default to Python 3.15. The test matrix covers Python 3.12 through 3.15. Set UV_PYTHON=3.14 when running uv commands with Python 3.14. Only Python dependencies are installed.

import sympy as s
from hypra import expand_epsilon

eps, w = s.symbols("eps w")
P = s.hyper([1, -eps], [1 - 2*eps], w)
result = expand_epsilon(P, eps, through=2, assumptions=s.And(w > 0, w < 1))
print(result.expression)
# 1 + eps*log(1-w)
#   + eps**2*(-2*polylog(2,w)-log(1-w)**2/2) + O(eps**3)
print(result.latex())

through=k is inclusive and includes every Laurent pole term. For example, expand_epsilon(gamma(eps)*P, eps, through=2, assumptions=...) requests P one order deeper, through cubic order. result.polynomial excludes the remainder; result.coefficient(-1) gives the pole coefficient; result.to_dict() preserves exact ASTs and reproducibility metadata. sympy.sympify(result) includes the remainder.

HPL support

from hypra import HPL, encode_expr, decode_expr
from hypra.symbolic import reduce_known_hpl
h = HPL((0, 1, -1), w)
assert decode_expr(encode_expr(h)) == h
assert HPL.from_compressed((2, -1), w) == h
print(s.diff(h, w))
print(s.latex(h))

Expanded letters {-1,0,1} use kernels 1/(1+t), 1/t, 1/(1-t); H_1(z)=-log(1-z). Construction/serialization preserves words. Known-word reduction is explicit and does not claim arbitrary analytic continuation.

Additional native HPL operations include exact at-i values for low weights, explicit upper/lower real-cut numerical values, ordinary-point Taylor series, classical reduction of all 27 ternary cubic words, near-one power/log series, alternating endpoints, MZV/EulerSum stuffle products and explicitly named shuffle-regularization APIs. Each has documented domain/resource limits; regularized constants are never silently treated as ordinary finite limits. See the HPL 2 capability map for remaining gaps.

Validate and produce LaTeX

make check
make test PYTEST_ARGS='-k gamma'
uv run python scripts/validate.py --numeric --output-dir reports/local
uv run hypra expand examples/gamma_q_request.json \
  --output result.json --latex result.tex

The native validation runs the Python engine on P, Q and the complete J4 integrand, then uses five independently derived logarithmic moments to integrate its coefficients. The mathematical documentation proves the endpoint exchange for J4 specifically. This yields

[ J_4=2\zeta(3)\epsilon^2+\frac{11\pi^4}{60}\epsilon^3+O(\epsilon^4). ]

This is not a general symbolic integration engine. No expected coefficient is injected into the native algorithm. Numerical quadrature is secondary evidence.

See mathematics, its LaTeX source and compiled PDF. Runnable examples include examples/gamma_q_request.json and its actual native JSON/LaTeX outputs.

Boundaries

  • Nonterminating expansion kernels cover supported pF(p-1) families. General HPL reduction, unrestricted continuation and generic integration remain open. See the roadmap.
  • Hypergeometric arguments must be regulator-independent. The native engine handles z=0 directly and applies the documented convergence or continuation rules at z=1. For finite exact off-cut complex points, select NativeConfig(argument_domain="principal-cut-plane"). Unknown valuations and essential or fractional-power regulator singularities fail closed.
  • Use exact Rational values, never binary floats. Unknown functions, invalid identifiers and contradictory/unsupported domain assumptions are rejected.
  • NativeConfig(max_internal_order=12) is the default complexity limit; it can be raised explicitly. HPL word counts can grow exponentially. There is no claim that arbitrary large requests will be fast.
  • The optional external Wolfram comparison bridge is experimental, unverified and not needed. Its strict remainder checks reject upstream paths returning bare polynomials; it is not advertised as a working comparison oracle.

Upstream source and academic use

Official HypExp/HPL archives were retrieved into Git-ignored reference/upstream and inspected read-only. Source manifest and algorithm map record exact origins/hashes and translation priorities. The current native formulas are independently implemented mathematical algorithms with citations, not copied upstream tables. The CPC licence restricts redistribution of original or modified source; no upstream code is bundled or published. Review permission before publishing a direct translation. No project license or registry/trademark availability for the working name Hypra is claimed yet.

The NNLO project was read only and remains unchanged.

References: HypExp, HypExp 2.

HPL tools and bounded jobs

from hypra import (HPL, hpl_at_one, extract_hpl_logs, negate_hpl, reflect_hpl,
                   NativeConfig)

extract_hpl_logs(HPL((1, 0), w))
hpl_at_one((0, 0, 1))  # zeta(3)
reflect_hpl((0, 1), w, domain="0<z<1")
negate_hpl((1, 0), w, domain="0<z<1")
config = NativeConfig(timeout_seconds=30)  # killable backend process

Transformations use explicit domains and reject unsupported branches. General MZVs remain exact rather than being reduced with unverified tables. See HPL endpoints, log extraction, and argument transformations.

For numerical HPL values, hpl_evalf(word, z, dps=50) defaults to the real interval. Select domain="principal-disk" explicitly for complex points inside the slit unit disk. continue_hpl(word, z, domain="principal-cut-plane", path="radial", dps=50) continues numerically along the specified off-cut radial path; it reports propagated truncation and precision-stability diagnostics. These numerical diagnostics do not certify floating-point roundoff.

Browse the documentation locally

make docs-serve

Open http://127.0.0.1:8000/ on the same computer. The documentation includes locally bundled math rendering and works without external browser resources.

Build and version

Run make help for the available targets and make build to produce a wheel and source distribution in dist/. Use make bump-preview to see the available version changes. make bump-pre advances 0.1.0a0 to 0.1.0a1, while make bump-patch starts the next patch series at 0.1.1a0. Use make bump-release to promote a prerelease directly to its stable version. Bump targets update package metadata, the runtime version, expansion provenance, and uv.lock for review before committing with GitButler.

Metadata

Release files for hypra 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hypra 0.2.0
File Size Uploaded Provenance Actions
hypra-0.2.0.tar.gz 2.5 MB With provenance Details for hypra-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for hypra 0.2.0
File Interpreter ABI Platform Actions
hypra-0.2.0-py3-none-any.whl Python 3 none any Details for hypra-0.2.0-py3-none-any.whl

Total release size: 2.6 MB

Release files / hypra-0.2.0.tar.gz

Download URL hypra-0.2.0.tar.gz
Size 2.5 MB
Tags Source
SHA-256 checksum
How to use checksums
39b9460d5fe7704a8ddaea79a01c2a196df89dcacd988f94f0abc159c03a6efc
BLAKE2b-256 checksum
How to use checksums
a417cc23d52de62ce2455b5cbe3925f27288493c320b68e44e73c96efd21d59b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

Release files / hypra-0.2.0-py3-none-any.whl

Download URL hypra-0.2.0-py3-none-any.whl
Size 123.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7fb10d7ec65341a9a25bdfe8f7b5ef5a04a3d0e79e4a7b894b3bd13ec0a220f5
BLAKE2b-256 checksum
How to use checksums
fe0098f88b1c5aabfb442b377ccf57d7be1b233b78bd349e0a5ebcbda652ba2a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

Security for hypra 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for hypra-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page