Macaulay2 » Documentation
Packages » MonomialAlgebras :: randomSemigroup
next | previous | forward | backward | up | index | toc

# randomSemigroup -- Generate random semigroups.

- Usage:
    `randomSemigroup(a,d,c)`
- Inputs:
  - a, an integer, positive
  - d, an integer, positive
  - c, an integer, positive
- Optional inputs:
  - Num => ..., default value 1, Option of randomSemigroup and randomMonomialAlgebra to return a list of several semigroups.
  - SetSeed => ..., default value false, Option to set the random seed for randomSemigroup and randomMonomialAlgebra.
  - Simplicial => ..., default value false, Option of randomSemigroup and randomMonomialAlgebra to return a simplicial semigroup.
- Outputs:
  - L, a list,

## Description

Generate a random generating set of a semigroups B in \mathbb{N}^d of full dimension with coordinate sum a and codimension c.

Note that the random number generator can be controlled by the command setRandomSeed. Alternatively you can also use the option SetSeed.

The option Num can be used to return a list of semigroups.

The option Simplicial can be used to return a simplicial semigroup such that the standard vectors a*e_i are among the Hilbert basis.

    i1 : randomSemigroup(5,3,7)

    o1 = {{1, 3, 1}, {0, 1, 4}, {2, 1, 2}, {0, 4, 1}, {2, 2, 1}, {3, 2, 0}, {3,
         ------------------------------------------------------------------------
         1, 1}, {5, 0, 0}, {2, 3, 0}, {0, 3, 2}}

    o1 : List

    i2 : setRandomSeed()
     -- initializing random seed

    i3 : randomSemigroup(5,3,7)

    o3 = {{5, 0, 0}, {1, 3, 1}, {1, 4, 0}, {0, 2, 3}, {3, 0, 2}, {0, 1, 4}, {0,
         ------------------------------------------------------------------------
         5, 0}, {4, 1, 0}, {2, 0, 3}, {4, 0, 1}}

    o3 : List

    i4 : setRandomSeed()
     -- initializing random seed

    i5 : randomSemigroup(5,3,7)

    o5 = {{5, 0, 0}, {1, 3, 1}, {1, 4, 0}, {0, 2, 3}, {3, 0, 2}, {0, 1, 4}, {0,
         ------------------------------------------------------------------------
         5, 0}, {4, 1, 0}, {2, 0, 3}, {4, 0, 1}}

    o5 : List

    i6 : setRandomSeed()
     -- initializing random seed

    i7 : randomSemigroup(5,3,7,Num=>2)

    o7 = {{{5, 0, 0}, {1, 3, 1}, {1, 4, 0}, {0, 2, 3}, {3, 0, 2}, {0, 1, 4}, {0,
         ------------------------------------------------------------------------
         5, 0}, {4, 1, 0}, {2, 0, 3}, {4, 0, 1}}, {{1, 3, 1}, {1, 4, 0}, {2, 3,
         ------------------------------------------------------------------------
         0}, {0, 5, 0}, {1, 2, 2}, {3, 1, 1}, {0, 0, 5}, {1, 1, 3}, {4, 0, 1},
         ------------------------------------------------------------------------
         {0, 2, 3}}}

    o7 : List

    i8 : setRandomSeed()
     -- initializing random seed

    i9 : randomSemigroup(5,3,7,Simplicial=>true)

    o9 = {{5, 0, 0}, {0, 5, 0}, {0, 0, 5}, {0, 1, 4}, {4, 0, 1}, {1, 1, 3}, {1,
         ------------------------------------------------------------------------
         3, 1}, {2, 3, 0}, {2, 0, 3}, {1, 4, 0}}

    o9 : List

## Ways to use randomSemigroup:

- `randomSemigroup(ZZ,ZZ,ZZ)`

## For the programmer

The object randomSemigroup is a method function with options.

The source of this document is in /build/macaulay2-88fgJW/macaulay2-1.25.11+ds/M2/Macaulay2/packages/MonomialAlgebras.m2:2320:0.