# Affine Permutations#

class sage.combinat.affine_permutation.AffinePermutation(parent, lst, check=True)[source]#

Bases: ClonableArray

An affine permutation, represented in the window notation, and considered as a bijection from $$\ZZ$$ to $$\ZZ$$.

EXAMPLES:

sage: A = AffinePermutationGroup(['A',7,1])
sage: p = A([3, -1, 0, 6, 5, 4, 10, 9])
sage: p
Type A affine permutation with window [3, -1, 0, 6, 5, 4, 10, 9]

>>> from sage.all import *
>>> A = AffinePermutationGroup(['A',Integer(7),Integer(1)])
>>> p = A([Integer(3), -Integer(1), Integer(0), Integer(6), Integer(5), Integer(4), Integer(10), Integer(9)])
>>> p
Type A affine permutation with window [3, -1, 0, 6, 5, 4, 10, 9]

apply_simple_reflection(i, side='right')[source]#

Apply a simple reflection.

INPUT:

• i – an integer

• side – (default: 'right') determines whether to apply the reflection on the 'right' or 'left'

EXAMPLES:

sage: p = AffinePermutationGroup(['A',7,1])([3, -1, 0, 6, 5, 4, 10, 9])
sage: p.apply_simple_reflection(3)
Type A affine permutation with window [3, -1, 6, 0, 5, 4, 10, 9]
sage: p.apply_simple_reflection(11)
Type A affine permutation with window [3, -1, 6, 0, 5, 4, 10, 9]
sage: p.apply_simple_reflection(3, 'left')
Type A affine permutation with window [4, -1, 0, 6, 5, 3, 10, 9]
sage: p.apply_simple_reflection(11, 'left')
Type A affine permutation with window [4, -1, 0, 6, 5, 3, 10, 9]

>>> from sage.all import *
>>> p = AffinePermutationGroup(['A',Integer(7),Integer(1)])([Integer(3), -Integer(1), Integer(0), Integer(6), Integer(5), Integer(4), Integer(10), Integer(9)])
>>> p.apply_simple_reflection(Integer(3))
Type A affine permutation with window [3, -1, 6, 0, 5, 4, 10, 9]
>>> p.apply_simple_reflection(Integer(11))
Type A affine permutation with window [3, -1, 6, 0, 5, 4, 10, 9]
>>> p.apply_simple_reflection(Integer(3), 'left')
Type A affine permutation with window [4, -1, 0, 6, 5, 3, 10, 9]
>>> p.apply_simple_reflection(Integer(11), 'left')
Type A affine permutation with window [4, -1, 0, 6, 5, 3, 10, 9]

grassmannian_quotient(i=0, side='right')[source]#

Return the Grassmannian quotient.

Factors self into a unique product of a Grassmannian and a finite-type element. Returns a tuple containing the Grassmannian and finite elements, in order according to side.

INPUT:

• i – (default: 0) an element of the index set; the descent checked for

EXAMPLES:

sage: A = AffinePermutationGroup(['A',7,1])
sage: p=A([3, -1, 0, 6, 5, 4, 10, 9])
sage: gq=p.grassmannian_quotient()
sage: gq
(Type A affine permutation with window [-1, 0, 3, 4, 5, 6, 9, 10],
Type A affine permutation with window [3, 1, 2, 6, 5, 4, 8, 7])
sage: gq[0].is_i_grassmannian()
True
sage: 0 not in gq[1].reduced_word()
True
sage: prod(gq)==p
True

sage: gqLeft=p.grassmannian_quotient(side='left')
sage: 0 not in gqLeft[0].reduced_word()
True
sage: gqLeft[1].is_i_grassmannian(side='left')
True
sage: prod(gqLeft)==p
True

>>> from sage.all import *
>>> A = AffinePermutationGroup(['A',Integer(7),Integer(1)])
>>> p=A([Integer(3), -Integer(1), Integer(0), Integer(6), Integer(5), Integer(4), Integer(10), Integer(9)])
>>> gq=p.grassmannian_quotient()
>>> gq
(Type A affine permutation with window [-1, 0, 3, 4, 5, 6, 9, 10],
Type A affine permutation with window [3, 1, 2, 6, 5, 4, 8, 7])
>>> gq[Integer(0)].is_i_grassmannian()
True
>>> Integer(0) not in gq[Integer(1)].reduced_word()
True
>>> prod(gq)==p
True

>>> gqLeft=p.grassmannian_quotient(side='left')
>>> Integer(0) not in gqLeft[Integer(0)].reduced_word()
True
>>> gqLeft[Integer(1)].is_i_grassmannian(side='left')
True
>>> prod(gqLeft)==p
True

index_set()[source]#

Index set of the affine permutation group.

EXAMPLES:

sage: A = AffinePermutationGroup(['A',7,1])
sage: A.index_set()
(0, 1, 2, 3, 4, 5, 6, 7)

>>> from sage.all import *
>>> A = AffinePermutationGroup(['A',Integer(7),Integer(1)])
>>> A.index_set()
(0, 1, 2, 3, 4, 5, 6, 7)

is_i_grassmannian(i=0, side='right')[source]#

Test whether self is $$i$$-grassmannian, i.e., either is the identity or has i as the sole descent.

INPUT:

• i – an element of the index set

• side – determines the side on which to check the descents

EXAMPLES:

sage: A = AffinePermutationGroup(['A',7,1])
sage: p=A([3, -1, 0, 6, 5, 4, 10, 9])
sage: p.is_i_grassmannian()
False
sage: q=A.from_word([3,2,1,0])
sage: q.is_i_grassmannian()
True
sage: q=A.from_word([2,3,4,5])
sage: q.is_i_grassmannian(5)
True
sage: q.is_i_grassmannian(2, side='left')
True

>>> from sage.all import *
>>> A = AffinePermutationGroup(['A',Integer(7),Integer(1)])
>>> p=A([Integer(3), -Integer(1), Integer(0), Integer(6), Integer(5), Integer(4), Integer(10), Integer(9)])
>>> p.is_i_grassmannian()
False
>>> q=A.from_word([Integer(3),Integer(2),Integer(1),Integer(0)])
>>> q.is_i_grassmannian()
True
>>> q=A.from_word([Integer(2),Integer(3),Integer(4),Integer(5)])
>>> q.is_i_grassmannian(Integer(5))
True
>>> q.is_i_grassmannian(Integer(2), side='left')
True

is_one()[source]#

Tests whether the affine permutation is the identity.

EXAMPLES:

sage: A = AffinePermutationGroup(['A',7,1])
sage: p=A([3, -1, 0, 6, 5, 4, 10, 9])
sage: p.is_one()
False
sage: q=A.one()
sage: q.is_one()
True

>>> from sage.all import *
>>> A = AffinePermutationGroup(['A',Integer(7),Integer(1)])
>>> p=A([Integer(3), -Integer(1), Integer(0), Integer(6), Integer(5), Integer(4), Integer(10), Integer(9)])
>>> p.is_one()
False
>>> q=A.one()
>>> q.is_one()
True

lower_covers(side='right')[source]#

Return lower covers of self.

The set of affine permutations of one less length related by multiplication by a simple transposition on the indicated side. These are the elements that self covers in weak order.

EXAMPLES:

sage: A = AffinePermutationGroup(['A',7,1])
sage: p=A([3, -1, 0, 6, 5, 4, 10, 9])
sage: p.lower_covers()
[Type A affine permutation with window [-1, 3, 0, 6, 5, 4, 10, 9],
Type A affine permutation with window [3, -1, 0, 5, 6, 4, 10, 9],
Type A affine permutation with window [3, -1, 0, 6, 4, 5, 10, 9],
Type A affine permutation with window [3, -1, 0, 6, 5, 4, 9, 10]]

>>> from sage.all import *
>>> A = AffinePermutationGroup(['A',Integer(7),Integer(1)])
>>> p=A([Integer(3), -Integer(1), Integer(0), Integer(6), Integer(5), Integer(4), Integer(10), Integer(9)])
>>> p.lower_covers()
[Type A affine permutation with window [-1, 3, 0, 6, 5, 4, 10, 9],
Type A affine permutation with window [3, -1, 0, 5, 6, 4, 10, 9],
Type A affine permutation with window [3, -1, 0, 6, 4, 5, 10, 9],
Type A affine permutation with window [3, -1, 0, 6, 5, 4, 9, 10]]

reduced_word()[source]#

Returns a reduced word for the affine permutation.

EXAMPLES:

sage: A = AffinePermutationGroup(['A',7,1])
sage: p=A([3, -1, 0, 6, 5, 4, 10, 9])
sage: p.reduced_word()
[0, 7, 4, 1, 0, 7, 5, 4, 2, 1]

>>> from sage.all import *
>>> A = AffinePermutationGroup(['A',Integer(7),Integer(1)])
>>> p=A([Integer(3), -Integer(1), Integer(0), Integer(6), Integer(5), Integer(4), Integer(10), Integer(9)])
>>> p.reduced_word()
[0, 7, 4, 1, 0, 7, 5, 4, 2, 1]

