Jacques Gélinas on Fri, 15 Nov 2019 16:52:00 +0100

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

List of polynomial coefficients in GP

Is there a direct way to get the list of coefficients of a polynomial in GP ?
Consider for example a polynomial with parameter P (representing Pi) in its coefficients:
            Vec(subst(1*u+2*P-6,u,x+3)) == [1, 2*P - 3]
is what I want, but this fails in
            Vec(subst(0*u+2*P-6,u,x+3)) == [2, -6]
so I must use
           cofs(p,v='x) = vector(1+max(0,poldegree(p,v)),k,polcoeff(p,k-1,v));
to get 
           cofs(subst(0*u+2*P-6,u,x+3),u) == [2*P - 6]

Any suggestions for a simpler solution ?

Jacques Gélinas