Skip to main content

omnibias.difference.singularity

0.1.0a2AlphaPython >=3.10Apache-2.0

Finite-difference stencils, confluence limits, polynomial sequences, and scoped derivative-extraction certificates.

import omnibias.difference.singularity
Module contract & mathematical conventions

Jet-Padé singularity tracking (theory 03-10).

This is a diagnostic and an estimate, not a proof of blow-up. Jets come from the founding bias collapse (delta -> 0). Temperature collapse (beta -> inf, feasibility) does not appear. Do not conflate the two.

Shared formulas do not imply universal floating-point identity. Verify dtype, shape, derivative-order support, and the stated numerical assumptions for the path you use.

CLASS

BlowupFit​

omnibias.difference.singularity.BlowupFitSource ↗
class BlowupFit

Dataclass constructor fields; inherited fields, if any, are declared by the base class. A field(...) expression describes a default factory or field options, not a literal argument default.

The module contract describes the context for this operation. Its signature, explicit validation, return expressions, and implementation are recorded below.

Parameters

NameType & defaultContract
t_cdataclass fieldfloatRequiredSee the operation contract and implementation below.
gammadataclass fieldfloatRequiredSee the operation contract and implementation below.
prefactordataclass fieldfloatRequiredSee the operation contract and implementation below.
t_c_lodataclass fieldfloatRequiredSee the operation contract and implementation below.
t_c_hidataclass fieldfloatRequiredSee the operation contract and implementation below.

Fields & methods

t_cfield
t_c: float

Declared float field on BlowupFit. A value must be provided when constructing the configuration, unless an inherited constructor supplies it.

View source ↗
gammafield
gamma: float

Declared float field on BlowupFit. A value must be provided when constructing the configuration, unless an inherited constructor supplies it.

View source ↗
prefactorfield
prefactor: float

Declared float field on BlowupFit. A value must be provided when constructing the configuration, unless an inherited constructor supplies it.

View source ↗
t_c_lofield
t_c_lo: float

Declared float field on BlowupFit. A value must be provided when constructing the configuration, unless an inherited constructor supplies it.

View source ↗
t_c_hifield
t_c_hi: float

Declared float field on BlowupFit. A value must be provided when constructing the configuration, unless an inherited constructor supplies it.

View source ↗
Read the implementation
class BlowupFit:
    t_c: float
    gamma: float
    prefactor: float
    t_c_lo: float
    t_c_hi: float
Other public import paths
  • omnibias.difference.singularity.BlowupFit
  • omnibias.fields.singularity.BlowupFit
CONSTANT

DISCLAIMER​

omnibias.difference.singularity.DISCLAIMERSource ↗
DISCLAIMER = 'diagnostic and estimate; not a proof of blow-up'

This exported constant is defined by the expression above. Its exact value and annotation come from the pinned source; use it with the module contract.

Regression example · g6 disclaimer serialized

This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_g6_disclaimer_serialized() -> None:
    track = SingularityTrack((0.0,), (0.3 + 0.0j,), (1.0,), None)
    payload = track.to_payload()
    assert payload["disclaimer"] == DISCLAIMER
    assert honesty_payload()["blowup_proof"] is False
    assert honesty_payload()["ns_regularity"] is False
python -m pytest packages/omnibias-difference/tests/test_singularity_tracking.py -k test_g6_disclaimer_serialized -q
Regression example · fields reexport disclaimer

This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_fields_reexport_disclaimer() -> None:
    from omnibias.fields.singularity import DISCLAIMER, honesty_payload, track_singularity

    rows = ((1.0, 2.0, 4.0, 8.0),)
    track = track_singularity(rows, (0.0,), method="pade")
    assert track.disclaimer == DISCLAIMER
    assert honesty_payload()["blowup_proof"] is False
python -m pytest packages/omnibias-fields/tests/test_singularity.py -k test_fields_reexport_disclaimer -q
Read the implementation
DISCLAIMER = "diagnostic and estimate; not a proof of blow-up"
Other public import paths
  • omnibias.difference.singularity.DISCLAIMER
  • omnibias.fields.singularity.DISCLAIMER
CONSTANT

FROISSART_REL​

omnibias.difference.singularity.FROISSART_RELSource ↗
FROISSART_REL = 1e-08

Froissart doublets are pole-zero pairs at machine scale (Weinstein-Saff). 1e-8 is ~45 ulps at unit scale, independent of the recovery suite.

Regression example · froissart threshold justified

This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_froissart_threshold_justified() -> None:
    assert FROISSART_REL == 1e-8
    poles = pade_singularities(_geom(2.0, 4), numer_deg=0, denom_deg=1)
    assert len(poles) == 1
    assert abs(poles[0] - 0.5) < 1e-9
python -m pytest packages/omnibias-difference/tests/test_singularity_tracking.py -k test_froissart_threshold_justified -q
Read the implementation
FROISSART_REL = 1e-8
CLASS

SingularityEstimate​

omnibias.difference.singularity.SingularityEstimateSource ↗
class SingularityEstimate

Dataclass constructor fields; inherited fields, if any, are declared by the base class. A field(...) expression describes a default factory or field options, not a literal argument default.

The module contract describes the context for this operation. Its signature, explicit validation, return expressions, and implementation are recorded below.

Parameters