signature()[source]#

Signature of the affine permutation, $$(-1)^l$$, where $$l$$ is the length of the permutation.

EXAMPLES:

sage: A = AffinePermutationGroup(['A',7,1])
sage: p=A([3, -1, 0, 6, 5, 4, 10, 9])
sage: p.signature()
1

>>> from sage.all import *
>>> A = AffinePermutationGroup(['A',Integer(7),Integer(1)])
>>> p=A([Integer(3), -Integer(1), Integer(0), Integer(6), Integer(5), Integer(4), Integer(10), Integer(9)])
>>> p.signature()
1

to_weyl_group_element()[source]#

The affine Weyl group element corresponding to the affine permutation.

EXAMPLES:

sage: A = AffinePermutationGroup(['A',7,1])
sage: p=A([3, -1, 0, 6, 5, 4, 10, 9])
sage: p.to_weyl_group_element()
[ 0 -1  0  1  0  0  1  0]
[ 1 -1  0  1  0  0  1 -1]
[ 1 -1  0  1  0  0  0  0]
[ 0  0  0  1  0  0  0  0]
[ 0  0  0  1  0 -1  1  0]
[ 0  0  0  1 -1  0  1  0]
[ 0  0  0  0  0  0  1  0]
[ 0 -1  1  0  0  0  1  0]

>>> from sage.all import *
>>> A = AffinePermutationGroup(['A',Integer(7),Integer(1)])
>>> p=A([Integer(3), -Integer(1), Integer(0), Integer(6), Integer(5), Integer(4), Integer(10), Integer(9)])
>>> p.to_weyl_group_element()
[ 0 -1  0  1  0  0  1  0]
[ 1 -1  0  1  0  0  1 -1]
[ 1 -1  0  1  0  0  0  0]
[ 0  0  0  1  0  0  0  0]
[ 0  0  0  1  0 -1  1  0]
[ 0  0  0  1 -1  0  1  0]
[ 0  0  0  0  0  0  1  0]
[ 0 -1  1  0  0  0  1  0]

sage.combinat.affine_permutation.AffinePermutationGroup(cartan_type)[source]#

Wrapper function for specific affine permutation groups.

These are combinatorial implementations of the affine Weyl groups of types $$A$$, $$B$$, $$C$$, $$D$$, and $$G$$ as permutations of the set of all integers. the basic algorithms are derived from [BB2005] and [Eri1995].

EXAMPLES:

sage: ct = CartanType(['A',7,1])
sage: A = AffinePermutationGroup(ct)
sage: A
The group of affine permutations of type ['A', 7, 1]

>>> from sage.all import *
>>> ct = CartanType(['A',Integer(7),Integer(1)])
>>> A = AffinePermutationGroup(ct)
>>> A
The group of affine permutations of type ['A', 7, 1]


We define an element of A:

sage: p = A([3, -1, 0, 6, 5, 4, 10, 9])
sage: p
Type A affine permutation with window [3, -1, 0, 6, 5, 4, 10, 9]

>>> from sage.all import *
>>> p = A([Integer(3), -Integer(1), Integer(0), Integer(6), Integer(5), Integer(4), Integer(10), Integer(9)])
>>> p
Type A affine permutation with window [3, -1, 0, 6, 5, 4, 10, 9]


We find the value $$p(1)$$, considering $$p$$ as a bijection on the integers. This is the same as calling the value() method:

sage: p.value(1)
3
sage: p(1) == p.value(1)
True

>>> from sage.all import *
>>> p.value(Integer(1))
3
>>> p(Integer(1)) == p.value(Integer(1))
True


We can also find the position of the integer 3 in $$p$$ considered as a sequence, equivalent to finding $$p^{-1}(3)$$:

sage: p.position(3)
1
sage: (p^-1)(3)
1

>>> from sage.all import *
>>> p.position(Integer(3))
1
>>> (p**-Integer(1))(Integer(3))
1


Since the affine permutation group is a group, we demonstrate its group properties:

sage: A.one()
Type A affine permutation with window [1, 2, 3, 4, 5, 6, 7, 8]

sage: q = A([0, 2, 3, 4, 5, 6, 7, 9])
sage: p * q
Type A affine permutation with window [1, -1, 0, 6, 5, 4, 10, 11]
sage: q * p
Type A affine permutation with window [3, -1, 1, 6, 5, 4, 10, 8]

sage: p^-1
Type A affine permutation with window [0, -1, 1, 6, 5, 4, 10, 11]
sage: p^-1 * p == A.one()
True
sage: p * p^-1 == A.one()
True

>>> from sage.all import *
>>> A.one()
Type A affine permutation with window [1, 2, 3, 4, 5, 6, 7, 8]

>>> q = A([Integer(0), Integer(2), Integer(3), Integer(4), Integer(5), Integer(6), Integer(7), Integer(9)])
>>> p * q
Type A affine permutation with window [1, -1, 0, 6, 5, 4, 10, 11]
>>> q * p
Type A affine permutation with window [3, -1, 1, 6, 5, 4, 10, 8]

>>> p**-Integer(1)
Type A affine permutation with window [0, -1, 1, 6, 5, 4, 10, 11]
>>> p**-Integer(1) * p == A.one()
True
>>> p * p**-Integer(1) == A.one()
True


If we decide we prefer the Weyl Group implementation of the affine Weyl group, we can easily get it:

sage: p.to_weyl_group_element()
[ 0 -1  0  1  0  0  1  0]
[ 1 -1  0  1  0  0  1 -1]
[ 1 -1  0  1  0  0  0  0]
[ 0  0  0  1  0  0  0  0]
[ 0  0  0  1  0 -1  1  0]
[ 0  0  0  1 -1  0  1  0]
[ 0  0  0  0  0  0  1  0]
[ 0 -1  1  0  0  0  1  0]

>>> from sage.all import *
>>> p.to_weyl_group_element()
[ 0 -1  0  1  0  0  1  0]
[ 1 -1  0  1  0  0  1 -1]
[ 1 -1  0  1  0  0  0  0]
[ 0  0  0  1  0  0  0  0]
[ 0  0  0  1  0 -1  1  0]
[ 0  0  0  1 -1  0  1  0]
[ 0  0  0  0  0  0  1  0]
[ 0 -1  1  0  0  0  1  0]


We can find a reduced word and do all of the other things one expects in a Coxeter group:

sage: p.has_right_descent(1)
True
sage: p.apply_simple_reflection(1)
Type A affine permutation with window [-1, 3, 0, 6, 5, 4, 10, 9]
sage: p.apply_simple_reflection(0)
Type A affine permutation with window [1, -1, 0, 6, 5, 4, 10, 11]
sage: p.reduced_word()
[0, 7, 4, 1, 0, 7, 5, 4, 2, 1]
sage: p.length()
10

>>> from sage.all import *
>>> p.has_right_descent(Integer(1))
True
>>> p.apply_simple_reflection(Integer(1))
Type A affine permutation with window [-1, 3, 0, 6, 5, 4, 10, 9]
>>> p.apply_simple_reflection(Integer(0))
Type A affine permutation with window [1, -1, 0, 6, 5, 4, 10, 11]
>>> p.reduced_word()
[0, 7, 4, 1, 0, 7, 5, 4, 2, 1]
>>> p.length()
10


The following methods are particular to type $$A$$. We can check if the element is fully commutative:

sage: p.is_fully_commutative()
False
sage: q.is_fully_commutative()
True

>>> from sage.all import *
>>> p.is_fully_commutative()
False
>>> q.is_fully_commutative()
True


We can also compute the affine Lehmer code of the permutation, a weak composition with $$k + 1$$ entries:

sage: p.to_lehmer_code()
[0, 3, 3, 0, 1, 2, 0, 1]

>>> from sage.all import *
>>> p.to_lehmer_code()
[0, 3, 3, 0, 1, 2, 0, 1]


Once we have the Lehmer code, we can obtain a $$k$$-bounded partition by sorting the Lehmer code, and then reading the row lengths. There is a unique 0-Grassmanian (dominant) affine permutation associated to this $$k$$-bounded partition, and a $$k$$-core as well.

sage: p.to_bounded_partition()
[5, 3, 2]
sage: p.to_dominant()
Type A affine permutation with window [-2, -1, 1, 3, 4, 8, 10, 13]
sage: p.to_core()
[5, 3, 2]

>>> from sage.all import *
>>> p.to_bounded_partition()
[5, 3, 2]
>>> p.to_dominant()
Type A affine permutation with window [-2, -1, 1, 3, 4, 8, 10, 13]
>>> p.to_core()
[5, 3, 2]


Finally, we can take a reduced word for $$p$$ and insert it to find a standard composition tableau associated uniquely to that word:

sage: p.tableau_of_word(p.reduced_word())
[[], [1, 6, 9], [2, 7, 10], [], [3], [4, 8], [], [5]]

