‣ DifferencesList ( L ) | ( function ) |
‣ QuotientsList ( L ) | ( function ) |
‣ FloatQuotientsList ( L ) | ( function ) |
These functions are in the process of being transferred from package ResClasses: for now you should LoadPackage("resclasses")
in order to use them.
They take a list L of length n and output the lists of length n-1 containing all the differences L[i]-L[i-1] and all the quotients L[i]/L[i-1] of consecutive entries in L.
In the quotient functions an error is returned if an entry is zero.
gap> L := [ 1, 3, 5, -1, -3, -5 ];; gap> DifferencesList( L ); [ 2, 2, -6, -2, -2 ] gap> QuotientsList( L ); [ 3, 5/3, -1/5, 3, 5/3 ] gap> FloatQuotientsList( L ); [ 3., 1.66667, -0.2, 3., 1.66667 ] gap> QuotientsList( [ 2, 1, 0, -1, -2 ] ); [ 1/2, 0, fail, 2 ]
‣ SearchCycle ( L ) | ( operation ) |
This function is in the process of being transferred from package RCWA: for now you should LoadPackage("rcwa")
in order to use it.
SearchCycle
is a tool to find likely cycles in lists. What, precisely, a cycle is, is deliberately fuzzy here, and may possibly even change. The idea is that the beginning of the list may be anything, following that the same pattern needs to be repeated several times in order to be recognized as a cycle.
gap> L := [1..20];; L[1]:=13;; gap> for i in [1..19] do > if IsOddInt(L[i]) then L[i+1]:=3*L[i]+1; else L[i+1]:=L[i]/2; fi; > od; gap> L; [ 13, 40, 20, 10, 5, 16, 8, 4, 2, 1, 4, 2, 1, 4, 2, 1, 4, 2, 1, 4 ] gap> SearchCycle( L ); [ 1, 4, 2 ]
‣ RandomCombination ( S, k ) | ( operation ) |
This function is in the process of being transferred from package ResClasses: for now you should LoadPackage("resclasses")
in order to use it.
It returns a random unordered k-tuple of distinct elements of a set S.
gap> RandomCombination([31..79],8); [ 33, 45, 60, 63, 65, 69, 71, 77 ]
‣ PrintListOneItemPerLine ( L ) | ( operation ) |
This function has been transferred from package XMod. Printing lists vertically, rather than in the usual horizontal form, may be useful when the entries are lengthy.
gap> PrintListOneItemPerLine( KnownPropertiesOfObject(L) ); [ IsFinite, IsSmallList ]
‣ DistinctRepresentatives ( list ) | ( operation ) |
‣ CommonRepresentatives ( list ) | ( operation ) |
‣ CommonTransversal ( grp, subgrp ) | ( operation ) |
‣ IsCommonTransversal ( grp, subgrp, list ) | ( operation ) |
These functions have been transferred from package XMod. They deal with lists of subsets of [1 ... n] and construct systems of distinct and common representatives using simple, non-recursive, combinatorial algorithms.
When L is a set of n subsets of [1 ... n] and the Hall condition is satisfied (the union of any k subsets has at least k elements), a set of DistinctRepresentatives
exists.
When J,K are both lists of n sets, the function CommonRepresentatives
returns two lists: the set of representatives, and a permutation of the subsets of the second list. It may also be used to provide a common transversal for sets of left and right cosets of a subgroup H of a group G, although a greedy algorithm is usually quicker.
gap> J := [ [1,2,3], [3,4], [3,4], [1,2,4] ];; gap> DistinctRepresentatives( J ); [ 1, 3, 4, 2 ] gap> K := [ [3,4], [1,2], [2,3], [2,3,4] ];; gap> CommonRepresentatives( J, K ); [ [ 3, 3, 3, 1 ], [ 1, 3, 4, 2 ] ] gap> d16 := DihedralGroup( IsPermGroup, 16 ); SetName( d16, "d16" ); Group([ (1,2,3,4,5,6,7,8), (2,8)(3,7)(4,6) ]) gap> c4 := Subgroup( d16, [ d16.1^2 ] ); SetName( c4, "c4" ); Group([ (1,3,5,7)(2,4,6,8) ]) gap> RightCosets( d16, c4 ); [ RightCoset(c4,()), RightCoset(c4,(2,8)(3,7)(4,6)), RightCoset(c4,(1,8,7,6,5, 4,3,2)), RightCoset(c4,(1,8)(2,7)(3,6)(4,5)) ] gap> trans := CommonTransversal( d16, c4 ); [ (), (2,8)(3,7)(4,6), (1,2,3,4,5,6,7,8), (1,2)(3,8)(4,7)(5,6) ] gap> IsCommonTransversal( d16, c4, trans ); true
‣ BlankFreeString ( obj ) | ( function ) |
This function is in the process of being transferred from package ResClasses: for now you should LoadPackage("resclasses")
in order to use it.
The result of BlankFreeString( obj );
is a composite of the functions String( obj )
and RemoveCharacters( obj, " " );
.
gap> D12 := DihedralGroup( 12 );; gap> BlankFreeString( D12 ); "Group([f1,f2,f3])"
‣ StringDotSuffix ( str, suf ) | ( operation ) |
This function has been transferred from package AutoDoc, and was originally named AUTODOC_GetSuffix
.
When StringDotSuffix
is given a string containing a "." it return its extension, i.e. the bit after the last ".".
gap> StringDotSuffix( "file.ext" ); "ext" gap> StringDotSuffix( "file.ext.bak" ); "bak" gap> StringDotSuffix( "file." ); "" gap> StringDotSuffix( "Hello" ); fail
generated by GAPDoc2HTML