1 | initial version |
Thank you all,
Indeed, considering sum of all monomials does the trick! As a reference, a slightly tweaked solution below that worked for me:
g # the polynomial
list(g) # convert polynomial to list
g1=sum(mon for coeff, mon in g) # get the sum of all monomials