API reference

Rational functions from arrays

Build normalized rational functions over QQ, QQi, GF(p), AA, or QQbar from dense coefficients or sparse terms, then calculate, decompose, and verify their normalization and partial fractions.

check(f) verifies cancellation, coprimality, and the monic denominator. check(parts) also verifies irreducible denominator factors, proper nonzero terms without duplicate factor/exponent pairs, and recomposition. Laurent checks verify source normalization and a formal truncated-product identity.

Every computational call accepts a shared Budget or max_steps=. See the tutorial for examples, domain restrictions, and the meaning of retained metadata.

For numerical fractions, pass context= to the constructor and each arithmetic operation. NumericFunction stores a numerator and denominator without approximate cancellation. enclose produces independently checked quotient bounds; check verifies the polynomial evaluations, their common point, and the final division. A denominator enclosure containing zero raises DOMAIN. Numerical partial fractions and Laurent expansions are not exact operations and are not provided by these overloads.

Save fractions, partial fractions, Laurent expansions, and checked enclosures with poly.io.

Function

@fieldwise_init
struct Function[P: Copyable & Deinitable, k: Int = 1](Copyable, Movable, _Record, _WithModulus)

A normalized rational function sharing immutable exact storage.

Parameters.

  • P: The inferred sparse power shape; Int for dense univariate input.
  • k: The inferred coefficient field; users normally leave this implicit.

Defined in src/poly/rational.mojo.

Function.ndim

def ndim(self) -> Int

Return the number of polynomial axes.

Returns. The retained power-shape width, including unused axes.

Function.domain

def domain(self) -> String

Return the coefficient domain.

Returns. The inferred field: QQ, QQi, GF(p), AA, or QQbar.

Function.modulus

def modulus(self) -> UInt64

Return the coefficient modulus.

Returns. The finite-field prime, or zero in characteristic zero.

Function.evidence

def evidence(self) -> ref[ImmOrigin(origin_of(self._data[].cancellation))] _Proof[Self.k]

Borrow the cancellation identity retained during construction.

Returns. Immutable evidence relating the stored input pair to the reduced pair.

Function.coprimality_evidence

def coprimality_evidence(self) -> ref[ImmOrigin(origin_of(self._data[].coprimality))] CoprimalityCertificate[_Field[Self.k]]

Borrow the proof that the returned numerator and denominator are coprime.

Returns. Immutable core evidence for check_coprimality on the reduced pair.

asarray

def asarray[A: Iterable, B: Iterable](numerator: A, denominator: B, mut budget: Budget) raises PolyError -> Function[Int, _FieldKind[_Join[_Kind[_Element[A]], _Kind[_Element[B]]]]]

Construct and normalize a fraction from two ascending coefficient iterables.

Parameters.

  • A: The numerator iterable type.
  • B: The denominator iterable type.

Arguments.

  • numerator: Ascending exact characteristic-zero coefficients.
  • denominator: Ascending coefficients of a nonzero polynomial.
  • budget: The shared work allowance, including preparation and result storage.

Returns. A univariate rational function over the inferred field with a monic nonzero denominator.

Raises.

  • PolyError: DOMAIN for incompatible inputs or unavailable divisions, LIMIT for exhausted work, or CAPACITY for unrepresentable storage.

Defined in src/poly/rational.mojo.

from_terms

def from_terms[A: Iterable, B: Iterable, P: Copyable & Deinitable, C: Copyable & Deinitable, D: Copyable & Deinitable](numerator: A, denominator: B, mut budget: Budget) raises PolyError -> Function[P, _FieldKind[_Join[_Kind[C], _Kind[D]]]] where _Element[A] == Tuple[P, C] and _Element[B] == Tuple[P, D]

Construct a rational function from sparse numerator and denominator terms.

Parameters.

  • A: The numerator iterable type.
  • B: The denominator iterable type.
  • P: The common power shape.
  • C: The numerator coefficient type.
  • D: The denominator coefficient type.

Arguments.

  • numerator: Exact (power, coefficient) terms.
  • denominator: Nonzero denominator terms with the same power shape.
  • budget: The shared work allowance, including preparation and result storage.

