Hi all,
I'm new to Python and SAGE and would like to ask a question:
I have a multivariate polynomial, of a degree 3, i.e:
g.<x1,x2,x3>=x1^2 + *2**x1*x2 + x2^2 + *2**x1*x3 + *2**x2*x3 + x3^2 +* 2**x1 +
*2**x2 + *2**x3 + 1
Its type is
<type
'sage.rings.polynomial.multi_polynomial_libsingular.MPolynomial_libsingu\
lar'>
The question is *how can I reduce all its leading coefficients to 1,* i.e.
transform ig to:
g.<x1,x2,x3>=x1^2 + *x1*x2 + x2^2 + *x1*x3 + *x2*x3 + x3^2 + *x1 + *x2 + *x3 + 1
I tried to get the coefficients of the polynomial (which is a list),
iterate through its items, and set the values of the items to 1, i.e.
for s in g.coefficients():
if s==2:
s=1
I think that the problem is that list items can't be cast to integer
(TypeError).
How could I solve this? Is there a more efficient way to do this?
Thank you for your responses!
Regards,
Natassa
--
You received this message because you are subscribed to the Google Groups
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.