Karim Belabas on Wed, 18 Jul 2012 17:17:20 +0200 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: (Mod(1,2)*x*y)^0 |
* Bill Allombert [2012-07-17 14:15]: > ? Mod(1,2)^0 > %1 = Mod(1,2) > ? (Mod(1,2)*x)^0 > %2 = Mod(1,2) > ? (Mod(1,2)*x*y)^0 > %3 = 1 > > Is it intended ? Yes :-( The code to determine "the" base ring for a given polynomial [ RgX_type() ] was adapted from factor(), and only supports univariate polynomials. What ^0 does in principle is to return "1" in this base ring. When that ring can't be determined, as here, we just return the integer 1 and hope for the best. The main reason for this behaviour is to avoid checking that the question even makes sense [ as in Pi*x + Mod(1,2), where it doesn't ]. The code supports all kind of devious constructs involving t_QUAD, t_COMPLEX with t_INTMOD coefficients, t_PADICs, etc. Right now, whenever factor doesn't understand what's going on, it just aborts: (17:06) gp > factor(Mod(1,4)*x+Mod(1,2)) *** at top-level: factor(Mod(1,4)*x+Mo *** ^-------------------- *** factor: sorry, factor for general polynomials is not yet implemented. Trying to compute a "common domain" on the spot from an arbitrary collection of unrelated coefficients is really the wrong approach if one wants sensible answers in all cases, esp. cases never needed in the PARI library itself. Cheers, K.B. -- Karim Belabas, IMB (UMR 5251) Tel: (+33) (0)5 40 00 26 17 Universite Bordeaux 1 Fax: (+33) (0)5 40 00 69 50 351, cours de la Liberation http://www.math.u-bordeaux1.fr/~belabas/ F-33405 Talence (France) http://pari.math.u-bordeaux1.fr/ [PARI/GP] `