In maple I can create the following procedure:
Code:
positivify := proc(f,vars)
description "takes a multivariable polynomial and changes its coefficient to positive"
local c:
c:=coeffs(f,vars,'t'):
convert([seq(abs(c[i])*t[i],i=1..nops([t]))],`+`);
end proc:
What this does is take a multivariable polynomial over the real numbers, say e.g. 4x^2-x+2xy-3z^4,
and creates a new polynomial with the same number of monomials and individual degree of variables but with coefficients that are the absolute value of the coefficient of the old monomials, so for the example it creates 4x^2+x+2xy+3z^4.
I would like to do the same in singular. Here, I believe, coeffs in singular works for univariate case (so I need to inquire the coeff of x but then I get values in R[y,z]). Any hints of how I can most efficiently program this in singular? I suppose there is naive way to just walk through all the coefficients of each indeterminate and check for the coefficient, but I fear I will end up writing a very long procedure that way.
Thanks for any advise!
Jose