Karim Belabas on Fri, 03 Aug 2012 11:04:20 +0200

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

Re: Polynomial division with imprecise types

* SÃren Lennart Berg [2012-08-03 04:30]:
> Hello,
> using the PARI library I'm having the following issue:
> Let p1,p2 be two (multivariate) polynomials. From the mathematical context I know that p2 divides p1.
> However, both may contain imprecise coefficients. e.g. t_REAL's. Using poldivrem() on p1/p2 PARI returns
> a rational function (t_RFRAC). Is there a way to obtain p1/p2 as a polynomial, i.e. force PARI to divide p1 by p2? 

Could you give a specific example ? Preferably under gp.

 GEN q = poldivrem(p1, p2, &r);
 // Euclidean diviÑion with respect to the *main* variable of [p1,p2]

should return a polynomial quotient q (t_POL), with a remainder r which
is close to 0. Both q and r have coefficient in the field of fractions
of the base ring, whÑch is a field of rational functions in your case.

For instance:

(10:58) gp > p1 = x^2 - Pi^2*y^2; p2 = x*y - Pi*y^2; divrem(p1, p2)
%1 = [1/y*x + 3.1415926535897932384626433832795028842, 0.E-37*y^2]~

\\ [q, r], both t_POL in x whith coefficients in R(y)  

The only potential problem I see is that division may not occur with
repect to the variable you intended.


Karim Belabas, IMB (UMR 5251)  Tel: (+33) (0)5 40 00 26 17
Universite Bordeaux 1          Fax: (+33) (0)5 40 00 69 50
351, cours de la Liberation    http://www.math.u-bordeaux1.fr/~belabas/
F-33405 Talence (France)       http://pari.math.u-bordeaux1.fr/  [PARI/GP]