Skip to content

numthy · NumberField

15 accepted declarations. Python and Rust forms, contracts, evidence, failure boundaries, and checked usages are kept together below.

Worked example

The complete checked program Split rational primes and factor an ideal in the Gaussian integers uses this API directly.

# SPDX-License-Identifier: MIT
# Copyright (c) 2026 Benjamin Antieau and Deven Manam
"""Split rational primes and factor an ideal in the Gaussian integers."""

from noether import Q
from noether.commalg import PolynomialRing
from noether.numthy import NumberField


def main() -> None:
    polynomials = PolynomialRing(Q, ["x"])
    field = NumberField(polynomials.generator("x") ** 2 + 1, name="i")
    order = field.maximal_order()
    primes = order.prime_ideals_above(5)
    assert len(primes) == 2
    assert all(prime.norm() == 5 for prime in primes)
    ideal = order.fractional_ideal([1 + field.generator])
    assert ideal.norm() == 2
    print(f"(5) splits into norms {[prime.norm() for prime in primes]}; N(1+i)={ideal.norm()}")


if __name__ == "__main__":
    main()

Run it with .venv/bin/python examples/12_number_field_ideals.py.

numthy.NumberField

An exact absolute number-field context.

NumberField(defining_polynomial: Polynomial[RationalField], *, name: str | None=None)

noether::numthy::NumberField · Direct Rust declaration

pub struct NumberField { /* private fields */ }
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core
GIL attached / bounded
Semantic ID noether/numthy/NumberField@1

Executable usage: examples/12_number_field_ideals.py:12 · examples/12_number_field_ideals.py:7 · validation/unit/commalg/test_polynomial_facade.py:25 · validation/unit/commalg/test_polynomial_facade.py:343 · validation/unit/infra/test_public_api_index.py:165 · validation/unit/linalg/test_acceptance_workload.py:12

numthy.NumberField.__call__

Call self as a function.

(self, value: int | Fraction | NumberFieldElement | Sequence[int | Fraction]) -> NumberFieldElement

noether::numthy::NumberField · Python projection

Python projection convenience over this Rust mathematical type
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core
GIL attached / bounded
Semantic ID noether/numthy/NumberField@1

Executable usage: validation/unit/infra/test_discovery.py:57 · validation/unit/infra/test_public_api_index.py:155 · validation/unit/infra/test_public_api_index.py:169

numthy.NumberField.defining_polynomial

Normalized defining polynomial over Q.

Detailed contract

The normalized monic defining polynomial over Q.

(self) -> Polynomial[RationalField]

noether::numthy::NumberField::defining_polynomial · Direct Rust declaration

pub fn defining_polynomial(&self) -> &Polynomial<RationalField>
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core
GIL attached / bounded
Semantic ID noether/numthy/NumberField@1

Executable usage: validation/unit/numthy/test_number_field_facade.py:25 · validation/unit/numthy/test_padic_local_field_facade.py:51 · validation/corpus/numthy/degree-six-ring-of-integers.py:15 · validation/corpus/numthy/degree-six-ring-of-integers.py:16

numthy.NumberField.degree

Degree over Q.

Detailed contract

Degree [K:Q].

(self) -> int

noether::numthy::NumberField::degree · Direct Rust declaration

pub fn degree(&self) -> usize
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core
GIL attached / bounded
Semantic ID noether/numthy/NumberField@1

Executable usage: examples/14_weighted_polynomials.py:16 · examples/14_weighted_polynomials.py:18 · examples/15_groebner_twisted_cubic.py:15 · examples/15_groebner_twisted_cubic.py:28 · examples/31_local_fields_and_precision.py:37 · examples/33_simplicial_cohomology_operations.py:26

numthy.NumberField.discriminant

Exact field discriminant, computed from the maximal order.

Detailed contract

The field discriminant, namely the discriminant of the maximal order.

(self) -> int

noether::numthy::NumberField::discriminant · Direct Rust declaration

