Jacques Gélinas on Fri, 15 Nov 2019 18:55:20 +0100


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

Re: List of polynomial coefficients in GP


>(Bill Allombert)  Fundamentally this is a bug in subst:

Looks like a feature of Vec, which simplifies its input, and I would not want to change that.

             Vec(Pol(subst(1*u+2*P-6,u,x+3))) == [1, 2*P - 3]
             Vec(Pol(subst(0*u+2*P-6,u,x+3))) == [2, -6]

I need a "cofs" function accessing directly the internal polynomial structure.

How easy is it to modify polcoef to return a vector instead of an error message ?
             polcoef(Pol(subst(0*u+2*P-6,u,x+3),x),,x)
***   missing mandatory argument: ...ubst(0*u+2*P-6,u,x+3),x),,x)

What about "polcoef(...,oo,x)" as a request for the vector of all coefficients ?

Jacques Gélinas






De : Bill Allombert <Bill.Allombert@math.u-bordeaux.fr>

Envoyé : 15 novembre 2019 12:13

À : pari-users@pari.math.u-bordeaux.fr <pari-users@pari.math.u-bordeaux.fr>

Objet : 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.



Cheers,

Bill