How to change a polynomial to a list of monomials in sagemath? The task is as follows. I defined a set of symbols:
for i in range(k):
for j in range(n):
var('y'+'_'+str(i)+'_'+str(j))
I would like to change a polynomial in $y_{ij}$ to a list of monomials. For example,
-y_0_3^2*y_1_2*y_2_1 + y_0_2*y_1_3*y_2_1^3
is changed to [[-1, y_0_3, y_0_3, y_1_2, y_2_1], [1, y_0_2, y_1_3, y_2_1, y_2_1, y_2_1]]. How to do this in sagemath? Thank you very much.