Bill Allombert on Tue, 04 Jan 2022 18:36:30 +0100


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

Re: converting a multivariate series to a polynomial


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