2021-01-21 09:51:24 +0200 received badge ● Popular Question (source) 2017-10-20 10:12:21 +0200 commented answer Force Convert a Polynomial Ring into Multivariate Polynomial Thanks, I finally did something similar . 2017-10-20 10:11:23 +0200 received badge ● Scholar (source) 2017-10-20 10:11:21 +0200 received badge ● Supporter (source) 2017-10-19 22:55:43 +0200 received badge ● Student (source) 2017-10-19 20:10:09 +0200 asked a question Force Convert a Polynomial Ring into Multivariate Polynomial I have the following code xi = var('xi') eta = var('eta') P = 3*eta - 1 Pr = P.polynomial(QQ) Pr.coefficients(sparse=False)  which gives the output [-1,3]  I would like to get the output in terms of both xi and eta that is, I want the output to be [-1,0,3]. How to force that? The reason I ask this is because my P is actually a mode in list of polyomials and generally function of both xi and eta and for different modes, either one or the other variable might not be there in the expression at all, and I want a general way to get the coefficients in a list corresponding to the coefficients of the terms 1,xi,eta,xi^2,xi *eta, eta^2 and so on.