Karim BELABAS on Tue, 15 Dec 1998 22:42:47 +0100 (MET) |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: interesting *randomness* issue |
[Igor:] > ? randpol(d,b)=x^d+sum(k=0,d-1,(random(2*b+1)-b)*x^k) > ? v=[];for(k=1,2000,t=randpol(8,2);if(polisirreducible(t),polgalois(t),);v=concat(v,[t])) > ? matsize(v) > [1, 2000] > ? length(Set(v)) > 816 > > So first I define a function which returns a random monic polynomial > of degree d and absolute value of coefficients <= b > > Then I generate 2000 random polynomials of degree 8 and run > polgalois() on those which are irreducible. From the 4th command > it's clear that they're not random anymore. And indeed, if you print > the vector v above, you'll see that it hits a loop of length 8 in the > end of the first 1000, and loops forever. > > However, if I use degree 7 polynomials instead, the pseudo-randomness > is fine. > > So I am curious how come polgalois() causes random number generator to > go berserk. Because somebody forgot to remove a debugging command once the version was made final (it did not affect the results...). Karim. *** src/modules/galois.c.orig Tue Dec 15 16:30:25 1998 --- src/modules/galois.c Tue Dec 15 22:40:22 1998 *************** *** 744,750 **** fprintferr("\n$$$$$ Tschirnhaus transformation of degree %ld: $$$$$\n",d); flusherr(); } ! v=varn(po); h=polun[v]; setrand(1); do { avma = av0; --- 744,750 ---- fprintferr("\n$$$$$ Tschirnhaus transformation of degree %ld: $$$$$\n",d); flusherr(); } ! v=varn(po); h=polun[v]; do { avma = av0; -- 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://pari.home.ml.org