Karim Belabas on Sat, 15 Jul 2017 09:12:42 +0200 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: Laurent polynomials instead of fractions |
* Emmanuel ROYER [2017-07-14 05:46]: > Dear pari-users, > > How can I ask pari-gp to write the following expression > > ((xi^2 - 2*xi + 1)/xi) + ((-2*xi^4 + 8*xi^3 - 12*xi^2 + 8*xi - > 2)/xi^2)*q + O(q^2) > > with the q-coefficients as Laurent polynomials in xi instead of fractions? ? f = ((xi^2 - 2*xi + 1)/xi) + ((-2*xi^4 + 8*xi^3 - 12*xi^2 + 8*xi - 2)/xi^2)*q + O(q^2); For display purposes, bivariate objects (esp. power series) quickly become unreadable, so transforming them to vectors (only for display) is advisable : ? Vec(f) %2 = [(xi^2 - 2*xi + 1)/xi, (-2*xi^4 + 8*xi^3 - 12*xi^2 + 8*xi - 2)/xi^2] Now to display rational function as Laurent series, you can either convert them to power series : ? Vec(f) * (1+O(xi^10)) %3 = [xi^-1 - 2 + xi + O(xi^9), -2*xi^-2 + 8*xi^-1 - 12 + 8*xi - 2*xi^2 + O(xi^8)] or remove denominators (usually better) : ? [v = valuation(f,xi), Vec(f) / xi^v] %4 = [-2, [xi^3 - 2*xi^2 + xi, -2*xi^4 + 8*xi^3 - 12*xi^2 + 8*xi - 2]] (I'm displaying both the valuation and the renormalized coeffs here). With this technique, there is no real need to convert to a vector, you can stick to the power series ? f / xi^v %5 = (xi^3 - 2*xi^2 + xi) + (-2*xi^4 + 8*xi^3 - 12*xi^2 + 8*xi - 2)*q + O(q^2) Cheers, K.B. -- Karim Belabas, IMB (UMR 5251) Tel: (+33) (0)5 40 00 26 17 Universite de Bordeaux Fax: (+33) (0)5 40 00 21 23 351, cours de la Liberation http://www.math.u-bordeaux.fr/~kbelabas/ F-33405 Talence (France) http://pari.math.u-bordeaux.fr/ [PARI/GP] `