>>> from sage.all import *
>>> p.tableau_of_word(p.reduced_word())
[[], [1, 6, 9], [2, 7, 10], [], [3], [4, 8], [], [5]]


We can also form affine permutation groups in types $$B$$, $$C$$, $$D$$, and $$G$$:

sage: B = AffinePermutationGroup(['B',4,1])
sage: B.an_element()
Type B affine permutation with window [-1, 3, 4, 11]

sage: C = AffinePermutationGroup(['C',4,1])
sage: C.an_element()
Type C affine permutation with window [2, 3, 4, 10]

sage: D = AffinePermutationGroup(['D',4,1])
sage: D.an_element()
Type D affine permutation with window [-1, 3, 11, 5]

sage: G = AffinePermutationGroup(['G',2,1])
sage: G.an_element()
Type G affine permutation with window [0, 4, -1, 8, 3, 7]

>>> from sage.all import *
>>> B = AffinePermutationGroup(['B',Integer(4),Integer(1)])
>>> B.an_element()
Type B affine permutation with window [-1, 3, 4, 11]

>>> C = AffinePermutationGroup(['C',Integer(4),Integer(1)])
>>> C.an_element()
Type C affine permutation with window [2, 3, 4, 10]

>>> D = AffinePermutationGroup(['D',Integer(4),Integer(1)])
>>> D.an_element()
Type D affine permutation with window [-1, 3, 11, 5]

>>> G = AffinePermutationGroup(['G',Integer(2),Integer(1)])
>>> G.an_element()
Type G affine permutation with window [0, 4, -1, 8, 3, 7]

class sage.combinat.affine_permutation.AffinePermutationGroupGeneric(cartan_type)[source]#

The generic affine permutation group class, in which we define all type-free methods for the specific affine permutation groups.

cartan_matrix()[source]#

Returns the Cartan matrix of self.

EXAMPLES:

sage: AffinePermutationGroup(['A',7,1]).cartan_matrix()
[ 2 -1  0  0  0  0  0 -1]
[-1  2 -1  0  0  0  0  0]
[ 0 -1  2 -1  0  0  0  0]
[ 0  0 -1  2 -1  0  0  0]
[ 0  0  0 -1  2 -1  0  0]
[ 0  0  0  0 -1  2 -1  0]
[ 0  0  0  0  0 -1  2 -1]
[-1  0  0  0  0  0 -1  2]

>>> from sage.all import *
>>> AffinePermutationGroup(['A',Integer(7),Integer(1)]).cartan_matrix()
[ 2 -1  0  0  0  0  0 -1]
[-1  2 -1  0  0  0  0  0]
[ 0 -1  2 -1  0  0  0  0]
[ 0  0 -1  2 -1  0  0  0]
[ 0  0  0 -1  2 -1  0  0]
[ 0  0  0  0 -1  2 -1  0]
[ 0  0  0  0  0 -1  2 -1]
[-1  0  0  0  0  0 -1  2]

cartan_type()[source]#

Returns the Cartan type of self.

EXAMPLES:

sage: AffinePermutationGroup(['A',7,1]).cartan_type()
['A', 7, 1]

>>> from sage.all import *
>>> AffinePermutationGroup(['A',Integer(7),Integer(1)]).cartan_type()
['A', 7, 1]

classical()[source]#

Returns the finite permutation group.

EXAMPLES:

sage: A = AffinePermutationGroup(['A',7,1])
sage: A.classical()
Symmetric group of order 8! as a permutation group

>>> from sage.all import *
>>> A = AffinePermutationGroup(['A',Integer(7),Integer(1)])
>>> A.classical()
Symmetric group of order 8! as a permutation group

from_word(w)[source]#

Builds an affine permutation from a given word. Note: Already in category as from_reduced_word, but this is less typing!

EXAMPLES:

sage: A = AffinePermutationGroup(['A',7,1])
sage: p=A([3, -1, 0, 6, 5, 4, 10, 9])
sage: A.from_word([0, 7, 4, 1, 0, 7, 5, 4, 2, 1])
Type A affine permutation with window [3, -1, 0, 6, 5, 4, 10, 9]

>>> from sage.all import *
>>> A = AffinePermutationGroup(['A',Integer(7),Integer(1)])
>>> p=A([Integer(3), -Integer(1), Integer(0), Integer(6), Integer(5), Integer(4), Integer(10), Integer(9)])
>>> A.from_word([Integer(0), Integer(7), Integer(4), Integer(1), Integer(0), Integer(7), Integer(5), Integer(4), Integer(2), Integer(1)])
Type A affine permutation with window [3, -1, 0, 6, 5, 4, 10, 9]

index_set()[source]#

EXAMPLES:

sage: AffinePermutationGroup(['A',7,1]).index_set()
(0, 1, 2, 3, 4, 5, 6, 7)

>>> from sage.all import *
>>> AffinePermutationGroup(['A',Integer(7),Integer(1)]).index_set()
(0, 1, 2, 3, 4, 5, 6, 7)

is_crystallographic()[source]#

Tells whether the affine permutation group is crystallographic.

EXAMPLES:

sage: AffinePermutationGroup(['A',7,1]).is_crystallographic()
True

>>> from sage.all import *
>>> AffinePermutationGroup(['A',Integer(7),Integer(1)]).is_crystallographic()
True

random_element(n=None)[source]#

Return a random affine permutation of length n.

If n is not specified, then n is chosen as a random non-negative integer in $$[0, 1000]$$.

Starts at the identity, then chooses an upper cover at random. Not very uniform: actually constructs a uniformly random reduced word of length $$n$$. Thus we most likely get elements with lots of reduced words!

For the actual code, see sage.categories.coxeter_group.random_element_of_length().

EXAMPLES:

sage: A = AffinePermutationGroup(['A',7,1])
sage: A.random_element() # random
Type A affine permutation with window [-12, 16, 19, -1, -2, 10, -3, 9]
sage: p = A.random_element(10)
sage: p.length() == 10
True

>>> from sage.all import *
>>> A = AffinePermutationGroup(['A',Integer(7),Integer(1)])
>>> A.random_element() # random
Type A affine permutation with window [-12, 16, 19, -1, -2, 10, -3, 9]
>>> p = A.random_element(Integer(10))
>>> p.length() == Integer(10)
True

rank()[source]#

Rank of the affine permutation group, equal to $$k+1$$.

EXAMPLES:

sage: AffinePermutationGroup(['A',7,1]).rank()
8

>>> from sage.all import *
>>> AffinePermutationGroup(['A',Integer(7),Integer(1)]).rank()
8

reflection_index_set()[source]#

EXAMPLES:

sage: AffinePermutationGroup(['A',7,1]).reflection_index_set()
(0, 1, 2, 3, 4, 5, 6, 7)

>>> from sage.all import *
>>> AffinePermutationGroup(['A',Integer(7),Integer(1)]).reflection_index_set()
(0, 1, 2, 3, 4, 5, 6, 7)

weyl_group()[source]#

Returns the Weyl Group of the same type as self.

EXAMPLES:

sage: A = AffinePermutationGroup(['A',7,1])
sage: A.weyl_group()
Weyl Group of type ['A', 7, 1] (as a matrix group acting on the root space)

>>> from sage.all import *
>>> A = AffinePermutationGroup(['A',Integer(7),Integer(1)])
>>> A.weyl_group()
Weyl Group of type ['A', 7, 1] (as a matrix group acting on the root space)

class sage.combinat.affine_permutation.AffinePermutationGroupTypeA(cartan_type)[source]#
Element[source]#

alias of AffinePermutationTypeA

from_lehmer_code(C, typ='decreasing', side='right')[source]#

Return the affine permutation with the supplied Lehmer code (a weak composition with $$k+1$$ parts, at least one of which is 0).

INPUT:

• typ'increasing' or 'decreasing' (default: 'decreasing'); type of product

• side'right' or 'left' (default: 'right'); whether the decomposition is from the right or left

EXAMPLES:

sage: import itertools
sage: A = AffinePermutationGroup(['A',7,1])
sage: p = A([3, -1, 0, 6, 5, 4, 10, 9])
sage: p.to_lehmer_code()
[0, 3, 3, 0, 1, 2, 0, 1]
sage: A.from_lehmer_code(p.to_lehmer_code()) == p
True
sage: orders = ('increasing','decreasing')
sage: sides = ('left','right')
sage: all(A.from_lehmer_code(p.to_lehmer_code(o,s),o,s) == p
....:     for o,s in itertools.product(orders,sides))
True

>>> from sage.all import *
>>> import itertools
>>> A = AffinePermutationGroup(['A',Integer(7),Integer(1)])
>>> p = A([Integer(3), -Integer(1), Integer(0), Integer(6), Integer(5), Integer(4), Integer(10), Integer(9)])
>>> p.to_lehmer_code()
[0, 3, 3, 0, 1, 2, 0, 1]
>>> A.from_lehmer_code(p.to_lehmer_code()) == p
True
>>> orders = ('increasing','decreasing')
>>> sides = ('left','right')
>>> all(A.from_lehmer_code(p.to_lehmer_code(o,s),o,s) == p
...     for o,s in itertools.product(orders,sides))
True

