Question: List of powers with positive coefficients

Given a polynomial expression I would like to obtain a list whose entries are the positive entries of the polynomial with multiplicity given by the coefficients:

Example:

Given the polynomial expression: p:=x^2*y-2*y*z+3*x^2+2*y-z

The positive terms are: x^2*y, 3*x^2, 2*y

Thus I would like to obtain the list L:=[x^2*y , x^2 , x^2 , x^2, y , y].

Notice x^2*y appears once since the coefficient is 1.

x^2 appears three times since the coefficient is 3.

y appears two times since the coefficient is 2.

 

 

 

 

 

 

Please Wait...