Dear All,
Let $r=x_{1}^{4} + 2 \, x_{1}^{3} x_{2} + 4 \, x_{1}^{2} x_{2}^{2} + 2 \,
x_{1}
x_{2}^{3} + x_{2}^{4} + 2 \, x_{1}^{3} x_{3} + 2 \, x_{2}^{3} x_{3} + 4
\, x_{1}^{2} x_{3}^{2} + 4 \, x_{2}^{2} x_{3}^{2} + 2 \, x_{1} x_{3}^{3}
+ 2 \, x_{2} x_{3}^{3} + x_{3}^{4}$.
1. How to return the list of exponents of the monomials in $r$ in Sage?
The result I want is $[(4,0,0), (3,1,0), \ldots]$.
2. How to list of terms in Sage?
The result I want is $[x_{1}^{4}, 2 \, x_{1}^{3} x_{2}, \ldots]$.
For Question 1, I used
R.<x1,x2,x3> = PolynomialRing(QQbar, 3)
r.exponents()
This works. But when I tried to use op for Question 2. It is said that
AttributeError: 'MPolynomial_polydict' object has no attribute 'op'
How could I solve both Questions 1 and 2 in Sage? Thank you very much.
Best regards,
Jianrong.
--
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.