one()[source]#

Return the identity element.

EXAMPLES:

sage: AffinePermutationGroup(['A',7,1]).one()
Type A affine permutation with window [1, 2, 3, 4, 5, 6, 7, 8]

>>> from sage.all import *
>>> AffinePermutationGroup(['A',Integer(7),Integer(1)]).one()
Type A affine permutation with window [1, 2, 3, 4, 5, 6, 7, 8]

class sage.combinat.affine_permutation.AffinePermutationGroupTypeB(cartan_type)[source]#
Element[source]#

alias of AffinePermutationTypeB

class sage.combinat.affine_permutation.AffinePermutationGroupTypeC(cartan_type)[source]#
Element[source]#

alias of AffinePermutationTypeC

one()[source]#

Return the identity element.

EXAMPLES:

sage: ct=CartanType(['C',4,1])
sage: C = AffinePermutationGroup(ct)
sage: C.one()
Type C affine permutation with window [1, 2, 3, 4]
sage: C.one()*C.one()==C.one()
True

>>> from sage.all import *
>>> ct=CartanType(['C',Integer(4),Integer(1)])
>>> C = AffinePermutationGroup(ct)
>>> C.one()
Type C affine permutation with window [1, 2, 3, 4]
>>> C.one()*C.one()==C.one()
True

class sage.combinat.affine_permutation.AffinePermutationGroupTypeD(cartan_type)[source]#
Element[source]#

alias of AffinePermutationTypeD

class sage.combinat.affine_permutation.AffinePermutationGroupTypeG(cartan_type)[source]#
Element[source]#

alias of AffinePermutationTypeG

one()[source]#

Return the identity element.

EXAMPLES:

sage: AffinePermutationGroup(['G',2,1]).one()
Type G affine permutation with window [1, 2, 3, 4, 5, 6]

>>> from sage.all import *
>>> AffinePermutationGroup(['G',Integer(2),Integer(1)]).one()
Type G affine permutation with window [1, 2, 3, 4, 5, 6]

class sage.combinat.affine_permutation.AffinePermutationTypeA(parent, lst, check=True)[source]#
apply_simple_reflection_left(i)[source]#

Apply the simple reflection to the values $$i$$, $$i+1$$.

EXAMPLES:

sage: p = AffinePermutationGroup(['A',7,1])([3, -1, 0, 6, 5, 4, 10, 9])
sage: p.apply_simple_reflection_left(3)
Type A affine permutation with window [4, -1, 0, 6, 5, 3, 10, 9]
sage: p.apply_simple_reflection_left(11)
Type A affine permutation with window [4, -1, 0, 6, 5, 3, 10, 9]

>>> from sage.all import *
>>> p = AffinePermutationGroup(['A',Integer(7),Integer(1)])([Integer(3), -Integer(1), Integer(0), Integer(6), Integer(5), Integer(4), Integer(10), Integer(9)])
>>> p.apply_simple_reflection_left(Integer(3))
Type A affine permutation with window [4, -1, 0, 6, 5, 3, 10, 9]
>>> p.apply_simple_reflection_left(Integer(11))
Type A affine permutation with window [4, -1, 0, 6, 5, 3, 10, 9]

apply_simple_reflection_right(i)[source]#

Apply the simple reflection to positions $$i$$, $$i+1$$.

INPUT:

• i – an integer

EXAMPLES:

sage: p = AffinePermutationGroup(['A',7,1])([3, -1, 0, 6, 5, 4, 10, 9])
sage: p.apply_simple_reflection_right(3)
Type A affine permutation with window [3, -1, 6, 0, 5, 4, 10, 9]
sage: p.apply_simple_reflection_right(11)
Type A affine permutation with window [3, -1, 6, 0, 5, 4, 10, 9]

>>> from sage.all import *
>>> p = AffinePermutationGroup(['A',Integer(7),Integer(1)])([Integer(3), -Integer(1), Integer(0), Integer(6), Integer(5), Integer(4), Integer(10), Integer(9)])
>>> p.apply_simple_reflection_right(Integer(3))
Type A affine permutation with window [3, -1, 6, 0, 5, 4, 10, 9]
>>> p.apply_simple_reflection_right(Integer(11))
Type A affine permutation with window [3, -1, 6, 0, 5, 4, 10, 9]

check()[source]#

Check that self is an affine permutation.

EXAMPLES:

sage: A = AffinePermutationGroup(['A',7,1])
sage: p = A([3, -1, 0, 6, 5, 4, 10, 9])
sage: p
Type A affine permutation with window [3, -1, 0, 6, 5, 4, 10, 9]
sage: q = A([1,2,3])  # indirect doctest
Traceback (most recent call last):
...
ValueError: length of list must be k+1=8
sage: q = A([1,2,3,4,5,6,7,0])  # indirect doctest
Traceback (most recent call last):
...
ValueError: window does not sum to 36
sage: q = A([1,1,3,4,5,6,7,9])  # indirect doctest
Traceback (most recent call last):
...
ValueError: entries must have distinct residues

>>> from sage.all import *
>>> A = AffinePermutationGroup(['A',Integer(7),Integer(1)])
>>> p = A([Integer(3), -Integer(1), Integer(0), Integer(6), Integer(5), Integer(4), Integer(10), Integer(9)])
>>> p
Type A affine permutation with window [3, -1, 0, 6, 5, 4, 10, 9]
>>> q = A([Integer(1),Integer(2),Integer(3)])  # indirect doctest
Traceback (most recent call last):
...
ValueError: length of list must be k+1=8
>>> q = A([Integer(1),Integer(2),Integer(3),Integer(4),Integer(5),Integer(6),Integer(7),Integer(0)])  # indirect doctest
Traceback (most recent call last):
...
ValueError: window does not sum to 36
>>> q = A([Integer(1),Integer(1),Integer(3),Integer(4),Integer(5),Integer(6),Integer(7),Integer(9)])  # indirect doctest
Traceback (most recent call last):
...
ValueError: entries must have distinct residues

flip_automorphism()[source]#

The Dynkin diagram automorphism which fixes $$s_0$$ and reverses all other indices.

EXAMPLES:

sage: A = AffinePermutationGroup(['A',7,1])
sage: p=A([3, -1, 0, 6, 5, 4, 10, 9])
sage: p.flip_automorphism()
Type A affine permutation with window [0, -1, 5, 4, 3, 9, 10, 6]

>>> from sage.all import *
>>> A = AffinePermutationGroup(['A',Integer(7),Integer(1)])
>>> p=A([Integer(3), -Integer(1), Integer(0), Integer(6), Integer(5), Integer(4), Integer(10), Integer(9)])
>>> p.flip_automorphism()
Type A affine permutation with window [0, -1, 5, 4, 3, 9, 10, 6]

has_left_descent(i)[source]#

Determine whether there is a descent at i.

INPUT:

• i – an integer

EXAMPLES:

sage: p = AffinePermutationGroup(['A',7,1])([3, -1, 0, 6, 5, 4, 10, 9])
sage: p.has_left_descent(1)
True
sage: p.has_left_descent(9)
True
sage: p.has_left_descent(0)
True

>>> from sage.all import *
>>> p = AffinePermutationGroup(['A',Integer(7),Integer(1)])([Integer(3), -Integer(1), Integer(0), Integer(6), Integer(5), Integer(4), Integer(10), Integer(9)])
>>> p.has_left_descent(Integer(1))
True
>>> p.has_left_descent(Integer(9))
True
>>> p.has_left_descent(Integer(0))
True

has_right_descent(i)[source]#

Determine whether there is a descent at i.

INPUT:

• i – an integer

EXAMPLES:

sage: p = AffinePermutationGroup(['A',7,1])([3, -1, 0, 6, 5, 4, 10, 9])
sage: p.has_right_descent(1)
True
sage: p.has_right_descent(9)
True
sage: p.has_right_descent(0)
False

>>> from sage.all import *
>>> p = AffinePermutationGroup(['A',Integer(7),Integer(1)])([Integer(3), -Integer(1), Integer(0), Integer(6), Integer(5), Integer(4), Integer(10), Integer(9)])
>>> p.has_right_descent(Integer(1))
True
>>> p.has_right_descent(Integer(9))
True
>>> p.has_right_descent(Integer(0))
False

is_fully_commutative()[source]#

Determine whether self is fully commutative.

This means that it has no reduced word with a braid.

This uses a specific algorithm.

EXAMPLES:

sage: A = AffinePermutationGroup(['A',7,1])
sage: p = A([3, -1, 0, 6, 5, 4, 10, 9])
sage: p.is_fully_commutative()
False
sage: q = A([-3, -2, 0, 7, 9, 2, 11, 12])
sage: q.is_fully_commutative()
True

