let mapq f a =
let p = constant_of a
and ml = nonconstant_monomials_of a in
let ml' =
List.fold_right
(fun m acc ->
let q = coefficient_of_mono m
and x = variable_of_mono m in
let q' = f q in
if Mpa.Q.is_zero q' then acc else
mk_monomial q' x :: acc)
ml []
in
mk_polynomial p ml'