SG::GenPerm
--
generates an element of the symmetric group
SG::GenPerm(n,typeperm)
SG::GenPerm(perm,typeperm)
n | - | any positive integer |
perm | - | any list denoting a permutation |
typeperm | - | First , Previous , Next , Last |
The SG::GenPerm
function generates one element of a symmetric group in
lexicographic order, according to the parameter typeperm
.
returns the first permutation of Sn.
SG::GenPerm
(n, First)
returns the last permutation of Sn.
SG::GenPerm
(n, Last)
gives the previous permutation according to
the lexicographic order.
It returns the SG::GenPerm
(perm, Previous)null()
value when perm is already the first permutation.
gives the next permutation according to the
lexicographic order.
It returns the SG::GenPerm
(perm, Next)null()
value when perm is already the last permutation.
>> muEC::SG::GenPerm( [3, 1, 4, 2], Next );
[3, 2, 1, 4]
>> muEC::SG::GenPerm(%, Previous);
[3, 1, 4, 2]
MuPAD Combinat, an open source algebraic combinatorics package