NameType & defaultContract
locationdataclass fieldcomplex | NoneRequiredSee the operation contract and implementation below.
exponentdataclass fieldfloat | NoneRequiredSee the operation contract and implementation below.
methoddataclass fieldLiteral['domb_sykes', 'pade', 'both', 'failed']RequiredSee the operation contract and implementation below.
residualdataclass fieldfloatRequiredSee the operation contract and implementation below.
enclosuredataclass fieldInterval | NoneRequiredSee the operation contract and implementation below.
faileddataclass fieldboolDefault: FalseSee the operation contract and implementation below.
reasondataclass fieldstrDefault: ''See the operation contract and implementation below.

Fields & methods

locationfield
location: complex | None

Declared complex | None field on SingularityEstimate. A value must be provided when constructing the configuration, unless an inherited constructor supplies it.

View source ↗
exponentfield
exponent: float | None

Declared float | None field on SingularityEstimate. A value must be provided when constructing the configuration, unless an inherited constructor supplies it.

View source ↗
methodfield
method: Literal['domb_sykes', 'pade', 'both', 'failed']

Declared Literal['domb_sykes', 'pade', 'both', 'failed'] field on SingularityEstimate. A value must be provided when constructing the configuration, unless an inherited constructor supplies it.

View source ↗
residualfield
residual: float

Declared float field on SingularityEstimate. A value must be provided when constructing the configuration, unless an inherited constructor supplies it.

View source ↗
enclosurefield
enclosure: Interval | None

Declared Interval | None field on SingularityEstimate. A value must be provided when constructing the configuration, unless an inherited constructor supplies it.

View source ↗
failedfield
failed: bool = False

Declared bool field on SingularityEstimate. Default expression: False.

View source ↗
reasonfield
reason: str = ''

Declared str field on SingularityEstimate. Default expression: ''.

View source ↗
Read the implementation
class SingularityEstimate:
    location: complex | None
    exponent: float | None
    method: Literal["domb_sykes", "pade", "both", "failed"]
    residual: float
    enclosure: Interval | None
    failed: bool = False
    reason: str = ""
Other public import paths
  • omnibias.difference.singularity.SingularityEstimate
  • omnibias.fields.singularity.SingularityEstimate
CLASS

SingularityTrack​

omnibias.difference.singularity.SingularityTrackSource ↗
class SingularityTrack

Dataclass constructor fields; inherited fields, if any, are declared by the base class. A field(...) expression describes a default factory or field options, not a literal argument default.

The module contract describes the context for this operation. Its signature, explicit validation, return expressions, and implementation are recorded below.

Parameters

NameType & defaultContract
timesdataclass fieldtuple[float, ...]RequiredSee the operation contract and implementation below.
locationsdataclass fieldtuple[complex, ...]RequiredSee the operation contract and implementation below.
exponentsdataclass fieldtuple[float, ...]RequiredSee the operation contract and implementation below.
blowup_fitdataclass fieldBlowupFit | NoneRequiredSee the operation contract and implementation below.
disclaimerdataclass fieldstrDefault: DISCLAIMERSee the operation contract and implementation below.
Executed regression · g6 disclaimer serialized

Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_g6_disclaimer_serialized() -> None:
    track = SingularityTrack((0.0,), (0.3 + 0.0j,), (1.0,), None)
    payload = track.to_payload()
    assert payload["disclaimer"] == DISCLAIMER
    assert honesty_payload()["blowup_proof"] is False
    assert honesty_payload()["ns_regularity"] is False
python -m pytest "packages/omnibias-difference/tests/test_singularity_tracking.py::test_g6_disclaimer_serialized" -q
Regression example · g5 tracking

This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_g5_tracking() -> None:
    times = (0.0, 0.2, 0.4, 0.6)
    rows = []
    for t in times:
        zs = 0.2 + 0.1j * (1.0 - t)
        rows.append(tuple(zs ** (-(k + 1)) for k in range(8)))
    track = track_singularity(rows, times, method="domb_sykes")
    assert track.disclaimer == DISCLAIMER
    assert track.blowup_fit is not None
    assert abs(track.blowup_fit.t_c - 1.0) / 1.0 <= 0.01
    assert track.blowup_fit.t_c_lo <= 1.0 <= track.blowup_fit.t_c_hi
python -m pytest packages/omnibias-difference/tests/test_singularity_tracking.py -k test_g5_tracking -q

Fields & methods

timesfield
times: tuple[float, ...]

Declared tuple[float, ...] field on SingularityTrack. A value must be provided when constructing the configuration, unless an inherited constructor supplies it.

View source ↗
locationsfield
locations: tuple[complex, ...]

Declared tuple[complex, ...] field on SingularityTrack. A value must be provided when constructing the configuration, unless an inherited constructor supplies it.

View source ↗
exponentsfield
exponents: tuple[float, ...]

Declared tuple[float, ...] field on SingularityTrack. A value must be provided when constructing the configuration, unless an inherited constructor supplies it.

View source ↗
blowup_fitfield
blowup_fit: BlowupFit | None

Declared BlowupFit | None field on SingularityTrack. A value must be provided when constructing the configuration, unless an inherited constructor supplies it.

Regression example · g5 tracking

This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_g5_tracking() -> None:
    times = (0.0, 0.2, 0.4, 0.6)
    rows = []
    for t in times:
        zs = 0.2 + 0.1j * (1.0 - t)
        rows.append(tuple(zs ** (-(k + 1)) for k in range(8)))
    track = track_singularity(rows, times, method="domb_sykes")
    assert track.disclaimer == DISCLAIMER
    assert track.blowup_fit is not None
    assert abs(track.blowup_fit.t_c - 1.0) / 1.0 <= 0.01
    assert track.blowup_fit.t_c_lo <= 1.0 <= track.blowup_fit.t_c_hi
