Module Pari.Polynomial

type 'a t = ('a polynomial, ring) typ constraint 'a = ('b, ring) typ
val to_string : 'a t -> string
val mul : 'a t -> 'a t -> 'a t
val div : 'a t -> 'a t -> 'a t
val equal : 'a t -> 'a t -> bool
val add : 'a t -> 'a t -> 'a t
val sub : 'a t -> 'a t -> 'a t
val neg : 'a t -> 'a t
val eval : 'a t -> 'a -> 'a
val degree : 'a t -> int
val create : 'a array -> 'a t

create a returns a_{n-1} X^{n-1} + ... + a_0 for array a of length n.

# let q = Polynomial.create
  [|
    Integer.of_int 1;
    Integer.of_int (-111);
    Integer.of_int 6064;
    Integer.of_int (-189804);
  |];;
val q : Integer.t Polynomial.t = <abstr>
# Polynomial.to_string q;;
- : string = "x^3 - 111*x^2 + 6064*x - 189804"
# let zero = Polynomial.create [| Integer.of_int 0 |];;
val zero : Integer.t Polynomial.t = <abstr>
# let qq = Polynomial.create [| q; q; zero; zero |];;
val qq : Integer.t Polynomial.t Polynomial.t = <abstr>
# Polynomial.to_string qq;;
- : string =
"(x^3 - 111*x^2 + 6064*x - 189804)*y^3 + (x^3 - 111*x^2 + 6064*x - 189804)*y^2"
val of_string : string -> 'a t option
val deriv : ?indeterminate:int -> 'a t -> 'a t
val derivn : ?indeterminate:int -> 'a t -> int -> 'a t
val cyclotomic : Signed.long -> Integer.t t
val is_irreducible : 'a t -> bool
val minimal : 'a t -> 'a t

minimal p reduces p to be the minimal polynomial of the roots of p over the field of the rational numbers.

# let q = Polynomial.create
  [|
    (Integer.of_int 1);
    (Integer.of_int (-111));
    (Integer.of_int 6064);
    (Integer.of_int (-189804));
  |];;
val q : Integer.t Polynomial.t = <abstr>
# Polynomial.to_string q;;
- : string = "x^3 - 111*x^2 + 6064*x - 189804"
# let qmin = Polynomial.minimal q;;
val qmin : ('a, ring) typ Polynomial.t = <abstr>
# Polynomial.to_string qmin;;
- : string = "x^3 - x^2 - 60*x - 364"
# Number_field.(are_isomorphic (create q) (create qmin));
- : bool = true
val (.%[]) : 'a t -> int -> 'a
val roots_ff : (finite_field, ring) typ t -> ((finite_field, field) typ, [ `ROW ]) Vector.t
val fold_left : f:('b -> 'a -> 'a) -> acc:'a -> 'b t -> 'a
val fold_left2 : f:('a -> 'b -> ('c, 'd) typ -> ('c, 'd) typ) -> acc:('c, 'd) typ -> 'a t -> 'b t -> ('c, 'd) typ
val fold_left2_vec : f:('a -> 'b -> ('c, 'd) typ -> ('c, 'd) typ) -> acc:('c, 'd) typ -> 'a t -> ('b, _) Vector.t -> ('c, 'd) typ
val inj_base_ring : inj:('a -> 'b) -> 'a t -> 'b t