Did I find the right examples for you? yes no

All Samples(855)  |  Call(818)  |  Derive(0)  |  Import(37)
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...)

src/s/y/sympy-0.7.5/sympy/combinatorics/generators.py   sympy(Download)
from __future__ import print_function, division
 
from sympy.combinatorics.permutations import Permutation
from sympy.utilities.iterables import variations, rotate_left
from sympy.core.symbol import symbols
    """
    for perm in variations(list(range(n)), n):
        yield Permutation(perm)
 
 
    gen = list(range(n))
    for i in xrange(n):
        yield Permutation(gen)
        gen = rotate_left(gen, 1)
 
    """
    for perm in variations(list(range(n)), n):
        p = Permutation(perm)
        if p.is_even:
            yield p
    """
    if n == 1:
        yield Permutation([0, 1])
        yield Permutation([1, 0])
    elif n == 2:

src/s/y/sympy-HEAD/sympy/combinatorics/generators.py   sympy(Download)
from __future__ import print_function, division
 
from sympy.combinatorics.permutations import Permutation
from sympy.utilities.iterables import variations, rotate_left
from sympy.core.symbol import symbols
    """
    for perm in variations(list(range(n)), n):
        yield Permutation(perm)
 
 
    gen = list(range(n))
    for i in xrange(n):
        yield Permutation(gen)
        gen = rotate_left(gen, 1)
 
    """
    for perm in variations(list(range(n)), n):
        p = Permutation(perm)
        if p.is_even:
            yield p
    """
    if n == 1:
        yield Permutation([0, 1])
        yield Permutation([1, 0])
    elif n == 2:

src/s/y/sympy-0.7.5/sympy/combinatorics/named_groups.py   sympy(Download)
from __future__ import print_function, division
 
from sympy.combinatorics.perm_groups import PermutationGroup
from sympy.combinatorics.group_constructs import DirectProduct
from sympy.combinatorics.permutations import Permutation
    # small cases are special
    if n in (1, 2):
        return PermutationGroup([Permutation([0])])
 
    a = list(range(n))
    # small cases are special
    if n == 1:
        return PermutationGroup([Permutation([1, 0])])
    if n == 2:
        return PermutationGroup([Permutation([1, 0, 3, 2]),
               Permutation([2, 3, 0, 1]), Permutation([3, 2, 1, 0])])

src/s/y/sympy-HEAD/sympy/combinatorics/named_groups.py   sympy(Download)
from __future__ import print_function, division
 
from sympy.combinatorics.perm_groups import PermutationGroup
from sympy.combinatorics.group_constructs import DirectProduct
from sympy.combinatorics.permutations import Permutation
    # small cases are special
    if n in (1, 2):
        return PermutationGroup([Permutation([0])])
 
    a = list(range(n))
    # small cases are special
    if n == 1:
        return PermutationGroup([Permutation([1, 0])])
    if n == 2:
        return PermutationGroup([Permutation([1, 0, 3, 2]),
               Permutation([2, 3, 0, 1]), Permutation([3, 2, 1, 0])])

src/s/y/sympy-0.7.5/sympy/combinatorics/tests/test_permutations.py   sympy(Download)
from itertools import permutations
 
from sympy.combinatorics.permutations import (Permutation, _af_parity,
    _af_rmul, _af_rmuln, Cycle)
from sympy.utilities.pytest import raises
def test_Permutation():
    # don't auto fill 0
    raises(ValueError, lambda: Permutation([1]))
    p = Permutation([0, 1, 2, 3])
    # call as bijective
    assert [p(i) for i in range(p.size)] == list(p)
    # call as operator
    assert p(list(range(p.size))) == list(p)

src/s/y/sympy-HEAD/sympy/combinatorics/tests/test_permutations.py   sympy(Download)
from itertools import permutations
 
from sympy.combinatorics.permutations import (Permutation, _af_parity,
    _af_rmul, _af_rmuln, Cycle)
from sympy.utilities.pytest import raises
def test_Permutation():
    # don't auto fill 0
    raises(ValueError, lambda: Permutation([1]))
    p = Permutation([0, 1, 2, 3])
    # call as bijective
    assert [p(i) for i in range(p.size)] == list(p)
    # call as operator
    assert p(list(range(p.size))) == list(p)

src/s/y/sympy-0.7.5/sympy/combinatorics/tensor_can.py   sympy(Download)
from __future__ import print_function, division
 
from sympy.combinatorics.permutations import Permutation, _af_rmul, _af_rmuln,\
    _af_invert, _af_new
from sympy.combinatorics.perm_groups import PermutationGroup, _orbit, \

src/s/y/sympy-HEAD/sympy/combinatorics/tensor_can.py   sympy(Download)
from __future__ import print_function, division
 
from sympy.combinatorics.permutations import Permutation, _af_rmul, _af_rmuln,\
    _af_invert, _af_new
from sympy.combinatorics.perm_groups import PermutationGroup, _orbit, \

src/s/y/sympy-0.7.5/sympy/combinatorics/util.py   sympy(Download)
from __future__ import print_function, division
 
from sympy.ntheory import isprime
from sympy.combinatorics.permutations import Permutation, _af_invert, _af_rmul
from sympy.core.compatibility import xrange

src/s/y/sympy-HEAD/sympy/combinatorics/util.py   sympy(Download)
from __future__ import print_function, division
 
from sympy.ntheory import isprime
from sympy.combinatorics.permutations import Permutation, _af_invert, _af_rmul
from sympy.core.compatibility import xrange

  1 | 2 | 3 | 4  Next