How do I extract the nth term of an expanded polynomial that is
ordered in a particular way (increasing exponents)?
For example, from:
1 + x**3 + 2*x**9 + 2*x**12 + 3*x**27 + 3*x**30 + 6*x**36 + 6*x**39
I want the 7th term.
I have tried args but this gives me a tuple that is not ordered in the
same way as its polynomial:
(1, 2*x**12, 3*x**30, 6*x**36, 3*x**27, x**3, 6*x**39, 2*x**9)
My polynomial is type <class 'sympy.core.add.Add'> and I built it
using the following code:
from sympy import *
x,y,z = symbols('xyz')
aux = 1 + x**3
for n in range(2, 4):
baseTerm = 1 + n*x**3**n
aux = aux * baseTerm
auxex = aux.expand()
print auxex
I also tried methods of the Poly class, but I believe they don´t work
precisely because my polynomial is not a Poly object. Would one way be
converting to Poly and then using those methods? How would I convert?
The latter code takes me to another question: Sum is the sum operator,
but don´t we have a product operator?
Thank you.
--
You received this message because you are subscribed to the Google Groups
"sympy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sympy?hl=en.