Here we describe some functions which are not specific for numerical semigroups but are used to do computations with them. As they may have interest by themselves, we describe them here.
A sequence of positive rational numbers \( a_1/b_1 < \cdots < a_n/b_n\) with \(a_i,b_i\) positive integers is a Bézout sequence if \( a_{i+1}b_i - a_i b_{i+1}=1\) for all \(i\in \{1,\ldots,n-1\}\).
The following function uses an algorithm presented in [BR09].
‣ BezoutSequence ( arg ) | ( function ) |
arg consists of two rational numbers or a list of two rational numbers. The output is a Bézout sequence with ends the two rational numbers given. (Warning: rational numbers are silently transformed into irreducible fractions.)
gap> BezoutSequence(4/5,53/27); [ 4/5, 1, 3/2, 5/3, 7/4, 9/5, 11/6, 13/7, 15/8, 17/9, 19/10, 21/11, 23/12, 25/13, 27/14, 29/15, 31/16, 33/17, 35/18, 37/19, 39/20, 41/21, 43/22, 45/23, 47/24, 49/25, 51/26, 53/27 ]
‣ IsBezoutSequence ( L ) | ( function ) |
L is a list of rational numbers. IsBezoutSequence
returns true
or false
according to whether L is a Bézout sequence or not.
gap> IsBezoutSequence([ 4/5, 1, 3/2, 5/3, 7/4, 9/5, 11/6]); true gap> IsBezoutSequence([ 4/5, 1, 3/2, 5/3, 7/4, 9/5, 11/3]); Take the 6 and the 7 elements of the sequence false
‣ CeilingOfRational ( r ) | ( function ) |
Returns the smallest integer greater than or equal to the rational r.
gap> CeilingOfRational(3/5); 1
A periodic function \(f\) of period \(m\) from the set \( {\mathbb N} \) of natural numbers into itself may be specified through a list of \(m\) natural numbers. The function \(f\) is said to be subadditive if \(f(i+j)\leq f(i)+f(j)\) and \(f(0)=0\).
‣ RepresentsPeriodicSubAdditiveFunction ( L ) | ( function ) |
L is a list of integers. RepresentsPeriodicSubAdditiveFunction
returns true
or false
according to whether L represents a periodic subadditive function \(f\) periodic of period \(m\) or not. To avoid defining \(f(0)\) (which we assume to be 0) we define \(f(m)=0\) and so the last element of the list must be 0. This technical need is due to the fact that positions in a list must be positive (not a 0).
gap> RepresentsPeriodicSubAdditiveFunction([1,2,3,4,0]); true
‣ IsListOfIntegersNS ( L ) | ( function ) |
Detects whether L is a nonempty list of integers.
gap> IsListOfIntegersNS([1,-1,0]); true gap> IsListOfIntegersNS(2); false gap> IsListOfIntegersNS([[2],3]); false gap> IsListOfIntegersNS([]); false
generated by GAPDoc2HTML