1TestCount := 0; 2 3-- the last examples are too long for automatic use 4-- activate them for proper testing, when working on radical 5RunSlowTestForRadical := false; 6-- RunSlowTestForRadical := true; 7 8define TEST_ASSERT(A,B) 9 toplevel TestCount; 10 toplevel PrintInfo; 11 TestCount := TestCount+1; 12 if A<>B then 13 error("TEST: " + Sprint(A) + " <> " + Sprint(B)); 14 endif; 15 // print "."; 16 // println TimeFrom(0); 17enddefine; -- TEST_ASSERT 18 19T0 := CpuTime(); 20 21---------------------------------------------------------------------- 22M:=3; use R::=QQ[x[1..M,1..M]], DegLex; 23J := ideal( 24 x[2,3]*x[3,1] , 25 x[1,2]*x[1,3] - x[1,3]*x[1,3], 26 x[1,1]*x[3,3] , 27 x[2,3]*x[1,2] - x[2,1]*x[1,3] 28 ); 29TEST_ASSERT(IsZeroDim(J), false); 30TEST_ASSERT(radical(J), 31ideal(x[2,3]*x[3,1], x[1,3]*x[2,1] -x[1,3]*x[2,3], 32 x[1,2]*x[2,3] -x[1,3]*x[2,3], x[1,2]*x[1,3] -x[1,3]^2, x[1,1]*x[3,3])); 33 34---------------------------------------------------------------------- 35use R::=QQ[b,c,d,e], DegLex; 36J := ideal([d*e, b*e -c*d, b*c -c^2, -b^2 +b*c]); 37TEST_ASSERT(IsZeroDim(J), false); 38TEST_ASSERT(radical(J), ideal(b -c, c*e, c*d, d*e)); 39 40---------------------------------------------------------------------- 41M:=6; use R::=QQ[x[1..M,1..M]], DegLex; 42 43J := ideal( 44 x[2,4]*x[3,6] - x[2,6]*x[3,4], 45 x[1,3]*x[2,4] - x[1,4]*x[2,3], 46 x[1,2]*x[4,3] - x[1,3]*x[4,2], 47 x[1,2]*x[5,4] - x[1,4]*x[5,2], 48 x[2,4]*x[5,5] - x[2,5]*x[5,4], 49 x[1,1]*x[3,4] - x[1,4]*x[3,1], 50 x[2,3]*x[6,5] - x[2,5]*x[6,3]); 51 52RadJ := ideal(x[2,4]*x[5,5] -x[2,5]*x[5,4], 53 x[2,4]*x[3,6] -x[2,6]*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*x[2,6]*x[3,4]*x[4,3]*x[5,2]*x[6,5], 71 x[1,3]*x[1,4]*x[2,6]*x[3,1]*x[5,4]*x[6,5] -x[1,4]^2*x[2,6]*x[3,1]*x[5,5]*x[6,3], 72 x[1,2]*x[1,4]*x[2,6]*x[3,1]*x[5,5]*x[6,3] -x[1,3]*x[1,4]*x[2,6]*x[3,1]*x[5,2]*x[6,5], 73 x[1,4]*x[2,6]*x[3,1]*x[4,2]*x[5,5]*x[6,3] -x[1,4]*x[2,6]*x[3,1]*x[4,3]*x[5,2]*x[6,5]); 74 75TEST_ASSERT(IsZeroDim(J), false); 76TEST_ASSERT(Radical(J), RadJ); 77TEST_ASSERT(Radical(RadJ), RadJ); 78// println "comm: done!"; 79 80---------------------------------------------------------------------- 81use P ::= QQ[x[1..4]]; 82 83I:=ideal(12*x[3]*x[4]*x[1]*x[2] - 15*x[4]^2*x[2]^2 + x[3]^2*x[1] + 84 8*x[3]*x[4]*x[1] - 2*x[3]*x[4]*x[2] - 4*x[4]^2*x[2], 85 3*x[3]^2*x[1]^2 - 3*x[4]^2*x[2]^2 + x[3]^2*x[1] + 86 2*x[3]*x[4]*x[1] - 2*x[3]*x[4]*x[2] - x[4]^2*x[2], 87 108*x[4]^3*x[2]^3 - 9*x[3]*x[4]^2*x[2]^2 - 72*x[4]^3*x[2]^2 - 88 x[3]^3*x[1] + 64*x[3]*x[4]^2*x[1] + 2*x[3]^2*x[4]*x[2] - 89 60*x[3]*x[4]^2*x[2] -32*x[4]^3*x[2]); 90 91RadJ := 92ideal(x[1]*x[2]^2*x[4] - (8/9)*x[1]^2*x[3] + (2/9)*x[1]*x[2]*x[3] 93 + (4/9)*x[1]*x[2]*x[4] - ( 4/9)*x[2]^2*x[4] -(2/9)*x[1]*x[3] - (1/9)*x[2]*x[4], 94 x[1]^2*x[2]*x[3] - (4/9)*x[1]^2*x[3] + 95(4/9)*x[1]*x[2]*x[3] + (2/9)*x[1]*x[2]*x[4] - (8/9)*x[2]^2*x[4] - 96(1/9)*x[1]*x[3] - (2/9)*x[2]*x[4], 97 x[1]*x[2]*x[3]*x[4] - (5/4)*x[2]^2*x[4]^2 + 98(1/12)*x[1]*x[3]^2 + (2/3)*x[1]*x[3]*x[4] - ( 1/6)*x[2]*x[3]*x[4] - 99(1/3)*x[2]*x[4]^2, 100 x[1]^2*x[3]^2 - x[2]^2*x[4]^2 + (1/3)*x[1]*x[3]^2 + 101(2/3)*x[1]*x[3]*x[4] - (2/3)*x[2]*x[3]*x[4] - (1/3)*x[2]*x[4]^2, 102 x[2]^3*x[4]^2 103+ (1/9)*x[1]*x[2]*x[3]^2 - (2/9)*x[2]^2*x[3]*x[4] - (2/3)*x[2]^2*x[4]^2 + 104(2/27)*x[1]*x[3]^2 + (16/27)*x[1]*x[3]*x[4] - (16/27)*x[2]*x[3]*x[4] - 105(8/27)*x[2]*x[4]^2); 106 107TEST_ASSERT(IsZeroDim(J), false); 108TEST_ASSERT(radical(I), RadJ); 109TEST_ASSERT(radical(RadJ), RadJ); 110 111 112 113---------------------------------------------------------------------- 114// See redmine 1390 115// Commented out because too slow: takes as long as all other tests combined! 116---------------------------------------------------------------------- 117-- TEST 02 : 118-- Test := Record[Id := "radical_02", Descr := "T2Test"]; 119use ZZ/(32003)[x[1..4]]; 120 121if RunSlowTestForRadical then 122I := 123ideal( 124x[2]^4 + x[1]^3*x[3] - 2*x[1]*x[3]^3 + x[1]^2 + x[2]*x[3], 125- x[1]^2*x[2]^2 - x[2]^3*x[3] - 3*x[2]*x[3]^3 - x[3]^3, 126x[2]^4 - 2*x[1]*x[2]*x[3]^2 - x[1]^2*x[3] + 2*x[2]^2*x[3]); 127 128RadJ := 129ideal(x[2]^4 + x[1]^3*x[3] - 2*x[1]*x[3]^3 + x[1]^2 + x[2]*x[3], 130 -x[1]^2*x[2]^2 - x[2]^3*x[3] - 3*x[2]*x[3]^3 - x[3]^3, 131 x[2]^4 -2*x[1]*x[2]*x[3]^2 - x[1]^2*x[3] + 2*x[2]^2*x[3], 132 x[2]^30 -993*x[2]^29 + 7940*x[2]^28 + 12659*x[2]^27 + 8774*x[2]^26 - 133500*x[2]^25 + 1266*x[2]^24 - 3594*x[2]^23 - 6212*x[2]^22 - 1348032*x[2]^21 + 737*x[2]^20 + 12167*x[2]^19 + 14825*x[2]^18 + 1354633*x[2]^17 - 13782*x[2]^16 + 3147*x[2]^15 + 10094*x[2]^14 + 13614552*x[2]^13 - 12563*x[2]^12 - 1781*x[2]^11 - 12780*x[2]^10 + 1372139*x[2]^9 - 2766*x[2]^8 - 13986*x[2]^7 - 487*x[2]^6 - 5195*x[2]^5 + 138394*x[2]^4 + 2096*x[2]^3 - 842*x[2]^2 - 6203*x[2], 139 x[1]^30 -6031*x[1]^29 - 9808*x[1]^28 + 15432*x[1]^27 + 8298*x[1]^26 + 14010183*x[1]^25 - 12754*x[1]^24 + 9516*x[1]^23 - 1465*x[1]^22 - 1412153*x[1]^21 + 2078*x[1]^20 - 91*x[1]^19 + 1238*x[1]^18 + 382*x[1]^17 142+ 5152*x[1]^16 - 4819*x[1]^15 - 10180*x[1]^14 + 15246*x[1]^13 + 14312691*x[1]^12 - 1049*x[1]^11 - 8004*x[1]^10 + 14757*x[1]^9 + 1441966*x[1]^8 + 8621*x[1]^7 - 8666*x[1]^6 - 14313*x[1]^5 - 11811*x[1]^4 145+ 10360*x[1]^3 - 14808*x[1]^2 + 6253*x[1], 146 x[3]^30 + 2716*x[3]^29 - 14713509*x[3]^28 + 12004*x[3]^27 - 5997*x[3]^26 - 14078*x[3]^25 + 14812648*x[3]^24 - 3187*x[3]^23 + 3848*x[3]^22 - 6570*x[3]^21 + 14911902*x[3]^20 + 9205*x[3]^19 + 4796*x[3]^18 - 9673*x[3]^17 + 15012422*x[3]^16 + 14867*x[3]^15 + 654*x[3]^14 + 15820*x[3]^13 + 1518496*x[3]^12 + 12980*x[3]^11 + 5476*x[3]^10 + 4205*x[3]^9 - 15215956*x[3]^8 - 10724*x[3]^7 - 2919*x[3]^6 - 4935*x[3]^5 + 9924*x[3]^4 153- 14554*x[3]^3 + 12653*x[3]^2 - 10420*x[3]); 154 155TEST_ASSERT(IsZeroDim(J), false); 156TEST_ASSERT($radical.RadicalOfUnmixed(I), RadJ); 157TEST_ASSERT(radical(I), RadJ); 158TEST_ASSERT(radical(RadJ), RadJ); 159-- println "1390: done!"; 160endif; -- RunSlowTestForRadical 161 162