>>> from sage.all import *
>>> A = AffinePermutationGroup(['A',Integer(7),Integer(1)])
>>> p = A([Integer(3), -Integer(1), Integer(0), Integer(6), Integer(5), Integer(4), Integer(10), Integer(9)])
>>> p.is_fully_commutative()
False
>>> q = A([-Integer(3), -Integer(2), Integer(0), Integer(7), Integer(9), Integer(2), Integer(11), Integer(12)])
>>> q.is_fully_commutative()
True

maximal_cyclic_decomposition(typ='decreasing', side='right', verbose=False)[source]#

Find the unique maximal decomposition of self into cyclically decreasing/increasing elements.

INPUT:

• typ'increasing' or 'decreasing' (default: 'decreasing'); chooses whether to find increasing or decreasing sets

• side'right' or 'left' (default: 'right') chooses whether to find maximal sets starting from the left or the right

• verbose – (default: False) print extra information while finding the decomposition

EXAMPLES:

sage: p = AffinePermutationGroup(['A',7,1])([3, -1, 0, 6, 5, 4, 10, 9])
sage: p.maximal_cyclic_decomposition()
[[0, 7], [4, 1, 0], [7, 5, 4, 2, 1]]
sage: p.maximal_cyclic_decomposition(side='left')
[[1, 0, 7, 5, 4], [1, 0, 5], [2, 1]]
sage: p.maximal_cyclic_decomposition(typ='increasing', side='right')
[[1], [5, 0, 1, 2], [4, 5, 7, 0, 1]]
sage: p.maximal_cyclic_decomposition(typ='increasing', side='left')
[[0, 1, 2, 4, 5], [4, 7, 0, 1], [7]]

>>> from sage.all import *
>>> p = AffinePermutationGroup(['A',Integer(7),Integer(1)])([Integer(3), -Integer(1), Integer(0), Integer(6), Integer(5), Integer(4), Integer(10), Integer(9)])
>>> p.maximal_cyclic_decomposition()
[[0, 7], [4, 1, 0], [7, 5, 4, 2, 1]]
>>> p.maximal_cyclic_decomposition(side='left')
[[1, 0, 7, 5, 4], [1, 0, 5], [2, 1]]
>>> p.maximal_cyclic_decomposition(typ='increasing', side='right')
[[1], [5, 0, 1, 2], [4, 5, 7, 0, 1]]
>>> p.maximal_cyclic_decomposition(typ='increasing', side='left')
[[0, 1, 2, 4, 5], [4, 7, 0, 1], [7]]

maximal_cyclic_factor(typ='decreasing', side='right', verbose=False)[source]#

For an affine permutation $$x$$, find the unique maximal subset $$A$$ of the index set such that $$x = yd_A$$ is a reduced product.

INPUT:

• typ'increasing' or 'decreasing' (default: 'decreasing'); chooses whether to find increasing or decreasing sets

• side'right' or 'left' (default: 'right') chooses whether to find maximal sets starting from the left or the right

• verbose – True or False. If True, outputs information about how the cyclically increasing element was found.

EXAMPLES:

sage: p = AffinePermutationGroup(['A',7,1])([3, -1, 0, 6, 5, 4, 10, 9])
sage: p.maximal_cyclic_factor()
[7, 5, 4, 2, 1]
sage: p.maximal_cyclic_factor(side='left')
[1, 0, 7, 5, 4]
sage: p.maximal_cyclic_factor('increasing','right')
[4, 5, 7, 0, 1]
sage: p.maximal_cyclic_factor('increasing','left')
[0, 1, 2, 4, 5]

>>> from sage.all import *
>>> p = AffinePermutationGroup(['A',Integer(7),Integer(1)])([Integer(3), -Integer(1), Integer(0), Integer(6), Integer(5), Integer(4), Integer(10), Integer(9)])
>>> p.maximal_cyclic_factor()
[7, 5, 4, 2, 1]
>>> p.maximal_cyclic_factor(side='left')
[1, 0, 7, 5, 4]
>>> p.maximal_cyclic_factor('increasing','right')
[4, 5, 7, 0, 1]
>>> p.maximal_cyclic_factor('increasing','left')
[0, 1, 2, 4, 5]

position(i)[source]#

Find the position j such the self.value(j) == i.

EXAMPLES:

sage: A = AffinePermutationGroup(['A',7,1])
sage: p = A([3, -1, 0, 6, 5, 4, 10, 9])
sage: p.position(3)
1
sage: p.position(11)
9

>>> from sage.all import *
>>> A = AffinePermutationGroup(['A',Integer(7),Integer(1)])
>>> p = A([Integer(3), -Integer(1), Integer(0), Integer(6), Integer(5), Integer(4), Integer(10), Integer(9)])
>>> p.position(Integer(3))
1
>>> p.position(Integer(11))
9

promotion()[source]#

The Dynkin diagram automorphism which sends $$s_i$$ to $$s_{i+1}$$.

EXAMPLES:

sage: A = AffinePermutationGroup(['A',7,1])
sage: p = A([3, -1, 0, 6, 5, 4, 10, 9])
sage: p.promotion()
Type A affine permutation with window [2, 4, 0, 1, 7, 6, 5, 11]

>>> from sage.all import *
>>> A = AffinePermutationGroup(['A',Integer(7),Integer(1)])
>>> p = A([Integer(3), -Integer(1), Integer(0), Integer(6), Integer(5), Integer(4), Integer(10), Integer(9)])
>>> p.promotion()
Type A affine permutation with window [2, 4, 0, 1, 7, 6, 5, 11]

tableau_of_word(w, typ='decreasing', side='right', alpha=None)[source]#

Finds a tableau on the Lehmer code of self corresponding to the given reduced word.

For a full description of this algorithm, see [Den2012].

INPUT:

• w – a reduced word for self

• typ'increasing' or 'decreasing'; the type of Lehmer code used

• side'right' or 'left'

• alpha – a content vector; w should be of type alpha; specifying alpha produces semistandard tableaux

EXAMPLES:

sage: A = AffinePermutationGroup(['A',7,1])
sage: p=A([3, -1, 0, 6, 5, 4, 10, 9])
sage: p.tableau_of_word(p.reduced_word())
[[], [1, 6, 9], [2, 7, 10], [], [3], [4, 8], [], [5]]
sage: A = AffinePermutationGroup(['A',7,1])
sage: p=A([3, -1, 0, 6, 5, 4, 10, 9])
sage: w=p.reduced_word()
sage: w
[0, 7, 4, 1, 0, 7, 5, 4, 2, 1]
sage: alpha=[5,3,2]
sage: p.tableau_of_word(p.reduced_word(), alpha=alpha)
[[], [1, 2, 3], [1, 2, 3], [], [1], [1, 2], [], [1]]
sage: p.tableau_of_word(p.reduced_word(), side='left')
[[1, 4, 9], [6], [], [], [3, 7], [8], [], [2, 5, 10]]
sage: p.tableau_of_word(p.reduced_word(), typ='increasing', side='right')
[[9, 10], [1, 2], [], [], [3, 4], [8], [], [5, 6, 7]]
sage: p.tableau_of_word(p.reduced_word(), typ='increasing', side='left')
[[1, 2], [4, 5, 6], [9, 10], [], [3], [7, 8], [], []]

>>> from sage.all import *
>>> A = AffinePermutationGroup(['A',Integer(7),Integer(1)])
>>> p=A([Integer(3), -Integer(1), Integer(0), Integer(6), Integer(5), Integer(4), Integer(10), Integer(9)])
>>> p.tableau_of_word(p.reduced_word())
[[], [1, 6, 9], [2, 7, 10], [], [3], [4, 8], [], [5]]
>>> A = AffinePermutationGroup(['A',Integer(7),Integer(1)])
>>> p=A([Integer(3), -Integer(1), Integer(0), Integer(6), Integer(5), Integer(4), Integer(10), Integer(9)])
>>> w=p.reduced_word()
>>> w
[0, 7, 4, 1, 0, 7, 5, 4, 2, 1]
>>> alpha=[Integer(5),Integer(3),Integer(2)]
>>> p.tableau_of_word(p.reduced_word(), alpha=alpha)
[[], [1, 2, 3], [1, 2, 3], [], [1], [1, 2], [], [1]]
>>> p.tableau_of_word(p.reduced_word(), side='left')
[[1, 4, 9], [6], [], [], [3, 7], [8], [], [2, 5, 10]]
>>> p.tableau_of_word(p.reduced_word(), typ='increasing', side='right')
[[9, 10], [1, 2], [], [], [3, 4], [8], [], [5, 6, 7]]
>>> p.tableau_of_word(p.reduced_word(), typ='increasing', side='left')
[[1, 2], [4, 5, 6], [9, 10], [], [3], [7, 8], [], []]

to_bounded_partition(typ='decreasing', side='right')[source]#

Return the $$k$$-bounded partition associated to the dominant element obtained by sorting the Lehmer code.

INPUT:

• typ'increasing' or 'decreasing' (default: 'decreasing'.) Chooses whether to find increasing or decreasing sets.

