Algebraic numbers by minimal polynomial and isolating ball
- Cost
- Equality, sign and comparison tests cost one or a few interval Newton refinements with ball operations each at a precision proportional to the separation of the numbers; creating the numbers costs a factorisation over and a complex root isolation.
An algebraic number is a root of a nonzero polynomial with integer coefficients. Among these polynomials there is a unique one, the minimal polynomial of , that is irreducible in , primitive (its coefficients have no common factor) and has a positive leading coefficient; every other integer polynomial vanishing at is a multiple of . The degree of is the degree of , and the roots of are the conjugates of . Since alone does not distinguish from its conjugates, qqbar.h stores a pair
where is a complex ball, a rectangle with real and imaginary parts given by arb.h balls, that contains and no other root of (an isolating ball). This representation, used for example by Loos [Loo1983] and Strzebonski [Str1997], is canonical: equal numbers have the same , and different balls for the same number are recognised by refining them. Arithmetic is described in Arithmetic with algebraic numbers.
Certifying an isolating ball#
Isolating balls are certified with the interval Newton method [Moo1966; Kra1969; Neu1990]. For a ball with center and a polynomial , let be a ball containing (computed in ball arithmetic) and define the Newton operator
Theorem 1 (Interval Newton). If and is contained in the interior of , then contains exactly one root of , and this root lies in .
Proof. For , write with . The segment from to lies in the convex set , so is an average of values of on and lies in the convex hull of , which is contained in the ball (a rectangle) . In particular .
Uniqueness. If are roots of in , then , and the integral lies in , which would have to contain 0.
Existence. The map is continuous on , since is continuous and nonzero, and maps into . By Brouwer's fixed point theorem it has a fixed point , and then . The root lies in .
For a real interval and a real polynomial the same argument, with the mean value theorem on an interval, shows that certifies a unique real root in . FLINT uses both forms:
_qqbar_validate_existence_uniquenessapplies Theorem 1 to an arbitrary ball; when the ball is real (or purely imaginary) the step is carried out on the real line (or the imaginary axis), which proves that the unique root lies there._qqbar_validate_uniquenessis used when the ball is already known to contain a root, for example a ball computed by a root-finding algorithm or an enclosure of obtained by ball arithmetic from an enclosure of . It slightly enlarges the ball before the Newton step, which makes the test succeed more easily, and returns the (usually much smaller) ball as the new enclosure.
Creating algebraic numbers#
Rational numbers have and an exact enclosure. The roots of a polynomial are created by factoring over (see Factoring polynomials over the integers) and isolating the complex roots of each irreducible factor numerically with arb_fmpz_poly_complex_roots, increasing the precision until all balls are certified by Theorem 1 (see Roots of polynomials and eigenvalues). Values of special functions at algebraic points that are algebraic, such as and , get their minimal polynomials from formulas: cyclotomic polynomials , and the minimal polynomial of (fmpz_poly_cos_minpoly), and their enclosures from arb.h evaluations of the function, which are then certified.
Every operation of qqbar.h produces its result in this form: it determines the minimal polynomial exactly and an isolating ball for the right root.
Refining an enclosure#
To obtain more precision, _qqbar_enclosure_raw iterates the Newton step , doubling the working precision each time; by Theorem 1 every again contains the root, and the convergence is quadratic once is small compared to the distance to the other roots. If a step fails to shrink the ball sufficiently (for example because the starting ball is too wide for the Newton iteration to contract), all roots are recomputed from scratch at the higher precision and the one overlapping the old ball is taken. A real enclosure is refined with the real version (arb_fmpz_poly_refine_root_arb on the real line).
The polished enclosures returned by qqbar_get_acb are refined until both the real and the imaginary part have the requested relative accuracy; a part that is known to be zero is set to an exact zero, and a part that equals a small dyadic number is detected by testing exactly, so that, for example, has an exact real part . qqbar_cache_enclosure stores a refined ball in the number itself, which helps when the same number is used many times.
Deciding predicates#
All predicates are decided exactly by combining refinement with simple algebraic facts.
Lemma 2 (Equality). Let and represent and . Then if and only if and some ball containing contains exactly one root of .
Proof. If , the minimal polynomials agree by uniqueness, and as the balls are refined towards the common root their union shrinks to it, so eventually a ball containing it isolates it. Conversely, a ball containing that contains a single root of must contain both and , so they are that root.
qqbar_equal therefore compares the minimal polynomials first (which decides most cases at once), then the balls, and refines both balls until they are disjoint (the numbers differ) or the union of the balls is certified by _qqbar_validate_uniqueness (they are equal). Since distinct numbers have disjoint balls at sufficient precision, this terminates.
Lemma 3 (Real and imaginary numbers). Let represent with .
- is real if and only if the real interval contains a root of .
- If , then is even, that is, .
Proof.
- If is real, . Conversely, a root of in is the unique root in , which is .
- If with real, then is also a root of the real polynomial . So and have the common root ; since is irreducible, , and comparing leading coefficients gives . If , then , so divides , which contradicts and irreducibility.
qqbar_sgn_im reads the sign of off the ball if the imaginary part of the ball excludes zero or is exactly zero. Otherwise it alternates refinement with an attempt to certify, with the real version of the Newton step, that the real interval obtained by setting the imaginary part of the ball to zero contains a root; by Lemma 3 this proves that is real. If is not real, the refinement eventually separates the ball from the real axis. In the same way qqbar_sgn_re decides the sign of the real part, attempting the certification on the imaginary axis only when is even. and is impossible for odd degree, and a real number of degree at least 2 is never zero.
The comparisons qqbar_cmp_re, qqbar_cmp_im and qqbar_cmpabs compare the corresponding parts of the balls, refining them while they overlap. Overlapping balls may represent equal parts of distinct numbers (for example complex conjugates have equal real parts), so if refinement does not separate the parts quickly, the difference is computed exactly with qqbar.h arithmetic (as , or as for conjugates) and its sign is determined as above. Exact tests on the minimal polynomial (degree, evenness, cyclotomicity) are used first wherever possible: qqbar_is_root_of_unity only checks whether is a cyclotomic polynomial with fmpz_poly_is_cyclotomic, and then reads off the index from a low-precision value of .
Size of the representation#
The minimal polynomial of a number of degree has coefficients, and for numbers obtained by arithmetic their size can grow quickly: a sum of numbers of degrees , and heights , generically has degree and height roughly . The enclosure needs a precision related to the separation of the roots of , which by Mahler's bound [Mah1964] is at worst exponentially small in , although typically it is moderate. The representation is therefore best suited to individual numbers of moderate degree; long computations in a fixed number field are better done in that field (nf_elem.h, or ca.h, which uses qqbar_t only to describe the generator).
Use in FLINT#
qqbar_equal,qqbar_sgn_re,qqbar_sgn_im,qqbar_is_real,qqbar_cmp_re,qqbar_cmp_im,qqbar_cmpabsandqqbar_cmp_root_orderdecide predicates as described above._qqbar_validate_uniqueness,_qqbar_validate_existence_uniqueness,_qqbar_enclosure_rawandqqbar_cache_enclosureimplement the interval Newton certification and refinement;qqbar_get_acbandqqbar_get_arbpolish enclosures.qqbar_roots_fmpz_poly,qqbar_real_roots_fmpz_poly,qqbar_root_of_unity,qqbar_cos_piand related functions create numbers from polynomials and from formulas.- The generic contexts
gr_ctx_init_real_qqbarandgr_ctx_init_complex_qqbar(see gr_domains) use this representation, and ca.h uses it for the generators of number fields and to decide predicates for algebraic numbers.
Referenced from#
- Arithmetic with algebraic numbers (algorithm)
- Zero testing (algorithm)
- qqbar.h (module)
qqbar_sgn_re,qqbar_sgn_im- Roots of polynomials and eigenvalues
- Using qqbar
References#
- [Loo1983] R. Loos. Computing in algebraic extensions. In B. Buchberger, G. E. Collins and R. Loos (eds.), Computer Algebra: Symbolic and Algebraic Computation, second edition, Springer, 1983, 173–187. https://doi.org/10.1007/978-3-7091-7551-4_12
- [Str1997] A. Strzebonski. "Computing in the field of complex algebraic numbers". Journal of Symbolic Computation (1997) 24, 647-656. https://doi.org/10.1006/jsco.1997.0158
- [Moo1966] R. E. Moore. Interval Analysis. Prentice-Hall, 1966.
- [Kra1969] R. Krawczyk. Newton-Algorithmen zur Bestimmung von Nullstellen mit Fehlerschranken. Computing 4 (1969), 187–201. https://doi.org/10.1007/BF02234767
- [Neu1990] A. Neumaier. Interval Methods for Systems of Equations. Cambridge University Press, 1990.
- [Mah1964] K. Mahler. An inequality for the discriminant of a polynomial. Michigan Mathematical Journal 11:3 (1964), 257–262. https://doi.org/10.1307/mmj/1028999140
The FLINT team, “Algebraic numbers by minimal polynomial and isolating ball,” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/algorithms/exact/qqbar-representation.html (generated 2026-11-02).
@misc{flint-doc-algorithms-exact-qqbar-representation,
author = {{The FLINT team}},
title = {{Algebraic numbers by minimal polynomial and isolating ball}},
howpublished = {FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev},
year = {2026},
url = {https://flintlib.org/doc/algorithms/exact/qqbar-representation.html},
note = {Generated 2026-11-02}
}