pub fn discriminant(&self) -> Result<Integer, NumberFieldOrderError>
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core
GIL released
Semantic ID noether/numthy/NumberField@1

Executable usage: examples/31_local_fields_and_precision.py:37 · validation/unit/numthy/test_acceptance_workload.py:53 · validation/unit/numthy/test_number_field_facade.py:101 · validation/unit/numthy/test_number_field_facade.py:126 · validation/unit/numthy/test_number_field_facade.py:143 · validation/unit/numthy/test_number_field_facade.py:144

numthy.NumberField.equation_order

The equation order Z[a], when the distinguished generator is integral.

Detailed contract

The equation order Z[a] of the distinguished generator. This exists exactly when the defining monic polynomial has integer coefficients. A rational nonintegral presentation must use an explicit integral basis or the maximal-order computation.

(self) -> NumberFieldOrder

noether::numthy::NumberField::equation_order · Direct Rust declaration

pub fn equation_order(&self) -> Result<NumberFieldOrder, NumberFieldOrderError>
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core
GIL released
Semantic ID noether/numthy/NumberField@1

Executable usage: validation/unit/numthy/test_number_field_facade.py:127 · validation/unit/numthy/test_number_field_facade.py:141 · validation/unit/numthy/test_number_field_facade.py:150 · validation/unit/numthy/test_number_field_facade.py:156 · validation/unit/numthy/test_number_field_facade.py:165 · validation/unit/numthy/test_number_field_facade.py:95

numthy.NumberField.from_json

Restore and validate a canonical context representation.

Detailed contract

Restore and validate a number-field context from canonical JSON.

(cls, value: str) -> NumberField

noether::numthy::NumberField::from_json · Direct Rust declaration

pub fn from_json(value: &str) -> Result<Self, NoetherError>
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core
GIL attached / bounded
Semantic ID noether/numthy/NumberField@1

Executable usage: validation/unit/category/test_category.py:14 · validation/unit/combin/test_acceptance_workload.py:65 · validation/unit/combin/test_acceptance_workload.py:86 · validation/unit/combin/test_graph_facade.py:106 · validation/unit/combin/test_graph_facade.py:25 · validation/unit/combinatorics/test_kashiwara_crystal.py:32

numthy.NumberField.generator

Distinguished power-basis generator.

Detailed contract

The distinguished generator, the image of the polynomial variable.

(self) -> NumberFieldElement

noether::numthy::NumberField::generator · Direct Rust declaration

pub fn generator(&self) -> NumberFieldElement
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core
GIL attached / bounded
Semantic ID noether/numthy/NumberField@1

Executable usage: examples/08_finite_field_extensions.py:10 · examples/08_finite_field_extensions.py:11 · examples/08_finite_field_extensions.py:12 · examples/08_finite_field_extensions.py:13 · examples/08_finite_field_extensions.py:14 · examples/10_padic_hensel_lifting.py:12

numthy.NumberField.generator_name

Display name of the distinguished generator.

Detailed contract

Display name of the distinguished power-basis generator.

(self) -> str

noether::numthy::NumberField::generator_name · Direct Rust declaration

pub fn generator_name(&self) -> &str
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core
GIL attached / bounded
Semantic ID noether/numthy/NumberField@1

Executable usage: validation/unit/numthy/test_number_field_facade.py:26 · validation/unit/numthy/test_number_field_facade.py:71 · validation/unit/numthy/test_number_field_facade.py:72 · validation/bench/magma_release.py:755

numthy.NumberField.maximal_order

The maximal order (ring of integers), computed unconditionally.

Detailed contract

Compute the maximal order (ring of integers) unconditionally. A rational presentation is first replaced by an integral generator. Round 2 then saturates at every prime whose square divides the starting order’s discriminant. Complete FLINT factorization makes the result unconditional.

(self) -> NumberFieldOrder

noether::numthy::NumberField::maximal_order · Direct Rust declaration

