Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

One solution is to force g into the univariate polynomial ring with respect to which you want to take coefficients:

sage: ZZ['a']['k'](g).coefficients()
[1, a, 1]

By mixing var('a') and _.<k> you're creating an element that has a rather complicated representation. You're better off either sticking entirely with var('a,k') or with defining the appropriate polynomial ring explicitly.