Alexander Shumakovitch on Wed, 29 Jan 2003 13:33:56 +0100


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

Wrong (negative) degree returned by poldegree.


Hi all!

I've recently came across the following problem with Pari 2.2.4:
  (13:16) gp > p1 = t^2 / q^4
  %1 = 1/q^4*t^2
  (13:16) gp > poldegree(p1, q)
  %2 = -1

On the other hand,
  (13:16) gp > p2 = p1 / t^7
  %3 = 1/(q^4*t^5)
  (13:17) gp > poldegree(p2, q)
  %4 = -4

poldegree obviously assumes that all exponents in a polynomial are positive
(it takes a maximum with -1 (basemath/gen3.c: 215), if one asks for a degree
with respect to a secondary variable. But this is not the case for p1:
  (13:17) gp > Vec(p1)
  %5 = [1/q^4, 0, 0]

Does the problem lie with the internal simplifications of (Laurent)
polynomials in Pari? The easiest solution would be to define poldegree(0) as
-VERYBIGINT (one can't have _that_ many monomials anyway). The the code would
work as it is. To keep the old convention intact, one could rename poldegree
to, say, poldegree0 (since it's recursive) and define poldegree as
poldegree0 == -VERYBIGINT ? -1 : poldegree0

For the time being I have to settle for
  (13:20) gp > poldegree(subst(p1, t, Pi), q)
  %6 = -4

Thanks,

   --- Alexander.

P.S. Pari 2.1.4 has much fancier ideas:
  (13:28) gp > p1 = t^2 / q^4
  %1 = 1/q^4*t^2
  (13:29) gp > poldegree(p1, q)
  %2 = 65509

;-)