python -m pytest packages/omnibias-difference/tests/test_singularity_tracking.py -k test_g5_tracking -q
View source ↗
disclaimerfield
disclaimer: str = DISCLAIMER

Declared str field on SingularityTrack. Default expression: DISCLAIMER.

Regression example · g5 tracking

This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_g5_tracking() -> None:
    times = (0.0, 0.2, 0.4, 0.6)
    rows = []
    for t in times:
        zs = 0.2 + 0.1j * (1.0 - t)
        rows.append(tuple(zs ** (-(k + 1)) for k in range(8)))
    track = track_singularity(rows, times, method="domb_sykes")
    assert track.disclaimer == DISCLAIMER
    assert track.blowup_fit is not None
    assert abs(track.blowup_fit.t_c - 1.0) / 1.0 <= 0.01
    assert track.blowup_fit.t_c_lo <= 1.0 <= track.blowup_fit.t_c_hi
python -m pytest packages/omnibias-difference/tests/test_singularity_tracking.py -k test_g5_tracking -q
View source ↗
to_payloadmethod
to_payload(self) -> dict[str, object]

See the class contract above and the exact method implementation below.

Returns: dict[str, object]

Executed regression · g6 disclaimer serialized

Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_g6_disclaimer_serialized() -> None:
    track = SingularityTrack((0.0,), (0.3 + 0.0j,), (1.0,), None)
    payload = track.to_payload()
    assert payload["disclaimer"] == DISCLAIMER
    assert honesty_payload()["blowup_proof"] is False
    assert honesty_payload()["ns_regularity"] is False
python -m pytest "packages/omnibias-difference/tests/test_singularity_tracking.py::test_g6_disclaimer_serialized" -q
Method implementation
    def to_payload(self) -> dict[str, object]:
        return {
            "times": list(self.times),
            "locations": [[z.real, z.imag] for z in self.locations],
            "exponents": list(self.exponents),
            "blowup_fit": None
            if self.blowup_fit is None
            else {
                "t_c": self.blowup_fit.t_c,
                "gamma": self.blowup_fit.gamma,
                "prefactor": self.blowup_fit.prefactor,
                "t_c_lo": self.blowup_fit.t_c_lo,
                "t_c_hi": self.blowup_fit.t_c_hi,
            },
            "disclaimer": self.disclaimer,
        }
View source ↗
Read the implementation
class SingularityTrack:
    times: tuple[float, ...]
    locations: tuple[complex, ...]
    exponents: tuple[float, ...]
    blowup_fit: BlowupFit | None
    disclaimer: str = DISCLAIMER

    def to_payload(self) -> dict[str, object]:
        return {
            "times": list(self.times),
            "locations": [[z.real, z.imag] for z in self.locations],
            "exponents": list(self.exponents),
            "blowup_fit": None
            if self.blowup_fit is None
            else {
                "t_c": self.blowup_fit.t_c,
                "gamma": self.blowup_fit.gamma,
                "prefactor": self.blowup_fit.prefactor,
                "t_c_lo": self.blowup_fit.t_c_lo,
                "t_c_hi": self.blowup_fit.t_c_hi,
            },
            "disclaimer": self.disclaimer,
        }
Other public import paths
  • omnibias.difference.singularity.SingularityTrack
  • omnibias.fields.singularity.SingularityTrack
FUNCTION

agreement​

omnibias.difference.singularity.agreementSource ↗
agreement(a: SingularityEstimate, b: SingularityEstimate) -> float

Relative location disagreement. inf if either method failed.

Parameters

NameType & defaultContract
apositional-or-keywordSingularityEstimateRequiredSee the operation contract and implementation below.
bpositional-or-keywordSingularityEstimateRequiredSee the operation contract and implementation below.
Returnsfloat
Executed regression · g4 agreement and hard case

Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_g4_agreement_and_hard_case() -> None:
    c = _geom(10.0 / 3.0, 6)
    gap = agreement(domb_sykes(c), pade_estimate(c, numer_deg=0, denom_deg=1))
    assert gap <= 1e-8
    two = tuple((10.0 / 3.0) ** k + ((-10.0 / 3.0) ** k) for k in range(8))
    ds = domb_sykes(two)
    pd = pade_estimate(two, numer_deg=1, denom_deg=2)
    assert agreement(ds, pd) == pytest.approx(float("inf")) or ds.failed or (
        pd.location is not None and ds.location is not None and agreement(ds, pd) > 0.05
    )
python -m pytest "packages/omnibias-difference/tests/test_singularity_tracking.py::test_g4_agreement_and_hard_case" -q
Read the implementation
def agreement(a: SingularityEstimate, b: SingularityEstimate) -> float:
    """Relative location disagreement. ``inf`` if either method failed."""
    if a.failed or b.failed or a.location is None or b.location is None:
        return math.inf
    denom = max(abs(a.location), abs(b.location), 1e-16)
    return abs(a.location - b.location) / denom
FUNCTION

both_estimates​

omnibias.difference.singularity.both_estimatesSource ↗
both_estimates(coeffs: Sequence[complex | float], *, numer_deg: int=0, denom_deg: int=1) -> SingularityEstimate

The module contract describes the context for this operation. Its signature, explicit validation, return expressions, and implementation are recorded below.

