Module Beloch.Mpoly

Sparse multivariate polynomials over ℚ in a fixed number of variables (indices 0 .. nvars-1). Built for Num.real_roots: it manufactures, by Sylvester-resultant elimination of each algebraic coefficient's generator, a ℚ-polynomial in the root variable whose real roots are a SUPERSET of the true roots (spurious conjugate roots are removed later by exact evaluation). Only the root set matters, so sign/constant factors are not tracked. The Sylvester resultant is computed by evaluation + interpolation: each specialized Sylvester determinant is a numeric Gaussian elimination over ℚ (Poly.det), and the multivariate result is recovered by Lagrange interpolation. Algorithms: bpr2006 §4.2.

type mono = int array
type t = (mono * Q.t) list
val mono_equal : mono -> mono -> bool
val zero : t
val is_zero : t -> bool
val const : int -> Q.t -> t
val var : int -> int -> t
val add_term : t -> mono -> Q.t -> t
val add : t -> t -> t
val neg : t -> t
val sub : t -> t -> t
val mul : t -> t -> t
val one_of : int -> t
val pow : t -> int -> t
val degree_in : t -> int -> int
val coeffs_in : t -> int -> t array
val specialize : t -> int -> (int * Q.t) list -> Q.t array
val resultant : t -> t -> int -> t
val to_poly_in : t -> int -> Poly.t