Goto Chapter: Top 1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C Bib Ind
 [Top of Book]  [Contents]   [Previous Chapter]   [Next Chapter] 

B "Random" functions
 B.1 Random functions for numerical semigroups
 B.2 Random functions for affine semigroups
 B.3 Random functions for good semigroups

B "Random" functions

Here we describe some functions which allow to create several "random" objects. We make use of the function RandomList.

B.1 Random functions for numerical semigroups

B.1-1 RandomNumericalSemigroup
‣ RandomNumericalSemigroup( n, a[, b] )( function )

Returns a ``random" numerical semigroup with no more than n generators in [1..a] (or in [a..b], if b is present).

gap> RandomNumericalSemigroup(3,9);
<Numerical semigroup with 3 generators>
gap> RandomNumericalSemigroup(3,9,55);
<Numerical semigroup with 3 generators>

B.1-2 RandomListForNS
‣ RandomListForNS( n, a, b )( function )

Returns a set of length not greater than n of random integers in [a..b] whose GCD is 1. It is used to create "random" numerical semigroups.

gap> RandomListForNS(13,1,79);
[ 22, 26, 29, 31, 34, 46, 53, 61, 62, 73, 76 ]

B.1-3 RandomModularNumericalSemigroup
‣ RandomModularNumericalSemigroup( k[, m] )( function )

Returns a ``random" modular numerical semigroup S(a,b) with a le k (see 1.) and multiplicity at least m, were m is the second argument, which may not be present..

gap> RandomModularNumericalSemigroup(9);
<Modular numerical semigroup satisfying 5x mod 6 <= x >
gap> RandomModularNumericalSemigroup(10,25);
<Modular numerical semigroup satisfying 4x mod 157 <= x >

B.1-4 RandomProportionallyModularNumericalSemigroup
‣ RandomProportionallyModularNumericalSemigroup( k[, m] )( function )

Returns a ``random" proportionally modular numerical semigroup S(a,b,c) with a le k (see 1.) and multiplicity at least m, were m is the second argument, which may not be present.

gap> RandomProportionallyModularNumericalSemigroup(9);
<Proportionally modular numerical semigroup satisfying 2x mod 3 <= 2x >
gap> RandomProportionallyModularNumericalSemigroup(10,25);
<Proportionally modular numerical semigroup satisfying 6x mod 681 <= 2x >

B.1-5 RandomListRepresentingSubAdditiveFunction
‣ RandomListRepresentingSubAdditiveFunction( m, a )( function )

Produces a ``random" list representing a subadditive function (see 1.) which is periodic with period m (or less). When possible, the images are in [a..20*a]. (Otherwise, the list of possible images is enlarged.)

gap> RandomListRepresentingSubAdditiveFunction(7,9);
[ 173, 114, 67, 0 ]
gap> RepresentsPeriodicSubAdditiveFunction(last);
true

B.1-6 NumericalSemigroupWithRandomElementsAndFrobenius
‣ NumericalSemigroupWithRandomElementsAndFrobenius( n, mult, frob )( function )

Produces a "random" semigroup containing (at least) n elements greater than or equal to mult and less than frob, chosen at random. The semigroup returned has multiplicity chosen at random but no smaller than mult and having Frobenius number chosen at random but not greater than frob. Returns fail if frob is greater than mult.

gap> ns := NumericalSemigroupWithRandomElementsAndFrobenius(5,10,50);
<Numerical semigroup with 17 generators>
gap> MinimalGeneratingSystem(ns);
[ 12, 13, 19, 27, 47 ]
gap> SmallElements(ns);
[ 0, 12, 13, 19, 24, 25, 26, 27, 31, 32, 36, 37, 38, 39, 40, 43 ]
gap> ns2 := NumericalSemigroupWithRandomElementsAndFrobenius(5,10,9); 
#I  The third argument must not be smaller than the second
fail
gap> ns3 := NumericalSemigroupWithRandomElementsAndFrobenius(5,10,10);
<Proportionally modular numerical semigroup satisfying 20x mod 200 <= 10x >
gap> MinimalGeneratingSystem(ns3);                                    
[ 10 .. 19 ]
gap> SmallElements(ns3);                                              
[ 0, 10 ]

B.1-7 RandomNumericalSemigroupWithGenus
‣ RandomNumericalSemigroupWithGenus( g )( function )

