Module Polynomial.Poly

Representation of polonomial with rational coefficient. a1.m1 + ... + c where

type t
val constant : NumCompat.Q.t -> t

constant c

  • returns

    the constant polynomial c

val variable : var -> t

variable x

  • returns

    the polynomial 1.x^1

val addition : t -> t -> t

addition p1 p2

  • returns

    the polynomial p1+p2

val product : t -> t -> t

product p1 p2

  • returns

    the polynomial p1*p2

val uminus : t -> t

uminus p

  • returns

    the polynomial -p i.e product by -1

val get : Monomial.t -> t -> NumCompat.Q.t

get mi p

  • returns

    the coefficient ai of the monomial mi.

val fold : (Monomial.t -> NumCompat.Q.t -> 'a -> 'a) -> t -> 'a -> 'a

fold f p a folds f over the monomials of p with non-zero coefficient

val add : Monomial.t -> NumCompat.Q.t -> t -> t

add m n p

  • returns

    the polynomial n*m + p