omnibias.difference.singularity
Finite-difference stencils, confluence limits, polynomial sequences, and scoped derivative-extraction certificates.
import omnibias.difference.singularityModule 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.
BlowupFit
omnibias.difference.singularity.BlowupFitSource ↗class BlowupFitDataclass 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
| Name | Type & default | Contract |
|---|---|---|
t_cdataclass field | floatRequired | See the operation contract and implementation below. |
gammadataclass field | floatRequired | See the operation contract and implementation below. |
prefactordataclass field | floatRequired | See the operation contract and implementation below. |
t_c_lodataclass field | floatRequired | See the operation contract and implementation below. |
t_c_hidataclass field | floatRequired | See the operation contract and implementation below. |
Fields & methods
t_cfield
t_c: floatDeclared float field on BlowupFit. A value must be provided when constructing the configuration, unless an inherited constructor supplies it.
View source ↗gammafield
gamma: floatDeclared float field on BlowupFit. A value must be provided when constructing the configuration, unless an inherited constructor supplies it.
View source ↗prefactorfield
prefactor: floatDeclared 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: floatDeclared 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: floatDeclared 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: floatOther public import paths
omnibias.difference.singularity.BlowupFitomnibias.fields.singularity.BlowupFit
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 Falsepython -m pytest packages/omnibias-difference/tests/test_singularity_tracking.py -k test_g6_disclaimer_serialized -qRegression 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 Falsepython -m pytest packages/omnibias-fields/tests/test_singularity.py -k test_fields_reexport_disclaimer -qRead the implementation
DISCLAIMER = "diagnostic and estimate; not a proof of blow-up"Other public import paths
omnibias.difference.singularity.DISCLAIMERomnibias.fields.singularity.DISCLAIMER
FROISSART_REL
omnibias.difference.singularity.FROISSART_RELSource ↗FROISSART_REL = 1e-08Froissart 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-9python -m pytest packages/omnibias-difference/tests/test_singularity_tracking.py -k test_froissart_threshold_justified -qRead the implementation
FROISSART_REL = 1e-8SingularityEstimate
omnibias.difference.singularity.SingularityEstimateSource ↗class SingularityEstimateDataclass 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
| Name | Type & default | Contract |
|---|---|---|
locationdataclass field | complex | NoneRequired | See the operation contract and implementation below. |
exponentdataclass field | float | NoneRequired | See the operation contract and implementation below. |
methoddataclass field | Literal['domb_sykes', 'pade', 'both', 'failed']Required | See the operation contract and implementation below. |
residualdataclass field | floatRequired | See the operation contract and implementation below. |
enclosuredataclass field | Interval | NoneRequired | See the operation contract and implementation below. |
faileddataclass field | boolDefault: False | See the operation contract and implementation below. |
reasondataclass field | strDefault: '' | See the operation contract and implementation below. |
Fields & methods
locationfield
location: complex | NoneDeclared 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 | NoneDeclared 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: floatDeclared float field on SingularityEstimate. A value must be provided when constructing the configuration, unless an inherited constructor supplies it.
View source ↗enclosurefield
enclosure: Interval | NoneDeclared 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 = FalseDeclared bool field on SingularityEstimate. Default expression: False.
reasonfield
reason: str = ''Declared str field on SingularityEstimate. Default expression: ''.
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.SingularityEstimateomnibias.fields.singularity.SingularityEstimate
SingularityTrack
omnibias.difference.singularity.SingularityTrackSource ↗class SingularityTrackDataclass 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
| Name | Type & default | Contract |
|---|---|---|
timesdataclass field | tuple[float, ...]Required | See the operation contract and implementation below. |
locationsdataclass field | tuple[complex, ...]Required | See the operation contract and implementation below. |
exponentsdataclass field | tuple[float, ...]Required | See the operation contract and implementation below. |
blowup_fitdataclass field | BlowupFit | NoneRequired | See the operation contract and implementation below. |
disclaimerdataclass field | strDefault: DISCLAIMER | See 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 Falsepython -m pytest "packages/omnibias-difference/tests/test_singularity_tracking.py::test_g6_disclaimer_serialized" -qRegression 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_hipython -m pytest packages/omnibias-difference/tests/test_singularity_tracking.py -k test_g5_tracking -qFields & 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 | NoneDeclared 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_hipython -m pytest packages/omnibias-difference/tests/test_singularity_tracking.py -k test_g5_tracking -qdisclaimerfield
disclaimer: str = DISCLAIMERDeclared 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_hipython -m pytest packages/omnibias-difference/tests/test_singularity_tracking.py -k test_g5_tracking -qto_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 Falsepython -m pytest "packages/omnibias-difference/tests/test_singularity_tracking.py::test_g6_disclaimer_serialized" -qMethod 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,
}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.SingularityTrackomnibias.fields.singularity.SingularityTrack
agreement
omnibias.difference.singularity.agreementSource ↗agreement(a: SingularityEstimate, b: SingularityEstimate) -> floatRelative location disagreement. inf if either method failed.
Parameters
| Name | Type & default | Contract |
|---|---|---|
apositional-or-keyword | SingularityEstimateRequired | See the operation contract and implementation below. |
bpositional-or-keyword | SingularityEstimateRequired | See the operation contract and implementation below. |
floatExecuted 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" -qRead 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) / denomboth_estimates
omnibias.difference.singularity.both_estimatesSource ↗both_estimates(coeffs: Sequence[complex | float], *, numer_deg: int=0, denom_deg: int=1) -> SingularityEstimateThe module contract describes the context for this operation. Its signature, explicit validation, return expressions, and implementation are recorded below.
Parameters
| Name | Type & default | Contract |
|---|---|---|
coeffspositional-or-keyword | Sequence[complex | float]Required | See the operation contract and implementation below. |
numer_degkeyword-only | intDefault: 0 | See the operation contract and implementation below. |
denom_degkeyword-only | intDefault: 1 | See the operation contract and implementation below. |
SingularityEstimateRead 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, "")certified_singularity_annulus
omnibias.difference.singularity.certified_singularity_annulusSource ↗certified_singularity_annulus(coeffs: Sequence[Interval | float], *, tail_bound: Interval, tail_ratio: float) -> IntervalLegacy 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
| Name | Type & default | Contract |
|---|---|---|
coeffspositional-or-keyword | Sequence[Interval | float]Required | See the operation contract and implementation below. |
tail_boundkeyword-only | IntervalRequired | See the operation contract and implementation below. |
tail_ratiokeyword-only | floatRequired | See the operation contract and implementation below. |
IntervalExecuted 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" -qRegression 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 -qRead 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
)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) -> IntervalEnclose 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
| Name | Type & default | Contract |
|---|---|---|
coeffspositional-or-keyword | Sequence[Interval | float]Required | See the operation contract and implementation below. |
tail_boundkeyword-only | IntervalRequired | See the operation contract and implementation below. |
tail_ratiokeyword-only | floatRequired | See the operation contract and implementation below. |
IntervalExplicit validation & failure cases
- When
not math.isfinite(tail_ratio) or tail_ratio <= 0.0, raisesValueError('tail_ratio must be positive and finite'). - When
tail_bound.lo < 0.0 or not math.isfinite(tail_bound.hi), raisesValueError('tail_bound must be nonnegative and finite'). - When
len(ivs) < 2, raisesValueError('need at least two coefficients'). - When
any((not math.isfinite(iv.lo) or not math.isfinite(iv.hi) for iv in ivs)), raisesValueError('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]" -qRegression 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 -qRead 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)domb_sykes
omnibias.difference.singularity.domb_sykesSource ↗domb_sykes(coeffs: Sequence[complex | float], *, drop_first: int=1) -> SingularityEstimateLinear fit of a_k / a_{k-1} against 1/k. Failure is first-class.
Parameters
| Name | Type & default | Contract |
|---|---|---|
coeffspositional-or-keyword | Sequence[complex | float]Required | See the operation contract and implementation below. |
drop_firstkeyword-only | intDefault: 1 | See the operation contract and implementation below. |
SingularityEstimateExecuted 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-9python -m pytest "packages/omnibias-difference/tests/test_singularity_tracking.py::test_worked_pole" -qRegression 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 -qRead 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, "")fit_blowup
omnibias.difference.singularity.fit_blowupSource ↗fit_blowup(times: Sequence[float], locations: Sequence[complex]) -> BlowupFit | NoneLinear fit of |Im x_s(t)| ~ C (t_c - t). Uncertainty is the residual band.
Parameters
| Name | Type & default | Contract |
|---|---|---|
timespositional-or-keyword | Sequence[float]Required | See the operation contract and implementation below. |
locationspositional-or-keyword | Sequence[complex]Required | See the operation contract and implementation below. |
BlowupFit | NoneExecuted 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_hipython -m pytest "packages/omnibias-difference/tests/test_singularity_tracking.py::test_g5_tracking" -qRead 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))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.
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 Falsepython -m pytest "packages/omnibias-difference/tests/test_singularity_tracking.py::test_g6_disclaimer_serialized" -qRegression 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 Falsepython -m pytest packages/omnibias-fields/tests/test_singularity.py -k test_fields_reexport_disclaimer -qRead 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_payloadomnibias.fields.singularity.honesty_payload
pade_estimate
omnibias.difference.singularity.pade_estimateSource ↗pade_estimate(coeffs: Sequence[complex | float], *, numer_deg: int, denom_deg: int) -> SingularityEstimateThe module contract describes the context for this operation. Its signature, explicit validation, return expressions, and implementation are recorded below.
Parameters
| Name | Type & default | Contract |
|---|---|---|
coeffspositional-or-keyword | Sequence[complex | float]Required | See the operation contract and implementation below. |
numer_degkeyword-only | intRequired | See the operation contract and implementation below. |
denom_degkeyword-only | intRequired | See the operation contract and implementation below. |
SingularityEstimateExecuted 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 Falsepython -m pytest "packages/omnibias-fields/tests/test_singularity.py::test_fields_reexport_disclaimer" -qRegression 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-9python -m pytest packages/omnibias-difference/tests/test_singularity_tracking.py -k test_worked_pole -qRead 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, "")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
| Name | Type & default | Contract |
|---|---|---|
coeffspositional-or-keyword | Sequence[complex | float]Required | See the operation contract and implementation below. |
numer_degkeyword-only | intRequired | See the operation contract and implementation below. |
denom_degkeyword-only | intRequired | See the operation contract and implementation below. |
tuple[complex, ...]Explicit validation & failure cases
- When
abs(z.imag) > 1e-14 * max(1.0, abs(z.real)), raisesValueError('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-9python -m pytest "packages/omnibias-difference/tests/test_singularity_tracking.py::test_froissart_threshold_justified" -qRead 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)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) -> IntervalReuse pade_certified_remainder on a disc inside the Taylor radius.
Parameters
| Name | Type & default | Contract |
|---|---|---|
coeffspositional-or-keyword | Sequence[float]Required | See the operation contract and implementation below. |
numer_degkeyword-only | intRequired | See the operation contract and implementation below. |
denom_degkeyword-only | intRequired | See the operation contract and implementation below. |
radiuskeyword-only | floatRequired | See the operation contract and implementation below. |
tail_boundkeyword-only | floatRequired | See the operation contract and implementation below. |
tail_ratiokeyword-only | floatRequired | See the operation contract and implementation below. |
IntervalExecuted 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.0python -m pytest "packages/omnibias-difference/tests/test_singularity_tracking.py::test_remainder_reuses_pade" -qRead 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))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') -> SingularityTrackTrack x_s(t) from jets at sampled times. Not a blow-up proof.
Parameters
| Name | Type & default | Contract |
|---|---|---|
coeff_rowspositional-or-keyword | Sequence[Sequence[complex | float]]Required | See the operation contract and implementation below. |
timespositional-or-keyword | Sequence[float]Required | See the operation contract and implementation below. |
methodkeyword-only | Literal['domb_sykes', 'pade', 'both']Default: 'both' | See the operation contract and implementation below. |
SingularityTrackExplicit validation & failure cases
- When
len(coeff_rows) != len(times), raisesValueError('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 Falsepython -m pytest "packages/omnibias-fields/tests/test_singularity.py::test_fields_reexport_disclaimer" -qRegression 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_hipython -m pytest packages/omnibias-difference/tests/test_singularity_tracking.py -k test_g5_tracking -qRead 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_singularityomnibias.fields.singularity.track_singularity