• side'right' or 'left' (default: 'right'.) Chooses whether to find maximal sets starting from the left or the right.

EXAMPLES:

sage: A = AffinePermutationGroup(['A',2,1])
sage: p=A.from_lehmer_code([4,1,0])
sage: p.to_bounded_partition()
[2, 1, 1, 1]

>>> from sage.all import *
>>> A = AffinePermutationGroup(['A',Integer(2),Integer(1)])
>>> p=A.from_lehmer_code([Integer(4),Integer(1),Integer(0)])
>>> p.to_bounded_partition()
[2, 1, 1, 1]

to_core(typ='decreasing', side='right')[source]#

Returns the core associated to the dominant element obtained by sorting the Lehmer code.

INPUT:

• typ'increasing' or 'decreasing' (default: 'decreasing'.)

• side'right' or 'left' (default: 'right'.) Chooses whether to find maximal sets starting from the left or the right.

EXAMPLES:

sage: A = AffinePermutationGroup(['A',2,1])
sage: p=A.from_lehmer_code([4,1,0])
sage: p.to_bounded_partition()
[2, 1, 1, 1]
sage: p.to_core()
[4, 2, 1, 1]

>>> from sage.all import *
>>> A = AffinePermutationGroup(['A',Integer(2),Integer(1)])
>>> p=A.from_lehmer_code([Integer(4),Integer(1),Integer(0)])
>>> p.to_bounded_partition()
[2, 1, 1, 1]
>>> p.to_core()
[4, 2, 1, 1]

to_dominant(typ='decreasing', side='right')[source]#

Finds the Lehmer code and then sorts it. Returns the affine permutation with the given sorted Lehmer code; this element is 0-dominant.

INPUT:

• typ'increasing' or 'decreasing' (default: 'decreasing') chooses whether to find increasing or decreasing sets

• side'right' or 'left' (default: 'right') chooses whether to find maximal sets starting from the left or the right

EXAMPLES:

sage: A = AffinePermutationGroup(['A',7,1])
sage: p=A([3, -1, 0, 6, 5, 4, 10, 9])
sage: p.to_dominant()
Type A affine permutation with window [-2, -1, 1, 3, 4, 8, 10, 13]
sage: p.to_dominant(typ='increasing', side='left')
Type A affine permutation with window [3, 4, -1, 5, 0, 9, 6, 10]

>>> from sage.all import *
>>> A = AffinePermutationGroup(['A',Integer(7),Integer(1)])
>>> p=A([Integer(3), -Integer(1), Integer(0), Integer(6), Integer(5), Integer(4), Integer(10), Integer(9)])
>>> p.to_dominant()
Type A affine permutation with window [-2, -1, 1, 3, 4, 8, 10, 13]
>>> p.to_dominant(typ='increasing', side='left')
Type A affine permutation with window [3, 4, -1, 5, 0, 9, 6, 10]

to_lehmer_code(typ='decreasing', side='right')[source]#

Return the affine Lehmer code.

There are four such codes; the options typ and side determine which code is generated. The codes generated are the shape of the maximal cyclic decompositions of self according to the given typ and side options.

INPUT:

• typ'increasing' or 'decreasing' (default: 'decreasing'); chooses whether to find increasing or decreasing sets

• side'right' or 'left' (default: 'right') chooses whether to find maximal sets starting from the left or the right

EXAMPLES:

sage: import itertools
sage: A = AffinePermutationGroup(['A',7,1])
sage: p=A([3, -1, 0, 6, 5, 4, 10, 9])
sage: orders = ('increasing','decreasing')
sage: sides = ('left','right')
sage: for o,s in itertools.product(orders, sides):
....:   p.to_lehmer_code(o,s)
[2, 3, 2, 0, 1, 2, 0, 0]
[2, 2, 0, 0, 2, 1, 0, 3]
[3, 1, 0, 0, 2, 1, 0, 3]
[0, 3, 3, 0, 1, 2, 0, 1]
sage: for a in itertools.product(orders, sides):
....:   A.from_lehmer_code(p.to_lehmer_code(a[0],a[1]), a[0],a[1])==p
True
True
True
True

>>> from sage.all import *
>>> import itertools
>>> A = AffinePermutationGroup(['A',Integer(7),Integer(1)])
>>> p=A([Integer(3), -Integer(1), Integer(0), Integer(6), Integer(5), Integer(4), Integer(10), Integer(9)])
>>> orders = ('increasing','decreasing')
>>> sides = ('left','right')
>>> for o,s in itertools.product(orders, sides):
...   p.to_lehmer_code(o,s)
[2, 3, 2, 0, 1, 2, 0, 0]
[2, 2, 0, 0, 2, 1, 0, 3]
[3, 1, 0, 0, 2, 1, 0, 3]
[0, 3, 3, 0, 1, 2, 0, 1]
>>> for a in itertools.product(orders, sides):
...   A.from_lehmer_code(p.to_lehmer_code(a[Integer(0)],a[Integer(1)]), a[Integer(0)],a[Integer(1)])==p
True
True
True
True

to_type_a()[source]#

Return an embedding of self into the affine permutation group of type $$A$$. (For type $$A$$, just returns self.)

EXAMPLES:

sage: p = AffinePermutationGroup(['A',7,1])([3, -1, 0, 6, 5, 4, 10, 9])
sage: p.to_type_a() is p
True

>>> from sage.all import *
>>> p = AffinePermutationGroup(['A',Integer(7),Integer(1)])([Integer(3), -Integer(1), Integer(0), Integer(6), Integer(5), Integer(4), Integer(10), Integer(9)])
>>> p.to_type_a() is p
True

value(i, base_window=False)[source]#

Return the image of the integer i under this permutation.

INPUT:

• base_window – boolean; indicating whether i is in the base window; if True, will run a bit faster, but the method will screw up if i is not actually in the index set

EXAMPLES:

sage: A = AffinePermutationGroup(['A',7,1])
sage: p = A([3, -1, 0, 6, 5, 4, 10, 9])
sage: p.value(1)
3
sage: p.value(9)
11

>>> from sage.all import *
>>> A = AffinePermutationGroup(['A',Integer(7),Integer(1)])
>>> p = A([Integer(3), -Integer(1), Integer(0), Integer(6), Integer(5), Integer(4), Integer(10), Integer(9)])
>>> p.value(Integer(1))
3
>>> p.value(Integer(9))
11

class sage.combinat.affine_permutation.AffinePermutationTypeB(parent, lst, check=True)[source]#
apply_simple_reflection_left(i)[source]#

Apply the simple reflection indexed by i on values.

EXAMPLES:

sage: B = AffinePermutationGroup(['B',4,1])
sage: p=B([-5,1,6,-2])
sage: p.apply_simple_reflection_left(0)
Type B affine permutation with window [-5, -2, 6, 1]
sage: p.apply_simple_reflection_left(2)
Type B affine permutation with window [-5, 1, 7, -3]
sage: p.apply_simple_reflection_left(4)
Type B affine permutation with window [-4, 1, 6, -2]

>>> from sage.all import *
>>> B = AffinePermutationGroup(['B',Integer(4),Integer(1)])
>>> p=B([-Integer(5),Integer(1),Integer(6),-Integer(2)])
>>> p.apply_simple_reflection_left(Integer(0))
Type B affine permutation with window [-5, -2, 6, 1]
>>> p.apply_simple_reflection_left(Integer(2))
Type B affine permutation with window [-5, 1, 7, -3]
>>> p.apply_simple_reflection_left(Integer(4))
Type B affine permutation with window [-4, 1, 6, -2]

apply_simple_reflection_right(i)[source]#

Apply the simple reflection indexed by i on positions.

EXAMPLES:

sage: B = AffinePermutationGroup(['B',4,1])
sage: p=B([-5,1,6,-2])
sage: p.apply_simple_reflection_right(1)
Type B affine permutation with window [1, -5, 6, -2]
sage: p.apply_simple_reflection_right(0)
Type B affine permutation with window [-1, 5, 6, -2]
sage: p.apply_simple_reflection_right(4)
Type B affine permutation with window [-5, 1, 6, 11]

>>> from sage.all import *
>>> B = AffinePermutationGroup(['B',Integer(4),Integer(1)])
>>> p=B([-Integer(5),Integer(1),Integer(6),-Integer(2)])
>>> p.apply_simple_reflection_right(Integer(1))
Type B affine permutation with window [1, -5, 6, -2]
>>> p.apply_simple_reflection_right(Integer(0))
Type B affine permutation with window [-1, 5, 6, -2]
>>> p.apply_simple_reflection_right(Integer(4))
Type B affine permutation with window [-5, 1, 6, 11]

check()[source]#

Check that self is an affine permutation.

EXAMPLES:

sage: B = AffinePermutationGroup(['B',4,1])
sage: x = B([-5,1,6,-2])
sage: x
Type B affine permutation with window [-5, 1, 6, -2]

