Module Poly

module Poly: sig .. end
Represent polynomials as written and convert to ordered form.


Basic Type Definition


type polynomial = 
| Var of string
| Const of float
| Times of polynomial * polynomial
| Plus of polynomial * polynomial

Printing


val str : polynomial -> string
Print a polynomial as a string.


val pow : polynomial -> int -> polynomial
Power function used in parser.
val simp_const : polynomial -> polynomial
Basic simplification, reduces constant polynomials to integers.

Convertion to Unordered Polynomials


val make_unordered : OrderedPoly.polynomial -> polynomial
val make_unordered_pair_list : (OrderedPoly.polynomial * 'a) list -> (polynomial * 'a) list

Convertion to Ordered Polynomials


val vars : polynomial -> string list
List variables in the given polynomial.
val vars_list : polynomial list -> string list
List variables in the given polynomial list.
val make_ordered : ?use_num:bool -> string list -> polynomial -> OrderedPoly.polynomial
Make an ordered polynomial from p with prio_list order on variables,i.e. if x appears in prio_list before y then x < y. Strings not appearing in prio_list at all are considered smaller than any string that appears.
val make_ordered_list : string list -> polynomial list -> OrderedPoly.polynomial list
Make ordered polynomials from ps with prio_list order on variables.
val make_ordered_pair_list : string list ->
(polynomial * 'a) list -> (OrderedPoly.polynomial * 'a) list
Make ordered polynomials from first components of ps, prio_list order.