Returns. A normalized fraction retaining the input power shape.

Raises.

  • PolyError: DOMAIN for incompatible inputs or unavailable divisions, LIMIT for exhausted work, or CAPACITY for unrepresentable storage.

Defined in src/poly/rational.mojo.

numerator

def numerator[P: Copyable & Deinitable, k: Int](value: Function[P, k], mut budget: Budget) raises PolyError -> sparse.Array[P, k]

Extract the normalized numerator as a sparse array.

Parameters.

  • P: The inferred power shape.
  • k: The inferred coefficient field; users normally leave this implicit.

Arguments.

  • value: The prepared rational function.
  • budget: The shared work allowance, including preparation and result storage.

Returns. An immutable polynomial with the original power shape.

Raises.

  • PolyError: DOMAIN for incompatible inputs or unavailable divisions, LIMIT for exhausted work, or CAPACITY for unrepresentable storage.

Defined in src/poly/rational.mojo.

denominator

def denominator[P: Copyable & Deinitable, k: Int](value: Function[P, k], mut budget: Budget) raises PolyError -> sparse.Array[P, k]

Extract the normalized denominator as a sparse array.

Parameters.

  • P: The inferred power shape.
  • k: The inferred coefficient field; users normally leave this implicit.

Arguments.

  • value: The prepared rational function.
  • budget: The shared work allowance, including preparation and result storage.

Returns. An immutable polynomial with the original power shape.

Raises.

  • PolyError: DOMAIN for incompatible inputs or unavailable divisions, LIMIT for exhausted work, or CAPACITY for unrepresentable storage.

Defined in src/poly/rational.mojo.

add

def add[P: Copyable & Deinitable, k: Int, l: Int](a: Function[P, k], b: Function[P, l], mut budget: Budget) raises PolyError -> Function[P, _Join[k, l]]

Add rational functions and normalize the resulting fraction.

Parameters.

  • P: The shared polynomial power shape.
  • k: The inferred coefficient field; users normally leave this implicit.
  • l: The second function's inferred coefficient field.

Arguments.

  • a: The left rational function.
  • b: The right rational function; division requires a nonzero numerator.
  • budget: The shared work allowance, including preparation and result storage.

Returns. A new fraction retaining its cancellation identity.

Raises.

  • PolyError: DOMAIN for incompatible inputs or unavailable divisions, LIMIT for exhausted work, or CAPACITY for unrepresentable storage.

Defined in src/poly/rational.mojo.

subtract

def subtract[P: Copyable & Deinitable, k: Int, l: Int](a: Function[P, k], b: Function[P, l], mut budget: Budget) raises PolyError -> Function[P, _Join[k, l]]

Subtract rational functions and normalize the resulting fraction.

Parameters.

  • P: The shared polynomial power shape.
  • k: The inferred coefficient field; users normally leave this implicit.
  • l: The second function's inferred coefficient field.

Arguments.

  • a: The left rational function.
  • b: The right rational function; division requires a nonzero numerator.
  • budget: The shared work allowance, including preparation and result storage.

Returns. A new fraction retaining its cancellation identity.

Raises.

  • PolyError: DOMAIN for incompatible inputs or unavailable divisions, LIMIT for exhausted work, or CAPACITY for unrepresentable storage.

Defined in src/poly/rational.mojo.

multiply

def multiply[P: Copyable & Deinitable, k: Int, l: Int](a: Function[P, k], b: Function[P, l], mut budget: Budget) raises PolyError -> Function[P, _Join[k, l]]

Multiply rational functions and normalize the resulting fraction.

Parameters.

  • P: The shared polynomial power shape.
  • k: The inferred coefficient field; users normally leave this implicit.
  • l: The second function's inferred coefficient field.

Arguments.

  • a: The left rational function.
  • b: The right rational function; division requires a nonzero numerator.
  • budget: The shared work allowance, including preparation and result storage.

Returns. A new fraction retaining its cancellation identity.

Raises.

  • PolyError: DOMAIN for incompatible inputs or unavailable divisions, LIMIT for exhausted work, or CAPACITY for unrepresentable storage.