Parameters

NameType & defaultContract
coeffspositional-or-keywordSequence[complex | float]RequiredSee the operation contract and implementation below.
numer_degkeyword-onlyintDefault: 0See the operation contract and implementation below.
denom_degkeyword-onlyintDefault: 1See the operation contract and implementation below.
ReturnsSingularityEstimate
Read the implementation
def both_estimates(
    coeffs: Sequence[complex | float], *, numer_deg: int = 0, denom_deg: int = 1
) -> SingularityEstimate:
    ds = domb_sykes(coeffs)
    pd = pade_estimate(coeffs, numer_deg=numer_deg, denom_deg=denom_deg)
    if ds.failed and pd.failed:
        return SingularityEstimate(None, None, "failed", math.inf, None, True, "both_failed")
    if ds.failed:
        return pd
    if pd.failed:
        return ds
    gap = agreement(ds, pd)
    if gap > 0.05:
        return SingularityEstimate(None, None, "failed", gap, None, True, "methods_disagree")
    loc = 0.5 * (ds.location + pd.location)  # type: ignore[operator]
    exp = ds.exponent
    return SingularityEstimate(loc, exp, "both", gap, None, False, "")
FUNCTION

certified_singularity_annulus​

omnibias.difference.singularity.certified_singularity_annulusSource ↗
certified_singularity_annulus(coeffs: Sequence[Interval | float], *, tail_bound: Interval, tail_ratio: float) -> Interval

Legacy name for convergence_radius_from_geometric_tail.

The upper endpoint is now ALWAYS infinity. Older releases incorrectly inferred a finite upper radius from a finite prefix. Consumers requiring singularity existence must provide a separate infinite-tail argument.

Parameters

NameType & defaultContract
coeffspositional-or-keywordSequence[Interval | float]RequiredSee the operation contract and implementation below.
tail_boundkeyword-onlyIntervalRequiredSee the operation contract and implementation below.
tail_ratiokeyword-onlyfloatRequiredSee the operation contract and implementation below.
ReturnsInterval
Executed regression · g2 annulus sound

Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_g2_annulus_sound() -> None:
    for rho in (2.0, 3.0, 4.0, 5.0):
        xs = 1.0 / rho
        c = [Interval.from_value(rho**k) for k in range(8)]
        enc = certified_singularity_annulus(c, tail_bound=Interval.point(1.0), tail_ratio=rho)
        assert enc.lo <= xs <= enc.hi
        assert enc.hi == float("inf")
python -m pytest "packages/omnibias-difference/tests/test_singularity_tracking.py::test_g2_annulus_sound" -q
Regression example · polynomial prefix never proves a finite singularity radius

This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_polynomial_prefix_never_proves_a_finite_singularity_radius() -> None:
    for coefficients in ((1.0, 1.0), (1.0, 1.0, 0.0, 0.0, 0.0)):
        for api in (certified_singularity_annulus, convergence_radius_from_geometric_tail):
            radius = api(coefficients, tail_bound=Interval.point(0), tail_ratio=0.5)
            assert radius.lo == radius.hi == float("inf")
            loose = api(coefficients, tail_bound=Interval.point(1), tail_ratio=0.5)
            assert loose.lo <= 2 and loose.hi == float("inf")
python -m pytest packages/omnibias-difference/tests/test_singularity_tracking.py -k test_polynomial_prefix_never_proves_a_finite_singularity_radius -q
Read the implementation
def certified_singularity_annulus(
    coeffs: Sequence[Interval | float],
    *,
    tail_bound: Interval,
    tail_ratio: float,
) -> Interval:
    """Legacy name for :func:`convergence_radius_from_geometric_tail`.

    The upper endpoint is now ALWAYS infinity. Older releases incorrectly
    inferred a finite upper radius from a finite prefix. Consumers requiring
    singularity existence must provide a separate infinite-tail argument.
    """
    return convergence_radius_from_geometric_tail(
        coeffs, tail_bound=tail_bound, tail_ratio=tail_ratio
    )
FUNCTION

convergence_radius_from_geometric_tail​

omnibias.difference.singularity.convergence_radius_from_geometric_tailSource ↗
convergence_radius_from_geometric_tail(coeffs: Sequence[Interval | float], *, tail_bound: Interval, tail_ratio: float) -> Interval

Enclose the convergence radius in [1/q, +inf] from an upper tail.

The caller must establish |a_k| <= M*q**k for EVERY k >= len(coeffs), where M=tail_bound.hi is finite and q=tail_ratio > 0. This is an infinite-tail mathematical contract, not a conclusion from the finite coefficients. Cauchy-Hadamard gives limsup |a_k|**(1/k) <= q, hence radius R >= 1/q.

If M=0, the declared series is a polynomial and [+inf,+inf] is returned. No finite prefix can supply a positive LOWER limsup bound: polynomial and entire continuations have the same prefix. Therefore this API never supplies a finite upper radius or proves a singularity exists. coeffs validates the declared finite prefix; it does not tighten this asymptotic bound.

Parameters