>>> from sage.all import *
>>> B = AffinePermutationGroup(['B',Integer(4),Integer(1)])
>>> x = B([-Integer(5),Integer(1),Integer(6),-Integer(2)])
>>> x
Type B affine permutation with window [-5, 1, 6, -2]

has_left_descent(i)[source]#

Determines whether there is a descent at i.

INPUT:

• i – an integer

EXAMPLES:

sage: B = AffinePermutationGroup(['B',4,1])
sage: p=B([-5,1,6,-2])
sage: [p.has_left_descent(i) for i in B.index_set()]
[True, True, False, False, True]

>>> from sage.all import *
>>> B = AffinePermutationGroup(['B',Integer(4),Integer(1)])
>>> p=B([-Integer(5),Integer(1),Integer(6),-Integer(2)])
>>> [p.has_left_descent(i) for i in B.index_set()]
[True, True, False, False, True]

has_right_descent(i)[source]#

Determines whether there is a descent at index i.

INPUT:

• i – an integer

EXAMPLES:

sage: B = AffinePermutationGroup(['B',4,1])
sage: p = B([-5,1,6,-2])
sage: [p.has_right_descent(i) for i in B.index_set()]
[True, False, False, True, False]

>>> from sage.all import *
>>> B = AffinePermutationGroup(['B',Integer(4),Integer(1)])
>>> p = B([-Integer(5),Integer(1),Integer(6),-Integer(2)])
>>> [p.has_right_descent(i) for i in B.index_set()]
[True, False, False, True, False]

class sage.combinat.affine_permutation.AffinePermutationTypeC(parent, lst, check=True)[source]#
apply_simple_reflection_left(i)[source]#

Apply the simple reflection indexed by i on values.

EXAMPLES:

sage: C = AffinePermutationGroup(['C',4,1])
sage: x = C([-1,5,3,7])
sage: for i in C.index_set(): x.apply_simple_reflection_left(i)
Type C affine permutation with window [1, 5, 3, 7]
Type C affine permutation with window [-2, 5, 3, 8]
Type C affine permutation with window [-1, 5, 2, 6]
Type C affine permutation with window [-1, 6, 4, 7]
Type C affine permutation with window [-1, 4, 3, 7]

>>> from sage.all import *
>>> C = AffinePermutationGroup(['C',Integer(4),Integer(1)])
>>> x = C([-Integer(1),Integer(5),Integer(3),Integer(7)])
>>> for i in C.index_set(): x.apply_simple_reflection_left(i)
Type C affine permutation with window [1, 5, 3, 7]
Type C affine permutation with window [-2, 5, 3, 8]
Type C affine permutation with window [-1, 5, 2, 6]
Type C affine permutation with window [-1, 6, 4, 7]
Type C affine permutation with window [-1, 4, 3, 7]

apply_simple_reflection_right(i)[source]#

Apply the simple reflection indexed by i on positions.

EXAMPLES:

sage: C = AffinePermutationGroup(['C',4,1])
sage: x=C([-1,5,3,7])
sage: for i in C.index_set(): x.apply_simple_reflection_right(i)
Type C affine permutation with window [1, 5, 3, 7]
Type C affine permutation with window [5, -1, 3, 7]
Type C affine permutation with window [-1, 3, 5, 7]
Type C affine permutation with window [-1, 5, 7, 3]
Type C affine permutation with window [-1, 5, 3, 2]

>>> from sage.all import *
>>> C = AffinePermutationGroup(['C',Integer(4),Integer(1)])
>>> x=C([-Integer(1),Integer(5),Integer(3),Integer(7)])
>>> for i in C.index_set(): x.apply_simple_reflection_right(i)
Type C affine permutation with window [1, 5, 3, 7]
Type C affine permutation with window [5, -1, 3, 7]
Type C affine permutation with window [-1, 3, 5, 7]
Type C affine permutation with window [-1, 5, 7, 3]
Type C affine permutation with window [-1, 5, 3, 2]

check()[source]#

Check that self is an affine permutation.

EXAMPLES:

sage: C = AffinePermutationGroup(['C',4,1])
sage: x = C([-1,5,3,7])
sage: x
Type C affine permutation with window [-1, 5, 3, 7]

>>> from sage.all import *
>>> C = AffinePermutationGroup(['C',Integer(4),Integer(1)])
>>> x = C([-Integer(1),Integer(5),Integer(3),Integer(7)])
>>> x
Type C affine permutation with window [-1, 5, 3, 7]

has_left_descent(i)[source]#

Determine whether there is a descent at i.

INPUT:

• i – an integer

EXAMPLES:

sage: C = AffinePermutationGroup(['C',4,1])
sage: x = C([-1,5,3,7])
sage: for i in C.index_set(): x.has_left_descent(i)
True
False
True
False
True

>>> from sage.all import *
>>> C = AffinePermutationGroup(['C',Integer(4),Integer(1)])
>>> x = C([-Integer(1),Integer(5),Integer(3),Integer(7)])
>>> for i in C.index_set(): x.has_left_descent(i)
True
False
True
False
True

has_right_descent(i)[source]#

Determine whether there is a descent at index i.

INPUT:

• i – an integer

EXAMPLES:

sage: C = AffinePermutationGroup(['C',4,1])
sage: x = C([-1,5,3,7])
sage: for i in C.index_set(): x.has_right_descent(i)
True
False
True
False
True

>>> from sage.all import *
>>> C = AffinePermutationGroup(['C',Integer(4),Integer(1)])
>>> x = C([-Integer(1),Integer(5),Integer(3),Integer(7)])
>>> for i in C.index_set(): x.has_right_descent(i)
True
False
True
False
True

position(i)[source]#

Find the position $$j$$ such the self.value(j)=i

EXAMPLES:

sage: C = AffinePermutationGroup(['C',4,1])
sage: x = C.one()
sage: [x.position(i) for i in range(-10,10)] == list(range(-10,10))
True

>>> from sage.all import *
>>> C = AffinePermutationGroup(['C',Integer(4),Integer(1)])
>>> x = C.one()
>>> [x.position(i) for i in range(-Integer(10),Integer(10))] == list(range(-Integer(10),Integer(10)))
True

to_type_a()[source]#

Return an embedding of self into the affine permutation group of type $$A$$.

EXAMPLES:

sage: C = AffinePermutationGroup(['C',4,1])
sage: x = C([-1,5,3,7])
sage: x.to_type_a()
Type A affine permutation with window [-1, 5, 3, 7, 2, 6, 4, 10, 9]

>>> from sage.all import *
>>> C = AffinePermutationGroup(['C',Integer(4),Integer(1)])
>>> x = C([-Integer(1),Integer(5),Integer(3),Integer(7)])
>>> x.to_type_a()
Type A affine permutation with window [-1, 5, 3, 7, 2, 6, 4, 10, 9]

value(i)[source]#

Return the image of the integer i under this permutation.

EXAMPLES:

sage: C = AffinePermutationGroup(['C',4,1])
sage: x = C.one()
sage: [x.value(i) for i in range(-10,10)] == list(range(-10,10))
True

>>> from sage.all import *
>>> C = AffinePermutationGroup(['C',Integer(4),Integer(1)])
>>> x = C.one()
>>> [x.value(i) for i in range(-Integer(10),Integer(10))] == list(range(-Integer(10),Integer(10)))
True

class sage.combinat.affine_permutation.AffinePermutationTypeD(parent, lst, check=True)[source]#
apply_simple_reflection_left(i)[source]#

Apply simple reflection indexed by i on values.

EXAMPLES:

sage: D = AffinePermutationGroup(['D',4,1])
sage: p=D([1,-6,5,-2])
sage: p.apply_simple_reflection_left(0)
Type D affine permutation with window [-2, -6, 5, 1]
sage: p.apply_simple_reflection_left(1)
Type D affine permutation with window [2, -6, 5, -1]
sage: p.apply_simple_reflection_left(4)
Type D affine permutation with window [1, -4, 3, -2]

>>> from sage.all import *
>>> D = AffinePermutationGroup(['D',Integer(4),Integer(1)])
>>> p=D([Integer(1),-Integer(6),Integer(5),-Integer(2)])
>>> p.apply_simple_reflection_left(Integer(0))
Type D affine permutation with window [-2, -6, 5, 1]
>>> p.apply_simple_reflection_left(Integer(1))
Type D affine permutation with window [2, -6, 5, -1]
>>> p.apply_simple_reflection_left(Integer(4))
Type D affine permutation with window [1, -4, 3, -2]

apply_simple_reflection_right(i)[source]#

Apply the simple reflection indexed by i on positions.

EXAMPLES:

sage: D = AffinePermutationGroup(['D',4,1])
sage: p=D([1,-6,5,-2])
sage: p.apply_simple_reflection_right(0)
Type D affine permutation with window [6, -1, 5, -2]
sage: p.apply_simple_reflection_right(1)
Type D affine permutation with window [-6, 1, 5, -2]
sage: p.apply_simple_reflection_right(4)
Type D affine permutation with window [1, -6, 11, 4]

