Macaulay2 » Documentation
Packages » RandomMonomialIdeals :: randomMonomialSet
next | previous | forward | backward | up | index | toc

randomMonomialSet -- randomly generates a list of monomials in fixed number of variables up to a given degree

Synopsis

Description

The function randomMonomialSet creates a list of monomials, up to a given degree $d$, $1\leq d\leq D$, in $n$ variables. If $p$ is a real number, it generates the set according to the Erdos-Renyi-type model, that is, based on a Binomial distribution: from the list of all monomials of degree $1,\dots,D$ in $n$ variables, it selects each one, independently, with probability $p$.

i1 : n=2; D=3; p=0.2;
i4 : randomMonomialSet(n,D,p)

       2   2     3
o4 = {x , x x , x }
       1   1 2   2

o4 : List
i5 : randomMonomialSet(3,2,0.6)

               2   2
o5 = {x , x , x , x }
       2   3   2   3

o5 : List

Note that this model does not generate the monomial $1$:

i6 : randomMonomialSet(3,2,1.0)

                   2               2         2
o6 = {x , x , x , x , x x , x x , x , x x , x }
       1   2   3   1   1 2   1 3   2   2 3   3

o6 : List

If $M$ is an integer, then the function creates a list of monomials of length $M$: randomly select $M$ monomials from the list of all monomials of degree $1,\dots,D$ in $n$ variables.

i7 : n=10; D=5; M=4;
i10 : randomMonomialSet(n,D,M)

                3          3
o10 = {x x x , x x x  , x x x  , x x x  }
        1 3 8   3 4 10   3 8 10   1 8 10

o10 : List

Note that it returns a set with $M = 4$ monomials.

If $M$ is greater than the total number of monomials in $n$ variables of degree at most $D$, then the function will return all those monomials (and not $M$ of them). For example:

i11 : randomMonomialSet(2,2,10)

            2             2
o11 = {x , x , x x , x , x }
        1   1   1 2   2   2

o11 : List

returns 5 monomials in a generating set, and not 10, since there are fewer than 10 monomials to choose from.

The input of type List controls the number of monomials in the generating set of each degree for the graded ER model. Specifically, this input is either a list of real numbers between 0 and 1, inclusive, whose i-th entry is the probability of including a monomial of degree i in the monomial set, or it is a list of nonnegative integers whose i-th entry is the number of monomials of each degree to include in the monomial set.

Consider the following two examples: If $p=p_1,\dots,p_D$ is a list of real numbers of length $D$, then the function generates the set utilizing the graded Erdos-Renyi-type model: select each monomial of degree $1\le d\le D$, independently, with probability $p_d$.

i12 : randomMonomialSet(2,3,{0.0, 1.0, 1.0})

        2         2   3   2       2   3
o12 = {x , x x , x , x , x x , x x , x }
        1   1 2   2   1   1 2   1 2   2

o12 : List

Note that the degree-1 monomials were not generated, since the first probability vector entry is 0.

If $M=M_1,\dots,M_D$ is a list of integers of length $D$, then the function creates a list of monomials, where $M_d$ monomials are of degree $d$.

i13 : randomMonomialSet(2,3,{2,1,1})

                2   3
o13 = {x , x , x , x }
        1   2   2   1

o13 : List

Observe that there are two degree-1, one degree-2, and one degree-3 monomials.

If Strategy=>"ER", the default setting for the graded fixed number of generators version of the function, the set of monomials we obtain will not necessarily be minimal. Else if Strategy=> "Minimal" then the set of monomials constitutes a minimal generating set which is build up of $M_d$ monomials, or the maximum number possible, of total degree $d$, for $d$ from 1 to $D$, starting from $d=1$.

i14 : randomMonomialSet(3,3,{1,1,1}, Strategy=>"Minimal")

            2   2
o14 = {x , x , x x }
        3   2   1 2

o14 : List

Observe that there are at most one degree-1, one degree-2, and one degree-3 monomials.

Sometimes we are already working in a specific ring and would like the random sets of monomials to live in the same ring:

i15 : D=3;p=.5; R=ZZ/101[a,b,c];
i18 : randomMonomialSet(R,D,p)

                 2        2        2   3   2    2             2   2      2 
o18 = {a, b, c, a , a*c, b , b*c, c , a , a b, a c, a*b*c, a*c , b c, b*c ,
      -----------------------------------------------------------------------
       3
      c }

o18 : List
i19 : ring oo_0

o19 = R

o19 : PolynomialRing

See also

Ways to use randomMonomialSet:

For the programmer

The object randomMonomialSet is a method function with options.