pub fn maximal_order(&self) -> Result<NumberFieldOrder, NumberFieldOrderError>
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core
GIL released
Semantic ID noether/numthy/NumberField@1

Executable usage: examples/12_number_field_ideals.py:13 · examples/31_local_fields_and_precision.py:22 · validation/unit/infra/test_public_api_index.py:165 · validation/unit/infra/test_public_api_index.py:184 · validation/unit/numthy/test_acceptance_workload.py:50 · validation/unit/numthy/test_number_field_facade.py:142

numthy.NumberField.one

Multiplicative identity.

(self) -> NumberFieldElement

noether::numthy::NumberField::one · Direct Rust declaration

fn one(&self) -> Self::Element
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core
GIL attached / bounded
Semantic ID noether/numthy/NumberField@1

Executable usage: examples/02_ball_arithmetic.py:13 · examples/11_qadic_witt_vectors.py:11 · examples/24_homology_and_persistence.py:3 · examples/31_local_fields_and_precision.py:27 · validation/unit/combinatorics/test_poset.py:3 · validation/unit/commalg/test_acceptance_workload.py:37

numthy.NumberField.order

Validate the order spanned by an explicit integral basis.

Detailed contract

Validate the full-rank Z-order spanned by basis.

(self, basis: Sequence[int | Fraction | NumberFieldElement | Sequence[int | Fraction]]) -> NumberFieldOrder

noether::numthy::NumberField::order · Direct Rust declaration

pub fn order( &self, basis: &[NumberFieldElement], ) -> Result<NumberFieldOrder, NumberFieldOrderError>
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core
GIL released
Semantic ID noether/numthy/NumberField@1

Executable usage: examples/11_qadic_witt_vectors.py:14 · examples/12_number_field_ideals.py:13 · examples/12_number_field_ideals.py:14 · examples/12_number_field_ideals.py:17 · examples/15_groebner_twisted_cubic.py:18 · examples/19_permutation_groups.py:13

numthy.NumberField.signature

Signature (r1, r2).

Detailed contract

Signature (r1, r2) with r1 + 2*r2 = degree.

(self) -> tuple[int, int]

noether::numthy::NumberField::signature · Direct Rust declaration

pub fn signature(&self) -> Result<(usize, usize), NumberFieldError>
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core
GIL attached / bounded
Semantic ID noether/numthy/NumberField@1

Executable usage: validation/unit/infra/test_repr_protocol.py:212 · validation/unit/infra/test_repr_protocol.py:215 · validation/unit/numthy/test_acceptance_workload.py:52 · validation/unit/numthy/test_number_field_facade.py:27 · validation/parity/combinatorics/test_crystals_parity.py:79 · validation/parity/combinatorics/test_crystals_parity.py:80

numthy.NumberField.to_json

Canonical JSON representation.

Detailed contract

Serialize this context to canonical JSON.

(self) -> str

noether::numthy::NumberField::to_json · Direct Rust declaration

pub fn to_json(&self) -> Result<String, NoetherError>
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core
GIL attached / bounded
Semantic ID noether/numthy/NumberField@1

Executable usage: validation/unit/category/test_category.py:14 · validation/unit/category/test_category.py:15 · validation/unit/combin/test_acceptance_workload.py:30 · validation/unit/combin/test_acceptance_workload.py:65 · validation/unit/combin/test_acceptance_workload.py:86 · validation/unit/combin/test_graph_facade.py:106

numthy.NumberField.zero

Additive identity.

(self) -> NumberFieldElement

noether::numthy::NumberField::zero · Direct Rust declaration

fn zero(&self) -> Self::Element
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core
GIL attached / bounded
Semantic ID noether/numthy/NumberField@1

Executable usage: examples/08_finite_field_extensions.py:11 · examples/10_padic_hensel_lifting.py:15 · examples/40_exterior_algebra.py:26 · examples/distributed/f2_linear_algebra.py:28 · examples/distributed/f2_linear_algebra.py:29 · examples/distributed/f2_linear_algebra.py:30