Defined in src/poly/rational.mojo.

divide

def divide[P: Copyable & Deinitable, k: Int, l: Int](a: Function[P, k], b: Function[P, l], mut budget: Budget) raises PolyError -> Function[P, _Join[k, l]]

Divide rational functions and normalize the resulting fraction.

Parameters.

  • P: The shared polynomial power shape.
  • k: The inferred coefficient field; users normally leave this implicit.
  • l: The second function's inferred coefficient field.

Arguments.

  • a: The left rational function.
  • b: The right rational function; division requires a nonzero numerator.
  • budget: The shared work allowance, including preparation and result storage.

Returns. A new fraction retaining its cancellation identity.

Raises.

  • PolyError: DOMAIN for incompatible inputs or unavailable divisions, LIMIT for exhausted work, or CAPACITY for unrepresentable storage.

Defined in src/poly/rational.mojo.

negative

def negative[P: Copyable & Deinitable, k: Int](value: Function[P, k], mut budget: Budget) raises PolyError -> Function[P, k]

Negate a rational function.

Parameters.

  • P: The inferred polynomial power shape.
  • k: The inferred coefficient field; users normally leave this implicit.

Arguments.

  • value: The input rational function.
  • budget: The shared work allowance, including preparation and result storage.

Returns. A new normalized rational function.

Raises.

  • PolyError: DOMAIN for incompatible inputs or unavailable divisions, LIMIT for exhausted work, or CAPACITY for unrepresentable storage.

Defined in src/poly/rational.mojo.

reciprocal

def reciprocal[P: Copyable & Deinitable, k: Int](value: Function[P, k], mut budget: Budget) raises PolyError -> Function[P, k]

Invert a nonzero rational function.

Parameters.

  • P: The inferred polynomial power shape.
  • k: The inferred coefficient field; users normally leave this implicit.

Arguments.

  • value: The input rational function.
  • budget: The shared work allowance, including preparation and result storage.

Returns. A new normalized rational function.

Raises.

  • PolyError: DOMAIN for incompatible inputs or unavailable divisions, LIMIT for exhausted work, or CAPACITY for unrepresentable storage.

Defined in src/poly/rational.mojo.

evaluate

def evaluate[P: Copyable & Deinitable, k: Int, *Ts: Copyable & Deinitable](value: Function[P, k], point: Tuple[*Ts], mut budget: Budget) raises PolyError -> _Scalar[_FieldKind[_Join[k, _TupleKind[Tuple[*Ts]]]]]

Evaluate the normalized function at exact coordinates.

Parameters.

  • P: The polynomial power shape.
  • k: The inferred coefficient field; users normally leave this implicit.
  • Ts: The inferred coordinate types.

Arguments.

  • value: The input rational function.
  • point: One exact coordinate per array axis; coordinates can promote the result field.
  • budget: The shared work allowance, including preparation and result storage.

Returns. An exact value; a remaining pole raises DOMAIN.

Raises.

  • PolyError: DOMAIN for incompatible inputs or unavailable divisions, LIMIT for exhausted work, or CAPACITY for unrepresentable storage.

Defined in src/poly/rational.mojo.

derivative

def derivative[P: Copyable & Deinitable, k: Int](value: Function[P, k], mut budget: Budget, *, axis: Int = 0) raises PolyError -> Function[P, k]

Differentiate a rational function along one array axis.

Parameters.

  • P: The inferred polynomial power shape.
  • k: The inferred coefficient field; users normally leave this implicit.

Arguments.

  • value: The input rational function.
  • budget: The shared work allowance, including preparation and result storage.
  • axis: The zero-based differentiation axis.

Returns. The normalized exact derivative.

Raises.

  • PolyError: DOMAIN for incompatible inputs or unavailable divisions, LIMIT for exhausted work, or CAPACITY for unrepresentable storage.

Defined in src/poly/rational.mojo.

compose

def compose[P: Copyable & Deinitable, k: Int, l: Int](outer: Function[P, k], inner: Function[P, l], mut budget: Budget, *, axis: Int = 0) raises PolyError -> Function[P, _Join[k, l]]

