Max Alekseyev on Thu, 22 Feb 2018 16:25:58 +0100


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

Re: sets of t_POLMOD


Dear Karim,

Now I understand the source of this behavior, but I confused about how
to cope with it.
Should I always envelope any operations on t_POLMOD with simplify(),
or what would be a correct approach here?

Thanks,
Max

On Thu, Feb 22, 2018 at 10:19 AM, Karim Belabas
<Karim.Belabas@math.u-bordeaux.fr> wrote:
> * Max Alekseyev [2018-02-22 16:12]:
>> Hello!
>>
>> I observe the following behavior in Version 2.10.0 (development 21603-bef585b)
>>
>> ? S = Set( [Mod(0,x^2+1)] )
>> %1 = [Mod(0, x^2 + 1)]
>> ? S*x
>> %2 = [Mod(0, x^2 + 1)]
>> ? setintersect(S,Set(S*x))
>> %3 = []
>>
>> Isn't this a bug?
>
> Not really: S and S*x *are* different [ inspect with dbg_x() or \x ].
>
> They are printed the same way and will test equal (==, mathematical
> equality allowing coercion), but not identical (===, typed equality) :
>
> (16:16) gp > S = Set( [Mod(0,x^2+1)] )
> %1 = [Mod(0, x^2 + 1)]
> (16:16) gp > S==S*x
> %2 = 1
> (16:16) gp > S===S*x \\ the reason is that lift S*x is Pol(0), not 0
> %3 = 0
> (16:16) gp > setintersect(S, simplify(S*x))
> %4 = [Mod(0, x^2 + 1)]
>
> 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]
> `