@@ -54,7 +54,7 @@ id = Permutation(0:10)
54
54
```
55
55
56
56
Cycle notation can more compactly describe a permuation, it can be passed in as a container of cycles specified through tuples or vectors:
57
-
57
+
58
58
```
59
59
p = Permutation([(0,2), (1,3)])
60
60
```
@@ -71,7 +71,7 @@ constructor with values separated by commas and the "call" method for
71
71
`i -> j` is created (also the notation `i^p` returns this`) *but* if
72
72
more than one argument is given, a cycle is created and multiplied on
73
73
the *right* by `p`, so that the above becomes `(0,2) * (1,3)`.
74
-
74
+
75
75
Here are two permutations forming the symmetries of square, naturally represented in the two ways:
76
76
77
77
```
@@ -81,11 +81,11 @@ rotate = Permutation([1,2,3,0]) # or Permutation(0,1,2,3) in cycle notation
81
81
82
82
Operations on permutations include:
83
83
84
- * a function call, `p(i)` to recover `j` where `i -> j`, also `i^p`.
84
+ * a function call, `p(i)` to recover `j` where `i -> j`, also `i^p`.
85
85
* `*` for multiplication. The convention is `(p*q)(i) = q(p(i))` or with the `^` notation: `i^(p*q) = (i^p)^q`.
86
86
* `+` for multiplication when `p` and `q` commute, where a check on commuting is performed.
87
87
* `inv` for the inverse permutation.
88
- * `/`, where `p/q` is `p * inv(q)`.
88
+ * `/`, where `p/q` is `p * inv(q)`.
89
89
* `p^n` for powers. We have `inv(p) = p^(-1)` and `p^order(p)` is the identity.
90
90
* `p^q` for conjugate, defined by `inv(q) * p * q`.
91
91
@@ -99,7 +99,7 @@ flip^2 # the identity
99
99
wheres a rotation is not (as it has order 4)
100
100
101
101
```
102
- rotate * rotate
102
+ rotate * rotate
103
103
order(rotate)
104
104
```
105
105
@@ -122,10 +122,10 @@ We can see this is the correct mapping `1 -> 3` with
122
122
We can check that `flip` and `rotate^2` do commute:
123
123
124
124
```
125
- id = Permutation(3) # (n) is the identify
125
+ id = Permutation(3) # (n) is the identify
126
126
commutator(flip, rotate^2) == id
127
- ```
128
-
127
+ ```
128
+
129
129
The conjugate for flip and rotate does the inverse of the flip, then rotates, then flips:
130
130
131
131
```
@@ -136,12 +136,12 @@ This is different than `flip^rotate`. As `flip` commutes with `rotate^2` this wi
136
136
137
137
```
138
138
(rotate^2)^flip
139
- ```
139
+ ```
140
140
141
141
!!! Differences:
142
142
143
- There is no support for the `Cycle` class
144
-
143
+ There is no support for the `Cycle` class
144
+
145
145
"""
146
146
function Permutation (x; kwargs... )
147
147
if typeof (x) <: UnitRange
@@ -218,7 +218,7 @@ for meth in permutations_new_functions
218
218
end
219
219
eval (Expr (:export , meth))
220
220
end
221
-
221
+
222
222
223
223
224
224
# # Base methods of the object
303
303
304
304
_unflatten_cyclic_form (m:: Matrix ) = [m[i,:] for i in 1 : size (m)[1 ]]
305
305
_unflatten_cyclic_form (m) = m
306
-
306
+
307
307
function cyclic_form (p:: SymPermutation )
308
308
m = PyCall. PyObject (p)[:cyclic_form ]
309
309
_unflatten_cyclic_form (m)
@@ -331,12 +331,12 @@ Some pre-defined groups are built-in:
331
331
* `DihedralGroup`: Group formed by a flip and rotation
332
332
* AlternativeGroup: Subgroup of S_n of even elements
333
333
* AbelianGroup: Returns the direct product of cyclic groups with the given orders.
334
-
334
+
335
335
336
336
Differences:
337
337
338
338
* use `collect(generate(G))` in place of `list(G.generate())`
339
-
339
+
340
340
"""
341
341
PermutationGroup (args... ; kwargs... ) = SymPy. combinatorics[:perm_groups ][:PermutationGroup ](args... ; kwargs... )
342
342
export PermutationGroup
@@ -366,7 +366,7 @@ SymPy.elements(gp::SymPy.SymPermutationGroup) = [a for a in PyCall.PyObject(gp)[
366
366
random_element(gp, ...)
367
367
368
368
A random group element. Alias to `sympy"random"`.
369
- """
369
+ """
370
370
random_element (gp:: SymPy.SymPermutationGroup , args... ) = object_meth (gp, :random , args... )
371
371
372
372
# base_methods
387
387
388
388
# new methods
389
389
permutation_group_methods = (# :baseswap,
390
- :base ,
390
+ # :base,
391
391
:center ,
392
392
:centralizer ,
393
393
:commutator ,
@@ -479,7 +479,7 @@ permutation_group_properties = (:basic_orbits,
479
479
:generators ,
480
480
:max_div ,
481
481
:transitivity_degree
482
-
482
+
483
483
)
484
484
for prop in permutation_group_properties
485
485
prop_name = string (prop)
@@ -494,10 +494,6 @@ for prop in permutation_group_properties
494
494
end
495
495
496
496
497
- if ! (VERSION >= v " 1.0.0" )
498
- import Base: base
499
- end
500
-
501
497
base (ex:: SymPermutationGroup ) = PyCall. PyObject (ex)[:base ]
502
498
export base
503
499
0 commit comments