Skip to content

Commit

Permalink
add code for random principal ideal
Browse files Browse the repository at this point in the history
  • Loading branch information
mgacummings committed Jun 1, 2024
1 parent 2e6f1a6 commit 49d657e
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion benchmarkIdeals.m2
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,40 @@


------------------------------------------------------------------------------------------
-- random PID
-- random principal ideal
------------------------------------------------------------------------------------------

restart

randomMonomial = indets -> (
upperExponentBound := 10;

numVars := #indets;

possibleExponents := random splice join apply(toList(0..upperExponentBound), n -> (numVars-2*n):n);
(random ZZ) * (product apply(toList(0..numVars-1), i -> (indets_i)^(possibleExponents_i) ))
)

randomPolynomial = indets -> (
numTerms := 5;
sum apply(toList(1..numTerms), j -> (random ZZ) * randomMonomial(indets))
)

R = QQ[x_1..x_10]
f = product for i from 1 to 3 list ((randomPolynomial(gens R))^(first random toList (1..5)));
I = ideal f;
time radical(I, Strategy=>CompleteIntersection);


-- approx. avg. time for Strategy=>Unmixed: not finishing, quit after a minute or so
-- approx. avg. time for Strategy=>Decompose: about 0.4s, usually between 0.2s and 0.7s
-- approx. avg. time for Strategy=>CompleteIntersection: at most 0.001s





restart


------------------------------------------------------------------------------------------
Expand Down

0 comments on commit 49d657e

Please sign in to comment.