Bill Allombert on Tue, 04 Jan 2022 23:47:04 +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 05:20:34PM -0500, Max Alekseyev wrote: > 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. Not really, it only implies that the argument of Pol is usually a vector or a power series. > If that is bad for some reason, it should be reflected > in the documentation. 'convert' is a structural operation without much mathematic meaning, while 'truncate' is a mathematical operation: For example ? truncate(1/x+1+x+O(x^2)) %1 = (x^2+x+1)/x ? Pol(1/x+1+x+O(x^2)) *** at top-level: Pol(1/x+1+x+O(x^2)) *** ^------------------- *** Pol: domain error in gtopoly: valuation < 0 as an aside, you might want to use this variant of truncateall: truncateall(x)=if(type(x)=="t_SER",truncate(apply(truncateall,x)),x) Cheers, Bill.