Karim Belabas on Sat, 09 Mar 2019 10:36:39 +0100


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

Re: poldisc variable must be x or y ?


* Jacques Gélinas [2019-02-21 10:03]:
> Thanks for the confirmation of the variable order problem.
> So what is the use of the second argument v in poldisc ?
> 
> poldisc0(GEN x, long v)  {
>     case t_POL:    {            <====== oups!!! type(z/a+1)=="t_RFRAC" (:-(
>       long v0 = -1;
>       if (v >= 0 && v != varn(x))
>       {
>         v0 = fetch_var_higher();
>         x = fix_pol(x,v, v0);
>       }
>       D = RgX_disc(x);
> 
> The easy fix is to always use x or y as main variable.

Or to update from current 'master', where I believe the bug is now fixed:

(10:28) gp > poldisc(x^2/y + 1, y)  \\ used to return 0
  ***   at top-level: poldisc(x^2/y+1,y)
  ***                 ^------------------
  *** poldisc: incorrect type in polresultant (t_RFRAC).

(10:28) gp > poldisc(y^2/x + 1, y) \\ used to raise an exception
%1 = -4/x

N.B. The problem also affected polresultant. Besides the problem you pointed
out with poldisc (only t_POL handled "correctly" v), fix_pol() was also
faulty (see the first example above, some corner cases were non).

Thanks for your report !

    K.B.

P.S. I notice that divrem has an analogous problem:

(10:32) gp > divrem(y^2/x, y/x+1, y)
  ***   at top-level: divrem(y^2/x,y/x+1,y)
  ***                 ^---------------------
  *** divrem: forbidden division t_RFRAC \ t_RFRAC.

I will fix that one later.
--
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]
`