Produces a pseudo-random numerical semigroup with genus g.

gap> RandomNumericalSemigroupWithGenus(7);Gaps(last);
<Numerical semigroup with 7 generators>
[ 1, 2, 3, 4, 5, 6, 9 ]

B.2 Random functions for affine semigroups

B.2-1 RandomAffineSemigroupWithGenusAndDimension
‣ RandomAffineSemigroupWithGenusAndDimension( g, d )( function )

Produces a pseudo-random affine semigroup with genus g and dimension d.

gap> RandomAffineSemigroupWithGenusAndDimension(10,3);Gaps(last);
<Affine semigroup in 3 dimensional space, with 66 generators>
[ [ 0, 1, 0 ], [ 0, 2, 0 ], [ 0, 3, 0 ], [ 0, 4, 0 ], [ 0, 5, 0 ], 
  [ 0, 7, 0 ], [ 1, 0, 0 ], [ 1, 1, 0 ], [ 2, 0, 0 ], [ 3, 0, 0 ] ]

B.2-2 RandomAffineSemigroup
‣ RandomAffineSemigroup( n, d, m )( function )

Returns an affine semigroup generated by a n*d matrix where d (the dimension) is randomly choosen from [1..d] and n (the number of generators) is randomly choosen from [1..n]. The entries of the matrix are randomly choosen from [0..m] (when the third argument is not present, m is taken as n*d)

gap> RandomAffineSemigroup(5,5);Generators(last);
<Affine semigroup in 5 dimensional space, with 4 generators>
[ [ 4, 10, 10, 8, 20 ], [ 9, 12, 16, 3, 16 ], [ 14, 19, 14, 3, 20 ], 
  [ 16, 6, 0, 7, 13 ] ]
gap> RandomAffineSemigroup(5,5,3);Generators(last);
<Affine semigroup in 4 dimensional space, with 5 generators>
[ [ 0, 2, 1, 3 ], [ 1, 3, 3, 2 ], [ 2, 3, 3, 2 ], [ 3, 1, 2, 1 ], 
  [ 3, 3, 1, 0 ] ]

B.2-3 RandomFullAffineSemigroup
‣ RandomFullAffineSemigroup( n, d, m )( function )

Returns a full affine semigroup either given by equations or inequalities (when no string is given, one is choosen at random). The matrix is an n*d matrix where d (the dimension) is randomly choosen from [1..d] and n is randomly choosen from [1..n]. When it is given by equations, the moduli are choosen at random. The entries of the matrix (and moduli) are randomly choosen from [0..m] (when the third integer is not present, m is taken as n*d)

gap> RandomFullAffineSemigroup(5,5,3);Generators(last);
<Affine semigroup>
#I  Using contejeanDevieAlgorithm for Hilbert Basis. Please, consider using
NormalizInterface, 4ti2Interface or 4ti2gap.
[ [ 0, 0, 0, 0, 1 ], [ 0, 0, 0, 1, 0 ], [ 0, 0, 1, 0, 0 ], [ 0, 1, 0, 0, 0 ], 
  [ 1, 0, 0, 0, 0 ] ]

B.3 Random functions for good semigroups

B.3-1 RandomGoodSemigroupWithFixedMultiplicity
‣ RandomGoodSemigroupWithFixedMultiplicity( m, cond )( function )

This function produces a "random" semigroup with multiplicity m and with conductor bounded by cond

gap> S:=RandomGoodSemigroupWithFixedMultiplicity([6,7],[30,30]);
<Good semigroup>
gap> SmallElements(S);
[ [ 0, 0 ], [ 6, 7 ], [ 9, 8 ], [ 9, 10 ], [ 9, 11 ], [ 9, 14 ], [ 9, 15 ],
  [ 9, 16 ], [ 10, 8 ], [ 11, 10 ], [ 11, 11 ], [ 12, 10 ], [ 12, 14 ],
  [ 13, 10 ], [ 13, 15 ], [ 13, 16 ], [ 15, 10 ], [ 15, 15 ], [ 15, 16 ],
  [ 16, 10 ], [ 16, 15 ], [ 17, 10 ], [ 17, 16 ] ]
  
 [Top of Book]  [Contents]   [Previous Chapter]   [Next Chapter] 
Goto Chapter: Top 1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C Bib Ind

generated by GAPDoc2HTML