Bill Allombert on Fri, 15 Nov 2019 18:13:30 +0100

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

Re: List of polynomial coefficients in GP

On Fri, Nov 15, 2019 at 03:51:54PM +0000, Jacques Gélinas wrote:
> 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]

Fundamentally this is a bug in subst:

? type(subst('u^0,u,x))
%1 = "t_INT"
it would be better to return a t_POL.
I do not know whether this is easy to fix.