Compose rational functions that depend only on the selected axis.

Parameters.

  • P: The common power shape.
  • k: The inferred coefficient field; users normally leave this implicit.
  • l: The second function's inferred coefficient field.

Arguments.

  • outer: The outer univariate rational function.
  • inner: The univariate replacement.
  • budget: The shared work allowance, including preparation and result storage.
  • axis: The sole occurring variable axis.

Returns. The normalized composition; other occurring axes raise DOMAIN.

Raises.

  • PolyError: DOMAIN for incompatible inputs or unavailable divisions, LIMIT for exhausted work, or CAPACITY for unrepresentable storage.

Defined in src/poly/rational.mojo.

substitute

def substitute[P: Copyable & Deinitable, k: Int, I: Iterable, C: Copyable & Deinitable](value: Function[P, k], replacements: I, mut budget: Budget, *, axes: List[Int] = List[Int]()) raises PolyError -> Function[P, _FieldKind[_Join[k, _Kind[C]]]] where _Element[_Nested[I]] == Tuple[P, C]

Substitute sparse polynomials simultaneously into numerator and denominator.

Parameters.

  • P: The common power shape.
  • k: The inferred coefficient field; users normally leave this implicit.
  • I: The iterable of replacement polynomial iterables.
  • C: The replacement coefficient type.

Arguments.

  • value: The original rational function.
  • replacements: A finite iterable of sparse polynomial inputs with the same power shape.
  • budget: The shared work allowance, including preparation and result storage.
  • axes: Distinct axes corresponding to replacements; empty assigns every axis.

Returns. A new normalized function; an identically zero denominator raises DOMAIN.

Raises.

  • PolyError: DOMAIN for incompatible inputs or unavailable divisions, LIMIT for exhausted work, or CAPACITY for unrepresentable storage.

Defined in src/poly/rational.mojo.

check

def check[P: Copyable & Deinitable, k: Int](value: Function[P, k], mut budget: Budget) raises PolyError -> Bool

Verify complete cancellation and the monic denominator of the returned fraction.

Parameters.

  • P: The inferred power shape.
  • k: The inferred coefficient field; users normally leave this implicit.

Arguments.

  • value: The fraction and its retained normalization evidence.
  • budget: The shared work allowance, including preparation and result storage.

Returns. Whether the retained identity, coprimality proof, and denominator normalization all hold.

Raises.

  • PolyError: DOMAIN for incompatible inputs or unavailable divisions, LIMIT for exhausted work, or CAPACITY for unrepresentable storage.

Defined in src/poly/rational.mojo.

PartialFractions

@fieldwise_init
struct PartialFractions[P: Copyable & Deinitable, k: Int = 1](_Archive, Copyable, Movable)

Polynomial part and proper fraction terms, with the original function retained.

Parameters.

  • P: The original polynomial power shape.
  • k: The inferred coefficient field; users normally leave this implicit.

Defined in src/poly/rational.mojo.

Field Type
polynomial dense.Array[Self.k] The polynomial part in the selected variable.
terms Values[Tuple[dense.Array[Self.k], dense.Array[Self.k], Int], Self.k] Each entry is (numerator, denominator factor, positive exponent).

partial_fractions

def partial_fractions[P: Copyable & Deinitable, k: Int](value: Function[P, k], mut budget: Budget, *, axis: Int = 0) raises PolyError -> PartialFractions[P, k]

Decompose a univariate fraction into a polynomial part and proper terms.

Parameters.

  • P: The original power shape.
  • k: The inferred coefficient field; users normally leave this implicit.

Arguments.

  • value: A fraction depending only on the selected axis.
  • budget: The shared work allowance, including preparation and result storage.
  • axis: The sole occurring variable axis.

Returns. Exact terms over distinct monic irreducible factors, retaining evidence for check.

Raises.

  • PolyError: DOMAIN for incompatible inputs or unavailable divisions, LIMIT for exhausted work, or CAPACITY for unrepresentable storage.

Defined in src/poly/rational.mojo.

poles

