Skip to contents

Various vector-like utilities for permutation objects such as length, names(), etc

Usage

# S3 method for class 'word'
length(x)
# S3 method for class 'permutation'
length(x) <- value
# S3 method for class 'word'
names(x)
# S3 method for class 'word'
names(x) <- value

Arguments

x

permutation object

value

In function names<-.word(), the new names

Details

These functions have methods only for word objects; cycle objects use the methods for lists. It is easy to confuse the length of a permutation with its size.

It is not possible to set the length of a permutation; this is more trouble than it is worth.

Author

Robin K. S. Hankin

See also

Examples


x <- rperm(5,9)
x
#> [1] (124)(3759)(68)   (176)(28)(35)(49) (16827)(34)       (3485)(697)      
#> [5] (1638)(2594)     
#> [coerced from word form]
names(x) <- letters[1:5]
x
#>                 a                 b                 c                 d 
#>   (124)(3759)(68) (176)(28)(35)(49)       (16827)(34)       (3485)(697) 
#>                 e 
#>      (1638)(2594) 
#> [coerced from word form]

megaminx
#>                                                                                            White 
#>                 (10,12,14,16,18)(11,13,15,17,19)(21,33,45,57,69)(22,34,46,58,60)(23,35,47,59,61) 
#>                                                                                           Purple 
#>                 (15,67,91,81,35)(16,68,92,82,36)(17,69,93,83,37)(20,22,24,26,28)(21,23,25,27,29) 
#>                                                                                       DarkYellow 
#>                 (17,29,89,79,47)(18,20,80,70,48)(19,21,81,71,49)(30,32,34,36,38)(31,33,35,37,39) 
#>                                                                                         DarkBlue 
#>              (10,32,78,118,50)(11,33,79,119,51)(19,31,77,117,59)(40,42,44,46,48)(41,43,45,47,49) 
#>                                                                                              Red 
#>           (11,43,115,105,61)(12,44,116,106,62)(13,45,117,107,63)(50,52,54,56,58)(51,53,55,57,59) 
#>                                                                                        DarkGreen 
#>              (13,55,103,93,23)(14,56,104,94,24)(15,57,105,95,25)(60,62,64,66,68)(61,63,65,67,69) 
#>                                                                                       LightGreen 
#>           (30,88,120,110,40)(31,89,121,111,41)(39,87,129,119,49)(70,72,74,76,78)(71,73,75,77,79) 
#>                                                                                           Orange 
#>              (27,99,121,71,37)(28,90,122,72,38)(29,91,123,73,39)(80,82,84,86,88)(81,83,85,87,89) 
#>                                                                                        LightBlue 
#>           (25,65,101,123,83)(26,66,102,124,84)(27,67,103,125,85)(90,92,94,96,98)(91,93,95,97,99) 
#>                                                                                      LightYellow 
#> (53,113,125,95,63)(54,114,126,96,64)(55,115,127,97,65)(100,102,104,106,108)(101,103,105,107,109) 
#>                                                                                             Pink 
#> (41,75,127,107,51)(42,76,128,108,52)(43,77,129,109,53)(110,112,114,116,118)(111,113,115,117,119) 
#>                                                                                             Grey 
#> (73,85,97,109,111)(74,86,98,100,112)(75,87,99,101,113)(120,122,124,126,128)(121,123,125,127,129) 
length(megaminx)   # the megaminx group has 12 generators, one per face.
#> [1] 12
size(megaminx)     # the megaminx group is a subgroup of S_129.
#> [1] 129

names(megaminx) <- NULL   # prints more nicely.
megaminx
#>  [1] (10,12,14,16,18)(11,13,15,17,19)(21,33,45,57,69)(22,34,46,58,60)(23,35,47,59,61)                
#>  [2] (15,67,91,81,35)(16,68,92,82,36)(17,69,93,83,37)(20,22,24,26,28)(21,23,25,27,29)                
#>  [3] (17,29,89,79,47)(18,20,80,70,48)(19,21,81,71,49)(30,32,34,36,38)(31,33,35,37,39)                
#>  [4] (10,32,78,118,50)(11,33,79,119,51)(19,31,77,117,59)(40,42,44,46,48)(41,43,45,47,49)             
#>  [5] (11,43,115,105,61)(12,44,116,106,62)(13,45,117,107,63)(50,52,54,56,58)(51,53,55,57,59)          
#>  [6] (13,55,103,93,23)(14,56,104,94,24)(15,57,105,95,25)(60,62,64,66,68)(61,63,65,67,69)             
#>  [7] (30,88,120,110,40)(31,89,121,111,41)(39,87,129,119,49)(70,72,74,76,78)(71,73,75,77,79)          
#>  [8] (27,99,121,71,37)(28,90,122,72,38)(29,91,123,73,39)(80,82,84,86,88)(81,83,85,87,89)             
#>  [9] (25,65,101,123,83)(26,66,102,124,84)(27,67,103,125,85)(90,92,94,96,98)(91,93,95,97,99)          
#> [10] (53,113,125,95,63)(54,114,126,96,64)(55,115,127,97,65)(100,102,104,106,108)(101,103,105,107,109)
#> [11] (41,75,127,107,51)(42,76,128,108,52)(43,77,129,109,53)(110,112,114,116,118)(111,113,115,117,119)
#> [12] (73,85,97,109,111)(74,86,98,100,112)(75,87,99,101,113)(120,122,124,126,128)(121,123,125,127,129)