Combinatorial maps

class sage.combinat.combinatorial_map.CombinatorialMap(f, order=None, name=None)

Bases: object

This is a wrapper class for methods that are combinatorial maps.

For further details and doctests, see combinatorial_map().

name()

Returns the name of a combinatorial map. This is used for the string representation of self.

EXAMPLES:

sage: from sage.combinat.combinatorial_map import combinatorial_map
sage: class CombinatorialClass:
...       @combinatorial_map(name='map1')
...       def to_self_1(): pass
...       @combinatorial_map()
...       def to_self_2(): pass
sage: CombinatorialClass.to_self_1.name()
'map1'
sage: CombinatorialClass.to_self_2.name()
'to_self_2'
order()

Returns the order of self, or None if the order is not known.

EXAMPLES:

sage: from sage.combinat.combinatorial_map import combinatorial_map
sage: class CombinatorialClass:
...       @combinatorial_map(order=2)
...       def to_self_1(): pass
...       @combinatorial_map()
...       def to_self_2(): pass
sage: CombinatorialClass.to_self_1.order()
2
sage: CombinatorialClass.to_self_2.order() is None
True
unbounded_map()

Return the unbounded version of self.

You can use this method to return a function which takes as input an element in the domain of the combinatorial map. See the example below.

EXAMPLES:

sage: from sage.combinat.permutation import Permutation
sage: pi = Permutation([1,3,2])
sage: f = pi.reverse
sage: F = f.unbounded_map()
sage: F(pi)
[2, 3, 1]
sage.combinat.combinatorial_map.combinatorial_map(f=None, order=None, name=None)

Combinatorial maps

We call a method a combinatorial map if it is a map between two combinatorial sets.

INPUT:

  • f – (default: None, if combinatorial_map is used as a decorator) a function
  • name – (default: None) the name for nicer outputs on combinatorial maps
  • order – (default: None) the order of the combinatorial map, if it is known. Is not used, but might be helpful later

OUTPUT:

The decorator combinatorial_map can be used to declare methods as combinatorial maps.

EXAMPLES:

sage: p = Permutation([1,3,2,4])
sage: p.left_tableau
Combinatorial map: Robinson-Schensted insertion tableau

We define a class illustrating the use of the decorator combinatorial_map with the various arguments:

sage: from sage.combinat.combinatorial_map import combinatorial_map
sage: class MyPermutation(object):
...
...       @combinatorial_map()
...       def reverse(self):
...           '''
...           Reverse the permutation
...           '''
...           pass
...
...       @combinatorial_map(order=2)
...       def inverse(self):
...           '''
...           The inverse of the permutation
...           '''
...           pass
...
...       @combinatorial_map(name='descent set of permutation')
...       def descent_set(self):
...           '''
...           The descent set of the permutation
...           '''
...           pass
...
...       def major_index(self):
...           '''
...           The major index of the permutation
...           '''
...           pass
sage: MyPermutation.reverse
Combinatorial map: reverse
sage: MyPermutation.descent_set
Combinatorial map: descent set of permutation
sage: MyPermutation.inverse
Combinatorial map: inverse

One can determine all the combinatorial maps associated with a given object as follows:

sage: from sage.combinat.combinatorial_map import combinatorial_maps_in_class
sage: X = combinatorial_maps_in_class(MyPermutation); X # random
[Combinatorial map: reverse,
 Combinatorial map: descent set of permutation,
 Combinatorial map: inverse]

The method major_index defined about is not a combinatorial map:

sage: MyPermutation.major_index
<unbound method MyPermutation.major_index>

But one can define a function that turns major_index into a combinatorial map:

sage: def major_index(p):
...       return p.major_index()
...
sage: major_index
<function major_index at ...>
sage: combinatorial_map(major_index)
Combinatorial map: major_index
sage.combinat.combinatorial_map.combinatorial_maps_in_class(cls)

Returns the combinatorial maps of the class as a list of combinatorial maps.

EXAMPLES:

sage: from sage.combinat.combinatorial_map import combinatorial_maps_in_class
sage: p = Permutation([1,3,2,4])
sage: cmaps = combinatorial_maps_in_class(p)
sage: cmaps # random
[Combinatorial map: Robinson-Schensted insertion tableau,
 Combinatorial map: Robinson-Schensted recording tableau,
 Combinatorial map: Robinson-Schensted tableau shape,
 Combinatorial map: complement,
 Combinatorial map: descent composition,
 Combinatorial map: inverse, ...]
sage: p.left_tableau in cmaps
True
sage: p.right_tableau in cmaps
True
sage: p.complement in cmaps
True

Previous topic

Miscellaneous

This Page