def poles[P: Copyable & Deinitable, k: Int](value: Function[P, k], mut budget: Budget, *, axis: Int = 0) raises PolyError -> Tuple[_Scalar[k], List[Tuple[dense.Array[k], Int]]]

Represent poles by factors of the reduced denominator.

Parameters.

  • P: The original power shape.
  • k: The inferred coefficient field; users normally leave this implicit.

Arguments.

  • value: A fraction univariate in the selected axis.
  • budget: The shared work allowance, including preparation and result storage.
  • axis: The sole occurring variable axis.

Returns. The denominator scalar and (factor, multiplicity) entries; each factor represents its zeros over an algebraic closure of the coefficient field.

Raises.

  • PolyError: DOMAIN for incompatible inputs or unavailable divisions, LIMIT for exhausted work, or CAPACITY for unrepresentable storage.

Defined in src/poly/rational.mojo.

Expansion

@fieldwise_init
struct Expansion[P: Copyable & Deinitable, k: Int = 1](_Archive, Copyable, Movable)

Consecutive Laurent coefficients with their center and lowest exponent.

Parameters.

  • P: The original polynomial power shape.
  • k: The inferred coefficient field; users normally leave this implicit.

Defined in src/poly/rational.mojo.

Field Type
center _Scalar[Self.k] The exact expansion center.
valuation Int The exponent of the first coefficient; negative at a pole.
coefficients Values[_Scalar[Self.k], Self.k] Known coefficients in ascending powers beginning at valuation.

laurent

def laurent[P: Copyable & Deinitable, k: Int, T: Copyable & Deinitable](value: Function[P, k], center: T, mut budget: Budget, *, terms: Int, axis: Int = 0) raises PolyError -> Expansion[P, _FieldKind[_Join[k, _Kind[T]]]]

Expand a rational function at an exact center, including a pole.

Parameters.

  • P: The original power shape.
  • k: The inferred coefficient field; users normally leave this implicit.
  • T: The exact center type.

Arguments.

  • value: A fraction univariate in the selected axis.
  • center: An exact expansion center.
  • budget: The shared work allowance, including preparation and result storage.
  • terms: Nonnegative number of coefficients beginning at the valuation.
  • axis: The sole occurring variable axis.

Returns. The center, valuation, and requested number of consecutive coefficients.

Raises.

  • PolyError: DOMAIN for incompatible inputs or unavailable divisions, LIMIT for exhausted work, or CAPACITY for unrepresentable storage.

Defined in src/poly/rational.mojo.

residue

def residue[P: Copyable & Deinitable, k: Int, T: Copyable & Deinitable](value: Function[P, k], center: T, mut budget: Budget, *, axis: Int = 0) raises PolyError -> _Scalar[_FieldKind[_Join[k, _Kind[T]]]]

Return the coefficient of (x-center)**-1, including zero at a regular point.

Parameters.

  • P: The original power shape.
  • k: The inferred coefficient field; users normally leave this implicit.
  • T: The center type.

Arguments.

  • value: A fraction univariate in the selected axis.
  • center: An exact expansion center.
  • budget: The shared work allowance, including preparation and result storage.
  • axis: The sole occurring variable axis.

Returns. The exact residue.

Raises.

  • PolyError: DOMAIN for incompatible inputs or unavailable divisions, LIMIT for exhausted work, or CAPACITY for unrepresentable storage.

Defined in src/poly/rational.mojo.

to_core

def to_core[P: Copyable & Deinitable, k: Int](value: Function[P, k], mut budget: Budget, *, variables: List[Int64] = List[Int64]()) raises PolyError -> _Export[k]

Export independent mutable core numerator and denominator storage.

Parameters.

  • P: The inferred power shape.
  • k: The inferred coefficient field; users normally leave this implicit.

Arguments.

  • value: The fraction to export.
  • budget: The shared work allowance, including preparation and result storage.
  • variables: Core variable IDs in array-axis order; empty uses consecutive IDs.

Returns. A core RationalFunction for QQ; otherwise a pair of public SparsePoly values using the selected core variable IDs.

