1#@local checkStandardAssociate, A, x, R 2gap> START_TEST("associate.tst"); 3 4# test StandardAssociate, StandardAssociateUnit, IsAssociated 5gap> checkStandardAssociate := 6> function(R, coll...) 7> local r, u, s; 8> if Length(coll) > 0 then 9> coll := coll[1]; 10> elif Size(R) <= 1000 then 11> coll := R; 12> else 13> coll := List([1..1000],i->Random(R)); 14> fi; 15> for r in coll do 16> u := StandardAssociateUnit(R,r); Assert(0, u in R); 17> if not IsUnit(R,u) then Error("StandardAssociateUnit not a unit for ", [R,r]); fi; 18> s := StandardAssociate(R,r); Assert(0, s in R); 19> if u * r <> s then Error("StandardAssociate doesn't match its unit for ", [R,r]); fi; 20> if not IsAssociated(R,r,s) then Error("r, s not associated for ", [R,r]); fi; 21> od; 22> return true; 23> end;; 24 25# rings in characteristic 0 26gap> checkStandardAssociate(Integers, [-10..10]); 27true 28gap> checkStandardAssociate(Rationals); 29true 30gap> checkStandardAssociate(GaussianIntegers); 31true 32gap> checkStandardAssociate(GaussianRationals); 33true 34 35# finite fields 36gap> ForAll(Filtered([2..50], IsPrimePowerInt), q->checkStandardAssociate(GF(q))); 37true 38 39# ZmodnZ 40gap> ForAll([1..100], m -> checkStandardAssociate(Integers mod m)); 41true 42gap> checkStandardAssociate(Integers mod ((2*3*5)^2)); 43true 44gap> checkStandardAssociate(Integers mod ((2*3*5)^3)); 45true 46gap> checkStandardAssociate(Integers mod ((2*3*5*7)^2)); 47true 48gap> checkStandardAssociate(Integers mod ((2*3*5*7)^3)); 49true 50 51# polynomial rings 52gap> for A in [ GF(5), Integers, Rationals ] do 53> for x in [1,3] do 54> R:=PolynomialRing(A, x); 55> checkStandardAssociate(R, List([1..30],i->PseudoRandom(R))); 56> od; 57> od; 58 59# 60gap> STOP_TEST("associate.tst", 1); 61