File: permutations-doc.m2

package info (click to toggle)
macaulay2 1.25.05%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 172,152 kB
  • sloc: cpp: 107,824; ansic: 16,193; javascript: 4,189; makefile: 3,899; lisp: 702; yacc: 604; sh: 476; xml: 177; perl: 114; lex: 65; python: 33
file content (62 lines) | stat: -rw-r--r-- 1,863 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
document {
    Key => {
	permutations,
       (permutations, ZZ),
       (permutations, VisibleList)
    },
    Headline => "produce all permutations of a list",
    Usage => "permutations x",
    Inputs => { "x" => { ofClass {VisibleList, ZZ} } },
    Outputs => { { "a list of all the permutations of the visible list ", TT "x",
	    ", or, if ", TT "x", " is an integer, of the list of integers from 0 through ", TT "n-1" } },
    EXAMPLE {
	"permutations {a,b,c,d}",
	"permutations 3"
    }
}

document {
    Key => {
	uniquePermutations,
       (uniquePermutations, ZZ),
       (uniquePermutations, VisibleList)
    },
    Headline => "produce all unique permutations of a list",
    Usage => "uniquePermutations x",
    Inputs => { "x" => { ofClass {VisibleList, ZZ} } },
    Outputs => { { "a list of all distinct permutations of the visible list ", TT "x",
	    ", or, if ", TT "x", " is an integer, of the list of integers from 0 through ", TT "n-1" } },
    EXAMPLE {
	"uniquePermutations {a,b,a,b}",
    }
}

document {
    Key => {
	inversePermutation,
       (inversePermutation, VisibleList)
    },
    Headline => "inverse permutation",
    Usage => "y = inversePermutation x",
    Inputs => {
	"x" => List => {"a list of length ", TT "n", " whose elements are the numbers 0, 1, 2, ..., ", TT "n-1", ", in some order,
	    representing the permutation defined by sending ", TT "i", " to ", TT "x#i"
	}
    },
    Outputs => {
	"y" => List => {"the list representing the inverse permutation of ", TT "x" }
    },
    EXAMPLE lines ///
      x = {1,2,3,4,5,0}
      y = inversePermutation x
      all(#x, i -> x#(y#i) == i)
      all(#x, i -> y#(x#i) == i)
    ///,
    PARA { "We compose permutations with ", TT "_", "; see ", TO (symbol_, VisibleList, List), "." },
    EXAMPLE lines ///
      x_x_x
      x_x_x_x_x_x
      x_y
      y_x
    ///
}