Did I find the right examples for you? yes no

# sympy.combinatorics.Permutation

All Samples(88)  |  Call(73)  |  Derive(0)  |  Import(15)
```A permutation, alternatively known as an 'arrangement number' or 'ordering'
is an arrangement of the elements of an ordered list into a one-to-one
mapping with itself. The permutation of a given arrangement is given by
indicating the positions of the elements after re-arrangment [2]_. For
example, if one started with elements [x, y, a, b] (in that order) and
they were reordered as [x, y, b, a] then the permutation would be
[0, 1, 3, 2]. Notice that (in SymPy) the first element is always referred
to as 0 and the permutation uses the indices of the elements in the
original ordering, not the elements (a, b, etc...) themselves.
(more...)
```

```
from sympy.core import Basic
from sympy.combinatorics import Permutation
from sympy.combinatorics.permutations import (_af_commutes_with, _af_invert,
_af_rmul, _af_rmuln, _af_pow, Cycle)
```
```            'to define the group')
if any(isinstance(a, Cycle) for a in args):
args = [Permutation(a) for a in args]
if has_variety(a.size for a in args):
degree = kwargs.pop('degree', None)
if degree is None:
degree = max(a.size for a in args)
for i in range(len(args)):
if args[i].size != degree:
args[i] = Permutation(args[i], size=degree)
```
```            if strict:
return False
g = Permutation(g, size=self.degree)
if g in self.generators:
return True
```
```
result = Permutation(list(range(self.degree)))
m = len(self)
for i in range(n):
```

```
from sympy.core import Basic
from sympy.combinatorics import Permutation
from sympy.combinatorics.permutations import (_af_commutes_with, _af_invert,
_af_rmul, _af_rmuln, _af_pow, Cycle)
```
```            'to define the group')
if any(isinstance(a, Cycle) for a in args):
args = [Permutation(a) for a in args]
if has_variety(a.size for a in args):
degree = kwargs.pop('degree', None)
if degree is None:
degree = max(a.size for a in args)
for i in range(len(args)):
if args[i].size != degree:
args[i] = Permutation(args[i], size=degree)
```
```            if strict:
return False
g = Permutation(g, size=self.degree)
if g in self.generators:
return True
```
```
result = Permutation(list(range(self.degree)))
m = len(self)
for i in range(n):
```

```from __future__ import print_function, division

from sympy.core import Basic, Tuple, FiniteSet
from sympy.core.compatibility import as_int
from sympy.combinatorics import Permutation as Perm
```
```        # use the identity permutation if none are given
obj._pgroup = PermutationGroup((
pgroup or [Perm(range(len(corners)))] ))
return obj

```
```            # map face to vertex: the resulting list of vertices are the
# permutation that we seek for the double
new_pgroup.append(Perm([fmap[f] for f in reorder]))
return new_pgroup

```
```    #
_t_pgroup = [
Perm([[1, 2, 3], [0]]),  # cw from top
Perm([[0, 1, 2], [3]]),  # cw from front face
Perm([[0, 3, 2], [1]]),  # cw from back right face
```

```from __future__ import print_function, division

from sympy.core import Basic, Tuple, FiniteSet
from sympy.core.compatibility import as_int
from sympy.combinatorics import Permutation as Perm
```
```        # use the identity permutation if none are given
obj._pgroup = PermutationGroup((
pgroup or [Perm(range(len(corners)))] ))
return obj

```
```            # map face to vertex: the resulting list of vertices are the
# permutation that we seek for the double
new_pgroup.append(Perm([fmap[f] for f in reorder]))
return new_pgroup

```
```    #
_t_pgroup = [
Perm([[1, 2, 3], [0]]),  # cw from top
Perm([[0, 1, 2], [3]]),  # cw from front face
Perm([[0, 3, 2], [1]]),  # cw from back right face
```

```    >>> V = S2('V')
"""
from sympy.combinatorics import Permutation
def tableau2bsgs(a):
if len(a) == 1:
```
```
if not args:
return TensorSymmetry([[], [Permutation(1)]])
if len(args) == 2 and isinstance(args[1][0], Permutation):
return TensorSymmetry(args)
```

```    >>> V = S2('V')
"""
from sympy.combinatorics import Permutation

def tableau2bsgs(a):
```
```
if not args:
return TensorSymmetry(Tuple(), Tuple(Permutation(1)))

if len(args) == 2 and isinstance(args[1][0], Permutation):
```

```def test_Permutation_Cycle():
from sympy.combinatorics import Permutation, Cycle

# general principle: economically, canonically show all moved elements
# and the size of the permutation.
```
```    Permutation.print_cyclic = False
for p, s in [
(Permutation([]),
'Permutation([])'),
(Permutation([], size=1),
'Permutation([0])'),
(Permutation([], size=2),
'Permutation([0, 1])'),
(Permutation([], size=10),
```

```def test_Permutation_Cycle():
from sympy.combinatorics import Permutation, Cycle

# general principle: economically, canonically show all moved elements
# and the size of the permutation.
```
```    Permutation.print_cyclic = False
for p, s in [
(Permutation([]),
'Permutation([])'),
(Permutation([], size=1),
'Permutation([0])'),
(Permutation([], size=2),
'Permutation([0, 1])'),
(Permutation([], size=10),
```

```from sympy.simplify import simplify
from sympy.core.compatibility import reduce
from sympy.combinatorics import Permutation

# TODO you are a bit excessive in the use of Dummies
```

```from sympy.simplify import simplify