NameType & defaultContract
coeffspositional-or-keywordSequence[Interval | float]RequiredSee the operation contract and implementation below.
tail_boundkeyword-onlyIntervalRequiredSee the operation contract and implementation below.
tail_ratiokeyword-onlyfloatRequiredSee the operation contract and implementation below.
ReturnsInterval
Explicit validation & failure cases
  • When not math.isfinite(tail_ratio) or tail_ratio <= 0.0, raises ValueError('tail_ratio must be positive and finite').
  • When tail_bound.lo < 0.0 or not math.isfinite(tail_bound.hi), raises ValueError('tail_bound must be nonnegative and finite').
  • When len(ivs) < 2, raises ValueError('need at least two coefficients').
  • When any((not math.isfinite(iv.lo) or not math.isfinite(iv.hi) for iv in ivs)), raises ValueError('finite prefix coefficients required').

These are explicit source guards. Backend operations may also raise for invalid shapes, dtypes, or unsupported devices.

Executed regression · radius rejects invalid geometric ratio

Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_radius_rejects_invalid_geometric_ratio(ratio) -> None:
    with pytest.raises(ValueError):
        convergence_radius_from_geometric_tail((1., 1.), tail_bound=Interval.point(1), tail_ratio=ratio)
python -m pytest "packages/omnibias-difference/tests/test_singularity_tracking.py::test_radius_rejects_invalid_geometric_ratio[-1.0]" -q
Regression example · radius rejects invalid prefix or tail contract

This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_radius_rejects_invalid_prefix_or_tail_contract() -> None:
    for tail in (Interval(-1, 1), Interval(0, float("inf"))):
        with pytest.raises(ValueError):
            convergence_radius_from_geometric_tail((1., 1.), tail_bound=tail, tail_ratio=1)
    with pytest.raises(ValueError):
        convergence_radius_from_geometric_tail((1., float("inf")), tail_bound=Interval.point(1), tail_ratio=1)
python -m pytest packages/omnibias-difference/tests/test_singularity_tracking.py -k test_radius_rejects_invalid_prefix_or_tail_contract -q
Read the implementation
def convergence_radius_from_geometric_tail(
    coeffs: Sequence[Interval | float],
    *,
    tail_bound: Interval,
    tail_ratio: float,
) -> Interval:
    r"""Enclose the convergence radius in ``[1/q, +inf]`` from an upper tail.

    The caller must establish ``|a_k| <= M*q**k`` for EVERY
    ``k >= len(coeffs)``, where ``M=tail_bound.hi`` is finite and
    ``q=tail_ratio > 0``. This is an infinite-tail mathematical contract,
    not a conclusion from the finite coefficients. Cauchy-Hadamard gives
    ``limsup |a_k|**(1/k) <= q``, hence radius ``R >= 1/q``.

    If ``M=0``, the declared series is a polynomial and ``[+inf,+inf]``
    is returned. No finite prefix can supply a positive LOWER limsup
    bound: polynomial and entire continuations have the same prefix.
    Therefore this API never supplies a finite upper radius or proves a
    singularity exists. ``coeffs`` validates the declared finite prefix;
    it does not tighten this asymptotic bound.
    """
    if not math.isfinite(tail_ratio) or tail_ratio <= 0.0:
        raise ValueError("tail_ratio must be positive and finite")
    if tail_bound.lo < 0.0 or not math.isfinite(tail_bound.hi):
        raise ValueError("tail_bound must be nonnegative and finite")
    ivs = [c if isinstance(c, Interval) else Interval.from_value(c) for c in coeffs]
    if len(ivs) < 2:
        raise ValueError("need at least two coefficients")
    if any(not math.isfinite(iv.lo) or not math.isfinite(iv.hi) for iv in ivs):
        raise ValueError("finite prefix coefficients required")
    if tail_bound.hi == 0.0:
        return Interval(inf, inf)
    return Interval(max(0.0, Interval.point(tail_ratio).reciprocal().lo), inf)
FUNCTION

domb_sykes​

omnibias.difference.singularity.domb_sykesSource ↗
domb_sykes(coeffs: Sequence[complex | float], *, drop_first: int=1) -> SingularityEstimate

Linear fit of a_k / a_{k-1} against 1/k. Failure is first-class.

Parameters

NameType & defaultContract
coeffspositional-or-keywordSequence[complex | float]RequiredSee the operation contract and implementation below.
drop_firstkeyword-onlyintDefault: 1See the operation contract and implementation below.
ReturnsSingularityEstimate
Executed regression · worked pole

Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_worked_pole() -> None:
    c = _geom(10.0 / 3.0, 4)
    ds = domb_sykes(c, drop_first=1)
    assert not ds.failed
    assert ds.location is not None
    assert abs(ds.location.real - 0.3) < 1e-9
    assert abs((ds.exponent or 0.0) - 1.0) < 1e-9
    pd = pade_estimate(c, numer_deg=0, denom_deg=1)
    assert pd.location is not None
    assert abs(pd.location.real - 0.3) < 1e-9
python -m pytest "packages/omnibias-difference/tests/test_singularity_tracking.py::test_worked_pole" -q
Regression example · g4 agreement and hard case

This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_g4_agreement_and_hard_case() -> None:
    c = _geom(10.0 / 3.0, 6)
    gap = agreement(domb_sykes(c), pade_estimate(c, numer_deg=0, denom_deg=1))
    assert gap <= 1e-8
    two = tuple((10.0 / 3.0) ** k + ((-10.0 / 3.0) ** k) for k in range(8))
    ds = domb_sykes(two)
    pd = pade_estimate(two, numer_deg=1, denom_deg=2)
    assert agreement(ds, pd) == pytest.approx(float("inf")) or ds.failed or (
        pd.location is not None and ds.location is not None and agreement(ds, pd) > 0.05
    )
