Skip to content

numthy · NumberFieldElement

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

Worked example

The complete checked program Reproduce Fisher's order-five elliptic-function normalization uses this API directly.

# SPDX-License-Identifier: MIT
# Copyright (c) 2026 Benjamin Antieau and Deven Manam
"""Reproduce Fisher's order-five elliptic-function normalization."""

from noether import Q
from noether.commalg import RationalFunctionField, WeilDivisor
from noether.numthy import EllipticCurve, NthPowerClassGroup


def main() -> None:
    coefficients = RationalFunctionField(Q, "lambda")
    parameter = coefficients.generator()
    curve = EllipticCurve(
        coefficients,
        [1 - parameter, -parameter, -parameter, 0, 0],
    )
    point = curve.point(0, 0)
    point.verify_exact_order(5)

    miller = curve.miller_function(point, 5)
    divisor = WeilDivisor(
        curve.underlying_curve,
        [
            (curve.origin().underlying_curve_point.as_closed_point(), 5),
            (point.underlying_curve_point.as_closed_point(), -5),
        ],
    )
    function = divisor.riemann_roch_space().basis[0]
    assert (function / miller.function).as_constant() is not None

    evaluation_at_two = function.evaluate_at((2 * point).underlying_curve_point)
    evaluation_at_four = function.evaluate_at((4 * point).underlying_curve_point)
    assert evaluation_at_two.value is not None
    assert evaluation_at_four.value is not None
    classes = NthPowerClassGroup(coefficients, 5)
    normalization = classes.class_of(evaluation_at_two.value) ** -2 * classes.class_of(
        evaluation_at_four.value
    )
    assert normalization.is_identity()
    print("order 5 verified; Riemann--Roch and Miller agree; normalization is trivial")


if __name__ == "__main__":
    main()

Run it with .venv/bin/python examples/26_elliptic_descent_functions.py.

numthy.NumberFieldElement

One exact element of a concrete number field.

class NumberFieldElement

noether::numthy::NumberFieldElement · Direct Rust declaration

