permutations v1.0-5

0

Monthly downloads

0th

Percentile

The Symmetric Group: Permutations of a Finite Set

Manipulates invertible functions from a finite set to itself. Can transform from word form to cycle form and back.

Readme

Build
Status CRAN\_Status\_Badge Rdoc

Overview

The permutations package provides R-centric functionality for working with permutations of a finite set. It includes group-theoretic composition of permutations and can transform from word form to cycle form and back.

Installation

You can install the released version of permutations from CRAN with:

# install.packages("permutations")  # uncomment this to use the package
library("permutations")
#> 
#> Attaching package: 'permutations'
#> The following object is masked from 'package:stats':
#> 
#>     cycle

The package is maintained on github.

The permutations package in use

Random permutations on a finite set are given by the rperm() command:

rperm(10,9)
#>  [1] (19524)(37)    (1238794)      (1745682)(39)  (15)(3897)(46)
#>  [5] (132654789)    (17263)(59)    (136)(47589)   (162)(4795)   
#>  [9] (14763)(259)   (168347925)

The result is printed in cycle form but we can print in word form if we wish:

options(print_word_as_cycle=FALSE)  # override default
as.word(rperm(10,9,3))
#>      {1} {2} {3} {4} {5} {6} {7} {8} {9}
#> [1]  7   .   .   .   .   .   9   .   1  
#> [2]  .   9   2   .   .   .   .   .   3  
#> [3]  .   .   .   .   .   .   .   .   .  
#> [4]  3   .   1   .   .   .   .   .   .  
#> [5]  .   8   .   .   2   .   .   5   .  
#> [6]  .   .   .   6   .   4   .   .   .  
#> [7]  .   .   .   .   .   .   .   .   .  
#> [8]  .   .   .   8   .   .   .   4   .  
#> [9]  6   .   1   .   .   3   .   .   .  
#> [10] .   .   .   9   .   .   .   .   4
options(print_word_as_cycle=TRUE)  # usually want to print a cycle irregardless

(A dot indicates a fixed point). The package uses arithmetic operations * to combine permutations and ^ for conjugation:

(a <- as.word(c(4,2,3,1,5,7,6)))
#> [1] (14)(67)
(b <- as.cycle(1:4))
#> [1] (1234)
a*b
#> [1] (234)(67)
b*a
#> [1] (123)(67)

The megaminx

The megaminx is a dodecahedral puzzle with similar construction to the Rubik cube puzzle that has 50 movable pieces and 132 coloured stickers (``facets’’). The permutations package includes functionality to simulate the megaminx and exhibits an 82-turn superflip. The vignette gives an extended discussion.

Functions in permutations

Name Description
permorder The order of a permutation
as.function.permutation Coerce a permutation to a function
c Concatenation of permutations
nullperm Null permutations
conjugate Are two permutations conjugate?
cyclist details of cyclists
valid Functions to validate permutations
orbit Orbits of integers
id The identity permutation
get1 Retrieve particular cycles or components of cycles
size Gets or sets the size of a permutation
tidy Utilities to neaten permutation objects
commutator Group-theoretic commutator and group action
allperms All permutations of a given size
megaminx megaminx
sgn Sign of a permutation
print Print methods for permutation objects
derangement Tests for a permutation being a derangement
length Various vector-like utilities for permutation objects.
dodecahedron The dodecahedron group
inverse Inverse of a permutation
megaminx_plotter Plotting routine for megaminx sequences
cayley Cayley tables for permutation groups
Ops.permutation Arithmetic Ops Group Methods for permutations
shape Shape of a permutation
rperm Random permutations
fixed Fixed elements
fbin The fundamental bijection
permutation Functions to create and coerce word objects and cycle objects
permutations-package permutations
perm_matrix Permutation matrices
No Results!

Vignettes of permutations

Name
megaminx_net.pdf
megaminx_net.svg
permutations.Rnw
permutations.bib
start.jpg
superflip.jpg
No Results!

Last month downloads

Details

Type Package
License GPL-2
VignetteBuilder knitr
URL https://github.com/RobinHankin/permutations.git
BugReports https://github.com/RobinHankin/permutations/issues
NeedsCompilation no
Packaged 2019-10-17 19:16:04 UTC; rhankin
Repository CRAN
Date/Publication 2019-10-17 20:20:07 UTC

Include our badge in your README

[![Rdoc](http://www.rdocumentation.org/badges/version/permutations)](http://www.rdocumentation.org/packages/permutations)