Raises.

  • PolyError: DOMAIN for incompatible inputs or unavailable divisions, LIMIT for exhausted work, or CAPACITY for unrepresentable storage.

Defined in src/poly/rational.mojo.

from_core

def from_core[ndim: Int](value: RationalFunction, mut budget: Budget, *, variables: List[Int64] = List[Int64]()) raises PolyError -> Function[_Shape[ndim]]

Validate, remap, and normalize a mutable core rational function.

Parameters.

  • ndim: The explicit array power-shape width.

Arguments.

  • value: The core numerator and denominator.
  • budget: The shared work allowance, including preparation and result storage.
  • variables: Core variable IDs in array-axis order; empty uses 0 through ndim-1.

Returns. An independent fraction retaining every specified array axis.

Raises.

  • PolyError: DOMAIN for incompatible inputs or unavailable divisions, LIMIT for exhausted work, or CAPACITY for unrepresentable storage.

Defined in src/poly/rational.mojo.

NumericFunction

@fieldwise_init
struct NumericFunction[P: Copyable & Deinitable, D: NumericDomain](Copyable, Movable, _Record)

A numerical numerator and denominator with explicit arithmetic contexts.

No approximate GCD cancellation is performed. Ball coefficients describe independent families; evaluation requires a denominator enclosure excluding zero.

Parameters.

  • P: The retained polynomial power shape.
  • D: The inferred numerical coefficient domain.

Defined in src/poly/_numeric_fraction.mojo.

NumericFunction.ndim

def ndim(self) -> Int

Return the number of polynomial axes.

Returns. The retained axis count, including unused axes.

Enclosure

@fieldwise_init
struct Enclosure[E: _QuotientInput, D: NumericDomain](_Archive, Copyable, Movable)

A quotient enclosure retaining checked numerator and denominator evaluations.

Parameters.

  • E: The retained polynomial evaluation type.
  • D: The real or complex ball domain.

Defined in src/poly/_numeric_fraction.mojo.

Enclosure.value

def value(self, mut budget: Budget) raises PolyError -> Self.D.Scalar

Copy the certified enclosure using the shared work allowance.

Arguments.

  • budget: The allowance for copying the enclosing scalar.

Returns. The real or complex ball quotient.

Raises.

  • PolyError: LIMIT or CAPACITY on resource limits.

Enclosure.value

def value(self, *, max_steps: UInt64 = UInt64.MAX) raises PolyError -> Self.D.Scalar

Copy the enclosing value with a bounded work allowance.

Arguments.

  • max_steps: The copying allowance.

Returns. The real or complex ball quotient.

Raises.

  • PolyError: LIMIT or CAPACITY on resource limits.

power

def power[P: Copyable & Deinitable, D: NumericDomain](value: NumericFunction[P, D], exponent: Int, mut budget: Budget, *, context: D.Context) raises PolyError -> NumericFunction[P, D]

Raise a numerical fraction to an integer power.

Every arithmetic step uses context; no approximate cancellation is attempted. DOMAIN reports an uncertain zero denominator; LIMIT/CAPACITY preserve resource failures.

Parameters.

  • P: The inferred polynomial power shape.
  • D: The stored numerical coefficient domain.

Arguments.

  • value: The input numerical fraction.
  • exponent: The integer power; negative values swap numerator and denominator.
  • budget: The shared allowance for conversion, arithmetic, and result storage.
  • context: The explicit arithmetic precision and rounding or enclosure settings.

Returns. A new numerical fraction with the same polynomial axes.

Raises.

  • PolyError: DOMAIN for invalid axes, incompatible inputs, or an uncertain zero denominator; LIMIT/CAPACITY on resource limits.

Defined in src/poly/rational.mojo.

enclose

def enclose[P: Copyable & Deinitable, k: Int, X: Copyable & Deinitable](value: Function[P, k], point: X, mut budget: Budget, *, context: BallContext) raises PolyError -> FractionEnclosure[_ev.Enclosure[_Ring[k], _EnclosureDomain[_Scalar[k], X], False, True], _EnclosureDomain[_Scalar[k], X]] where (_Kind[X] >= 0 or _num._IsNumeric[X])

