From 49d657e43aa8b13fc1592c19c844aa3655e2a878 Mon Sep 17 00:00:00 2001 From: Mike Cummings <64451595+mgacummings@users.noreply.github.com> Date: Sat, 1 Jun 2024 15:55:58 -0600 Subject: [PATCH] add code for random principal ideal --- benchmarkIdeals.m2 | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/benchmarkIdeals.m2 b/benchmarkIdeals.m2 index 1dbb412..8f91486 100644 --- a/benchmarkIdeals.m2 +++ b/benchmarkIdeals.m2 @@ -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 ------------------------------------------------------------------------------------------