python -m pytest packages/omnibias-difference/tests/test_singularity_tracking.py -k test_g4_agreement_and_hard_case -q
Read the implementation
def domb_sykes(coeffs: Sequence[complex | float], *, drop_first: int = 1) -> SingularityEstimate:
    """Linear fit of ``a_k / a_{k-1}`` against ``1/k``. Failure is first-class."""
    c = _as_float(coeffs)
    xs: list[float] = []
    ys: list[complex] = []
    start = max(int(drop_first), 1)
    for k in range(start, len(c)):
        prev = c[k - 1]
        if abs(prev) <= 1e-30:
            return SingularityEstimate(None, None, "failed", math.inf, None, True, "vanishing_coefficient")
        ratio = c[k] / prev
        xs.append(1.0 / float(k))
        ys.append(ratio)
    if len(xs) < 3:
        return SingularityEstimate(None, None, "failed", math.inf, None, True, "too_few_ratios")
    slope_r, intercept_r, resid_r = _linfit(xs, [z.real for z in ys])
    slope_i, intercept_i, resid_i = _linfit(xs, [z.imag for z in ys])
    intercept = complex(intercept_r, intercept_i)
    resid = math.hypot(resid_r, resid_i)
    scale = max(abs(intercept), 1.0)
    if abs(intercept) < 1e-8:
        return SingularityEstimate(None, None, "failed", resid, None, True, "essential_or_infinite_radius")
    if resid / scale > 0.05:
        return SingularityEstimate(None, None, "failed", resid, None, True, "not_single_algebraic")
    xs_loc = 1.0 / intercept
    exponent = 1.0 + complex(slope_r, slope_i) * xs_loc
    return SingularityEstimate(xs_loc, float(exponent.real), "domb_sykes", float(resid), None, False, "")
FUNCTION

fit_blowup​

omnibias.difference.singularity.fit_blowupSource ↗
fit_blowup(times: Sequence[float], locations: Sequence[complex]) -> BlowupFit | None

Linear fit of |Im x_s(t)| ~ C (t_c - t). Uncertainty is the residual band.

Parameters

NameType & defaultContract
timespositional-or-keywordSequence[float]RequiredSee the operation contract and implementation below.
locationspositional-or-keywordSequence[complex]RequiredSee the operation contract and implementation below.
ReturnsBlowupFit | None
Executed regression · g5 tracking

Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_g5_tracking() -> None:
    times = (0.0, 0.2, 0.4, 0.6)
    rows = []
    for t in times:
        zs = 0.2 + 0.1j * (1.0 - t)
        rows.append(tuple(zs ** (-(k + 1)) for k in range(8)))
    track = track_singularity(rows, times, method="domb_sykes")
    assert track.disclaimer == DISCLAIMER
    assert track.blowup_fit is not None
    assert abs(track.blowup_fit.t_c - 1.0) / 1.0 <= 0.01
    assert track.blowup_fit.t_c_lo <= 1.0 <= track.blowup_fit.t_c_hi
python -m pytest "packages/omnibias-difference/tests/test_singularity_tracking.py::test_g5_tracking" -q
Read the implementation
def fit_blowup(times: Sequence[float], locations: Sequence[complex]) -> BlowupFit | None:
    """Linear fit of ``|Im x_s(t)| ~ C (t_c - t)``. Uncertainty is the residual band."""
    ts = [float(t) for t in times]
    ims = [abs(complex(z).imag) for z in locations]
    if len(ts) < 3 or min(ims) <= 0.0:
        return None
    slope, intercept, resid = _linfit(ts, ims)
    if abs(slope) < 1e-14:
        return None
    t_c = -intercept / slope
    # Im = slope * t + intercept = (-C) t + C t_c with C = -slope when approaching 0.
    prefactor = -slope if slope < 0.0 else abs(slope)
    width = max(3.0 * resid / max(prefactor, 1e-16), 1e-6)
    return BlowupFit(float(t_c), 1.0, float(prefactor), float(t_c - width), float(t_c + width))
FUNCTION

honesty_payload​

omnibias.difference.singularity.honesty_payloadSource ↗
honesty_payload() -> dict[str, object]

The module contract describes the context for this operation. Its signature, explicit validation, return expressions, and implementation are recorded below.

Returnsdict[str, object]
Executed regression · g6 disclaimer serialized

Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_g6_disclaimer_serialized() -> None:
    track = SingularityTrack((0.0,), (0.3 + 0.0j,), (1.0,), None)
    payload = track.to_payload()
    assert payload["disclaimer"] == DISCLAIMER
    assert honesty_payload()["blowup_proof"] is False
    assert honesty_payload()["ns_regularity"] is False
python -m pytest "packages/omnibias-difference/tests/test_singularity_tracking.py::test_g6_disclaimer_serialized" -q
Regression example · fields reexport disclaimer

This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_fields_reexport_disclaimer() -> None:
    from omnibias.fields.singularity import DISCLAIMER, honesty_payload, track_singularity

    rows = ((1.0, 2.0, 4.0, 8.0),)
    track = track_singularity(rows, (0.0,), method="pade")
    assert track.disclaimer == DISCLAIMER
    assert honesty_payload()["blowup_proof"] is False
python -m pytest packages/omnibias-fields/tests/test_singularity.py -k test_fields_reexport_disclaimer -q
Read the implementation
def honesty_payload() -> dict[str, object]:
    return {
        "blowup_proof": False,
        "diagnostic": True,
        "disclaimer": DISCLAIMER,
        "founding_bias_collapse": True,
        "temperature_collapse": False,
        "ns_regularity": False,
        "order_ceiling_float64": 20,
    }