>>> from sage.all import *
>>> D = AffinePermutationGroup(['D',Integer(4),Integer(1)])
>>> p=D([Integer(1),-Integer(6),Integer(5),-Integer(2)])
>>> p.apply_simple_reflection_right(Integer(0))
Type D affine permutation with window [6, -1, 5, -2]
>>> p.apply_simple_reflection_right(Integer(1))
Type D affine permutation with window [-6, 1, 5, -2]
>>> p.apply_simple_reflection_right(Integer(4))
Type D affine permutation with window [1, -6, 11, 4]

check()[source]#

Check that self is an affine permutation.

EXAMPLES:

sage: D = AffinePermutationGroup(['D',4,1])
sage: p = D([1,-6,5,-2])
sage: p
Type D affine permutation with window [1, -6, 5, -2]

>>> from sage.all import *
>>> D = AffinePermutationGroup(['D',Integer(4),Integer(1)])
>>> p = D([Integer(1),-Integer(6),Integer(5),-Integer(2)])
>>> p
Type D affine permutation with window [1, -6, 5, -2]

has_left_descent(i)[source]#

Determine whether there is a descent at i.

INPUT:

• i – an integer

EXAMPLES:

sage: D = AffinePermutationGroup(['D',4,1])
sage: p=D([1,-6,5,-2])
sage: [p.has_left_descent(i) for i in D.index_set()]
[True, True, False, True, True]

>>> from sage.all import *
>>> D = AffinePermutationGroup(['D',Integer(4),Integer(1)])
>>> p=D([Integer(1),-Integer(6),Integer(5),-Integer(2)])
>>> [p.has_left_descent(i) for i in D.index_set()]
[True, True, False, True, True]

has_right_descent(i)[source]#

Determine whether there is a descent at index i.

INPUT:

• i – an integer

EXAMPLES:

sage: D = AffinePermutationGroup(['D',4,1])
sage: p=D([1,-6,5,-2])
sage: [p.has_right_descent(i) for i in D.index_set()]
[True, True, False, True, False]

>>> from sage.all import *
>>> D = AffinePermutationGroup(['D',Integer(4),Integer(1)])
>>> p=D([Integer(1),-Integer(6),Integer(5),-Integer(2)])
>>> [p.has_right_descent(i) for i in D.index_set()]
[True, True, False, True, False]

class sage.combinat.affine_permutation.AffinePermutationTypeG(parent, lst, check=True)[source]#
apply_simple_reflection_left(i)[source]#

Apply simple reflection indexed by $$i$$ on values.

EXAMPLES:

sage: G = AffinePermutationGroup(['G',2,1])
sage: p=G([2, 10, -5, 12, -3, 5])
sage: p.apply_simple_reflection_left(0)
Type G affine permutation with window [0, 10, -7, 14, -3, 7]
sage: p.apply_simple_reflection_left(1)
Type G affine permutation with window [1, 9, -4, 11, -2, 6]
sage: p.apply_simple_reflection_left(2)
Type G affine permutation with window [3, 11, -5, 12, -4, 4]

>>> from sage.all import *
>>> G = AffinePermutationGroup(['G',Integer(2),Integer(1)])
>>> p=G([Integer(2), Integer(10), -Integer(5), Integer(12), -Integer(3), Integer(5)])
>>> p.apply_simple_reflection_left(Integer(0))
Type G affine permutation with window [0, 10, -7, 14, -3, 7]
>>> p.apply_simple_reflection_left(Integer(1))
Type G affine permutation with window [1, 9, -4, 11, -2, 6]
>>> p.apply_simple_reflection_left(Integer(2))
Type G affine permutation with window [3, 11, -5, 12, -4, 4]

apply_simple_reflection_right(i)[source]#

Apply the simple reflection indexed by i on positions.

EXAMPLES:

sage: G = AffinePermutationGroup(['G',2,1])
sage: p = G([2, 10, -5, 12, -3, 5])
sage: p.apply_simple_reflection_right(0)
Type G affine permutation with window [-9, -1, -5, 12, 8, 16]
sage: p.apply_simple_reflection_right(1)
Type G affine permutation with window [10, 2, 12, -5, 5, -3]
sage: p.apply_simple_reflection_right(2)
Type G affine permutation with window [2, -5, 10, -3, 12, 5]

>>> from sage.all import *
>>> G = AffinePermutationGroup(['G',Integer(2),Integer(1)])
>>> p = G([Integer(2), Integer(10), -Integer(5), Integer(12), -Integer(3), Integer(5)])
>>> p.apply_simple_reflection_right(Integer(0))
Type G affine permutation with window [-9, -1, -5, 12, 8, 16]
>>> p.apply_simple_reflection_right(Integer(1))
Type G affine permutation with window [10, 2, 12, -5, 5, -3]
>>> p.apply_simple_reflection_right(Integer(2))
Type G affine permutation with window [2, -5, 10, -3, 12, 5]

check()[source]#

Check that self is an affine permutation.

EXAMPLES:

sage: G = AffinePermutationGroup(['G',2,1])
sage: p = G([2, 10, -5, 12, -3, 5])
sage: p
Type G affine permutation with window [2, 10, -5, 12, -3, 5]

>>> from sage.all import *
>>> G = AffinePermutationGroup(['G',Integer(2),Integer(1)])
>>> p = G([Integer(2), Integer(10), -Integer(5), Integer(12), -Integer(3), Integer(5)])
>>> p
Type G affine permutation with window [2, 10, -5, 12, -3, 5]

has_left_descent(i)[source]#

Determines whether there is a descent at i.

INPUT:

• i – an integer

EXAMPLES:

sage: G = AffinePermutationGroup(['G',2,1])
sage: p = G([2, 10, -5, 12, -3, 5])
sage: [p.has_left_descent(i) for i in G.index_set()]
[False, True, False]

>>> from sage.all import *
>>> G = AffinePermutationGroup(['G',Integer(2),Integer(1)])
>>> p = G([Integer(2), Integer(10), -Integer(5), Integer(12), -Integer(3), Integer(5)])
>>> [p.has_left_descent(i) for i in G.index_set()]
[False, True, False]

has_right_descent(i)[source]#

Determines whether there is a descent at index $$i$$.

INPUT:

• i – an integer

EXAMPLES:

sage: G = AffinePermutationGroup(['G',2,1])
sage: p = G([2, 10, -5, 12, -3, 5])
sage: [p.has_right_descent(i) for i in G.index_set()]
[False, False, True]

>>> from sage.all import *
>>> G = AffinePermutationGroup(['G',Integer(2),Integer(1)])
>>> p = G([Integer(2), Integer(10), -Integer(5), Integer(12), -Integer(3), Integer(5)])
>>> [p.has_right_descent(i) for i in G.index_set()]
[False, False, True]

position(i)[source]#

Find the position j such the self.value(j) == i.

EXAMPLES:

sage: G = AffinePermutationGroup(['G',2,1])
sage: p = G([2, 10, -5, 12, -3, 5])
sage: [p.position(i) for i in p]
[1, 2, 3, 4, 5, 6]

>>> from sage.all import *
>>> G = AffinePermutationGroup(['G',Integer(2),Integer(1)])
>>> p = G([Integer(2), Integer(10), -Integer(5), Integer(12), -Integer(3), Integer(5)])
>>> [p.position(i) for i in p]
[1, 2, 3, 4, 5, 6]

to_type_a()[source]#

Return an embedding of self into the affine permutation group of type A.

EXAMPLES:

sage: G = AffinePermutationGroup(['G',2,1])
sage: p = G([2, 10, -5, 12, -3, 5])
sage: p.to_type_a()
Type A affine permutation with window [2, 10, -5, 12, -3, 5]

>>> from sage.all import *
>>> G = AffinePermutationGroup(['G',Integer(2),Integer(1)])
>>> p = G([Integer(2), Integer(10), -Integer(5), Integer(12), -Integer(3), Integer(5)])
>>> p.to_type_a()
Type A affine permutation with window [2, 10, -5, 12, -3, 5]

value(i, base_window=False)[source]#

Return the image of the integer i under this permutation.

INPUT:

• base_window – boolean indicating whether i is between 1 and $$k+1$$; if True, will run a bit faster, but the method will screw up if i is not actually in the index set

EXAMPLES:

sage: G = AffinePermutationGroup(['G',2,1])
sage: p=G([2, 10, -5, 12, -3, 5])
sage: [p.value(i) for i in [1..12]]
[2, 10, -5, 12, -3, 5, 8, 16, 1, 18, 3, 11]

>>> from sage.all import *
>>> G = AffinePermutationGroup(['G',Integer(2),Integer(1)])
>>> p=G([Integer(2), Integer(10), -Integer(5), Integer(12), -Integer(3), Integer(5)])
>>> [p.value(i) for i in (ellipsis_range(Integer(1),Ellipsis,Integer(12)))]
[2, 10, -5, 12, -3, 5, 8, 16, 1, 18, 3, 11]