Karim BELABAS on Tue, 7 Mar 2000 14:06:45 +0100 (MET) |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: Bug in Mod (2.0.15) |
> On Wed, Mar 01, 2000 at 06:51:04PM +0100, Karim BELABAS wrote: > > > ? z=Mod(x,x^2+y^2) > > > %1 = Mod(x, x^2 + y^2) > > > ? u=Mod(z,x^2+y^2+t^2) > > > %2 = 0 > > > > It's a (debatable...) feature : modular objects (POLMOD/INTMOD) > > of different modulus are adjusted to a common modulus first, here > > gcd(x^2 + y^2, x^2 + y^2 + t^2) = 1, and all objects mod 1 are equal to 0... > > Eh? > > ? Mod(0,1) > %1 = Mod(0, 1) > > They may be equal to 0, but they are definitely not 0. Just the same here. An algebraic number (t_POLMOD) which is equal to 0 is printed as zero. (13:01) gp > z = Mod(x,x^2+y^2) %1 = Mod(x, x^2 + y^2) (13:01) gp > u = Mod(z,x^2+y^2+t^2) %2 = 0 (13:01) gp > %2.mod %3 = x^2 + (y^2 + t^2) (13:01) gp > %2.pol %4 = Mod(0, 1) \\ 1 = gcd(x^2+y^2, x^2+y^2+t^2) BUT: (13:01) gp > u.pol %5 = Mod(x, x^2 + y^2) the "problem" (due to the phenomenom alluded to in my previous mail) actually occurs while simplifying the expression (just before printing, but after the assignment u = ...) (13:01) gp > \y simplify = 0 (off) (13:01) gp > u = Mod(z,x^2+y^2+t^2) %6 = Mod(Mod(x, x^2 + y^2), x^2 + (y^2 + t^2)) which is an incorrect object... Mod() currently only checks its second argument, leaving the user responsible for the other one. This follows the "PARI philosophy" [ try to make sense of most input, and let the user shoot himself in the foot if she wishes ]. Again, this should probably be revised (generic functions are far too permissive in my opinion). Karim. __ 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://www.parigp-home.de/