Other public import paths
  • omnibias.difference.singularity.honesty_payload
  • omnibias.fields.singularity.honesty_payload
FUNCTION

pade_estimate​

omnibias.difference.singularity.pade_estimateSource ↗
pade_estimate(coeffs: Sequence[complex | float], *, numer_deg: int, denom_deg: int) -> SingularityEstimate

The module contract describes the context for this operation. Its signature, explicit validation, return expressions, and implementation are recorded below.

Parameters

NameType & defaultContract
coeffspositional-or-keywordSequence[complex | float]RequiredSee the operation contract and implementation below.
numer_degkeyword-onlyintRequiredSee the operation contract and implementation below.
denom_degkeyword-onlyintRequiredSee the operation contract and implementation below.
ReturnsSingularityEstimate
Executed regression · fields reexport disclaimer

Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_fields_reexport_disclaimer() -> None:
    from omnibias.fields.singularity import DISCLAIMER, honesty_payload, track_singularity

    rows = ((1.0, 2.0, 4.0, 8.0),)
    track = track_singularity(rows, (0.0,), method="pade")
    assert track.disclaimer == DISCLAIMER
    assert honesty_payload()["blowup_proof"] is False
python -m pytest "packages/omnibias-fields/tests/test_singularity.py::test_fields_reexport_disclaimer" -q
Regression example · worked pole

This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_worked_pole() -> None:
    c = _geom(10.0 / 3.0, 4)
    ds = domb_sykes(c, drop_first=1)
    assert not ds.failed
    assert ds.location is not None
    assert abs(ds.location.real - 0.3) < 1e-9
    assert abs((ds.exponent or 0.0) - 1.0) < 1e-9
    pd = pade_estimate(c, numer_deg=0, denom_deg=1)
    assert pd.location is not None
    assert abs(pd.location.real - 0.3) < 1e-9
python -m pytest packages/omnibias-difference/tests/test_singularity_tracking.py -k test_worked_pole -q
Read the implementation
def pade_estimate(coeffs: Sequence[complex | float], *, numer_deg: int, denom_deg: int) -> SingularityEstimate:
    poles = pade_singularities(coeffs, numer_deg=numer_deg, denom_deg=denom_deg)
    if not poles:
        return SingularityEstimate(None, None, "failed", math.inf, None, True, "no_stable_pole")
    loc = min(poles, key=abs)
    return SingularityEstimate(loc, None, "pade", 0.0, None, False, "")
FUNCTION

pade_singularities​

omnibias.difference.singularity.pade_singularitiesSource ↗
pade_singularities(coeffs: Sequence[complex | float], *, numer_deg: int, denom_deg: int) -> tuple[complex, ...]

Denominator roots of [L/M] after a justified Froissart filter.

Parameters

NameType & defaultContract
coeffspositional-or-keywordSequence[complex | float]RequiredSee the operation contract and implementation below.
numer_degkeyword-onlyintRequiredSee the operation contract and implementation below.
denom_degkeyword-onlyintRequiredSee the operation contract and implementation below.
Returnstuple[complex, ...]
Explicit validation & failure cases
  • When abs(z.imag) > 1e-14 * max(1.0, abs(z.real)), raises ValueError('pade_singularities expects real Taylor coefficients').

These are explicit source guards. Backend operations may also raise for invalid shapes, dtypes, or unsupported devices.

Executed regression · froissart threshold justified

Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_froissart_threshold_justified() -> None:
    assert FROISSART_REL == 1e-8
    poles = pade_singularities(_geom(2.0, 4), numer_deg=0, denom_deg=1)
    assert len(poles) == 1
    assert abs(poles[0] - 0.5) < 1e-9
python -m pytest "packages/omnibias-difference/tests/test_singularity_tracking.py::test_froissart_threshold_justified" -q
Read the implementation
def pade_singularities(
    coeffs: Sequence[complex | float],
    *,
    numer_deg: int,
    denom_deg: int,
) -> tuple[complex, ...]:
    """Denominator roots of ``[L/M]`` after a justified Froissart filter."""
    fracs: list[Fraction] = []
    for c in coeffs:
        z = complex(c)
        if abs(z.imag) > 1e-14 * max(1.0, abs(z.real)):
            raise ValueError("pade_singularities expects real Taylor coefficients")
        fracs.append(Fraction(z.real).limit_denominator(10**12))
    numer, denom = pade_approximant(fracs, int(numer_deg), int(denom_deg))
    poles = _polynomial_roots([complex(q) for q in denom])
    zeros = _polynomial_roots([complex(p) for p in numer])
    kept: list[complex] = []
    for pole in poles:
        doublet = False
        for zero in zeros:
            if abs(pole - zero) <= FROISSART_REL * max(1.0, abs(pole)):
                doublet = True
                break
        if not doublet:
            kept.append(pole)
    return tuple(kept)
FUNCTION

remainder_on_safe_disc​

omnibias.difference.singularity.remainder_on_safe_discSource ↗
remainder_on_safe_disc(coeffs: Sequence[float], *, numer_deg: int, denom_deg: int, radius: float, tail_bound: float, tail_ratio: float) -> Interval

Reuse pade_certified_remainder on a disc inside the Taylor radius.

Parameters

