Skip to main content

Module algebraic

Module algebraic 

Source
Expand description

Real algebraic numbers: exact roots of integer polynomials, with decidable equality and order.

An Algebraic is the index-th real root (counting from 1 in increasing order) of its minimal polynomial — irreducible over ℚ, primitive over ℤ, positive leading coefficient — together with an isolating interval for that root. The pair (minimal polynomial, index) is the value’s canonical name, so equality and hashing read only it and two routes to √2 are the same value; the interval is a refinable cache that comparison, floor and printing narrow as needed. A rational is the degree-1 case, held with its exact point interval.

Arithmetic builds a polynomial the result is known to be a root of, then cuts it down by factoring and picks the one irreducible factor with exactly one root inside an interval enclosure of the result, shrinking the enclosure until only one candidate root remains:

  • α + β is a root of Res_y(m_α(y), m_β(x − y)), α·β of Res_y(m_α(y), y^{deg} m_β(x/y)), and α^e of Res_y(m_α(y), x − y^e) — each resultant interpolated from univariate resultants at integer points, which is exact because the leading coefficients in y do not depend on x;
  • a rational shift or scale, negation, and reciprocal transform the minimal polynomial directly (they keep it irreducible), and ᵏ√α is a root of m_α(x^k).

Every decision is exact: the order of two distinct values is found by refining both intervals until they separate, which always happens because distinct numbers have a positive distance.

Structs§

Algebraic
A real algebraic number. See the module documentation.