Karim BELABAS on Thu, 21 Jan 1999 15:58:35 +0100 (MET)


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

Re: poldisc


> [Ilya:]
> > a) It looks like you cannot advice poldisc() which variable you are
> > interested in.
[me:]
> True; easy to add, though. The patch below does what you want (see online
> help).

Hum, too easy... My previous patch did the wrong thing when the polynomial
was not unitary. This one should be foolproof (apply after my preceding
poldisc() patch).

   Karim.

*** src/basemath/polarit2.c.orig        Thu Jan 21 15:20:43 1999
--- src/basemath/polarit2.c     Thu Jan 21 15:50:21 1999
***************
*** 2071,2082 ****
    {
      case t_POL:
        if (gcmp0(x)) return gzero;
!       if (v < 0)
!         p1 = subres(x, derivpol(x));
!       else
!         p1 = polresultant0(x, deriv(x,v), v, 0);
        p2 = leading_term(x); if (!gcmp1(p2)) p1 = gdiv(p1,p2);
        if ((lgef(x)-3) & 2) p1 = gneg(p1);
        return gerepileupto(av,p1);
  
      case t_COMPLEX:
--- 2071,2081 ----
    {
      case t_POL:
        if (gcmp0(x)) return gzero;
!       if (v >= 0 && v != varn(x)) { i = 0; x = fix_pol(x,v, &i); }
!       p1 = subres(x, derivpol(x));
        p2 = leading_term(x); if (!gcmp1(p2)) p1 = gdiv(p1,p2);
        if ((lgef(x)-3) & 2) p1 = gneg(p1);
+       if (i) p1 = gsubst(p1, MAXVARN, polx[0]);
        return gerepileupto(av,p1);
  
      case t_COMPLEX:

--
Karim Belabas                    email: Karim.Belabas@math.u-psud.fr
Dep. de Mathematiques, Bat. 425
Universite Paris-Sud             Tel: (00 33) 1 69 15 57 48
F-91405 Orsay (France)           Fax: (00 33) 1 69 15 60 19
--
PARI/GP Home Page: http://hasse.mathematik.-tu-muenchen.de/ntsw/pari/