NameType & defaultContract
coeffspositional-or-keywordSequence[float]RequiredSee the operation contract and implementation below.
numer_degkeyword-onlyintRequiredSee the operation contract and implementation below.
denom_degkeyword-onlyintRequiredSee the operation contract and implementation below.
radiuskeyword-onlyfloatRequiredSee the operation contract and implementation below.
tail_boundkeyword-onlyfloatRequiredSee the operation contract and implementation below.
tail_ratiokeyword-onlyfloatRequiredSee the operation contract and implementation below.
ReturnsInterval
Executed regression · remainder reuses pade

Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_remainder_reuses_pade() -> None:
    rem = remainder_on_safe_disc(_geom(2.0, 6), numer_deg=0, denom_deg=1, radius=0.2, tail_bound=1.0, tail_ratio=2.0)
    assert rem.lo <= 0.0 <= rem.hi
    assert rem.mag < 1.0
python -m pytest "packages/omnibias-difference/tests/test_singularity_tracking.py::test_remainder_reuses_pade" -q
Read the implementation
def remainder_on_safe_disc(
    coeffs: Sequence[float],
    *,
    numer_deg: int,
    denom_deg: int,
    radius: float,
    tail_bound: float,
    tail_ratio: float,
) -> Interval:
    """Reuse ``pade_certified_remainder`` on a disc inside the Taylor radius."""
    fracs = [Fraction(float(c)).limit_denominator(10**12) for c in coeffs]
    numer, denom = pade_approximant(fracs, int(numer_deg), int(denom_deg))
    ivs = [Interval.from_value(float(c)) for c in coeffs]
    return pade_certified_remainder(numer, denom, ivs, float(radius), tail_bound=float(tail_bound), tail_ratio=float(tail_ratio))
FUNCTION

track_singularity​

omnibias.difference.singularity.track_singularitySource ↗
track_singularity(coeff_rows: Sequence[Sequence[complex | float]], times: Sequence[float], *, method: Literal['domb_sykes', 'pade', 'both']='both') -> SingularityTrack

Track x_s(t) from jets at sampled times. Not a blow-up proof.

Parameters

NameType & defaultContract
coeff_rowspositional-or-keywordSequence[Sequence[complex | float]]RequiredSee the operation contract and implementation below.
timespositional-or-keywordSequence[float]RequiredSee the operation contract and implementation below.
methodkeyword-onlyLiteral['domb_sykes', 'pade', 'both']Default: 'both'See the operation contract and implementation below.
ReturnsSingularityTrack
Explicit validation & failure cases
  • When len(coeff_rows) != len(times), raises ValueError('coeff_rows and times must have the same length').

These are explicit source guards. Backend operations may also raise for invalid shapes, dtypes, or unsupported devices.

Executed regression · fields reexport disclaimer

Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_fields_reexport_disclaimer() -> None:
    from omnibias.fields.singularity import DISCLAIMER, honesty_payload, track_singularity

    rows = ((1.0, 2.0, 4.0, 8.0),)
    track = track_singularity(rows, (0.0,), method="pade")
    assert track.disclaimer == DISCLAIMER
    assert honesty_payload()["blowup_proof"] is False
python -m pytest "packages/omnibias-fields/tests/test_singularity.py::test_fields_reexport_disclaimer" -q
Regression example · g5 tracking

This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_g5_tracking() -> None:
    times = (0.0, 0.2, 0.4, 0.6)
    rows = []
    for t in times:
        zs = 0.2 + 0.1j * (1.0 - t)
        rows.append(tuple(zs ** (-(k + 1)) for k in range(8)))
    track = track_singularity(rows, times, method="domb_sykes")
    assert track.disclaimer == DISCLAIMER
    assert track.blowup_fit is not None
    assert abs(track.blowup_fit.t_c - 1.0) / 1.0 <= 0.01
    assert track.blowup_fit.t_c_lo <= 1.0 <= track.blowup_fit.t_c_hi
python -m pytest packages/omnibias-difference/tests/test_singularity_tracking.py -k test_g5_tracking -q
Read the implementation
def track_singularity(
    coeff_rows: Sequence[Sequence[complex | float]],
    times: Sequence[float],
    *,
    method: Literal["domb_sykes", "pade", "both"] = "both",
) -> SingularityTrack:
    """Track ``x_s(t)`` from jets at sampled times. Not a blow-up proof."""
    if len(coeff_rows) != len(times):
        raise ValueError("coeff_rows and times must have the same length")
    locs: list[complex] = []
    exps: list[float] = []
    for row in coeff_rows:
        if method == "domb_sykes":
            est = domb_sykes(row)
        elif method == "pade":
            est = pade_estimate(row, numer_deg=0, denom_deg=1)
        else:
            est = both_estimates(row, numer_deg=0, denom_deg=1)
        if est.failed or est.location is None:
            locs.append(complex("nan"))
            exps.append(float("nan"))
        else:
            locs.append(est.location)
            exps.append(float("nan") if est.exponent is None else float(est.exponent))
    finite = [(t, z) for t, z in zip(times, locs, strict=True) if z == z]
    fit = fit_blowup([p[0] for p in finite], [p[1] for p in finite]) if len(finite) >= 3 else None
    return SingularityTrack(tuple(float(t) for t in times), tuple(locs), tuple(exps), fit, DISCLAIMER)
Other public import paths
  • omnibias.difference.singularity.track_singularity
  • omnibias.fields.singularity.track_singularity