Evaluate a fraction with independently checked numerator, denominator, and quotient bounds.

Parameters.

  • P: Inferred from the input types.
  • k: Inferred from the input types.
  • X: Inferred from the input types.

Arguments.

  • value: The exact fraction.
  • point: A scalar or coordinate tuple.
  • budget: The shared work allowance.
  • context: The explicit output precision and rounding context.

Returns. A quotient enclosure retaining both polynomial evaluations and their evidence.

Raises.

  • PolyError: DOMAIN for incompatible input or a denominator containing zero, or LIMIT/CAPACITY on resource limits.

Defined in src/poly/rational.mojo.

adaptive_evaluate accepts NumericOptions and increases precision for the whole quotient. Inspect has_value(), accurate(), and outcome() separately: a valid certificate can describe a precision ceiling without a finite quotient.

adaptive_evaluate

def adaptive_evaluate[P: Copyable & Deinitable, k: Int, X: Copyable & Deinitable](value: Function[P, k], point: X, mut budget: Budget, *, options: NumericOptions) raises PolyError -> AdaptiveFractionEnclosure[_ev.Enclosure[_Ring[k], _EnclosureDomain[_Scalar[k], X], False, True], _EnclosureDomain[_Scalar[k], X]] where (_Kind[X] >= 0 or _num._IsNumeric[X])

Refine a quotient until its requested width is certified or precision is exhausted.

Parameters.

  • P: Inferred from the input types.
  • k: Inferred from the input types.
  • X: Inferred from the input types.

Arguments.

  • value: The exact fraction.
  • point: A scalar or coordinate tuple.
  • budget: The shared work allowance.
  • options: Initial and maximum precision, plus absolute or relative width targets.

Returns. Checked numerator and denominator evaluations, an accuracy outcome, and an optional finite quotient. has_value() is False when denominator separation remains unresolved; this does not by itself prove a pole.

Raises.

  • PolyError: DOMAIN for incompatible input, or LIMIT/CAPACITY on resource limits.

Defined in src/poly/rational.mojo.

AdaptiveEnclosure

@fieldwise_init
struct AdaptiveEnclosure[E: _QuotientInput, D: NumericDomain](_Archive, Copyable, Movable)

A checked quotient with an accuracy outcome and optional finite enclosure.

Parameters.

  • E: The retained polynomial evaluation type.
  • D: The real or complex ball domain.

Defined in src/poly/_numeric_fraction.mojo.

AdaptiveEnclosure.has_value

def has_value(self) -> Bool

Report whether the denominator was certified away from zero.

Returns. Whether value() can return a finite enclosure.

AdaptiveEnclosure.accurate

def accurate(self) -> Bool

Report whether the requested quotient width was established.

Returns. True for SUCCESS; verify the evidence with rational.check.

AdaptiveEnclosure.precision

def precision(self) -> Int

Return the last working precision in bits.

Returns. The precision used for both polynomial evaluations and the quotient.

AdaptiveEnclosure.options

def options(self) -> NumericOptions

Return the original accuracy request.

Returns. The retained precision limits and width targets.

AdaptiveEnclosure.outcome

def outcome(self) -> NumericOutcome

Report SUCCESS or PRECISION_CEILING.

Returns. PRECISION_CEILING when accuracy or denominator separation remains unresolved.

AdaptiveEnclosure.value

def value(self, mut budget: Budget) raises PolyError -> Self.D.Scalar

Copy the finite quotient enclosure when one was established.

Arguments.

  • budget: The copying allowance.

Returns. An enclosing ball, which may be wider than requested at the precision ceiling.

Raises.

  • PolyError: DOMAIN if the denominator still contains zero, or LIMIT/CAPACITY.

AdaptiveEnclosure.value

def value(self, *, max_steps: UInt64 = UInt64.MAX) raises PolyError -> Self.D.Scalar

Copy the finite quotient enclosure under a work limit.

Arguments.

  • max_steps: The copying allowance.

Returns. The enclosing real or complex ball.

Raises.

  • PolyError: DOMAIN without a finite enclosure, or LIMIT/CAPACITY.