Max Alekseyev on Tue, 04 Jan 2022 23:21:14 +0100


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

Re: converting a multivariate series to a polynomial


Dear Bill,

Thank you for a neat solution!

As a side note, can you please elaborate on the "you should use truncate" suggestion?
PARI documentation says 
"Pol(t,{v='x}): convert t (usually a vector or a power series) into a polynomial..."
and thus it implies that Pol() is usually used for converting power series into a polynomial. If that is bad for some reason, it should be reflected in the documentation.

Regards,
Max





On Tue, Jan 4, 2022 at 12:36 PM Bill Allombert <Bill.Allombert@math.u-bordeaux.fr> wrote:
On Tue, Jan 04, 2022 at 12:16:24PM -0500, Max Alekseyev wrote:
> While it is easy to convert univariate t_SER to t_POL by calling Pol(),

Normally, you should use truncate.

> I'm puzzled on what would be the easiest way to convert a multivariate series
> like
>
> ((((x5 + O(x5^10))*x4 + O(x4^10))*x3 + O(x3^10))*x2 + O(x2^10))*x1 +
> O(x1^10)
>
> to a polynomial, which is x5*x4*x3*x2*x1 in this example.

You can try
truncateall(x)=if(type(x)=="t_SER",apply(truncateall,truncate(x)),x)

Cheers,
Bill