Karim Belabas on Tue, 20 Jan 2015 11:51:39 +0100

 Re: Mixing variables in Mod expressions

```* Pascal Molin [2015-01-20 11:39]:
> What suprises me is that the moduli is removed in the result.
>
> Over Z I run through this issue every year with students and they
> understood well that
> the result is the only sensible one (2+3\Z) + (5+2\Z) = \Z
> and gp gives Mod(2,3) + Mod(5,2) = Mod(0,1)

The moduli is not removed, but indeed not printed:

(11:42) gp > Mod(0,x)
%1 = 0
(11:43) gp > dbg_x(%)  \\ clearly a t_POLMOD
[&=0000000000b7cb00] POLMOD(lg=3,CLONE):1300000000000003 0000000000b7cb50 0000000000b7cb18
mod = [&=0000000000b7cb50] POL(lg=4):1400000000000004 (+,varn=0):4000000000000000 0000000000b7cb40 0000000000b7cb28
coef of degree 0 = [&=0000000000b7cb40] INT(lg=2):0200000000000002 (0,lgefint=2):0000000000000002
coef of degree 1 = [&=0000000000b7cb28] INT(lg=3):0200000000000003 (+,lgefint=3):4000000000000003 0000000000000001
pol = [&=0000000000b7cb18] INT(lg=2):0200000000000002 (0,lgefint=2):0000000000000002

A 0 t_POLMOD is printed as 0 and omitted in polynomial coefficients.
For t_INTMOD, 0 is still explicitly written as Mod(0, N) [ but still omitted
when a polynomial coefficient ]

I don't see any rationale for this. I can fix the discrepancy, and
explicitly write Mod(0, x) above instead of 0.

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 69 50
351, cours de la Liberation    http://www.math.u-bordeaux1.fr/~kbelabas/
F-33405 Talence (France)       http://pari.math.u-bordeaux1.fr/  [PARI/GP]
`

```