OKlibrary
0.2.1.6

Central docusfile for enumeration at the Maxima/Lisp level. More...
Go to the source code of this file.
Central docusfile for enumeration at the Maxima/Lisp level.
Load all enumerationfunctionality (specifically) by
oklib_load("OKlib/ComputerAlgebra/Combinatorics/Lisp/Enumeration/include.mac");
The basic concepts one finds in ComputerAlgebra/Combinatorics/Lisp/Enumeration/Basics.mac.
The functionality is loaded (specifically) by
(%i1) oklib_load("OKlib/ComputerAlgebra/Combinatorics/Lisp/Enumeration/Subsets.mac");
See ComputerAlgebra/Combinatorics/Lisp/Enumeration/Subsets.mac for the definitions and specifications.
Counting of ksubsets (subsets of length k) happens, of course, by using binomial coefficients, but for completeness we also provide special functions:
(%i2) count_ksubsets_s({1,3,5,6},2); (%o2) 6 (%i3) count_ksubsets(4,2); (%o3) 6
The list of all ksubsets of a set in lexicographical order:
(%i4) lex_ksubsets_l({1,1,2,2},2); (%o4) [{2,1},{2,1},{2,2},{1,1},{1,2},{1,2}] (%i5) lex_ksubsets_ll([1,1,2,2],2); (%o5) [{1,1},{1,2},{2,1},{1,2},{2,1},{2,2}]
Ranking and unranking is available for standardised basesets {1, ..., n}:
(%i6) lex_ksubsets_l(setn(4),2); (%o6) [{1,2},{1,3},{1,4},{2,3},{2,4},{3,4}] (%i7) rank_lex_ksubsets({1,4},4); (%o7) 3 (%i8) unrank_lex_ksubsets(3,4,2); (%o8) {1,4}
The list of all ksubsets of a set in colexicographical order:
(%i9) colex_ksubsets_l({1,1,2,2},2); (%o9) [{2,1},{2,1},{1,1},{2,2},{1,2},{1,2}] (%i10) colex_ksubsets_ll([1,1,2,2],2); (%o10) [{1,1},{1,2},{1,2},{2,1},{2,1},{2,2}]
Ranking and unranking is available for standardised basesets {1, ..., n}:
(%i11) colex_ksubsets_l(setn(4),2); (%o11) [{1,2},{1,3},{2,3},{1,4},{2,4},{3,4}] (%i12) rank_colex_ksubsets({2,3}); (%o12) 3 (%i13) unrank_colex_ksubsets(3,4,2); (%o13) {2,3}
Definition in file general.hpp.