pub struct NumberFieldElement { /* 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/NumberFieldElement@1

Executable usage: validation/unit/infra/test_discovery.py:36 · validation/unit/infra/test_public_api_index.py:113 · validation/unit/numthy/test_number_field_facade.py:10 · validation/unit/numthy/test_number_field_facade.py:60 · validation/bench/magma_release.py:2439 · validation/bench/magma_release.py:2862

numthy.NumberFieldElement.__add__

Add another compatible value to this value.

Detailed contract

Add another element of the same number field. Returns the argument unchanged.

(self, other: int | Fraction | NumberFieldElement) -> NumberFieldElement

noether::numthy::NumberFieldElement::add · Direct Rust declaration

pub fn add(&self, other: &Self) -> Result<Self, ContextMismatchError>
fn add(self, rhs: &NumberFieldElement) -> Self::Output
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/NumberFieldElement@1

Executable usage: validation/unit/infra/test_discovery.py:211 · validation/unit/infra/test_public_api_index.py:293

numthy.NumberFieldElement.__mul__

Multiply this value by another compatible value.

Detailed contract

Multiply by another element of the same number field.

(self, other: int | Fraction | NumberFieldElement) -> NumberFieldElement

noether::numthy::NumberFieldElement::mul · Direct Rust declaration

pub fn mul(&self, other: &Self) -> Result<Self, ContextMismatchError>
fn mul(self, rhs: &NumberFieldElement) -> Self::Output
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/NumberFieldElement@1

Executable usage: validation/unit/infra/test_public_api_index.py:214

numthy.NumberFieldElement.__neg__

Return the additive inverse of this value.

Detailed contract

Additive inverse.

(self) -> NumberFieldElement

noether::numthy::NumberFieldElement::neg · Direct Rust declaration

pub fn neg(&self) -> Self
fn neg(self) -> Self::Output
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/NumberFieldElement@1

numthy.NumberFieldElement.__pow__

Raise this value to the supplied power.

(self, exponent: int, modulus: None=None) -> NumberFieldElement

noether::numthy::NumberFieldElement · 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/NumberFieldElement@1

numthy.NumberFieldElement.__radd__

Add this value to a compatible value on its left.

(self, other: int | Fraction) -> NumberFieldElement

noether::numthy::NumberFieldElement · 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/NumberFieldElement@1

numthy.NumberFieldElement.__rmul__

Multiply this value by a compatible value on its left.

(self, other: int | Fraction) -> NumberFieldElement

noether::numthy::NumberFieldElement · 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/NumberFieldElement@1

numthy.NumberFieldElement.__rsub__

Subtract this value from a compatible value on its left.

(self, other: int | Fraction) -> NumberFieldElement

noether::numthy::NumberFieldElement · 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/NumberFieldElement@1

numthy.NumberFieldElement.__rtruediv__

Divide a compatible value on the left by this value.

(self, other: int | Fraction) -> NumberFieldElement

noether::numthy::NumberFieldElement · 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/NumberFieldElement@1

numthy.NumberFieldElement.__sub__

Subtract another compatible value from this value.

Detailed contract

Subtract another element of the same number field.

(self, other: int | Fraction | NumberFieldElement) -> NumberFieldElement

noether::numthy::NumberFieldElement::sub · Direct Rust declaration

pub fn sub(&self, other: &Self) -> Result<Self, ContextMismatchError>
fn sub(self, rhs: &NumberFieldElement) -> Self::Output
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/NumberFieldElement@1

Executable usage: validation/unit/infra/test_discovery.py:212

numthy.NumberFieldElement.__truediv__

Divide this value by another compatible value.

(self, other: int | Fraction | NumberFieldElement) -> NumberFieldElement

noether::numthy::NumberFieldElement · 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/NumberFieldElement@1

numthy.NumberFieldElement.characteristic_polynomial

Characteristic polynomial over Q.

Detailed contract

Characteristic polynomial over Q, in the canonical variable t.

(self) -> Polynomial[RationalField]

noether::numthy::NumberFieldElement::characteristic_polynomial · Direct Rust declaration

pub fn characteristic_polynomial( &self, ) -> Result<Polynomial<RationalField>, 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/NumberFieldElement@1

Executable usage: validation/unit/linalg/test_acceptance_workload.py:79 · validation/unit/linalg/test_acceptance_workload.py:80 · validation/unit/linalg/test_acceptance_workload.py:98 · validation/unit/linalg/test_acceptance_workload.py:99 · validation/unit/linalg/test_exact_linear_algebra_facade.py:129 · validation/unit/linalg/test_exact_linear_algebra_facade.py:130

numthy.NumberFieldElement.coefficients

Exact ascending power-basis coefficients as Fraction values.

Detailed contract

Exact ascending coordinates in the distinguished power basis.

(self) -> list[Fraction]

noether::numthy::NumberFieldElement::coefficients · Direct Rust declaration

pub fn coefficients(&self) -> Vec<Rational>
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/NumberFieldElement@1

Executable usage: examples/26_elliptic_descent_functions.py:11 · examples/26_elliptic_descent_functions.py:12 · examples/26_elliptic_descent_functions.py:14 · examples/26_elliptic_descent_functions.py:35 · examples/31_local_fields_and_precision.py:11 · examples/31_local_fields_and_precision.py:12

numthy.NumberFieldElement.conjugates

Certified values under every complex embedding.

Detailed contract

Certified complex values under every embedding of this field.

(self, precision: int=53) -> list[ComplexBall]

noether::numthy::NumberFieldElement::conjugates · Direct Rust declaration

pub fn conjugates( &self, ball_field: ComplexBallField, ) -> Result<Vec<ComplexBall>, 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/NumberFieldElement@1

Executable usage: validation/unit/numthy/test_number_field_facade.py:54 · validation/unit/numthy/test_number_field_facade.py:56 · validation/unit/numthy/test_number_field_facade.py:57 · validation/corpus/numthy/cubic-field-embeddings.py:23 · validation/corpus/numthy/cubic-field-embeddings.py:31

numthy.NumberFieldElement.field

Concrete number-field context.

Detailed contract

Concrete field context containing this element.

(self) -> NumberField

noether::numthy::NumberFieldElement::field · Direct Rust declaration

pub fn field(&self) -> &NumberField
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/NumberFieldElement@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/08_finite_field_extensions.py:3

numthy.NumberFieldElement.from_json

Restore and validate an exact element representation.

Detailed contract

Restore and validate an exact element from canonical JSON.

(cls, value: str) -> NumberFieldElement

noether::numthy::NumberFieldElement::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/NumberFieldElement@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.NumberFieldElement.inverse

Multiplicative inverse, failing on zero.

(self) -> NumberFieldElement

noether::numthy::NumberFieldElement::inverse · Direct Rust declaration

pub fn inverse(&self) -> Result<Self, InversionError>
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/NumberFieldElement@1

Executable usage: examples/distributed/f2_linear_algebra.py:37 · examples/distributed/f2_linear_algebra.py:39 · validation/unit/commalg/test_context_tower_workload.py:121 · validation/unit/commalg/test_context_tower_workload.py:122 · validation/unit/commalg/test_context_tower_workload.py:75 · validation/unit/commalg/test_context_tower_workload.py:77

numthy.NumberFieldElement.is_one

Whether this element is one.

(self) -> bool

noether::numthy::NumberFieldElement::is_one · Direct Rust declaration

pub fn is_one(&self) -> bool
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/NumberFieldElement@1

Executable usage: validation/unit/commalg/test_rational_function_facade.py:31 · validation/unit/commalg/test_residue_ring_facade.py:25 · validation/unit/numthy/test_number_field_facade.py:29 · validation/corpus/commalg/evolution-algebra-isomorphism.py:34 · validation/corpus/numthy/diagonal-quadric-local-density-sums.py:36

numthy.NumberFieldElement.is_zero

Whether this element is zero.

(self) -> bool

noether::numthy::NumberFieldElement::is_zero · Direct Rust declaration

pub fn is_zero(&self) -> bool
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/NumberFieldElement@1

Executable usage: examples/17_weighted_power_series.py:16 · examples/17_weighted_power_series.py:17 · examples/39_kahler_differentials.py:20 · validation/unit/commalg/test_graded_commutative_facade.py:26 · validation/unit/commalg/test_kahler_differentials.py:113 · validation/unit/commalg/test_kahler_differentials.py:38

numthy.NumberFieldElement.minimal_polynomial

Minimal polynomial over Q.

Detailed contract

Minimal polynomial over Q, in the canonical variable t.

(self) -> Polynomial[RationalField]

noether::numthy::NumberFieldElement::minimal_polynomial · Direct Rust declaration

pub fn minimal_polynomial( &self, ) -> Result<Polynomial<RationalField>, 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/NumberFieldElement@1

Executable usage: validation/unit/infra/test_discovery.py:247 · validation/unit/numthy/test_number_field_facade.py:51 · validation/unit/numthy/test_padic_local_field_facade.py:80 · validation/unit/numthy/test_padic_local_field_facade.py:82 · validation/bench/magma_release.py:1460 · validation/bench/magma_release.py:1468

numthy.NumberFieldElement.norm

Exact field norm to Q.

Detailed contract

Exact field norm to Q.

(self) -> Fraction

noether::numthy::NumberFieldElement::norm · Direct Rust declaration

pub fn norm(&self) -> Rational
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/NumberFieldElement@1

Executable usage: examples/06_shortest_lattice_vectors.py:15 · examples/08_finite_field_extensions.py:13 · examples/08_finite_field_extensions.py:14 · examples/08_finite_field_extensions.py:3 · examples/12_number_field_ideals.py:16 · examples/12_number_field_ideals.py:18

numthy.NumberFieldElement.to_json

Canonical JSON representation.

Detailed contract

Serialize this exact element to canonical JSON.

(self) -> str

noether::numthy::NumberFieldElement::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/NumberFieldElement@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.NumberFieldElement.trace

Exact field trace to Q.

Detailed contract

Exact field trace to Q.

(self) -> Fraction

noether::numthy::NumberFieldElement::trace · Direct Rust declaration

pub fn trace(&self) -> Rational
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/NumberFieldElement@1

Executable usage: examples/08_finite_field_extensions.py:12 · examples/08_finite_field_extensions.py:14 · examples/08_finite_field_extensions.py:3 · validation/unit/commalg/test_acceptance_workload.py:41 · validation/unit/commalg/test_context_tower_workload.py:116 · validation/unit/commalg/test_context_tower_workload.py:96