code stringlengths 17 6.64M |
|---|
def KirillovReshetikhinCrystal(cartan_type, r, s):
"\n Return the KR crystal `B^{r,s}` using\n :class:`rigged configurations <RiggedConfigurations>`.\n\n This is the rigged configuration `RC(B^{r,s})` or `RC(L)` with\n `L = (L_i^{(a)})` and `L_i^{(a)} = \\delta_{a,r} \\delta_{i,s}`.\n\n EXAMPLES::\n\n sage: K1 = crystals.kirillov_reshetikhin.RiggedConfigurations(['A',6,2], 2, 1)\n sage: K2 = crystals.kirillov_reshetikhin.LSPaths(['A',6,2], 2, 1)\n sage: K1.digraph().is_isomorphic(K2.digraph(), edge_labels=True)\n True\n\n TESTS:\n\n We explicitly import and check we get the same crystal::\n\n sage: from sage.combinat.rigged_configurations.rigged_configurations import KirillovReshetikhinCrystal\n sage: K1 = crystals.kirillov_reshetikhin.RiggedConfigurations(['A',6,2], 2, 1)\n sage: K1 is KirillovReshetikhinCrystal(['A',6,2], 2, 1)\n True\n "
return RiggedConfigurations(cartan_type, [[r, s]])
|
class RiggedConfigurations(UniqueRepresentation, Parent):
"\n Rigged configurations as `U_q^{\\prime}(\\mathfrak{g})`-crystals.\n\n Let `\\overline{I}` denote the classical index set associated to the Cartan\n type of the rigged configurations. A rigged configuration of multiplicity\n array `L_i^{(a)}` and dominant weight `\\Lambda` is a sequence of partitions\n `\\{ \\nu^{(a)} \\mid a \\in \\overline{I} \\}` such that\n\n .. MATH::\n\n \\sum_{\\overline{I} \\times \\ZZ_{>0}} i m_i^{(a)} \\alpha_a\n = \\sum_{\\overline{I} \\times \\ZZ_{>0}} i L_i^{(a)} \\Lambda_a\n - \\Lambda\n\n where `\\alpha_a` is a simple root, `\\Lambda_a` is a fundamental weight,\n and `m_i^{(a)}` is the number of rows of length `i` in the partition\n `\\nu^{(a)}`.\n\n Each partition `\\nu^{(a)}`, in the sequence also comes with a sequence of\n statistics `p_i^{(a)}` called *vacancy numbers* and a weakly decreasing\n sequence `J_i^{(a)}` of length `m_i^{(a)}` called *riggings*.\n Vacancy numbers are computed based upon the partitions and `L_i^{(a)}`,\n and the riggings must satisfy `\\max J_i^{(a)} \\leq p_i^{(a)}`. We call\n such a partition a *rigged partition*. For more, see\n [RigConBijection]_ [CrysStructSchilling06]_ [BijectionLRT]_.\n\n Rigged configurations form combinatorial objects first introduced by\n Kerov, Kirillov and Reshetikhin that arose from studies of statistical\n mechanical models using the Bethe Ansatz. They are sequences of rigged\n partitions. A rigged partition is a partition together with a label\n associated to each part that satisfy certain constraints. The labels\n are also called riggings.\n\n Rigged configurations exist for all affine Kac-Moody Lie algebras. See\n for example [HKOTT2002]_. In Sage they are specified by providing a Cartan\n type and a list of rectangular shapes `B`. The list of all (highest\n weight) rigged configurations for given `B` is computed via the (virtual)\n Kleber algorithm (see also\n :class:`~sage.combinat.rigged_configurations.kleber_tree.KleberTree` and\n :class:`~sage.combinat.rigged_configurations.kleber_tree.VirtualKleberTree`).\n\n Rigged configurations in simply-laced types all admit a classical crystal\n structure [CrysStructSchilling06]_. For non-simply-laced types, the\n crystal is given by using virtual rigged configurations [OSS03]_. The\n highest weight rigged configurations are those where all riggings are\n nonnegative. The list of all rigged configurations is computed from the\n highest weight ones using the crystal operators.\n\n Rigged configurations are conjecturally in bijection with\n :class:`~sage.combinat.rigged_configurations.tensor_product_kr_tableaux.TensorProductOfKirillovReshetikhinTableaux`\n of non-exceptional affine types where the list `B` corresponds to the\n tensor factors `B^{r,s}`. The bijection has been proven in types `A_n^{(1)}`\n and `D_n^{(1)}` and when the only non-zero entries of `L_i^{(a)}` are either\n only `L_1^{(a)}` or only `L_i^{(1)}` (corresponding to single columns or\n rows respectively) [RigConBijection]_, [BijectionLRT]_, [BijectionDn]_.\n\n KR crystals are implemented in Sage, see\n :func:`~sage.combinat.crystals.kirillov_reshetikhin.KirillovReshetikhinCrystal`,\n however, in the bijection with rigged configurations a different\n realization of the elements in the crystal are obtained, which are\n coined KR tableaux, see\n :class:`~sage.combinat.rigged_configurations.kr_tableaux.KirillovReshetikhinTableaux`.\n For more details see [OSS2011]_.\n\n .. NOTE::\n\n All non-simply-laced rigged configurations have not been proven to\n give rise to aligned virtual crystals (i.e. have the correct crystal\n structure or isomorphic as affine crystals to the tensor product of\n KR tableaux).\n\n INPUT:\n\n - ``cartan_type`` -- a Cartan type\n\n - ``B`` -- a list of positive integer tuples `(r,s)` corresponding to the\n tensor factors in the bijection with tensor product of\n Kirillov-Reshetikhin tableaux or equivalently the sequence of width `s`\n and height `r` rectangles\n\n REFERENCES:\n\n .. [HKOTT2002] \\G. Hatayama, A. Kuniba, M. Okado, T. Takagi, Z. Tsuboi.\n Paths, Crystals and Fermionic Formulae.\n Prog. Math. Phys. **23** (2002) Pages 205-272.\n\n .. [CrysStructSchilling06] Anne Schilling.\n Crystal structure on rigged configurations.\n International Mathematics Research Notices.\n Volume 2006. (2006) Article ID 97376. Pages 1-27.\n\n .. [RigConBijection] Masato Okado, Anne Schilling, Mark Shimozono.\n A crystal to rigged configuration bijection for non-exceptional affine\n algebras.\n Algebraic Combinatorics and Quantum Groups.\n Edited by N. Jing. World Scientific. (2003) Pages 85-124.\n\n .. [BijectionDn] Anne Schilling.\n A bijection between type `D_n^{(1)}` crystals and rigged configurations.\n J. Algebra. **285** (2005) 292-334\n\n .. [BijectionLRT] Anatol N. Kirillov, Anne Schilling, Mark Shimozono.\n A bijection between Littlewood-Richardson tableaux and rigged\n configurations.\n Selecta Mathematica (N.S.). **8** (2002) Pages 67-135.\n (:mathscinet:`MR1890195`).\n\n EXAMPLES::\n\n sage: RC = RiggedConfigurations(['A', 3, 1], [[3, 2], [1, 2], [1, 1]])\n sage: RC\n Rigged configurations of type ['A', 3, 1] and factor(s) ((3, 2), (1, 2), (1, 1))\n\n sage: RC = RiggedConfigurations(['A', 3, 1], [[2,1]]); RC\n Rigged configurations of type ['A', 3, 1] and factor(s) ((2, 1),)\n sage: RC.cardinality()\n 6\n sage: len(RC.list()) == RC.cardinality()\n True\n sage: RC.list() # random\n [\n <BLANKLINE>\n 0[ ]0\n (/) (/) (/) -1[ ]-1 -1[ ]-1\n -1[ ]-1\n (/) -1[ ]-1 0[ ]0 0[ ]0 1[ ]1 -1[ ]-1\n <BLANKLINE>\n (/) (/) -1[ ]-1 (/) -1[ ]-1 0[ ]0\n , , , , ,\n ]\n\n A rigged configuration element with all riggings equal to the vacancy\n numbers can be created as follows::\n\n sage: RC = RiggedConfigurations(['A', 3, 1], [[3,2], [2,1], [1,1], [1,1]]); RC\n Rigged configurations of type ['A', 3, 1] and factor(s) ((3, 2), (2, 1), (1, 1), (1, 1))\n sage: elt = RC(partition_list=[[1],[],[]]); elt\n <BLANKLINE>\n 0[ ]0\n <BLANKLINE>\n (/)\n <BLANKLINE>\n (/)\n <BLANKLINE>\n\n If on the other hand we also want to specify the riggings, this can be\n achieved as follows::\n\n sage: RC = RiggedConfigurations(['A', 3, 1], [[3, 2], [1, 2], [1, 1]])\n sage: RC(partition_list=[[2],[2],[2]])\n <BLANKLINE>\n 1[ ][ ]1\n <BLANKLINE>\n 0[ ][ ]0\n <BLANKLINE>\n 0[ ][ ]0\n sage: RC(partition_list=[[2],[2],[2]], rigging_list=[[0],[0],[0]])\n <BLANKLINE>\n 1[ ][ ]0\n <BLANKLINE>\n 0[ ][ ]0\n <BLANKLINE>\n 0[ ][ ]0\n\n A larger example::\n\n sage: RC = RiggedConfigurations(['D', 7, 1], [[3,3],[5,2],[4,3],[2,3],[4,4],[3,1],[1,4],[2,2]])\n sage: elt = RC(partition_list=[[2],[3,2,1],[2,2,1,1],[2,2,1,1,1,1],[3,2,1,1,1,1],[2,1,1],[2,2]],\n ....: rigging_list=[[2],[1,0,0],[4,1,2,1],[1,0,0,0,0,0],[0,1,0,0,0,0],[0,0,0],[0,0]])\n sage: elt\n <BLANKLINE>\n 3[ ][ ]2\n <BLANKLINE>\n 1[ ][ ][ ]1\n 2[ ][ ]0\n 1[ ]0\n <BLANKLINE>\n 4[ ][ ]4\n 4[ ][ ]1\n 3[ ]2\n 3[ ]1\n <BLANKLINE>\n 2[ ][ ]1\n 2[ ][ ]0\n 0[ ]0\n 0[ ]0\n 0[ ]0\n 0[ ]0\n <BLANKLINE>\n 0[ ][ ][ ]0\n 2[ ][ ]1\n 0[ ]0\n 0[ ]0\n 0[ ]0\n 0[ ]0\n <BLANKLINE>\n 0[ ][ ]0\n 0[ ]0\n 0[ ]0\n <BLANKLINE>\n 0[ ][ ]0\n 0[ ][ ]0\n <BLANKLINE>\n\n To obtain the KR tableau under the bijection between rigged configurations\n and KR tableaux, we can type the following. This example was checked\n against Reiho Sakamoto's Mathematica program on rigged configurations::\n\n sage: output = elt.to_tensor_product_of_kirillov_reshetikhin_tableaux(); output\n [[1, 1, 1], [2, 3, 3], [3, 4, -5]] (X) [[1, 1], [2, 2], [3, 3], [5, -6], [6, -5]] (X)\n [[1, 1, 2], [2, 2, 3], [3, 3, 7], [4, 4, -7]] (X) [[1, 1, 1], [2, 2, 2]] (X)\n [[1, 1, 1, 3], [2, 2, 3, 4], [3, 3, 4, 5], [4, 4, 5, 6]] (X) [[1], [2], [3]] (X) [[1, 1, 1, 1]] (X) [[1, 1], [2, 2]]\n sage: elt.to_tensor_product_of_kirillov_reshetikhin_tableaux().to_rigged_configuration() == elt\n True\n sage: output.to_rigged_configuration().to_tensor_product_of_kirillov_reshetikhin_tableaux() == output\n True\n\n We can also convert between rigged configurations and tensor products of\n KR crystals::\n\n sage: RC = RiggedConfigurations(['D', 4, 1], [[2, 1]])\n sage: elt = RC(partition_list=[[1],[1,1],[1],[1]])\n sage: tp_krc = elt.to_tensor_product_of_kirillov_reshetikhin_crystals(); tp_krc\n [[]]\n sage: ret = RC(tp_krc)\n sage: ret == elt\n True\n\n ::\n\n sage: RC = RiggedConfigurations(['D', 4, 1], [[4,1], [3,3]])\n sage: KR1 = crystals.KirillovReshetikhin(['D', 4, 1], 4, 1)\n sage: KR2 = crystals.KirillovReshetikhin(['D', 4, 1], 3, 3)\n sage: T = crystals.TensorProduct(KR1, KR2)\n sage: t = T[1]; t\n [[++++, []], [+++-, [[1], [2], [4], [-4]]]]\n sage: ret = RC(t)\n sage: ret.to_tensor_product_of_kirillov_reshetikhin_crystals()\n [[++++, []], [+++-, [[1], [2], [4], [-4]]]]\n\n TESTS::\n\n sage: RC = RiggedConfigurations(['A', 3, 1], [[3,2], [2,1], [1,1], [1,1]])\n sage: len(RC.module_generators)\n 17\n sage: RC = RiggedConfigurations(['D', 4, 1], [[1, 1]])\n sage: RC.cardinality()\n 8\n\n sage: RC = RiggedConfigurations(['D', 4, 1], [[2, 1]])\n sage: c = RC.cardinality(); c\n 29\n sage: K = crystals.KirillovReshetikhin(['D',4,1],2,1)\n sage: K.cardinality() == c\n True\n "
@staticmethod
def __classcall_private__(cls, cartan_type, B):
"\n Normalize the input arguments to ensure unique representation.\n\n EXAMPLES::\n\n sage: RC1 = RiggedConfigurations(CartanType(['A',3,1]), [[2,2]])\n sage: RC2 = RiggedConfigurations(['A',3,1], [(2,2)])\n sage: RC3 = RiggedConfigurations(['A',3,1], ((2,2),))\n sage: RC2 is RC1, RC3 is RC1\n (True, True)\n "
cartan_type = CartanType(cartan_type)
if (not cartan_type.is_affine()):
raise ValueError('The Cartan type must be affine')
B = tuple((tuple(factor) for factor in B))
if (not B):
raise ValueError('must contain at least one factor')
if (cartan_type.type() == 'BC'):
return RCTypeA2Even(cartan_type, B)
if (cartan_type.dual().type() == 'BC'):
return RCTypeA2Dual(cartan_type, B)
if (not cartan_type.classical().is_simply_laced()):
return RCNonSimplyLaced(cartan_type, B)
return super().__classcall__(cls, cartan_type, B)
def __init__(self, cartan_type, B):
"\n Initialize the RiggedConfigurations class.\n\n EXAMPLES::\n\n sage: RC = RiggedConfigurations(['A', 3, 1], [[3,1], [1,2]])\n sage: TestSuite(RC).run() # long time\n sage: RC = RiggedConfigurations(['A',1,1], [[1,1], [1,1]])\n sage: TestSuite(RC).run()\n sage: RC = RiggedConfigurations(['A',2,1], [[1,1], [2,1]])\n sage: TestSuite(RC).run()\n sage: RC = RiggedConfigurations(['D', 4, 1], [[2,1], [1,1]])\n sage: TestSuite(RC).run() # long time\n sage: RC = RiggedConfigurations(['D', 4, 1], [[3,1]])\n sage: TestSuite(RC).run() # long time\n sage: RC = RiggedConfigurations(['D', 4, 1], [[4,2]])\n sage: TestSuite(RC).run() # long time\n "
self._cartan_type = cartan_type
self.dims = B
cl = cartan_type.classical()
self._rc_index = cl.index_set()
self._rc_index_inverse = {i: ii for (ii, i) in enumerate(self._rc_index)}
self._cartan_matrix = cl.cartan_matrix()
Parent.__init__(self, category=KirillovReshetikhinCrystals().TensorProducts())
class options(GlobalOptions):
'\n Sets and displays the options for rigged configurations.\n If no parameters are set, then the function returns a copy of\n the options dictionary.\n\n The ``options`` to partitions can be accessed as the method\n :obj:`RiggedConfigurations.options` of\n :class:`RiggedConfigurations`.\n\n @OPTIONS@\n\n EXAMPLES::\n\n sage: RC = RiggedConfigurations([\'A\',3,1], [[2,2],[1,1],[1,1]])\n sage: elt = RC(partition_list=[[3,1], [3], [1]])\n sage: elt\n <BLANKLINE>\n -3[ ][ ][ ]-3\n -1[ ]-1\n <BLANKLINE>\n 1[ ][ ][ ]1\n <BLANKLINE>\n -1[ ]-1\n <BLANKLINE>\n sage: RiggedConfigurations.options(display="horizontal", convention="french")\n sage: elt\n -1[ ]-1 1[ ][ ][ ]1 -1[ ]-1\n -3[ ][ ][ ]-3\n\n Changing the ``convention`` for rigged configurations also changes the\n ``convention`` option for tableaux and vice versa::\n\n sage: T = Tableau([[1,2,3],[4,5]])\n sage: T.pp()\n 4 5\n 1 2 3\n sage: Tableaux.options.convention="english"\n sage: elt\n -3[ ][ ][ ]-3 1[ ][ ][ ]1 -1[ ]-1\n -1[ ]-1\n sage: T.pp()\n 1 2 3\n 4 5\n sage: RiggedConfigurations.options._reset()\n '
NAME = 'RiggedConfigurations'
module = 'sage.combinat.rigged_configurations.rigged_configurations'
display = dict(default='vertical', description='Specifies how rigged configurations should be printed', values=dict(vertical='displayed vertically', horizontal='displayed horizontally'), case_sensitive=False)
element_ascii_art = dict(default=True, description='display using the repr option ``element_ascii_art``', checker=(lambda x: isinstance(x, bool)))
half_width_boxes_type_B = dict(default=True, description='display the last rigged partition in affine type B as half width boxes', checker=(lambda x: isinstance(x, bool)))
convention = dict(link_to=(tableau.Tableaux.options, 'convention'))
notation = dict(alt_name='convention')
def _repr_(self):
"\n Return a string representation of ``self``.\n\n EXAMPLES::\n\n sage: RiggedConfigurations(['A', 3, 1], [[3, 2], [1, 2], [1, 1]])\n Rigged configurations of type ['A', 3, 1] and factor(s) ((3, 2), (1, 2), (1, 1))\n "
return 'Rigged configurations of type {} and factor(s) {}'.format(self._cartan_type, self.dims)
def _repr_option(self, key):
"\n Metadata about the :meth:`_repr_` output.\n\n See :meth:`sage.structure.parent._repr_option` for details.\n\n EXAMPLES::\n\n sage: RC = RiggedConfigurations(['A', 3, 1], [[2,1]])\n sage: RC._repr_option('element_ascii_art')\n True\n "
if (key == 'element_ascii_art'):
return self.options.element_ascii_art
return super()._repr_option(key)
def __iter__(self):
"\n Iterate over ``self``.\n\n EXAMPLES::\n\n sage: RC = RiggedConfigurations(['A', 3, 1], [[2,1], [1,1]])\n sage: L = [x for x in RC]\n sage: len(L)\n 24\n "
index_set = self._rc_index
from sage.sets.recursively_enumerated_set import RecursivelyEnumeratedSet
return RecursivelyEnumeratedSet(self.module_generators, (lambda x: [x.f(i) for i in index_set]), structure='graded').breadth_first_search_iterator()
@lazy_attribute
def module_generators(self):
"\n Module generators for this set of rigged configurations.\n\n Iterate over the highest weight rigged configurations by moving\n through the\n :class:`~sage.combinat.rigged_configurations.kleber_tree.KleberTree`\n and then setting appropriate values of the partitions.\n\n EXAMPLES::\n\n sage: RC = RiggedConfigurations(['D', 4, 1], [[2,1]])\n sage: for x in RC.module_generators: x\n <BLANKLINE>\n (/)\n <BLANKLINE>\n (/)\n <BLANKLINE>\n (/)\n <BLANKLINE>\n (/)\n <BLANKLINE>\n <BLANKLINE>\n 0[ ]0\n <BLANKLINE>\n 0[ ]0\n 0[ ]0\n <BLANKLINE>\n 0[ ]0\n <BLANKLINE>\n 0[ ]0\n <BLANKLINE>\n\n TESTS:\n\n We check that this works with relabelled Cartan types (:trac:`16876`)::\n\n sage: ct = CartanType(['A',3,1]).relabel(lambda x: x+2)\n sage: RC = RiggedConfigurations(ct, [[4,1],[5,1]])\n sage: len(RC.module_generators)\n 2\n sage: ct = CartanType(['A',3,1]).relabel(lambda x: (x+2) % 4)\n sage: RC = RiggedConfigurations(ct, [[0,1],[1,1]])\n sage: len(RC.module_generators)\n 2\n "
module_gens = []
n = len(self._rc_index)
for tree_node in self.kleber_tree():
shapes = []
cur = tree_node
path_lambda = [cur.up_root.to_vector()]
while (cur.parent_node is not None):
path_lambda.insert(0, (cur.parent_node.up_root - cur.up_root).to_vector())
cur = cur.parent_node
for a in range(n):
shapes.append([])
for (i, cur_lambda) in enumerate(path_lambda):
for j in range(cur_lambda[a]):
shapes[(- 1)].insert(0, i)
base = self.element_class(self, partition_list=shapes[:])
vac_nums = []
blocks = []
L = []
for partition in base:
vac_nums.append(partition.vacancy_numbers)
blocks.append([[]])
if (not partition._list):
L.append([[]])
continue
block_len = partition[0]
for (i, rowLen) in enumerate(partition):
if (block_len != rowLen):
blocks[(- 1)].append([])
block_len = rowLen
blocks[(- 1)][(- 1)].append(partition.vacancy_numbers[i])
L2 = []
for block in blocks[(- 1)]:
L2.append(IterableFunctionCall(self._block_iterator, block))
L.append(itertools.product(*L2))
C = itertools.product(*L)
for curBlocks in C:
module_gens.append(self.element_class(self, KT_constructor=[shapes[:], self._blocks_to_values(curBlocks[:]), vac_nums[:]]))
return tuple(module_gens)
def _block_iterator(self, container):
"\n Iterate over all possible riggings for a particular block.\n\n Helper iterator which iterates over all possible partitions contained\n within the container.\n\n INPUT:\n\n - ``container`` -- a list of widths of the rows of the container\n\n TESTS::\n\n sage: RC = RiggedConfigurations(['A', 4, 1], [[2, 2]])\n sage: for x in RC._block_iterator([]): x\n []\n sage: for x in RC._block_iterator([2,3]): x\n [0, 0]\n [1, 0]\n [1, 1]\n [2, 0]\n [2, 1]\n [2, 2]\n "
if (not container):
(yield [])
return
pos = 0
length = len(container)
ret_part = ([(- 1)] * length)
while (pos >= 0):
ret_part[pos] += 1
if ((ret_part[pos] > container[pos]) or ((pos != 0) and (ret_part[pos] > ret_part[(pos - 1)]))):
ret_part[pos] = (- 1)
pos -= 1
else:
pos += 1
if (pos == length):
(yield ret_part[:])
pos -= 1
def _blocks_to_values(self, blocks):
"\n Convert an array of blocks into a list of partition values.\n\n INPUT:\n\n - ``blocks`` -- the (2-dim) array blocks of the partition values\n\n TESTS::\n\n sage: RC = RiggedConfigurations(['A', 4, 1], [[2, 2]])\n sage: RC._blocks_to_values([[[2, 1]]])\n [[2, 1]]\n "
values = []
for part_block in blocks:
if (not part_block):
values.append([])
else:
values.append(part_block[0][:])
for block in part_block[1:]:
values[(- 1)].extend(block)
return values
def classically_highest_weight_vectors(self):
"\n Return the classically highest weight elements of ``self``.\n\n TESTS::\n\n sage: RC = RiggedConfigurations(['A', 4, 1], [[2, 2]])\n sage: ascii_art(RC.classically_highest_weight_vectors())\n ( (/) (/) (/) (/) )\n "
return self.module_generators
def _element_constructor_(self, *lst, **options):
"\n Construct a ``RiggedConfigurationElement``.\n\n Typically the user should not call this method since it does not check\n if it is a valid configuration. Instead the user should use the\n iterator methods.\n\n EXAMPLES::\n\n sage: RC = RiggedConfigurations(['A', 4, 1], [[2, 1]])\n sage: RC(partition_list=[[1], [1], [], []], rigging_list=[[-1], [0], [], []])\n <BLANKLINE>\n -1[ ]-1\n <BLANKLINE>\n 0[ ]0\n <BLANKLINE>\n (/)\n <BLANKLINE>\n (/)\n <BLANKLINE>\n\n TESTS::\n\n sage: KT = crystals.TensorProductOfKirillovReshetikhinTableaux(['C',2,1], [[2,4],[1,2]])\n sage: t = KT(pathlist=[[2,1,2,1,-2,2,-1,-2],[2,-2]])\n sage: rc = t.to_rigged_configuration(); rc\n <BLANKLINE>\n -1[ ][ ][ ]-1\n 0[ ][ ]0\n <BLANKLINE>\n -1[ ][ ]-1\n -1[ ]-1\n -1[ ]-1\n <BLANKLINE>\n sage: RC = RiggedConfigurations(['C',2,1], [[1,2],[2,4]])\n sage: RC(rc)\n <BLANKLINE>\n -1[ ][ ][ ]-1\n 0[ ][ ]0\n <BLANKLINE>\n -1[ ][ ]-1\n -1[ ]-1\n -1[ ]-1\n <BLANKLINE>\n\n TESTS:\n\n Check that :trac:`17054` is fixed::\n\n sage: B = crystals.infinity.RiggedConfigurations(['A',2])\n sage: RC = RiggedConfigurations(['A',2,1], [[1,1]]*4 + [[2,1]]*4)\n sage: x = B.an_element().f_string([2,2,1,1,2,1,2,1])\n sage: ascii_art(x)\n -4[ ][ ][ ][ ]-4 -4[ ][ ][ ][ ]0\n sage: ascii_art(RC(x))\n 0[ ][ ][ ][ ]-4 0[ ][ ][ ][ ]0\n sage: x == B.an_element().f_string([2,2,1,1,2,1,2,1])\n True\n "
if (not lst):
return self.element_class(self, [], **options)
from sage.combinat.rigged_configurations.tensor_product_kr_tableaux_element import TensorProductOfKirillovReshetikhinTableauxElement
if isinstance(lst[0], TensorProductOfKirillovReshetikhinTableauxElement):
if (self != lst[0].parent().rigged_configurations()):
raise ValueError('incorrect bijection image')
return lst[0].to_rigged_configuration()
from sage.combinat.crystals.tensor_product import TensorProductOfRegularCrystalsElement
if isinstance(lst[0], TensorProductOfRegularCrystalsElement):
lst = lst[0]
from sage.combinat.crystals.kirillov_reshetikhin import KirillovReshetikhinGenericCrystalElement
if isinstance(lst[0], KirillovReshetikhinGenericCrystalElement):
KRT = self.tensor_product_of_kirillov_reshetikhin_tableaux()
krt_elt = KRT(*[x.to_kirillov_reshetikhin_tableau() for x in lst])
return krt_elt.to_rigged_configuration()
if isinstance(lst[0], (list, tuple)):
lst = lst[0]
if isinstance(lst[0], RiggedPartition):
lst = [p._clone() for p in lst]
elif isinstance(lst[0], RiggedConfigurationElement):
lst = [p._clone() for p in lst[0]]
return self.element_class(self, list(lst), **options)
def _calc_vacancy_number(self, partitions, a, i, **options):
"\n Calculate the vacancy number `p_i^{(a)}` in ``self``.\n\n This assumes that `\\gamma_a = 1` for all `a` and `(\\alpha_a \\mid\n \\alpha_b ) = A_{ab}`.\n\n INPUT:\n\n - ``partitions`` -- the list of rigged partitions we are using\n\n - ``a`` -- the rigged partition index\n\n - ``i`` -- the row length\n\n TESTS::\n\n sage: RC = RiggedConfigurations(['A', 4, 1], [[2, 1]])\n sage: elt = RC(partition_list=[[1], [1], [], []])\n sage: RC._calc_vacancy_number(elt.nu(), 1, 1)\n 0\n "
vac_num = 0
if ('B' in options):
for tab in options['B']:
if (len(tab) == self._rc_index[a]):
vac_num += min(i, len(tab[0]))
elif ('L' in options):
L = options['L']
if (a in L):
for kvp in L[a].items():
vac_num += (min(kvp[0], i) * kvp[1])
elif ('dims' in options):
for dim in options['dims']:
if (dim[0] == self._rc_index[a]):
vac_num += min(dim[1], i)
else:
for dim in self.dims:
if (dim[0] == self._rc_index[a]):
vac_num += min(dim[1], i)
if (i == float('inf')):
vac_num -= sum(((self._cartan_matrix[(a, b)] * sum(nu)) for (b, nu) in enumerate(partitions)))
else:
vac_num -= sum(((self._cartan_matrix[(a, b)] * nu.get_num_cells_to_column(i)) for (b, nu) in enumerate(partitions)))
return vac_num
def kleber_tree(self):
"\n Return the underlying Kleber tree used to generate all highest\n weight rigged configurations.\n\n EXAMPLES::\n\n sage: RC = RiggedConfigurations(['A',3,1], [[1,1], [2,1]])\n sage: RC.kleber_tree()\n Kleber tree of Cartan type ['A', 3, 1] and B = ((1, 1), (2, 1))\n "
return KleberTree(self._cartan_type, self.dims)
@cached_method
def tensor_product_of_kirillov_reshetikhin_tableaux(self):
"\n Return the corresponding tensor product of Kirillov-Reshetikhin\n tableaux.\n\n EXAMPLES::\n\n sage: RC = RiggedConfigurations(['A', 3, 1], [[3, 2], [1, 2]])\n sage: RC.tensor_product_of_kirillov_reshetikhin_tableaux()\n Tensor product of Kirillov-Reshetikhin tableaux of type ['A', 3, 1] and factor(s) ((3, 2), (1, 2))\n "
from sage.combinat.rigged_configurations.tensor_product_kr_tableaux import TensorProductOfKirillovReshetikhinTableaux
return TensorProductOfKirillovReshetikhinTableaux(self._cartan_type, self.dims)
@cached_method
def tensor_product_of_kirillov_reshetikhin_crystals(self):
"\n Return the corresponding tensor product of Kirillov-Reshetikhin\n crystals.\n\n EXAMPLES::\n\n sage: RC = RiggedConfigurations(['A', 3, 1], [[3,1],[2,2]])\n sage: RC.tensor_product_of_kirillov_reshetikhin_crystals()\n Full tensor product of the crystals\n [Kirillov-Reshetikhin crystal of type ['A', 3, 1] with (r,s)=(3,1),\n Kirillov-Reshetikhin crystal of type ['A', 3, 1] with (r,s)=(2,2)]\n "
return self.tensor_product_of_kirillov_reshetikhin_tableaux().tensor_product_of_kirillov_reshetikhin_crystals()
def fermionic_formula(self, q=None, only_highest_weight=False, weight=None):
"\n Return the fermionic formula associated to ``self``.\n\n Given a set of rigged configurations `RC(\\lambda, L)`, the fermionic\n formula is defined as:\n\n .. MATH::\n\n M(\\lambda, L; q) = \\sum_{(\\nu,J)} q^{cc(\\nu, J)}\n\n where we sum over all (classically highest weight) rigged\n configurations of weight `\\lambda` where `cc` is the\n :meth:`cocharge statistic\n <sage.combinat.rigged_configurations.rigged_configuration_element.RiggedConfigurationElement.cc>`.\n This is known to reduce to\n\n .. MATH::\n\n M(\\lambda, L; q) = \\sum_{\\nu} q^{cc(\\nu)} \\prod_{(a,i) \\in\n I \\times \\ZZ} \\begin{bmatrix} p_i^{(a)} + m_i^{(a)} \\\\ m_i^{(a)}\n \\end{bmatrix}_q.\n\n The generating function of `M(\\lambda, L; q)` in the weight algebra\n subsumes all fermionic formulas:\n\n .. MATH::\n\n M(L; q) = \\sum_{\\lambda \\in P} M(\\lambda, L; q) \\lambda.\n\n This is conjecturally equal to the\n :meth:`one dimensional configuration sum\n <sage.combinat.crystals.tensor_product.CrystalOfWords.one_dimensional_configuration_sum>`\n of the corresponding tensor product of Kirillov-Reshetikhin crystals, see [HKOTT2002]_.\n This has been proven in general for type `A_n^{(1)}` [BijectionLRT]_,\n single factors `B^{r,s}` in type `D_n^{(1)}` [OSS2011]_ with the result\n from [Sakamoto13]_, as well as for a tensor product of single columns\n [OSS2003]_, [BijectionDn]_ or a tensor product of single rows [OSS03]_\n for all non-exceptional types.\n\n INPUT:\n\n - ``q`` -- the variable `q`\n - ``only_highest_weight`` -- use only the classically highest weight\n rigged configurations\n - ``weight`` -- return the fermionic formula `M(\\lambda, L; q)` where\n `\\lambda` is the classical weight ``weight``\n\n REFERENCES:\n\n .. [OSS2003] Masato Okado, Anne Schilling, and Mark Shimozono.\n Virtual crystals and fermionic formulas of type `D_{n+1}^{(2)}`,\n `A_{2n}^{(2)}`, and `C_n^{(1)}`. Representation Theory. **7** (2003)\n :arxiv:`math.QA/0105017`.\n\n .. [Sakamoto13] Reiho Sakamoto.\n Rigged configurations and Kashiwara operators.\n (2013) :arxiv:`1302.4562v1`.\n\n EXAMPLES::\n\n sage: RC = RiggedConfigurations(['A', 2, 1], [[1,1], [1,1]])\n sage: RC.fermionic_formula()\n B[-2*Lambda[1] + 2*Lambda[2]] + (q+1)*B[-Lambda[1]]\n + (q+1)*B[Lambda[1] - Lambda[2]] + B[2*Lambda[1]]\n + B[-2*Lambda[2]] + (q+1)*B[Lambda[2]]\n sage: t = QQ['t'].gen(0)\n sage: RC.fermionic_formula(t)\n B[-2*Lambda[1] + 2*Lambda[2]] + (t+1)*B[-Lambda[1]]\n + (t+1)*B[Lambda[1] - Lambda[2]] + B[2*Lambda[1]]\n + B[-2*Lambda[2]] + (t+1)*B[Lambda[2]]\n sage: La = RC.weight_lattice_realization().classical().fundamental_weights()\n sage: RC.fermionic_formula(weight=La[2])\n q + 1\n sage: RC.fermionic_formula(only_highest_weight=True, weight=La[2])\n q\n\n Only using the highest weight elements on other types::\n\n sage: RC = RiggedConfigurations(['A', 3, 1], [[3,1], [2,2]])\n sage: RC.fermionic_formula(only_highest_weight=True)\n q*B[Lambda[1] + Lambda[2]] + B[2*Lambda[2] + Lambda[3]]\n sage: RC = RiggedConfigurations(['D', 4, 1], [[3,1], [4,1], [2,1]])\n sage: RC.fermionic_formula(only_highest_weight=True)\n (q^4+q^3+q^2)*B[Lambda[1]] + (q^2+q)*B[Lambda[1] + Lambda[2]]\n + q*B[Lambda[1] + 2*Lambda[3]] + q*B[Lambda[1] + 2*Lambda[4]]\n + B[Lambda[2] + Lambda[3] + Lambda[4]] + (q^3+2*q^2+q)*B[Lambda[3] + Lambda[4]]\n sage: RC = RiggedConfigurations(['E', 6, 1], [[2,2]])\n sage: RC.fermionic_formula(only_highest_weight=True)\n q^2*B[0] + q*B[Lambda[2]] + B[2*Lambda[2]]\n sage: RC = RiggedConfigurations(['B', 3, 1], [[3,1], [2,2]])\n sage: RC.fermionic_formula(only_highest_weight=True) # long time\n q*B[Lambda[1] + Lambda[2] + Lambda[3]] + q^2*B[Lambda[1]\n + Lambda[3]] + (q^2+q)*B[Lambda[2] + Lambda[3]] + B[2*Lambda[2]\n + Lambda[3]] + (q^3+q^2)*B[Lambda[3]]\n sage: RC = RiggedConfigurations(['C', 3, 1], [[3,1], [2,2]])\n sage: RC.fermionic_formula(only_highest_weight=True) # long time\n (q^3+q^2)*B[Lambda[1] + Lambda[2]] + q*B[Lambda[1] + 2*Lambda[2]]\n + (q^2+q)*B[2*Lambda[1] + Lambda[3]] + B[2*Lambda[2] + Lambda[3]]\n + (q^4+q^3+q^2)*B[Lambda[3]]\n sage: RC = RiggedConfigurations(['D', 4, 2], [[3,1], [2,2]])\n sage: RC.fermionic_formula(only_highest_weight=True) # long time\n (q^2+q)*B[Lambda[1] + Lambda[2] + Lambda[3]] + (q^5+2*q^4+q^3)*B[Lambda[1]\n + Lambda[3]] + (q^3+q^2)*B[2*Lambda[1] + Lambda[3]] + (q^4+q^3+q^2)*B[Lambda[2]\n + Lambda[3]] + B[2*Lambda[2] + Lambda[3]] + (q^6+q^5+q^4)*B[Lambda[3]]\n sage: RC = RiggedConfigurations(CartanType(['A',4,2]).dual(), [[1,1],[2,2]])\n sage: RC.fermionic_formula(only_highest_weight=True)\n (q^3+q^2)*B[Lambda[1]] + (q^2+q)*B[Lambda[1] + 2*Lambda[2]]\n + B[Lambda[1] + 4*Lambda[2]] + q*B[3*Lambda[1]] + q*B[4*Lambda[2]]\n\n TESTS::\n\n sage: RC = RiggedConfigurations(['A', 2, 1], [[1,1], [1,1]])\n sage: KR = RC.tensor_product_of_kirillov_reshetikhin_crystals()\n sage: RC.fermionic_formula() == KR.one_dimensional_configuration_sum()\n True\n sage: KT = RC.tensor_product_of_kirillov_reshetikhin_tableaux()\n sage: RC.fermionic_formula() == KT.one_dimensional_configuration_sum()\n True\n sage: RC = RiggedConfigurations(['C', 2, 1], [[2,1], [2,1]])\n sage: KR = RC.tensor_product_of_kirillov_reshetikhin_crystals()\n sage: RC.fermionic_formula() == KR.one_dimensional_configuration_sum() # long time\n True\n sage: t = QQ['t'].gen(0)\n sage: RC = RiggedConfigurations(['D', 4, 1], [[1,1], [2,1]])\n sage: KR = RC.tensor_product_of_kirillov_reshetikhin_crystals()\n sage: RC.fermionic_formula(t) == KR.one_dimensional_configuration_sum(t) # long time\n True\n "
if (q is None):
from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
q = PolynomialRing(QQ, 'q').gen(0)
if only_highest_weight:
L = self.module_generators
else:
L = self
P = q.parent()
WLR = self.weight_lattice_realization().classical()
if (weight is not None):
weight = WLR(weight)
return P.sum(((q ** x.cc()) for x in L if (WLR(x.weight()) == weight)))
B = WLR.algebra(P)
return B.sum((((q ** x.cc()) * B(WLR(x.weight()))) for x in L))
def _test_bijection(self, **options):
"\n Test function to make sure that the bijection between rigged\n configurations and Kirillov-Reshetikhin tableaux is correct.\n\n EXAMPLES::\n\n sage: RC = RiggedConfigurations(['A', 3, 1], [[2,1],[1,1]])\n sage: RC._test_bijection()\n "
tester = self._tester(**options)
rejects = []
for x in self:
y = x.to_tensor_product_of_kirillov_reshetikhin_tableaux()
z = y.to_rigged_configuration()
if (z != x):
rejects.append((x, z))
tester.assertEqual(len(rejects), 0, 'Bijection is not correct: {}'.format(rejects))
if rejects:
return rejects
def tensor(self, *crystals, **options):
"\n Return the tensor product of ``self`` with ``crystals``.\n\n If ``crystals`` is a list of rigged configurations of the same\n Cartan type, then this returns a new :class:`RiggedConfigurations`.\n\n EXAMPLES::\n\n sage: RC = RiggedConfigurations(['A', 3, 1], [[2,1],[1,3]])\n sage: RC2 = RiggedConfigurations(['A', 3, 1], [[1,1], [3,3]])\n sage: RC.tensor(RC2, RC2)\n Rigged configurations of type ['A', 3, 1]\n and factor(s) ((2, 1), (1, 3), (1, 1), (3, 3), (1, 1), (3, 3))\n\n sage: K = crystals.KirillovReshetikhin(['A', 3, 1], 2, 2, model='KR')\n sage: RC.tensor(K)\n Full tensor product of the crystals\n [Rigged configurations of type ['A', 3, 1] and factor(s) ((2, 1), (1, 3)),\n Kirillov-Reshetikhin tableaux of type ['A', 3, 1] and shape (2, 2)]\n "
ct = self._cartan_type
if all(((isinstance(B, RiggedConfigurations) and (B.cartan_type() == ct)) for B in crystals)):
dims = self.dims
for B in crystals:
dims += B.dims
return RiggedConfigurations(ct, dims)
return super().tensor(*crystals, **options)
Element = KRRCSimplyLacedElement
|
class RCNonSimplyLaced(RiggedConfigurations):
'\n Rigged configurations in non-simply-laced types.\n\n These are rigged configurations which lift to virtual rigged configurations\n in a simply-laced type.\n\n For more on rigged configurations, see :class:`RiggedConfigurations`.\n '
@staticmethod
def __classcall_private__(cls, cartan_type, B):
"\n Normalize the input arguments to ensure unique representation.\n\n EXAMPLES::\n\n sage: RC1 = RiggedConfigurations(CartanType(['A',4,2]), [[2,2]])\n sage: RC2 = RiggedConfigurations(['A',4,2], [(2,2)])\n sage: RC3 = RiggedConfigurations(['BC',2,2], ((2,2),))\n sage: RC2 is RC1, RC3 is RC1\n (True, True)\n "
cartan_type = CartanType(cartan_type)
B = tuple(map(tuple, B))
return super().__classcall__(cls, cartan_type, B)
def __init__(self, cartan_type, dims):
"\n Initialize ``self``.\n\n EXAMPLES::\n\n sage: RC = RiggedConfigurations(['C',2,1], [[1,1]])\n sage: TestSuite(RC).run()\n sage: RC = RiggedConfigurations(['C',2,1], [[1,2],[2,1]])\n sage: TestSuite(RC).run() # long time\n sage: RC = RiggedConfigurations(['B',3,1], [[3,1],[1,1]])\n sage: TestSuite(RC).run() # long time\n sage: RC = RiggedConfigurations(['D',4,2], [[2,1]])\n sage: TestSuite(RC).run() # long time\n sage: RC = RiggedConfigurations(['A',5,2], [[2,1]])\n sage: TestSuite(RC).run() # long time\n "
self._folded_ct = cartan_type.as_folding()
RiggedConfigurations.__init__(self, cartan_type, dims)
def _calc_vacancy_number(self, partitions, a, i, **options):
"\n Calculate the vacancy number `p_i^{(a)}` in ``self``.\n\n INPUT:\n\n - ``partitions`` -- the list of rigged partitions we are using\n\n - ``a`` -- the rigged partition index\n\n - ``i`` -- the row length\n\n TESTS::\n\n sage: RC = RiggedConfigurations(['C', 4, 1], [[2, 1]])\n sage: elt = RC(partition_list=[[1], [2], [2], [1]])\n sage: RC._calc_vacancy_number(elt.nu(), 1, 2)\n 0\n "
vac_num = 0
if ('B' in options):
for tab in options['B']:
if (len(tab) == self._rc_index[a]):
vac_num += min(i, len(tab[0]))
elif ('L' in options):
L = options['L']
if (a in L):
for kvp in L[a].items():
vac_num += (min(kvp[0], i) * kvp[1])
elif ('dims' in options):
for dim in options['dims']:
if (dim[0] == self._rc_index[a]):
vac_num += min(dim[1], i)
else:
for dim in self.dims:
if (dim[0] == self._rc_index[a]):
vac_num += min(dim[1], i)
if (i == float('inf')):
vac_num -= sum(((self._cartan_matrix[(a, b)] * sum(nu)) for (b, nu) in enumerate(partitions)))
else:
gamma = self._folded_ct.scaling_factors()
vac_num -= sum((((self._cartan_matrix[(a, b)] * nu.get_num_cells_to_column((gamma[(a + 1)] * i), gamma[(b + 1)])) // gamma[(b + 1)]) for (b, nu) in enumerate(partitions)))
return vac_num
@lazy_attribute
def module_generators(self):
"\n Module generators for this set of rigged configurations.\n\n Iterate over the highest weight rigged configurations by moving\n through the\n :class:`~sage.combinat.rigged_configurations.kleber_tree.KleberTree`\n and then setting appropriate values of the partitions.\n\n EXAMPLES::\n\n sage: RC = RiggedConfigurations(['C', 3, 1], [[1,2]])\n sage: for x in RC.module_generators: x\n <BLANKLINE>\n (/)\n <BLANKLINE>\n (/)\n <BLANKLINE>\n (/)\n <BLANKLINE>\n <BLANKLINE>\n 0[ ][ ]0\n <BLANKLINE>\n 0[ ][ ]0\n <BLANKLINE>\n 0[ ]0\n <BLANKLINE>\n\n sage: RC = RiggedConfigurations(['D',4,3], [[1,1]])\n sage: RC.module_generators\n (\n <BLANKLINE>\n 0[ ]0\n (/) 0[ ]0\n <BLANKLINE>\n (/) 0[ ]0\n ,\n )\n "
module_gens = []
vec_len = len(self.kleber_tree().root.up_root.to_vector())
for tree_node in self.kleber_tree():
shapes = []
cur = tree_node
path_lambda = [cur.up_root.to_vector()]
while (cur.parent_node is not None):
path_lambda.insert(0, (cur.parent_node.up_root - cur.up_root).to_vector())
cur = cur.parent_node
for a in range(vec_len):
shapes.append([])
for (i, cur_lambda) in enumerate(path_lambda):
for j in range(cur_lambda[a]):
shapes[(- 1)].insert(0, i)
sigma = self._folded_ct.folding_orbit()
vindex = self.virtual._rc_index
shapes = [shapes[vindex.index(sigma[a][0])] for a in self._rc_index]
if (self._cartan_type.type() != 'BC'):
gamma = self._folded_ct.scaling_factors()
for (a, shape) in enumerate(shapes):
for i in range(len(shape)):
shape[i] = (shape[i] // gamma[self._rc_index[a]])
base = self.element_class(self, partition_list=shapes[:])
vac_nums = []
blocks = []
L = []
for partition in base:
vac_nums.append(partition.vacancy_numbers)
blocks.append([[]])
if (not partition._list):
L.append([[]])
continue
block_len = partition[0]
for (i, rowLen) in enumerate(partition):
if (block_len != rowLen):
blocks[(- 1)].append([])
block_len = rowLen
blocks[(- 1)][(- 1)].append(partition.vacancy_numbers[i])
L2 = []
for block in blocks[(- 1)]:
L2.append(IterableFunctionCall(self._block_iterator, block))
L.append(itertools.product(*L2))
C = itertools.product(*L)
for cur_blocks in C:
module_gens.append(self.element_class(self, KT_constructor=[shapes[:], self._blocks_to_values(cur_blocks[:]), vac_nums[:]]))
return tuple(module_gens)
def kleber_tree(self):
"\n Return the underlying (virtual) Kleber tree used to generate all\n highest weight rigged configurations.\n\n EXAMPLES::\n\n sage: RC = RiggedConfigurations(['C',3,1], [[1,1], [2,1]])\n sage: RC.kleber_tree()\n Virtual Kleber tree of Cartan type ['C', 3, 1] and B = ((1, 1), (2, 1))\n "
return VirtualKleberTree(self._cartan_type, self.dims)
@lazy_attribute
def virtual(self):
"\n Return the corresponding virtual crystal.\n\n EXAMPLES::\n\n sage: RC = RiggedConfigurations(['C',2,1], [[1,2],[1,1],[2,1]])\n sage: RC\n Rigged configurations of type ['C', 2, 1] and factor(s) ((1, 2), (1, 1), (2, 1))\n sage: RC.virtual\n Rigged configurations of type ['A', 3, 1] and factor(s) ((1, 2), (3, 2), (1, 1), (3, 1), (2, 2))\n "
gamma = self._folded_ct.scaling_factors()
sigma = self._folded_ct.folding_orbit()
virtual_dims = []
for (r, s) in self.dims:
for a in sigma[r]:
virtual_dims.append([a, (s * gamma[r])])
return RiggedConfigurations(self._folded_ct._folding, virtual_dims)
def to_virtual(self, rc):
"\n Convert ``rc`` into a rigged configuration in the virtual crystal.\n\n INPUT:\n\n - ``rc`` -- a rigged configuration element\n\n EXAMPLES::\n\n sage: RC = RiggedConfigurations(['C',2,1], [[1,2],[1,1],[2,1]])\n sage: elt = RC(partition_list=[[3],[2]]); elt\n <BLANKLINE>\n 0[ ][ ][ ]0\n <BLANKLINE>\n 0[ ][ ]0\n sage: velt = RC.to_virtual(elt); velt\n <BLANKLINE>\n 0[ ][ ][ ]0\n <BLANKLINE>\n 0[ ][ ][ ][ ]0\n <BLANKLINE>\n 0[ ][ ][ ]0\n sage: velt.parent()\n Rigged configurations of type ['A', 3, 1] and factor(s) ((1, 2), (3, 2), (1, 1), (3, 1), (2, 2))\n "
gamma = self._folded_ct.scaling_factors()
sigma = self._folded_ct.folding_orbit()
n = len(self.virtual._rc_index)
partitions = ([None] * n)
for (a, rp) in enumerate(rc):
g = gamma[(a + 1)]
for i in sigma[(a + 1)]:
partitions[(i - 1)] = RiggedPartition([(row_len * g) for row_len in rp._list], [(rig_val * g) for rig_val in rp.rigging], [(vac_num * g) for vac_num in rp.vacancy_numbers])
return self.virtual.element_class(self.virtual, partitions, use_vacancy_numbers=True)
def from_virtual(self, vrc):
"\n Convert ``vrc`` in the virtual crystal into a rigged configuration of\n the original Cartan type.\n\n INPUT:\n\n - ``vrc`` -- a virtual rigged configuration\n\n EXAMPLES::\n\n sage: RC = RiggedConfigurations(['C',2,1], [[1,2],[1,1],[2,1]])\n sage: elt = RC(partition_list=[[3],[2]])\n sage: vrc_elt = RC.to_virtual(elt)\n sage: ret = RC.from_virtual(vrc_elt); ret\n <BLANKLINE>\n 0[ ][ ][ ]0\n <BLANKLINE>\n 0[ ][ ]0\n sage: ret == elt\n True\n "
gamma = self._folded_ct.scaling_factors()
sigma = self._folded_ct.folding_orbit()
n = len(self._rc_index)
partitions = ([None] * n)
for a in range(n):
rp = vrc[(sigma[(a + 1)][0] - 1)]
g = gamma[(a + 1)]
partitions[a] = RiggedPartition([(row_len // g) for row_len in rp._list], [(rig_val // g) for rig_val in rp.rigging], [(vac_val // g) for vac_val in rp.vacancy_numbers])
return self.element_class(self, partitions, use_vacancy_numbers=True)
def _test_virtual_vacancy_numbers(self, **options):
"\n Test to make sure that the vacancy numbers obtained from the virtual\n rigged configuration agree with the explicit computation of the\n vacancy numbers done here.\n\n EXAMPLES::\n\n sage: RC = RiggedConfigurations(['B', 3, 1], [[2,1]])\n sage: RC._test_virtual_vacancy_numbers()\n "
tester = self._tester(**options)
for x in self:
parts_list = [p._list[:] for p in x]
elt = self.element_class(self, partition_list=parts_list)
for (i, p) in enumerate(elt):
for (j, vac_num) in enumerate(p.vacancy_numbers):
tester.assertEqual(vac_num, x[i].vacancy_numbers[j], 'Incorrect vacancy number: {}\nComputed: {}\nFor: {}'.format(x[i].vacancy_numbers[j], vac_num, x))
Element = KRRCNonSimplyLacedElement
|
class RCTypeA2Even(RCNonSimplyLaced):
"\n Rigged configurations for type `A_{2n}^{(2)}`.\n\n For more on rigged configurations, see :class:`RiggedConfigurations`.\n\n EXAMPLES::\n\n sage: RC = RiggedConfigurations(['A',4,2], [[2,1], [1,2]])\n sage: RC.cardinality()\n 150\n sage: RC = RiggedConfigurations(['A',2,2], [[1,1]])\n sage: RC.cardinality()\n 3\n sage: RC = RiggedConfigurations(['A',2,2], [[1,2],[1,1]])\n sage: TestSuite(RC).run() # long time\n sage: RC = RiggedConfigurations(['A',4,2], [[2,1]])\n sage: TestSuite(RC).run() # long time\n "
def cardinality(self):
"\n Return the cardinality of ``self``.\n\n EXAMPLES::\n\n sage: RC = RiggedConfigurations(['A',4,2], [[1,1], [2,2]])\n sage: RC.cardinality()\n 250\n "
return self.tensor_product_of_kirillov_reshetikhin_tableaux().cardinality()
@lazy_attribute
def virtual(self):
"\n Return the corresponding virtual crystal.\n\n EXAMPLES::\n\n sage: RC = RiggedConfigurations(['A',4,2], [[1,2],[1,1],[2,1]])\n sage: RC\n Rigged configurations of type ['BC', 2, 2] and factor(s) ((1, 2), (1, 1), (2, 1))\n sage: RC.virtual\n Rigged configurations of type ['A', 3, 1] and factor(s) ((1, 2), (3, 2), (1, 1), (3, 1), (2, 1), (2, 1))\n "
sigma = self._folded_ct.folding_orbit()
n = (len(sigma) - 1)
virtual_dims = []
for (r, s) in self.dims:
if (r == n):
virtual_dims.extend([[n, s], [n, s]])
else:
for a in sigma[r]:
virtual_dims.append([a, s])
return RiggedConfigurations(self._folded_ct._folding, virtual_dims)
def _calc_vacancy_number(self, partitions, a, i, **options):
"\n Calculate the vacancy number `p_i^{(a)}` in ``self``.\n\n This is a special implementation for type `A_{2n}^{(2)}`.\n\n INPUT:\n\n - ``partitions`` -- the list of rigged partitions we are using\n\n - ``a`` -- the rigged partition index\n\n - ``i`` -- the row length\n\n TESTS::\n\n sage: RC = RiggedConfigurations(['A', 4, 2], [[2, 1]])\n sage: elt = RC(partition_list=[[1], [2]])\n sage: RC._calc_vacancy_number(elt.nu(), 1, 2)\n 0\n "
vac_num = 0
if ('B' in options):
for tab in options['B']:
if (len(tab) == self._rc_index[a]):
vac_num += min(i, len(tab[0]))
elif ('L' in options):
L = options['L']
if (a in L):
for kvp in L[a].items():
vac_num += (min(kvp[0], i) * kvp[1])
elif ('dims' in options):
for dim in options['dims']:
if (dim[0] == self._rc_index[a]):
vac_num += min(dim[1], i)
else:
for dim in self.dims:
if (dim[0] == self._rc_index[a]):
vac_num += min(dim[1], i)
gamma = self._folded_ct.scaling_factors()
if (i == float('inf')):
vac_num -= sum((((self._cartan_matrix[(a, b)] * sum(nu)) // gamma[(b + 1)]) for (b, nu) in enumerate(partitions)))
else:
vac_num -= sum((((self._cartan_matrix[(a, b)] * nu.get_num_cells_to_column(i)) // gamma[(b + 1)]) for (b, nu) in enumerate(partitions)))
return vac_num
def to_virtual(self, rc):
"\n Convert ``rc`` into a rigged configuration in the virtual crystal.\n\n INPUT:\n\n - ``rc`` -- a rigged configuration element\n\n EXAMPLES::\n\n sage: RC = RiggedConfigurations(['A',4,2], [[2,2]])\n sage: elt = RC(partition_list=[[1],[1]]); elt\n <BLANKLINE>\n -1[ ]-1\n <BLANKLINE>\n 1[ ]1\n <BLANKLINE>\n sage: velt = RC.to_virtual(elt); velt\n <BLANKLINE>\n -1[ ]-1\n <BLANKLINE>\n 2[ ]2\n <BLANKLINE>\n -1[ ]-1\n <BLANKLINE>\n sage: velt.parent()\n Rigged configurations of type ['A', 3, 1] and factor(s) ((2, 2), (2, 2))\n "
gamma = self._folded_ct.scaling_factors()
sigma = self._folded_ct.folding_orbit()
n = len(self.virtual._rc_index)
partitions = ([None] * n)
for (a, rp) in enumerate(rc):
g = gamma[(a + 1)]
for i in sigma[(a + 1)]:
partitions[(i - 1)] = RiggedPartition([row_len for row_len in rp._list], [(rig_val * g) for rig_val in rp.rigging], [(vac_num * g) for vac_num in rp.vacancy_numbers])
return self.virtual.element_class(self.virtual, partitions, use_vacancy_numbers=True)
def from_virtual(self, vrc):
"\n Convert ``vrc`` in the virtual crystal into a rigged configuration of\n the original Cartan type.\n\n INPUT:\n\n - ``vrc`` -- a virtual rigged configuration element\n\n EXAMPLES::\n\n sage: RC = RiggedConfigurations(['A',4,2], [[2,2]])\n sage: elt = RC(partition_list=[[1],[1]])\n sage: velt = RC.to_virtual(elt)\n sage: ret = RC.from_virtual(velt); ret\n <BLANKLINE>\n -1[ ]-1\n <BLANKLINE>\n 1[ ]1\n <BLANKLINE>\n sage: ret == elt\n True\n "
gamma = self._folded_ct.scaling_factors()
sigma = self._folded_ct.folding_orbit()
n = len(self._rc_index)
partitions = ([None] * n)
for a in range(n):
rp = vrc[(sigma[(a + 1)][0] - 1)]
g = gamma[(a + 1)]
partitions[a] = RiggedPartition([row_len for row_len in rp._list], [(rig_val // g) for rig_val in rp.rigging], [(vac_val // g) for vac_val in rp.vacancy_numbers])
return self.element_class(self, partitions, use_vacancy_numbers=True)
|
class RCTypeA2Dual(RCTypeA2Even):
"\n Rigged configurations of type `A_{2n}^{(2)\\dagger}`.\n\n For more on rigged configurations, see :class:`RiggedConfigurations`.\n\n EXAMPLES::\n\n sage: RC = RiggedConfigurations(CartanType(['A',4,2]).dual(), [[1,2],[1,1],[2,1]])\n sage: RC\n Rigged configurations of type ['BC', 2, 2]^* and factor(s) ((1, 2), (1, 1), (2, 1))\n sage: RC.cardinality()\n 750\n sage: RC.virtual\n Rigged configurations of type ['A', 3, 1] and factor(s) ((1, 2), (3, 2), (1, 1), (3, 1), (2, 1), (2, 1))\n sage: RC = RiggedConfigurations(CartanType(['A',2,2]).dual(), [[1,1]])\n sage: RC.cardinality()\n 3\n sage: RC = RiggedConfigurations(CartanType(['A',2,2]).dual(), [[1,2],[1,1]])\n sage: TestSuite(RC).run() # long time\n sage: RC = RiggedConfigurations(CartanType(['A',4,2]).dual(), [[2,1]])\n sage: TestSuite(RC).run() # long time\n "
def _calc_vacancy_number(self, partitions, a, i, **options):
"\n Calculate the vacancy number `p_i^{(a)}` in ``self``. A special case\n is needed for the `n`-th partition for type `A_{2n}^{(2)\\dagger}`.\n\n INPUT:\n\n - ``partitions`` -- the list of rigged partitions we are using\n\n - ``a`` -- the rigged partition index\n\n - ``i`` -- the row length\n\n TESTS::\n\n sage: RC = RiggedConfigurations(CartanType(['A', 6, 2]).dual(), [[2,1]])\n sage: elt = RC(partition_list=[[1], [2], [2]])\n sage: RC._calc_vacancy_number(elt.nu(), 0, 1)\n -1\n "
if (a != (len(self._rc_index) - 1)):
return RCTypeA2Even._calc_vacancy_number(self, partitions, a, i, **options)
vac_num = 0
if ('B' in options):
for tab in options['B']:
if (len(tab) == self._rc_index[a]):
vac_num += min(i, len(tab[0]))
elif ('L' in options):
L = options['L']
if (a in L):
for kvp in L[a].items():
vac_num += (min(kvp[0], i) * kvp[1])
elif ('dims' in options):
for dim in options['dims']:
if (dim[0] == self._rc_index[a]):
vac_num += min(dim[1], i)
else:
for dim in self.dims:
if (dim[0] == self._rc_index[a]):
vac_num += min(dim[1], i)
if (i == float('inf')):
vac_num -= sum((((self._cartan_matrix[(a, b)] * sum(nu)) / 2) for (b, nu) in enumerate(partitions)))
else:
vac_num -= sum((((self._cartan_matrix[(a, b)] * nu.get_num_cells_to_column(i)) / 2) for (b, nu) in enumerate(partitions)))
return vac_num
@lazy_attribute
def module_generators(self):
"\n Module generators for rigged configurations of type\n `A_{2n}^{(2)\\dagger}`.\n\n Iterate over the highest weight rigged configurations by moving\n through the\n :class:`~sage.combinat.rigged_configurations.kleber_tree.KleberTree`\n and then setting appropriate values of the partitions. This also\n skips rigged configurations where `P_i^{(n)} < 1` when `i` is odd.\n\n EXAMPLES::\n\n sage: RC = RiggedConfigurations(CartanType(['A', 4, 2]).dual(), [[1,1]])\n sage: for x in RC.module_generators: x\n <BLANKLINE>\n (/)\n <BLANKLINE>\n (/)\n <BLANKLINE>\n "
module_gens = []
vec_len = len(self.kleber_tree().root.up_root.to_vector())
for tree_node in self.kleber_tree():
shapes = []
cur = tree_node
path_lambda = [cur.up_root.to_vector()]
while (cur.parent_node is not None):
path_lambda.insert(0, (cur.parent_node.up_root - cur.up_root).to_vector())
cur = cur.parent_node
for a in range(vec_len):
shapes.append([])
for (i, cur_lambda) in enumerate(path_lambda):
for j in range(cur_lambda[a]):
shapes[(- 1)].insert(0, i)
sigma = self._folded_ct.folding_orbit()
vindex = self.virtual._rc_index
shapes = [shapes[vindex.index(sigma[a][0])] for a in self._rc_index]
base = self.element_class(self, partition_list=shapes[:])
invalid_RC = False
for i in range(len(base[(- 1)]._list)):
if (((base[(- 1)]._list[i] % 2) == 1) and (base[(- 1)].vacancy_numbers[i] < 1)):
invalid_RC = True
break
if invalid_RC:
continue
vac_nums = []
blocks = []
L = []
for partition in base[:(- 1)]:
vac_nums.append(partition.vacancy_numbers)
blocks.append([[]])
if (len(partition) <= 0):
L.append([[]])
continue
block_len = partition[0]
for (i, row_len) in enumerate(partition):
if (block_len != row_len):
blocks[(- 1)].append([])
block_len = row_len
blocks[(- 1)][(- 1)].append(partition.vacancy_numbers[i])
L2 = []
for block in blocks[(- 1)]:
L2.append(IterableFunctionCall(self._block_iterator, block))
L.append(itertools.product(*L2))
partition = base[(- 1)]
vac_nums.append(partition.vacancy_numbers)
if (len(partition) <= 0):
L.append([[]])
else:
block_len = partition[0]
blocks = [[]]
odd_block = []
for (i, row_len) in enumerate(partition):
if (block_len != row_len):
blocks.append([])
odd_block.append(((block_len % 2) == 1))
block_len = row_len
blocks[(- 1)].append(partition.vacancy_numbers[i])
odd_block.append(((block_len % 2) == 1))
L2 = []
for (i, block) in enumerate(blocks):
if odd_block[i]:
L2.append(IterableFunctionCall(self._block_iterator_n_odd, block))
else:
L2.append(IterableFunctionCall(self._block_iterator, block))
L.append(itertools.product(*L2))
C = itertools.product(*L)
for curBlocks in C:
module_gens.append(self.element_class(self, KT_constructor=[shapes[:], self._blocks_to_values(curBlocks[:]), vac_nums[:]]))
return tuple(module_gens)
def _block_iterator_n_odd(self, container):
"\n Iterate over all possible riggings for a block of odd length in the\n `n`-th rigged partition for type `A_{2n}^{(2)\\dagger}`.\n\n Helper iterator which iterates over all possible partitions of\n `\\frac{2k+1}{2}` sizes contained within the container.\n\n INPUT:\n\n - ``container`` -- a list the widths of the rows of the container\n\n TESTS::\n\n sage: RC = RiggedConfigurations(CartanType(['A', 4, 2]).dual(), [[2, 2]])\n sage: for x in RC._block_iterator_n_odd([]): x\n []\n sage: for x in RC._block_iterator_n_odd([2,2]): x\n [1/2, 1/2]\n [3/2, 1/2]\n [3/2, 3/2]\n "
if (len(container) == 0):
(yield [])
return
pos = 0
length = len(container)
ret_part = ([(- 1)] * length)
while (pos >= 0):
ret_part[pos] += 2
if ((ret_part[pos] > (container[pos] * 2)) or ((pos != 0) and (ret_part[pos] > ret_part[(pos - 1)]))):
ret_part[pos] = (- 1)
pos -= 1
else:
pos += 1
if (pos == length):
(yield [(QQ(n) / QQ(2)) for n in ret_part])
pos -= 1
def to_virtual(self, rc):
"\n Convert ``rc`` into a rigged configuration in the virtual crystal.\n\n INPUT:\n\n - ``rc`` -- a rigged configuration element\n\n EXAMPLES::\n\n sage: RC = RiggedConfigurations(CartanType(['A',4,2]).dual(), [[2,2]])\n sage: elt = RC(partition_list=[[1],[1]]); elt\n <BLANKLINE>\n -1[ ]-1\n <BLANKLINE>\n 1[ ]1\n <BLANKLINE>\n sage: velt = RC.to_virtual(elt); velt\n <BLANKLINE>\n -1[ ]-1\n <BLANKLINE>\n 2[ ]2\n <BLANKLINE>\n -1[ ]-1\n <BLANKLINE>\n sage: velt.parent()\n Rigged configurations of type ['A', 3, 1] and factor(s) ((2, 2), (2, 2))\n "
gammatilde = list(self._folded_ct.scaling_factors())
gammatilde[(- 1)] = 2
sigma = self._folded_ct.folding_orbit()
n = len(self.virtual._rc_index)
partitions = ([None] * n)
for (a, rp) in enumerate(rc):
g = gammatilde[(a + 1)]
for i in sigma[(a + 1)]:
partitions[(i - 1)] = RiggedPartition([row_len for row_len in rp._list], [(rig_val * g) for rig_val in rp.rigging])
return self.virtual.element_class(self.virtual, partitions)
def from_virtual(self, vrc):
"\n Convert ``vrc`` in the virtual crystal into a rigged configuration of\n the original Cartan type.\n\n INPUT:\n\n - ``vrc`` -- a virtual rigged configuration element\n\n EXAMPLES::\n\n sage: RC = RiggedConfigurations(CartanType(['A',4,2]).dual(), [[2,2]])\n sage: elt = RC(partition_list=[[1],[1]])\n sage: velt = RC.to_virtual(elt)\n sage: ret = RC.from_virtual(velt); ret\n <BLANKLINE>\n -1[ ]-1\n <BLANKLINE>\n 1[ ]1\n <BLANKLINE>\n sage: ret == elt\n True\n "
gammatilde = list(self._folded_ct.scaling_factors())
gammatilde[(- 1)] = QQ(2)
sigma = self._folded_ct.folding_orbit()
n = len(self._rc_index)
partitions = ([None] * n)
for a in range(n):
rp = vrc[(sigma[(a + 1)][0] - 1)]
g = gammatilde[(a + 1)]
partitions[a] = RiggedPartition([row_len for row_len in rp._list], [(rig_val / g) for rig_val in rp.rigging])
return self.element_class(self, partitions)
Element = KRRCTypeA2DualElement
|
class HighestWeightTensorKRT(UniqueRepresentation):
'\n Class so we do not have to build the module generators for\n :class:`~sage.combinat.rigged_configurations.tensor_product_kr_tableaux.TensorProductOfKirillovReshetikhinTableaux`\n at initialization.\n\n .. WARNING::\n\n This class is for internal use only!\n '
def __init__(self, tp_krt):
"\n Initialize ``self``.\n\n EXAMPLES::\n\n sage: KRT = crystals.TensorProductOfKirillovReshetikhinTableaux(['D',4,1], [[2,2]])\n sage: from sage.combinat.rigged_configurations.tensor_product_kr_tableaux import HighestWeightTensorKRT\n sage: hw = HighestWeightTensorKRT(KRT)\n sage: hw2 = HighestWeightTensorKRT(KRT)\n sage: hw is hw2\n True\n "
self.tp_krt = tp_krt
self._cache = None
def __getitem__(self, i):
"\n Return the `i`-th highest weight element in the cache.\n\n TESTS::\n\n sage: KRT = crystals.TensorProductOfKirillovReshetikhinTableaux(['A',3,1], [[3,1], [2,1]])\n sage: KRT.module_generators[0]\n [[1], [2], [3]] (X) [[1], [2]]\n "
if (self._cache is None):
self._cache = tuple([x.to_tensor_product_of_kirillov_reshetikhin_tableaux() for x in self.tp_krt.rigged_configurations().module_generators])
return self._cache[i]
def __iter__(self):
"\n Iterate over the highest weight elements.\n\n EXAMPLES::\n\n sage: KRT = crystals.TensorProductOfKirillovReshetikhinTableaux(['D',4,1], [[2,1]])\n sage: from sage.combinat.rigged_configurations.tensor_product_kr_tableaux import HighestWeightTensorKRT\n sage: for x in HighestWeightTensorKRT(KRT): x\n [[1], [2]]\n [[1], [-1]]\n "
if (self._cache is None):
self._cache = tuple([x.to_tensor_product_of_kirillov_reshetikhin_tableaux() for x in self.tp_krt.rigged_configurations().module_generators])
(yield from self._cache)
def __repr__(self):
"\n Return a string representation of ``self``.\n\n EXAMPLES::\n\n sage: KRT = crystals.TensorProductOfKirillovReshetikhinTableaux(['D',4,1], [[2,1]])\n sage: from sage.combinat.rigged_configurations.tensor_product_kr_tableaux import HighestWeightTensorKRT\n sage: HighestWeightTensorKRT(KRT)\n Highest weight elements of Tensor product of Kirillov-Reshetikhin tableaux of type ['D', 4, 1] and factor(s) ((2, 1),)\n "
return 'Highest weight elements of {}'.format(self.tp_krt)
@cached_method
def cardinality(self):
"\n Return the cardinality of ``self``, which is the number of\n highest weight elements.\n\n EXAMPLES::\n\n sage: KRT = crystals.TensorProductOfKirillovReshetikhinTableaux(['D',4,1], [[2,2]])\n sage: from sage.combinat.rigged_configurations.tensor_product_kr_tableaux import HighestWeightTensorKRT\n sage: HW = HighestWeightTensorKRT(KRT)\n sage: HW.cardinality()\n 3\n sage: len(HW)\n 3\n sage: len(KRT.module_generators)\n 3\n "
count = 0
for x in self:
count += 1
return Integer(count)
__len__ = cardinality
|
class TensorProductOfKirillovReshetikhinTableaux(FullTensorProductOfRegularCrystals):
"\n A tensor product of\n :class:`~sage.combinat.rigged_configurations.kr_tableaux.KirillovReshetikhinTableaux`.\n\n Through the bijection with rigged configurations, the tableaux that are\n produced in all nonexceptional types are all of rectangular shapes and do\n not necessarily obey the usual strict increase in columns and weak\n increase in rows. The relation between the elements of the\n Kirillov-Reshetikhin crystal, given by the Kashiwara-Nakashima tableaux,\n and the Kirillov-Reshetikhin tableaux is given by a filling map.\n\n .. NOTE::\n\n The tableaux for all non-simply-laced types are provably correct if the\n bijection with :class:`rigged configurations\n <sage.combinat.rigged_configurations.rigged_configurations.RiggedConfigurations>`\n holds. Therefore this is currently only proven for `B^{r,1}` or\n `B^{1,s}` and in general for types `A_n^{(1)}` and `D_n^{(1)}`.\n\n For more information see [OSS2011]_ and\n :class:`~sage.combinat.rigged_configurations.kr_tableaux.KirillovReshetikhinTableaux`.\n\n For more information on KR crystals, see\n :mod:`sage.combinat.crystals.kirillov_reshetikhin`.\n\n INPUT:\n\n - ``cartan_type`` -- a Cartan type\n\n - ``B`` -- an (ordered) list of pairs `(r,s)` which give the dimension\n of a rectangle with `r` rows and `s` columns and corresponds to a\n Kirillov-Reshetikhin tableaux factor of `B^{r,s}`.\n\n REFERENCES:\n\n .. [OSS2011] Masato Okado, Reiho Sakamoto, Anne Schilling,\n Affine crystal structure on rigged configurations of type `D_n^{(1)}`,\n J. Algebraic Combinatorics 37(3) (2013) 571-599 (:arxiv:`1109.3523` [math.QA])\n\n EXAMPLES:\n\n We can go between tensor products of KR crystals and rigged\n configurations::\n\n sage: KRT = crystals.TensorProductOfKirillovReshetikhinTableaux(['A',3,1], [[3,1],[2,2]])\n sage: tp_krt = KRT(pathlist=[[3,2,1],[3,2,3,2]]); tp_krt\n [[1], [2], [3]] (X) [[2, 2], [3, 3]]\n sage: RC = RiggedConfigurations(['A',3,1], [[3,1],[2,2]])\n sage: rc_elt = tp_krt.to_rigged_configuration(); rc_elt\n <BLANKLINE>\n -2[ ][ ]-2\n <BLANKLINE>\n 0[ ][ ]0\n <BLANKLINE>\n (/)\n <BLANKLINE>\n sage: tp_krc = tp_krt.to_tensor_product_of_kirillov_reshetikhin_crystals(); tp_krc\n [[[1], [2], [3]], [[2, 2], [3, 3]]]\n sage: KRT(tp_krc) == tp_krt\n True\n sage: rc_elt == tp_krt.to_rigged_configuration()\n True\n sage: KR1 = crystals.KirillovReshetikhin(['A',3,1], 3,1)\n sage: KR2 = crystals.KirillovReshetikhin(['A',3,1], 2,2)\n sage: T = crystals.TensorProduct(KR1, KR2)\n sage: t = T(KR1(3,2,1), KR2(3,2,3,2))\n sage: KRT(t) == tp_krt\n True\n sage: t == tp_krc\n True\n\n We can get the highest weight elements by using the attribute\n ``module_generators``::\n\n sage: KRT = crystals.TensorProductOfKirillovReshetikhinTableaux(['A',3,1], [[3,1], [2,1]])\n sage: list(KRT.module_generators)\n [[[1], [2], [3]] (X) [[1], [2]], [[1], [3], [4]] (X) [[1], [2]]]\n\n To create elements directly (i.e. not passing in KR tableaux elements),\n there is the **pathlist** option will receive a list of lists which\n contain the reversed far-eastern reading word of the tableau. That is to\n say, in English notation, the word obtain from reading bottom-to-top,\n left-to-right. ::\n\n sage: KRT = crystals.TensorProductOfKirillovReshetikhinTableaux(['A',3,1], [[3,2], [1,2], [2,1]])\n sage: elt = KRT(pathlist=[[3, 2, 1, 4, 2, 1], [1, 3], [3, 1]])\n sage: elt.pp()\n 1 1 (X) 1 3 (X) 1\n 2 2 3\n 3 4\n\n One can still create elements in the same way as tensor product of\n crystals::\n\n sage: K1 = crystals.KirillovReshetikhin(['A',3,1], 3, 2, model='KR')\n sage: K2 = crystals.KirillovReshetikhin(['A',3,1], 1, 2, model='KR')\n sage: K3 = crystals.KirillovReshetikhin(['A',3,1], 2, 1, model='KR')\n sage: eltlong = KRT(K1(3, 2, 1, 4, 2, 1), K2(1, 3), K3(3, 1))\n sage: eltlong == elt\n True\n "
@staticmethod
def __classcall_private__(cls, cartan_type, B):
"\n Normalize the input arguments to ensure unique representation.\n\n EXAMPLES::\n\n sage: T1 = crystals.TensorProductOfKirillovReshetikhinTableaux(CartanType(['A',3,1]), [[2,2]])\n sage: T2 = crystals.TensorProductOfKirillovReshetikhinTableaux(['A',3,1], [(2,2)])\n sage: T3 = crystals.TensorProductOfKirillovReshetikhinTableaux(['A',3,1], ((2,2),))\n sage: T2 is T1, T3 is T1\n (True, True)\n "
cartan_type = CartanType(cartan_type)
if (not cartan_type.is_affine()):
raise ValueError('The Cartan type must be affine')
B = tuple((tuple(dim) for dim in B))
return super().__classcall__(cls, cartan_type, B)
def __init__(self, cartan_type, B):
"\n Initialize ``self``.\n\n EXAMPLES::\n\n sage: KRT = crystals.TensorProductOfKirillovReshetikhinTableaux(['A',3,1], [[3,1],[2,2]]); KRT\n Tensor product of Kirillov-Reshetikhin tableaux of type ['A', 3, 1] and factor(s) ((3, 1), (2, 2))\n sage: TestSuite(KRT).run() # long time\n sage: KRT = crystals.TensorProductOfKirillovReshetikhinTableaux(['D',4,1], [[2,2]])\n sage: TestSuite(KRT).run() # long time\n sage: KRT = crystals.TensorProductOfKirillovReshetikhinTableaux(['D',4,1], [[3,1]])\n sage: TestSuite(KRT).run() # long time\n sage: KRT = crystals.TensorProductOfKirillovReshetikhinTableaux(['D',4,1], [[4,3]])\n sage: TestSuite(KRT).run() # long time\n "
self.dims = B
self.letters = CrystalOfLetters(cartan_type.classical())
tensor_prod = tuple((KirillovReshetikhinTableaux(cartan_type, rect_dims[0], rect_dims[1]) for rect_dims in B))
FullTensorProductOfRegularCrystals.__init__(self, tensor_prod, cartan_type=cartan_type)
self.module_generators = HighestWeightTensorKRT(self)
self.rename(f'Tensor product of Kirillov-Reshetikhin tableaux of type {cartan_type} and factor(s) {B}')
def __iter__(self):
"\n Return the iterator of ``self``.\n\n EXAMPLES::\n\n sage: KRT = crystals.TensorProductOfKirillovReshetikhinTableaux(['A', 3, 1], [[2,1], [1,1]])\n sage: g = KRT.__iter__()\n sage: next(g) # random\n [[2], [3]] (X) [[1]]\n sage: next(g) # random\n [[2], [4]] (X) [[1]]\n "
index_set = self._cartan_type.classical().index_set()
from sage.sets.recursively_enumerated_set import RecursivelyEnumeratedSet
return RecursivelyEnumeratedSet(self.module_generators, (lambda x: [x.f(i) for i in index_set]), structure=None).naive_search_iterator()
def _test_bijection(self, **options):
"\n Test function to make sure that the bijection between rigged\n configurations and Kirillov-Reshetikhin tableaux is correct.\n\n EXAMPLES::\n\n sage: KRT = crystals.TensorProductOfKirillovReshetikhinTableaux(['A', 4, 1], [[3,2],[4,1]])\n sage: KRT._test_bijection()\n "
tester = self._tester(**options)
rejects = []
for x in self:
y = x.to_rigged_configuration()
z = y.to_tensor_product_of_kirillov_reshetikhin_tableaux()
if (z != x):
rejects.append((x, z))
tester.assertEqual(len(rejects), 0, ('Bijection is not correct: %s' % rejects))
if rejects:
return rejects
def _element_constructor_(self, *path, **options):
"\n Construct an element of ``self``.\n\n Typically the user will call this with the option **pathlist** which\n will receive a list of lists of reversed far-eastern reading words.\n\n EXAMPLES::\n\n sage: KRT = crystals.TensorProductOfKirillovReshetikhinTableaux(['A',3,1], [[3,1], [2,1]])\n sage: KRT(pathlist=[[4, 2, 1], [2, 1]])\n [[1], [2], [4]] (X) [[1], [2]]\n "
if isinstance(path[0], KirillovReshetikhinTableauxElement):
return self.element_class(self, path)
if isinstance(path[0], TensorProductOfKirillovReshetikhinTableauxElement):
return path[0]
from sage.combinat.crystals.kirillov_reshetikhin import KirillovReshetikhinGenericCrystalElement
if isinstance(path[0], KirillovReshetikhinGenericCrystalElement):
return self.element_class(self, [x.to_kirillov_reshetikhin_tableau() for x in path])
from sage.combinat.crystals.tensor_product import TensorProductOfRegularCrystalsElement
if (isinstance(path[0], TensorProductOfRegularCrystalsElement) and isinstance(path[0][0], KirillovReshetikhinGenericCrystalElement)):
return self.element_class(self, [x.to_kirillov_reshetikhin_tableau() for x in path[0]])
from sage.combinat.rigged_configurations.rigged_configuration_element import RiggedConfigurationElement
if isinstance(path[0], RiggedConfigurationElement):
if (self.rigged_configurations() != path[0].parent()):
raise ValueError('incorrect bijection image')
return path[0].to_tensor_product_of_kirillov_reshetikhin_tableaux()
return self.element_class(self, list(path), **options)
@cached_method
def _module_generators_brute_force(self):
"\n Return the module generators of ``self`` by brute force searching\n through all elements of ``self`` as a Cartesian product.\n\n EXAMPLES::\n\n sage: KRT = crystals.TensorProductOfKirillovReshetikhinTableaux(['A',3,1], [[1,3], [2,1]])\n sage: tuple(KRT.module_generators)\n ([[1, 1, 1]] (X) [[1], [2]], [[1, 1, 3]] (X) [[1], [2]])\n sage: KRT._module_generators_brute_force()\n ([[1, 1, 1]] (X) [[1], [2]], [[1, 1, 3]] (X) [[1], [2]])\n "
index_set = self.cartan_type().classical().index_set()
return tuple((x for x in FullTensorProductOfRegularCrystals.__iter__(self) if x.is_highest_weight(index_set)))
@cached_method
def rigged_configurations(self):
"\n Return the corresponding set of rigged configurations.\n\n EXAMPLES::\n\n sage: KRT = crystals.TensorProductOfKirillovReshetikhinTableaux(['A',3,1], [[1,3], [2,1]])\n sage: KRT.rigged_configurations()\n Rigged configurations of type ['A', 3, 1] and factor(s) ((1, 3), (2, 1))\n "
from sage.combinat.rigged_configurations.rigged_configurations import RiggedConfigurations
return RiggedConfigurations(self.cartan_type(), self.dims)
@cached_method
def tensor_product_of_kirillov_reshetikhin_crystals(self):
"\n Return the corresponding tensor product of Kirillov-Reshetikhin\n crystals.\n\n EXAMPLES::\n\n sage: KRT = crystals.TensorProductOfKirillovReshetikhinTableaux(['A',3,1], [[3,1],[2,2]])\n sage: KRT.tensor_product_of_kirillov_reshetikhin_crystals()\n Full tensor product of the crystals [Kirillov-Reshetikhin crystal of type ['A', 3, 1] with (r,s)=(3,1),\n Kirillov-Reshetikhin crystal of type ['A', 3, 1] with (r,s)=(2,2)]\n\n TESTS::\n\n sage: KRT = crystals.TensorProductOfKirillovReshetikhinTableaux(['D', 4, 1], [[4,1], [3,3]])\n sage: KR1 = crystals.KirillovReshetikhin(['D', 4, 1], 4, 1)\n sage: KR2 = crystals.KirillovReshetikhin(['D', 4, 1], 3, 3)\n sage: T = crystals.TensorProduct(KR1, KR2)\n sage: T == KRT.tensor_product_of_kirillov_reshetikhin_crystals()\n True\n sage: T is KRT.tensor_product_of_kirillov_reshetikhin_crystals()\n True\n "
return FullTensorProductOfRegularCrystals(tuple((x.kirillov_reshetikhin_crystal() for x in self.crystals)), cartan_type=self.cartan_type())
def tensor(self, *crystals, **options):
"\n Return the tensor product of ``self`` with ``crystals``.\n\n If ``crystals`` is a list of (a tensor product of) KR tableaux, this\n returns a :class:`TensorProductOfKirillovReshetikhinTableaux`.\n\n EXAMPLES::\n\n sage: TP = crystals.TensorProductOfKirillovReshetikhinTableaux(['A', 3, 1], [[1,3],[3,1]])\n sage: K = crystals.KirillovReshetikhin(['A', 3, 1], 2, 2, model='KR')\n sage: TP.tensor(K, TP)\n Tensor product of Kirillov-Reshetikhin tableaux of type ['A', 3, 1]\n and factor(s) ((1, 3), (3, 1), (2, 2), (1, 3), (3, 1))\n\n sage: C = crystals.KirillovReshetikhin(['A',3,1], 3, 1, model='KN')\n sage: TP.tensor(K, C)\n Full tensor product of the crystals\n [Kirillov-Reshetikhin tableaux of type ['A', 3, 1] and shape (1, 3),\n Kirillov-Reshetikhin tableaux of type ['A', 3, 1] and shape (3, 1),\n Kirillov-Reshetikhin tableaux of type ['A', 3, 1] and shape (2, 2),\n Kirillov-Reshetikhin crystal of type ['A', 3, 1] with (r,s)=(3,1)]\n "
ct = self._cartan_type
from sage.combinat.rigged_configurations.kr_tableaux import KirillovReshetikhinTableaux
if all(((isinstance(B, (KirillovReshetikhinTableaux, TensorProductOfKirillovReshetikhinTableaux)) and (B.cartan_type() == ct)) for B in crystals)):
dims = list(self.dims)
for B in crystals:
if isinstance(B, TensorProductOfKirillovReshetikhinTableaux):
dims += B.dims
elif isinstance(B, KirillovReshetikhinTableaux):
dims.append([B._r, B._s])
return TensorProductOfKirillovReshetikhinTableaux(ct, dims)
return super().tensor(*crystals, **options)
|
class TensorProductOfKirillovReshetikhinTableauxElement(TensorProductOfRegularCrystalsElement):
"\n An element in a tensor product of Kirillov-Reshetikhin tableaux.\n\n For more on tensor product of Kirillov-Reshetikhin tableaux, see\n :class:`~sage.combinat.rigged_configurations.tensor_product_kr_tableaux.TensorProductOfKirillovReshetikhinTableaux`.\n\n The most common way to construct an element is to specify the option\n ``pathlist`` which is a list of lists which will be used to generate\n the individual factors of\n :class:`~sage.combinat.rigged_configurations.kr_tableaux.KirillovReshetikhinTableauxElement`.\n\n EXAMPLES:\n\n Type `A_n^{(1)}` examples::\n\n sage: KRT = crystals.TensorProductOfKirillovReshetikhinTableaux(['A', 3, 1], [[1,1], [2,1], [1,1], [2,1], [2,1], [2,1]])\n sage: T = KRT(pathlist=[[2], [4,1], [3], [4,2], [3,1], [2,1]])\n sage: T\n [[2]] (X) [[1], [4]] (X) [[3]] (X) [[2], [4]] (X) [[1], [3]] (X) [[1], [2]]\n sage: T.to_rigged_configuration()\n <BLANKLINE>\n 0[ ][ ]0\n 1[ ]1\n <BLANKLINE>\n 1[ ][ ]0\n 1[ ]0\n 1[ ]0\n <BLANKLINE>\n 0[ ][ ]0\n <BLANKLINE>\n sage: T = KRT(pathlist=[[1], [2,1], [1], [4,1], [3,1], [2,1]])\n sage: T\n [[1]] (X) [[1], [2]] (X) [[1]] (X) [[1], [4]] (X) [[1], [3]] (X) [[1], [2]]\n sage: T.to_rigged_configuration()\n <BLANKLINE>\n (/)\n <BLANKLINE>\n 1[ ]0\n 1[ ]0\n <BLANKLINE>\n 0[ ]0\n <BLANKLINE>\n\n Type `D_n^{(1)}` examples::\n\n sage: KRT = crystals.TensorProductOfKirillovReshetikhinTableaux(['D', 4, 1], [[1,1], [1,1], [1,1], [1,1]])\n sage: T = KRT(pathlist=[[-1], [-1], [1], [1]])\n sage: T\n [[-1]] (X) [[-1]] (X) [[1]] (X) [[1]]\n sage: T.to_rigged_configuration()\n <BLANKLINE>\n 0[ ][ ]0\n 0[ ][ ]0\n <BLANKLINE>\n 0[ ][ ]0\n 0[ ][ ]0\n <BLANKLINE>\n 0[ ][ ]0\n <BLANKLINE>\n 0[ ][ ]0\n <BLANKLINE>\n sage: KRT = crystals.TensorProductOfKirillovReshetikhinTableaux(['D', 4, 1], [[2,1], [1,1], [1,1], [1,1]])\n sage: T = KRT(pathlist=[[3,2], [1], [-1], [1]])\n sage: T\n [[2], [3]] (X) [[1]] (X) [[-1]] (X) [[1]]\n sage: T.to_rigged_configuration()\n <BLANKLINE>\n 0[ ]0\n 0[ ]0\n 0[ ]0\n <BLANKLINE>\n 0[ ]0\n 0[ ]0\n 0[ ]0\n <BLANKLINE>\n 1[ ]0\n <BLANKLINE>\n 1[ ]0\n <BLANKLINE>\n sage: T.to_rigged_configuration().to_tensor_product_of_kirillov_reshetikhin_tableaux()\n [[2], [3]] (X) [[1]] (X) [[-1]] (X) [[1]]\n "
def __init__(self, parent, list=[[]], **options):
"\n Construct a TensorProductOfKirillovReshetikhinTableauxElement.\n\n INPUT:\n\n - ``parent`` -- Parent for this element\n\n - ``list`` -- The list of KR tableaux elements\n\n EXAMPLES::\n\n sage: KRT = crystals.TensorProductOfKirillovReshetikhinTableaux(['A', 3, 1], [[1, 1], [2, 1], [1, 1], [2, 1], [2, 1], [2, 1]])\n sage: T = KRT(pathlist=[[2], [4, 1], [3], [4, 2], [3, 1], [2, 1]])\n sage: T\n [[2]] (X) [[1], [4]] (X) [[3]] (X) [[2], [4]] (X) [[1], [3]] (X) [[1], [2]]\n sage: KRT = crystals.TensorProductOfKirillovReshetikhinTableaux(['A', 3, 1], [[3,3], [2,1]])\n sage: T = KRT(pathlist=[[3, 2, 1, 4, 2, 1, 4, 3, 1], [2, 1]])\n sage: T\n [[1, 1, 1], [2, 2, 3], [3, 4, 4]] (X) [[1], [2]]\n sage: KRT = crystals.TensorProductOfKirillovReshetikhinTableaux(['D', 4, 1], [[2, 1], [1, 1], [1, 1], [1, 1]])\n sage: T = KRT(pathlist=[[3,2], [1], [-1], [1]])\n sage: T\n [[2], [3]] (X) [[1]] (X) [[-1]] (X) [[1]]\n sage: TestSuite(T).run()\n "
if ('pathlist' in options):
pathlist = options['pathlist']
TensorProductOfRegularCrystalsElement.__init__(self, parent, [parent.crystals[i](*tab) for (i, tab) in enumerate(pathlist)])
else:
TensorProductOfRegularCrystalsElement.__init__(self, parent, list)
def _repr_(self):
"\n Return a string representation of ``self``.\n\n EXAMPLES::\n\n sage: KRT = crystals.TensorProductOfKirillovReshetikhinTableaux(['D', 4, 1], [[2, 1], [1, 1], [1, 1], [1, 1]])\n sage: T = KRT(pathlist=[[3,2], [1], [-1], [1]])\n sage: T # indirect doctest\n [[2], [3]] (X) [[1]] (X) [[-1]] (X) [[1]]\n "
ret_str = repr(self[0])
for i in range(1, len(self)):
ret_str += (' (X) ' + repr(self[i]))
return ret_str
def _repr_diagram(self):
"\n Return a string representation of ``self`` as a diagram.\n\n EXAMPLES::\n\n sage: TPKRT = crystals.TensorProductOfKirillovReshetikhinTableaux(['A',4,1], [[2,2],[3,1],[3,3]])\n sage: print(TPKRT.module_generators[0]._repr_diagram())\n 1 1 (X) 1 (X) 1 1 1\n 2 2 2 2 2 2\n 3 3 3 3\n sage: Partitions.options(convention='French')\n sage: print(TPKRT.module_generators[0]._repr_diagram())\n 2 2 (X) 3 (X) 3 3 3\n 1 1 2 2 2 2\n 1 1 1 1\n sage: Partitions.options._reset()\n "
comp = [crys._repr_diagram().splitlines() for crys in self]
num_comp = len(comp)
col_len = [(((len(t) > 0) and len(t[0])) or 1) for t in comp]
num_rows = max((len(t) for t in comp))
diag = ''
diag += ' (X) '.join((c[0] for c in comp))
for row in range(1, num_rows):
diag += '\n'
for c in range(num_comp):
if (c > 0):
diag += ' '
if (row < len(comp[c])):
diag += comp[c][row]
else:
diag += (' ' * col_len[c])
return diag
def pp(self):
"\n Pretty print ``self``.\n\n EXAMPLES::\n\n sage: TPKRT = crystals.TensorProductOfKirillovReshetikhinTableaux(['A',4,1], [[2,2],[3,1],[3,3]])\n sage: TPKRT.module_generators[0].pp()\n 1 1 (X) 1 (X) 1 1 1\n 2 2 2 2 2 2\n 3 3 3 3\n "
print(self._repr_diagram())
def classical_weight(self):
"\n Return the classical weight of ``self``.\n\n EXAMPLES::\n\n sage: KRT = crystals.TensorProductOfKirillovReshetikhinTableaux(['D',4,1], [[2,2]])\n sage: elt = KRT(pathlist=[[3,2,-1,1]]); elt\n [[2, 1], [3, -1]]\n sage: elt.classical_weight()\n (0, 1, 1, 0)\n sage: KRT = crystals.TensorProductOfKirillovReshetikhinTableaux(['A',3,1], [[2,2],[1,3]])\n sage: elt = KRT(pathlist=[[2,1,3,2],[1,4,4]]); elt\n [[1, 2], [2, 3]] (X) [[1, 4, 4]]\n sage: elt.classical_weight()\n (2, 2, 1, 2)\n "
return sum([x.classical_weight() for x in self])
def lusztig_involution(self):
"\n Return the result of the classical Lusztig involution on ``self``.\n\n EXAMPLES::\n\n sage: KRT = crystals.TensorProductOfKirillovReshetikhinTableaux(['A',3,1], [[2,2],[1,3]])\n sage: elt = KRT(pathlist=[[2,1,3,2],[1,4,4]])\n sage: li = elt.lusztig_involution(); li\n [[1, 1, 4]] (X) [[2, 3], [3, 4]]\n sage: li.parent()\n Tensor product of Kirillov-Reshetikhin tableaux of type ['A', 3, 1] and factor(s) ((1, 3), (2, 2))\n "
from sage.combinat.rigged_configurations.tensor_product_kr_tableaux import TensorProductOfKirillovReshetikhinTableaux
P = self.parent()
P = TensorProductOfKirillovReshetikhinTableaux(P._cartan_type, reversed(P.dims))
return P(*[x.lusztig_involution() for x in reversed(self)])
def left_split(self):
"\n Return the image of ``self`` under the left column splitting map.\n\n EXAMPLES::\n\n sage: KRT = crystals.TensorProductOfKirillovReshetikhinTableaux(['A',3,1], [[2,2],[1,3]])\n sage: elt = KRT(pathlist=[[2,1,3,2],[1,4,4]]); elt.pp()\n 1 2 (X) 1 4 4\n 2 3\n sage: elt.left_split().pp()\n 1 (X) 2 (X) 1 4 4\n 2 3\n "
P = self.parent()
if (P.dims[0][1] == 1):
raise ValueError('cannot split a single column')
(r, s) = P.dims[0]
B = [[r, 1], [r, (s - 1)]]
B.extend(P.dims[1:])
from sage.combinat.rigged_configurations.tensor_product_kr_tableaux import TensorProductOfKirillovReshetikhinTableaux
TP = TensorProductOfKirillovReshetikhinTableaux(P._cartan_type, B)
x = self[0].left_split()
return TP(*(list(x) + self[1:]))
def right_split(self):
"\n Return the image of ``self`` under the right column splitting map.\n\n EXAMPLES::\n\n sage: KRT = crystals.TensorProductOfKirillovReshetikhinTableaux(['A',3,1], [[2,2],[1,3]])\n sage: elt = KRT(pathlist=[[2,1,3,2],[1,4,4]]); elt.pp()\n 1 2 (X) 1 4 4\n 2 3\n sage: elt.right_split().pp()\n 1 2 (X) 1 4 (X) 4\n 2 3\n\n Let `\\ast` denote the :meth:`Lusztig involution<lusztig_involution>`,\n we check that `\\ast \\circ \\mathrm{ls} \\circ \\ast = \\mathrm{rs}`::\n\n sage: all(x.lusztig_involution().left_split().lusztig_involution() == x.right_split() for x in KRT)\n True\n "
P = self.parent()
if (P.dims[(- 1)][1] == 1):
raise ValueError('cannot split a single column')
(r, s) = P.dims[(- 1)]
B = list(P.dims[:(- 1)])
B.append([r, (s - 1)])
B.append([r, 1])
from sage.combinat.rigged_configurations.tensor_product_kr_tableaux import TensorProductOfKirillovReshetikhinTableaux
TP = TensorProductOfKirillovReshetikhinTableaux(P._cartan_type, B)
x = self[(- 1)].right_split()
return TP(*(self[:(- 1)] + list(x)))
def to_rigged_configuration(self, display_steps=False):
"\n Perform the bijection from ``self`` to a\n :class:`rigged configuration<sage.combinat.rigged_configurations.rigged_configuration_element.RiggedConfigurationElement>`\n which is described in [RigConBijection]_, [BijectionLRT]_, and\n [BijectionDn]_.\n\n .. NOTE::\n\n This is only proven to be a bijection in types `A_n^{(1)}`\n and `D_n^{(1)}`, as well as `\\bigotimes_i B^{r_i,1}` and\n `\\bigotimes_i B^{1,s_i}` for general affine types.\n\n INPUT:\n\n - ``display_steps`` -- (default: ``False``) Boolean which indicates\n if we want to output each step in the algorithm.\n\n OUTPUT:\n\n The rigged configuration corresponding to ``self``.\n\n EXAMPLES:\n\n Type `A_n^{(1)}` example::\n\n sage: KRT = crystals.TensorProductOfKirillovReshetikhinTableaux(['A', 3, 1], [[2,1], [2,1], [2,1]])\n sage: T = KRT(pathlist=[[4, 2], [3, 1], [2, 1]])\n sage: T\n [[2], [4]] (X) [[1], [3]] (X) [[1], [2]]\n sage: T.to_rigged_configuration()\n <BLANKLINE>\n 0[ ]0\n <BLANKLINE>\n 1[ ]1\n 1[ ]0\n <BLANKLINE>\n 0[ ]0\n <BLANKLINE>\n\n Type `D_n^{(1)}` example::\n\n sage: KRT = crystals.TensorProductOfKirillovReshetikhinTableaux(['D', 4, 1], [[2,2]])\n sage: T = KRT(pathlist=[[2,1,4,3]])\n sage: T\n [[1, 3], [2, 4]]\n sage: T.to_rigged_configuration()\n <BLANKLINE>\n 0[ ]0\n <BLANKLINE>\n -1[ ]-1\n -1[ ]-1\n <BLANKLINE>\n 0[ ]0\n <BLANKLINE>\n (/)\n\n Type `D_n^{(1)}` spinor example::\n\n sage: CP = crystals.TensorProductOfKirillovReshetikhinTableaux(['D', 5, 1], [[5,1],[2,1],[1,1],[1,1],[1,1]])\n sage: elt = CP(pathlist=[[-2,-5,4,3,1],[-1,2],[1],[1],[1]])\n sage: elt\n [[1], [3], [4], [-5], [-2]] (X) [[2], [-1]] (X) [[1]] (X) [[1]] (X) [[1]]\n sage: elt.to_rigged_configuration()\n <BLANKLINE>\n 2[ ][ ]1\n <BLANKLINE>\n 0[ ][ ]0\n 0[ ]0\n <BLANKLINE>\n 0[ ][ ]0\n 0[ ]0\n <BLANKLINE>\n 0[ ]0\n <BLANKLINE>\n 0[ ][ ]0\n <BLANKLINE>\n\n This is invertible by calling\n :meth:`~sage.combinat.rigged_configurations.rigged_configuration_element.RiggedConfigurationElement.to_tensor_product_of_kirillov_reshetikhin_tableaux()`::\n\n sage: KRT = crystals.TensorProductOfKirillovReshetikhinTableaux(['D', 4, 1], [[2,2]])\n sage: T = KRT(pathlist=[[2,1,4,3]])\n sage: rc = T.to_rigged_configuration()\n sage: ret = rc.to_tensor_product_of_kirillov_reshetikhin_tableaux(); ret\n [[1, 3], [2, 4]]\n sage: ret == T\n True\n "
from sage.combinat.rigged_configurations.bijection import KRTToRCBijection
return KRTToRCBijection(self).run(display_steps)
def to_tensor_product_of_kirillov_reshetikhin_crystals(self):
"\n Return a tensor product of Kirillov-Reshetikhin crystals corresponding\n to ``self``.\n\n This works by performing the filling map on each individual factor.\n For more on the filling map, see\n :class:`~sage.combinat.rigged_configurations.kr_tableaux.KirillovReshetikhinTableaux`.\n\n EXAMPLES::\n\n sage: KRT = crystals.TensorProductOfKirillovReshetikhinTableaux(['D',4,1], [[1,1],[2,2]])\n sage: elt = KRT(pathlist=[[-1],[-1,2,-1,1]]); elt\n [[-1]] (X) [[2, 1], [-1, -1]]\n sage: tp_krc = elt.to_tensor_product_of_kirillov_reshetikhin_crystals(); tp_krc\n [[[-1]], [[2], [-1]]]\n\n We can recover the original tensor product of KR tableaux::\n\n sage: ret = KRT(tp_krc); ret\n [[-1]] (X) [[2, 1], [-1, -1]]\n sage: ret == elt\n True\n "
TP = self.parent().tensor_product_of_kirillov_reshetikhin_crystals()
return TP(*[x.to_kirillov_reshetikhin_crystal() for x in self])
|
class AmbientSpace(CombinatorialFreeModule):
'\n Abstract class for ambient spaces\n\n All subclasses should implement a class method\n ``smallest_base_ring`` taking a Cartan type as input, and a method\n ``dimension`` working on a partially initialized instance with\n just ``root_system`` as attribute. There is no safe default\n implementation for the later, so none is provided.\n\n EXAMPLES::\n\n sage: AL = RootSystem([\'A\',2]).ambient_lattice()\n\n .. NOTE:: This is only used so far for finite root systems.\n\n Caveat: Most of the ambient spaces currently have a basis indexed\n by `0,\\dots, n`, unlike the usual mathematical convention::\n\n sage: e = AL.basis()\n sage: e[0], e[1], e[2]\n ((1, 0, 0), (0, 1, 0), (0, 0, 1))\n\n This will be cleaned up!\n\n .. SEEALSO::\n\n - :class:`sage.combinat.root_system.type_A.AmbientSpace`\n - :class:`sage.combinat.root_system.type_B.AmbientSpace`\n - :class:`sage.combinat.root_system.type_C.AmbientSpace`\n - :class:`sage.combinat.root_system.type_D.AmbientSpace`\n - :class:`sage.combinat.root_system.type_E.AmbientSpace`\n - :class:`sage.combinat.root_system.type_F.AmbientSpace`\n - :class:`sage.combinat.root_system.type_G.AmbientSpace`\n - :class:`sage.combinat.root_system.type_dual.AmbientSpace`\n - :class:`sage.combinat.root_system.type_affine.AmbientSpace`\n\n TESTS::\n\n sage: # needs sage.libs.gap\n sage: types = CartanType.samples(crystallographic=True) + [CartanType(["A",2],["C",5])]\n sage: for e in [ct.root_system().ambient_space() for ct in types]:\n ....: TestSuite(e).run()\n\n sage: e1 = RootSystem([\'A\',3]).ambient_lattice()\n sage: e2 = RootSystem([\'B\',3]).ambient_lattice()\n sage: e1 == e1\n True\n sage: e1 == e2\n False\n\n sage: e1 = RootSystem([\'A\',3]).ambient_space(QQ)\n sage: e2 = RootSystem([\'A\',3]).ambient_space(RR)\n sage: e1 == e2\n False\n '
def __init__(self, root_system, base_ring, index_set=None):
"\n EXAMPLES::\n\n sage: e = RootSystem(['A',3]).ambient_lattice()\n sage: s = e.simple_reflections()\n\n sage: L = RootSystem(['A',3]).coroot_lattice()\n sage: e.has_coerce_map_from(L)\n True\n sage: e(L.simple_root(1))\n (1, -1, 0, 0)\n "
self.root_system = root_system
if (index_set is None):
index_set = tuple(range(self.dimension()))
CombinatorialFreeModule.__init__(self, base_ring, index_set, prefix='e', category=WeightLatticeRealizations(base_ring))
coroot_lattice = self.root_system.coroot_lattice()
coroot_lattice.module_morphism(self.simple_coroot, codomain=self).register_as_coercion()
self.n = self.dimension()
ct = root_system.cartan_type()
if (ct.is_irreducible() and (ct.type() == 'E')):
self._v0 = self([0, 0, 0, 0, 0, 0, 1, 1])
self._v1 = self([0, 0, 0, 0, 0, (- 2), 1, (- 1)])
def _test_norm_of_simple_roots(self, **options):
"\n Test that the norm of the roots is, up to an overall constant factor,\n given by the symmetrizer of the Cartan matrix.\n\n .. SEEALSO:: :class:`TestSuite`\n\n EXAMPLES::\n\n sage: e = RootSystem(['F',4]).ambient_space()\n sage: e._test_norm_of_simple_roots()\n "
tester = self._tester(**options)
T = self.cartan_type()
try:
D = T.symmetrizer()
alpha = self.simple_roots()
DD = T.dynkin_diagram()
except ImportError:
return
for C in DD.connected_components(sort=False):
tester.assertEqual(len(set(((alpha[i].scalar(alpha[i]) / D[i]) for i in C))), 1)
def dimension(self):
"\n Return the dimension of this ambient space.\n\n EXAMPLES::\n\n sage: from sage.combinat.root_system.ambient_space import AmbientSpace\n sage: e = RootSystem(['F',4]).ambient_space()\n sage: AmbientSpace.dimension(e)\n Traceback (most recent call last):\n ...\n NotImplementedError\n\n "
raise NotImplementedError
@classmethod
def smallest_base_ring(cls, cartan_type=None):
"\n Return the smallest ground ring over which the ambient space can be realized.\n\n This class method will get called with the Cartan type as\n input. This default implementation returns `\\QQ`; subclasses\n should override it as appropriate.\n\n EXAMPLES::\n\n sage: e = RootSystem(['F',4]).ambient_space()\n sage: e.smallest_base_ring()\n Rational Field\n "
return QQ
def _repr_(self):
"\n EXAMPLES::\n\n sage: RootSystem(['A',4]).ambient_lattice() # indirect doctest\n Ambient lattice of the Root system of type ['A', 4]\n sage: RootSystem(['B',4]).ambient_space()\n Ambient space of the Root system of type ['B', 4]\n\n "
return self._name_string()
def _name_string(self, capitalize=True, base_ring=False, type=True):
'\n EXAMPLES::\n\n sage: RootSystem([\'A\',4]).ambient_lattice()._name_string()\n "Ambient lattice of the Root system of type [\'A\', 4]"\n\n '
return self._name_string_helper('ambient', capitalize=capitalize, base_ring=base_ring, type=type)
def __call__(self, v):
"\n TESTS::\n\n sage: R = RootSystem(['A',4]).ambient_lattice()\n sage: R([1,2,3,4,5])\n (1, 2, 3, 4, 5)\n sage: len(R([1,0,0,0,0]).monomial_coefficients())\n 1\n "
if isinstance(v, (list, tuple)):
K = self.base_ring()
return self._from_dict(dict(((i, K(c)) for (i, c) in enumerate(v) if c)))
else:
return CombinatorialFreeModule.__call__(self, v)
def __getitem__(self, i):
"\n Note that indexing starts at 1.\n\n EXAMPLES::\n\n sage: e = RootSystem(['A',2]).ambient_lattice()\n sage: e[1]\n (1, 0, 0)\n sage: e[0]\n Traceback (most recent call last):\n ...\n IndexError: value out of range\n "
if (not ((i > 0) and (i <= self.dimension()))):
raise IndexError('value out of range')
return self.monomial((i - 1))
def coroot_lattice(self):
'\n EXAMPLES::\n\n sage: e = RootSystem(["A", 3]).ambient_lattice()\n sage: e.coroot_lattice()\n Ambient lattice of the Root system of type [\'A\', 3]\n '
return self
def simple_coroot(self, i):
'\n Returns the i-th simple coroot, as an element of this space\n\n EXAMPLES::\n\n sage: R = RootSystem(["A",3])\n sage: L = R.ambient_lattice()\n sage: L.simple_coroot(1)\n (1, -1, 0, 0)\n sage: L.simple_coroot(2)\n (0, 1, -1, 0)\n sage: L.simple_coroot(3)\n (0, 0, 1, -1)\n '
return self.simple_root(i).associated_coroot()
def reflection(self, root, coroot=None):
'\n EXAMPLES::\n\n sage: e = RootSystem(["A", 3]).ambient_lattice()\n sage: a = e.simple_root(0); a\n (-1, 0, 0, 0)\n sage: b = e.simple_root(1); b\n (1, -1, 0, 0)\n sage: s_a = e.reflection(a)\n sage: s_a(b)\n (0, -1, 0, 0)\n\n '
return (lambda v: (v - (root.base_ring()(((2 * root.inner_product(v)) / root.inner_product(root))) * root)))
@cached_method
def fundamental_weight(self, i):
"\n Returns the fundamental weight `\\Lambda_i` in ``self``\n\n In several of the ambient spaces, it is more convenient to\n construct all fundamental weights at once. To support this, we\n provide this default implementation of ``fundamental_weight``\n using the method ``fundamental_weights``. Beware that this\n will cause a loop if neither ``fundamental_weight`` nor\n ``fundamental_weights`` is implemented.\n\n EXAMPLES::\n\n sage: e = RootSystem(['F',4]).ambient_space()\n sage: e.fundamental_weight(3)\n (3/2, 1/2, 1/2, 1/2)\n\n sage: e = RootSystem(['G',2]).ambient_space()\n sage: e.fundamental_weight(1)\n (1, 0, -1)\n\n sage: e = RootSystem(['E',6]).ambient_space()\n sage: e.fundamental_weight(3)\n (-1/2, 1/2, 1/2, 1/2, 1/2, -5/6, -5/6, 5/6)\n "
return self.fundamental_weights()[i]
def from_vector_notation(self, weight, style='lattice'):
'\n INPUT:\n\n - ``weight`` - a vector or tuple representing a weight\n\n Returns an element of self. If the weight lattice is not\n of full rank, it coerces it into the weight lattice, or\n its ambient space by orthogonal projection. This arises\n in two cases: for SL(r+1), the weight lattice is\n contained in a hyperplane of codimension one in the ambient,\n space, and for types E6 and E7, the weight lattice is\n contained in a subspace of codimensions 2 or 3, respectively.\n\n If style="coroots" and the data is a tuple of integers, it\n is assumed that the data represent a linear combination of\n fundamental weights. If style="coroots", and the root lattice\n is not of full rank in the ambient space, it is projected\n into the subspace corresponding to the semisimple derived group.\n This arises with Cartan type A, E6 and E7.\n\n EXAMPLES::\n\n sage: RootSystem("A2").ambient_space().from_vector_notation((1,0,0))\n (1, 0, 0)\n sage: RootSystem("A2").ambient_space().from_vector_notation([1,0,0])\n (1, 0, 0)\n sage: RootSystem("A2").ambient_space().from_vector_notation((1,0),style="coroots")\n (2/3, -1/3, -1/3)\n '
if ((style == 'coroots') and isinstance(weight, tuple) and all(((xv in ZZ) for xv in weight))):
weight = self.linear_combination(zip(self.fundamental_weights(), weight))
x = self(weight)
if (style == 'coroots'):
cartan_type = self.cartan_type()
if (cartan_type.is_irreducible() and (cartan_type.type() == 'E')):
if (cartan_type.rank() == 6):
x = x.coerce_to_e6()
if (cartan_type.rank() == 7):
x = x.coerce_to_e7()
else:
x = x.coerce_to_sl()
return x
def to_ambient_space_morphism(self):
"\n Return the identity map on ``self``.\n\n This is present for uniformity of use; the corresponding method\n for abstract root and weight lattices/spaces, is not trivial.\n\n EXAMPLES::\n\n sage: P = RootSystem(['A',2]).ambient_space()\n sage: f = P.to_ambient_space_morphism()\n sage: p = P.an_element()\n sage: p\n (2, 2, 3)\n sage: f(p)\n (2, 2, 3)\n sage: f(p)==p\n True\n "
return End(self).identity()
|
class AmbientSpaceElement(CombinatorialFreeModule.Element):
def _repr_(self):
"\n EXAMPLES::\n\n sage: e = RootSystem(['A',2]).ambient_space()\n sage: e.simple_root(0) # indirect doctest\n (-1, 0, 0)\n "
return str(self.to_vector())
def inner_product(self, lambdacheck):
"\n The scalar product with elements of the coroot lattice\n embedded in the ambient space.\n\n EXAMPLES::\n\n sage: e = RootSystem(['A',2]).ambient_space()\n sage: a = e.simple_root(0); a\n (-1, 0, 0)\n sage: a.inner_product(a)\n 2\n "
self_mc = self._monomial_coefficients
lambdacheck_mc = lambdacheck._monomial_coefficients
result = self.parent().base_ring().zero()
for (t, c) in lambdacheck_mc.items():
if (t not in self_mc):
continue
result += (c * self_mc[t])
return result
scalar = inner_product
dot_product = inner_product
def associated_coroot(self):
"\n EXAMPLES::\n\n sage: e = RootSystem(['F',4]).ambient_space()\n sage: a = e.simple_root(0); a\n (1/2, -1/2, -1/2, -1/2)\n sage: a.associated_coroot()\n (1, -1, -1, -1)\n\n "
return (self * self.base_ring()((2 / self.inner_product(self))))
def is_positive_root(self):
"\n EXAMPLES::\n\n sage: R = RootSystem(['A',3]).ambient_space()\n sage: r=R.simple_root(1)+R.simple_root(2)\n sage: r.is_positive_root()\n True\n sage: r=R.simple_root(1)-R.simple_root(2)\n sage: r.is_positive_root()\n False\n "
return (self.parent().rho().scalar(self) > 0)
def coerce_to_sl(self):
'\n For type [\'A\',r], this coerces the element of the ambient space into the\n root space by orthogonal projection. The root space has codimension one\n and corresponds to the Lie algebra of SL(r+1,CC), whereas the full weight\n space corresponds to the Lie algebra of GL(r+1,CC). So this operation\n corresponds to multiplication by a (possibly fractional) power of the\n determinant to give a weight determinant one.\n\n EXAMPLES::\n\n sage: [fw.coerce_to_sl() for fw in RootSystem("A2").ambient_space().fundamental_weights()]\n [(2/3, -1/3, -1/3), (1/3, 1/3, -2/3)]\n sage: L = RootSystem("A2xA3").ambient_space()\n sage: L([1,2,3,4,5,0,0]).coerce_to_sl()\n (-1, 0, 1, 7/4, 11/4, -9/4, -9/4)\n '
cartan_type = self.parent().cartan_type()
x = self
if cartan_type.is_atomic():
if (cartan_type.type() == 'A'):
x = (x - self.parent().det((sum(x.to_vector()) / self.parent().dimension())))
else:
xv = x.to_vector()
shifts = cartan_type._shifts
types = cartan_type.component_types()
for i in range(len(types)):
if (cartan_type.component_types()[i][0] == 'A'):
s = self.parent().ambient_spaces()[i].det((sum(xv[shifts[i]:shifts[(i + 1)]]) / (types[i][1] + 1)))
x = (x - self.parent().inject_weights(i, s))
return x
def coerce_to_e7(self):
'\n For type E8, this orthogonally projects the given element of\n the E8 root lattice into the E7 root lattice. This operation on\n weights corresponds to intersection with the semisimple subgroup E7.\n\n EXAMPLES::\n\n sage: [b.coerce_to_e7() for b in RootSystem("E8").ambient_space().basis()]\n [(1, 0, 0, 0, 0, 0, 0, 0), (0, 1, 0, 0, 0, 0, 0, 0),\n (0, 0, 1, 0, 0, 0, 0, 0), (0, 0, 0, 1, 0, 0, 0, 0),\n (0, 0, 0, 0, 1, 0, 0, 0), (0, 0, 0, 0, 0, 1, 0, 0),\n (0, 0, 0, 0, 0, 0, 1/2, -1/2), (0, 0, 0, 0, 0, 0, -1/2, 1/2)]\n '
x = self
v0 = self.parent()._v0
ret = (x - ((x.inner_product(v0) / 2) * v0))
return ret
def coerce_to_e6(self):
'\n For type E7 or E8, orthogonally projects an element of the root lattice\n into the E6 root lattice. This operation on weights corresponds to\n intersection with the semisimple subgroup E6.\n\n EXAMPLES::\n\n sage: [b.coerce_to_e6() for b in RootSystem("E8").ambient_space().basis()]\n [(1, 0, 0, 0, 0, 0, 0, 0), (0, 1, 0, 0, 0, 0, 0, 0), (0, 0, 1, 0, 0, 0, 0, 0),\n (0, 0, 0, 1, 0, 0, 0, 0), (0, 0, 0, 0, 1, 0, 0, 0), (0, 0, 0, 0, 0, 1/3, 1/3, -1/3),\n (0, 0, 0, 0, 0, 1/3, 1/3, -1/3), (0, 0, 0, 0, 0, -1/3, -1/3, 1/3)]\n '
x = self
v0 = self.parent()._v0
v1 = self.parent()._v1
x = (x - ((x.inner_product(v0) / 2) * v0))
return (x - ((x.inner_product(v1) / 6) * v1))
def to_ambient(self):
"\n Map ``self`` to the ambient space.\n\n This exists for uniformity. Its analogue for root and weight lattice realizations,\n is not trivial.\n\n EXAMPLES::\n\n sage: v = CartanType(['C',3]).root_system().ambient_space().an_element(); v\n (2, 2, 3)\n sage: v.to_ambient()\n (2, 2, 3)\n\n "
return self
|
def Associahedron(cartan_type, backend='ppl'):
"\n Construct an associahedron.\n\n The generalized associahedron is a polytopal complex with vertices in\n one-to-one correspondence with clusters in the cluster complex, and with\n edges between two vertices if and only if the associated two clusters\n intersect in codimension 1.\n\n The associahedron of type `A_n` is one way to realize the classical\n associahedron as defined in the :wikipedia:`Associahedron`.\n\n A polytopal realization of the associahedron can be found in [CFZ2002]_. The\n implementation is based on [CFZ2002]_, Theorem 1.5, Remark 1.6, and Corollary\n 1.9.\n\n INPUT:\n\n - ``cartan_type`` -- a cartan type according to\n :class:`sage.combinat.root_system.cartan_type.CartanTypeFactory`\n\n - ``backend`` -- string (``'ppl'``); the backend to use;\n see :meth:`sage.geometry.polyhedron.constructor.Polyhedron`\n\n EXAMPLES::\n\n sage: Asso = polytopes.associahedron(['A',2]); Asso\n Generalized associahedron of type ['A', 2] with 5 vertices\n\n sage: sorted(Asso.Hrepresentation(), key=repr)\n [An inequality (-1, 0) x + 1 >= 0,\n An inequality (0, -1) x + 1 >= 0,\n An inequality (0, 1) x + 1 >= 0,\n An inequality (1, 0) x + 1 >= 0,\n An inequality (1, 1) x + 1 >= 0]\n\n sage: Asso.Vrepresentation()\n (A vertex at (1, -1), A vertex at (1, 1), A vertex at (-1, 1),\n A vertex at (-1, 0), A vertex at (0, -1))\n\n sage: polytopes.associahedron(['B',2])\n Generalized associahedron of type ['B', 2] with 6 vertices\n\n The two pictures of [CFZ2002]_ can be recovered with::\n\n sage: Asso = polytopes.associahedron(['A',3]); Asso\n Generalized associahedron of type ['A', 3] with 14 vertices\n sage: Asso.plot() # long time\n Graphics3d Object\n\n sage: Asso = polytopes.associahedron(['B',3]); Asso\n Generalized associahedron of type ['B', 3] with 20 vertices\n sage: Asso.plot() # long time\n Graphics3d Object\n\n TESTS::\n\n sage: sorted(polytopes.associahedron(['A',3]).vertices())\n [A vertex at (-3/2, 0, -1/2), A vertex at (-3/2, 0, 3/2),\n A vertex at (-3/2, 1, -3/2), A vertex at (-3/2, 2, -3/2),\n A vertex at (-3/2, 2, 3/2), A vertex at (-1/2, -1, -1/2),\n A vertex at (-1/2, 0, -3/2), A vertex at (1/2, -2, 1/2),\n A vertex at (1/2, -2, 3/2), A vertex at (3/2, -2, 1/2),\n A vertex at (3/2, -2, 3/2), A vertex at (3/2, 0, -3/2),\n A vertex at (3/2, 2, -3/2), A vertex at (3/2, 2, 3/2)]\n\n sage: sorted(polytopes.associahedron(['B',3]).vertices())\n [A vertex at (-3, 0, 0), A vertex at (-3, 0, 3),\n A vertex at (-3, 2, -2), A vertex at (-3, 4, -3),\n A vertex at (-3, 5, -3), A vertex at (-3, 5, 3),\n A vertex at (-2, 1, -2), A vertex at (-2, 3, -3),\n A vertex at (-1, -2, 0), A vertex at (-1, -1, -1),\n A vertex at (1, -4, 1), A vertex at (1, -3, 0),\n A vertex at (2, -5, 2), A vertex at (2, -5, 3),\n A vertex at (3, -5, 2), A vertex at (3, -5, 3),\n A vertex at (3, -3, 0), A vertex at (3, 3, -3),\n A vertex at (3, 5, -3), A vertex at (3, 5, 3)]\n\n sage: polytopes.associahedron(['A',4]).f_vector()\n (1, 42, 84, 56, 14, 1)\n sage: polytopes.associahedron(['B',4]).f_vector()\n (1, 70, 140, 90, 20, 1)\n\n sage: p1 = polytopes.associahedron(['A',4], backend='normaliz') # optional - pynormaliz\n sage: TestSuite(p1).run(skip='_test_pickling') # optional - pynormaliz\n sage: p2 = polytopes.associahedron(['A',4], backend='cdd')\n sage: TestSuite(p2).run()\n sage: p3 = polytopes.associahedron(['A',4], backend='field')\n sage: TestSuite(p3).run()\n "
cartan_type = CartanType(cartan_type)
parent = Associahedra(QQ, cartan_type.rank(), backend)
return parent(cartan_type)
|
class Associahedron_class_base():
"\n The base class of the Python class of an associahedron\n\n You should use the :func:`Associahedron` convenience function to\n construct associahedra from the Cartan type.\n\n TESTS::\n\n sage: Asso = polytopes.associahedron(['A',2]); Asso\n Generalized associahedron of type ['A', 2] with 5 vertices\n sage: TestSuite(Asso).run()\n "
def __new__(typ, parent=None, Vrep=None, Hrep=None, cartan_type=None, **kwds):
"\n Return instance of :class:`Assciahedron_class_base`, if ``cartan_type`` is provided\n or object is being unpickled.\n\n In other cases, this call is a result of a polyhedral construction with an associahedron.\n Thus we return the corresponding instance of\n :class:`sage.geometry.polyhedron.base.Polyhedron_base` (not an associahedron).\n\n TESTS:\n\n Check that faces of associahedra work::\n\n sage: A = polytopes.associahedron(['A',3], backend='ppl'); A\n Generalized associahedron of type ['A', 3] with 14 vertices\n sage: face = A.faces(2)[3]\n sage: P = face.as_polyhedron(); P\n A 2-dimensional polyhedron in QQ^3 defined as the convex hull of 4 vertices\n sage: P.backend()\n 'ppl'\n sage: A = polytopes.associahedron(['A',3], backend='field'); A\n Generalized associahedron of type ['A', 3] with 14 vertices\n sage: A.faces(2)[3].as_polyhedron().backend()\n 'field'\n\n Check other polytopal constructions::\n\n sage: A = polytopes.associahedron(['A',4], backend='ppl')\n sage: A + A\n A 4-dimensional polyhedron in QQ^4 defined as the convex hull of 42 vertices\n sage: A - A\n A 0-dimensional polyhedron in QQ^4 defined as the convex hull of 1 vertex\n sage: A.intersection(A)\n A 4-dimensional polyhedron in QQ^4 defined as the convex hull of 42 vertices\n sage: A.translation(A.center())\n A 4-dimensional polyhedron in QQ^4 defined as the convex hull of 42 vertices\n sage: A.dilation(2)\n A 4-dimensional polyhedron in QQ^4 defined as the convex hull of 42 vertices\n sage: A.dilation(2.0)\n A 4-dimensional polyhedron in RDF^4 defined as the convex hull of 42 vertices\n sage: A.convex_hull(A)\n A 4-dimensional polyhedron in QQ^4 defined as the convex hull of 42 vertices\n sage: A.polar()\n A 4-dimensional polyhedron in QQ^4 defined as the convex hull of 14 vertices\n "
if (cartan_type or ((parent is None) and (Vrep is None) and (Hrep is None))):
return super().__new__(typ, parent, Vrep, Hrep, **kwds)
else:
mro = typ.mro()
for typ1 in mro:
if (typ1 in ancestors_of_associahedron):
return typ1(parent, Vrep, Hrep, **kwds)
raise ValueError('could not determine a parent class')
def __init__(self, parent, Vrep, Hrep, cartan_type=None, **kwds):
"\n Initialize an associahedron.\n\n If ``'cartan_type'`` is ``None``, :meth:`Associahedron_class_base.__new__`\n returns a (general) polyhedron instead.\n\n TESTS::\n\n sage: A = polytopes.associahedron(['A',3], backend='ppl'); A\n Generalized associahedron of type ['A', 3] with 14 vertices\n "
if cartan_type:
self._cartan_type = cartan_type
super().__init__(parent, Vrep, Hrep, **kwds)
else:
raise ValueError('associahedron must be initialized with cartan type')
def _repr_(self):
'\n Return a string representation of ``self``.\n\n EXAMPLES::\n\n sage: polytopes.associahedron([\'A\',3])._repr_()\n "Generalized associahedron of type [\'A\', 3] with 14 vertices"\n '
msg = 'Generalized associahedron of type {} with {} vertices'
return msg.format(self._cartan_type, self.n_vertices())
def cartan_type(self):
"\n Return the Cartan type of ``self``.\n\n EXAMPLES::\n\n sage: polytopes.associahedron(['A',3]).cartan_type()\n ['A', 3]\n "
return self._cartan_type
def vertices_in_root_space(self):
"\n Return the vertices of ``self`` as elements in the root space.\n\n EXAMPLES::\n\n sage: Asso = polytopes.associahedron(['A',2])\n sage: Asso.vertices()\n (A vertex at (1, -1), A vertex at (1, 1),\n A vertex at (-1, 1), A vertex at (-1, 0),\n A vertex at (0, -1))\n\n sage: Asso.vertices_in_root_space()\n (alpha[1] - alpha[2], alpha[1] + alpha[2], -alpha[1] + alpha[2],\n -alpha[1], -alpha[2])\n "
root_space = self._cartan_type.root_system().root_space()
return tuple((root_space.from_vector(vector(V)) for V in self.vertex_generator()))
|
class Associahedron_class_ppl(Associahedron_class_base, Polyhedron_QQ_ppl):
pass
|
class Associahedron_class_normaliz(Associahedron_class_base, Polyhedron_QQ_normaliz):
pass
|
class Associahedron_class_cdd(Associahedron_class_base, Polyhedron_QQ_cdd):
pass
|
class Associahedron_class_polymake(Associahedron_class_base, Polyhedron_polymake):
pass
|
class Associahedron_class_field(Associahedron_class_base, Polyhedron_field):
pass
|
def Associahedra(base_ring, ambient_dim, backend='ppl'):
"\n Construct a parent class of Associahedra according to ``backend``.\n\n TESTS::\n\n sage: from sage.combinat.root_system.associahedron import Associahedra\n sage: Associahedra(QQ, 4, 'ppl').parent()\n <class 'sage.combinat.root_system.associahedron.Associahedra_ppl_with_category'>\n sage: Associahedra(QQ, 4, 'normaliz').parent() # optional - pynormaliz\n <class 'sage.combinat.root_system.associahedron.Associahedra_normaliz_with_category'>\n sage: Associahedra(QQ, 4, 'polymake').parent() # optional - jupymake\n <class 'sage.combinat.root_system.associahedron.Associahedra_polymake_with_category'>\n sage: Associahedra(QQ, 4, 'field').parent()\n <class 'sage.combinat.root_system.associahedron.Associahedra_field_with_category'>\n sage: Associahedra(QQ, 4, 'cdd').parent()\n <class 'sage.combinat.root_system.associahedron.Associahedra_cdd_with_category'>\n\n .. SEEALSO::\n\n :class:`Associahedra_base`.\n "
if (base_ring is not QQ):
raise NotImplementedError('base ring must be QQ')
if (backend == 'ppl'):
return Associahedra_ppl(base_ring, ambient_dim, backend)
elif (backend == 'normaliz'):
return Associahedra_normaliz(base_ring, ambient_dim, backend)
elif (backend == 'cdd'):
return Associahedra_cdd(QQ, ambient_dim, backend)
elif (backend == 'polymake'):
return Associahedra_polymake(base_ring.fraction_field(), ambient_dim, backend)
elif (backend == 'field'):
return Associahedra_field(base_ring, ambient_dim, backend)
else:
raise ValueError('unknown backend')
|
class Associahedra_base():
"\n Base class of parent of Associahedra of specified dimension\n\n EXAMPLES::\n\n sage: from sage.combinat.root_system.associahedron import Associahedra\n sage: parent = Associahedra(QQ,2,'ppl'); parent\n Polyhedra in QQ^2\n sage: type(parent)\n <class 'sage.combinat.root_system.associahedron.Associahedra_ppl_with_category'>\n sage: parent(['A',2])\n Generalized associahedron of type ['A', 2] with 5 vertices\n\n Importantly, the parent knows the dimension of the ambient\n space. If you try to construct an associahedron of a different\n dimension, a :class:`ValueError` is raised::\n\n sage: parent(['A',3])\n Traceback (most recent call last):\n ...\n ValueError: V-representation data requires a list of length ambient_dim\n "
def _element_constructor_(self, cartan_type, **kwds):
"\n The element constructor.\n\n This method is called internally when we try to convert\n something into an element. In this case, the only thing that\n can be converted into an associahedron is the Cartan type.\n\n EXAMPLES::\n\n sage: from sage.combinat.root_system.associahedron import Associahedra\n sage: parent = Associahedra(QQ,2,'ppl')\n sage: parent(['A',2])\n Generalized associahedron of type ['A', 2] with 5 vertices\n sage: parent._element_constructor_(['A',2])\n Generalized associahedron of type ['A', 2] with 5 vertices\n\n TESTS::\n\n sage: parent(['A', 2, 1])\n Traceback (most recent call last):\n ...\n ValueError: the Cartan type must be finite\n "
cartan_type = CartanType(cartan_type)
if (not cartan_type.is_finite()):
raise ValueError('the Cartan type must be finite')
root_space = cartan_type.root_system().root_space()
rhocheck = (sum((beta.associated_coroot() for beta in root_space.positive_roots())) / 2)
I = root_space.index_set()
inequalities = []
for orbit in root_space.almost_positive_roots_decomposition():
c = rhocheck.coefficient(orbit[0].leading_support())
for beta in orbit:
inequalities.append(([c] + [beta.coefficient(i) for i in I]))
associahedron = super()._element_constructor_(None, [inequalities, []], cartan_type=cartan_type)
return associahedron
def _coerce_map_from_(self, X):
"\n Return whether there is a coercion from ``X``\n\n INPUT:\n\n - ``X`` -- anything.\n\n OUTPUT:\n\n Boolean.\n\n EXAMPLES::\n\n sage: from sage.geometry.polyhedron.parent import Polyhedra\n sage: from sage.combinat.root_system.associahedron import Associahedra\n sage: Associahedra(QQ,3).has_coerce_map_from( Polyhedra(QQ,3) ) # indirect doctest\n False\n sage: Polyhedra(QQ,3).has_coerce_map_from( Associahedra(QQ,3) )\n True\n\n TESTS::\n\n sage: A = polytopes.associahedron(['A',4], backend='ppl'); type(A.parent())\n <class 'sage.combinat.root_system.associahedron.Associahedra_ppl_with_category'>\n sage: B = polytopes.simplex().change_ring(QQ); type(B.parent())\n <class 'sage.geometry.polyhedron.parent.Polyhedra_QQ_ppl_with_category'>\n sage: A + B\n A 4-dimensional polyhedron in QQ^4 defined as the convex hull of 70 vertices\n sage: A - B\n A 4-dimensional polyhedron in QQ^4 defined as the convex hull of 24 vertices\n sage: A.intersection(B)\n A 3-dimensional polyhedron in QQ^4 defined as the convex hull of 4 vertices\n sage: A.convex_hull(B)\n A 4-dimensional polyhedron in QQ^4 defined as the convex hull of 42 vertices\n "
if (not isinstance(X, Associahedra_base)):
return False
return super()._coerce_map_from_(X)
def _pushout_(self, other):
"\n The pushout of Polyhedra over ZZ and Associahedra over QQ is Polyhedra over QQ.\n\n TESTS::\n\n sage: A = polytopes.associahedron(['A',4], backend='ppl'); type(A.parent())\n <class 'sage.combinat.root_system.associahedron.Associahedra_ppl_with_category'>\n sage: B = polytopes.simplex(); type(B.parent())\n <class 'sage.geometry.polyhedron.parent.Polyhedra_ZZ_ppl_with_category'>\n sage: A + B\n A 4-dimensional polyhedron in QQ^4 defined as the convex hull of 70 vertices\n sage: A - B\n A 4-dimensional polyhedron in QQ^4 defined as the convex hull of 24 vertices\n sage: A.intersection(B)\n A 3-dimensional polyhedron in QQ^4 defined as the convex hull of 4 vertices\n sage: A.convex_hull(B)\n A 4-dimensional polyhedron in QQ^4 defined as the convex hull of 42 vertices\n "
if (isinstance(other, Polyhedra_base) and (other.base_ring() == ZZ)):
return Polyhedra(QQ, self.ambient_dim(), self.backend())
if hasattr(super(), '_pushout_'):
return super()._pushout_(other)
|
class Associahedra_ppl(Associahedra_base, Polyhedra_QQ_ppl):
Element = Associahedron_class_ppl
|
class Associahedra_normaliz(Associahedra_base, Polyhedra_QQ_normaliz):
Element = Associahedron_class_normaliz
|
class Associahedra_cdd(Associahedra_base, Polyhedra_QQ_cdd):
Element = Associahedron_class_cdd
|
class Associahedra_polymake(Associahedra_base, Polyhedra_polymake):
Element = Associahedron_class_polymake
|
class Associahedra_field(Associahedra_base, Polyhedra_field):
Element = Associahedron_class_field
|
class BraidMoveCalculator():
'\n Helper class to compute braid moves.\n '
def __init__(self, coxeter_group):
'\n Initialize ``self``.\n\n EXAMPLES::\n\n sage: from sage.combinat.root_system.braid_move_calculator import BraidMoveCalculator\n sage: W = CoxeterGroup([\'C\',3])\n sage: B = BraidMoveCalculator(W)\n sage: TestSuite(B).run(skip="_test_pickling")\n '
self.coxeter_matrix = coxeter_group.coxeter_matrix()
def _apply_put_in_front_recur_step(self, k, input_word, coxeter_matrix_entry):
"\n Recurrence step for :meth:`put_in_front`.\n\n EXAMPLES::\n\n sage: from sage.combinat.root_system.braid_move_calculator import BraidMoveCalculator\n sage: W = CoxeterGroup(['C',3])\n sage: B = BraidMoveCalculator(W)\n sage: B.put_in_front(2, (3, 2, 3, 1, 2, 3, 1, 2, 1)) # indirect doctest\n ((3, 2, 3, 1, 2, 3, 1, 2, 1),\n (3, 2, 3, 1, 2, 1, 3, 2, 1),\n (3, 2, 3, 2, 1, 2, 3, 2, 1),\n (2, 3, 2, 3, 1, 2, 3, 2, 1))\n "
i = input_word[0]
def partial_braid_word(length, swap=False, i=i, k=k):
if swap:
(i, k) = (k, i)
running_braid_word = ([i, k] * (length // 2))
if (length % 2):
running_braid_word.append(i)
return tuple(running_braid_word)
current_last_word = input_word
current_first_letter = k
output_word_list = [current_last_word]
for counter in range(1, coxeter_matrix_entry):
current_word_list = self.put_in_front(current_first_letter, current_last_word[1:])
output_word_list += [(partial_braid_word(counter) + word) for word in current_word_list[1:]]
if (current_first_letter == k):
current_first_letter = i
else:
current_first_letter = k
current_last_word = current_word_list[(- 1)]
if (i != k):
output_word_list += [(partial_braid_word(coxeter_matrix_entry, swap=True) + current_last_word[1:])]
return tuple(output_word_list)
def put_in_front(self, k, input_word):
"\n Return a list of reduced words starting with ``input_word``\n and ending with a reduced word whose first letter is ``k``.\n\n There still remains an issue with 0 indices.\n\n EXAMPLES::\n\n sage: from sage.combinat.root_system.braid_move_calculator import BraidMoveCalculator\n sage: W = CoxeterGroup(['C',3])\n sage: B = BraidMoveCalculator(W)\n sage: B.put_in_front(2, (3, 2, 3, 1, 2, 3, 1, 2, 1))\n ((3, 2, 3, 1, 2, 3, 1, 2, 1),\n (3, 2, 3, 1, 2, 1, 3, 2, 1),\n (3, 2, 3, 2, 1, 2, 3, 2, 1),\n (2, 3, 2, 3, 1, 2, 3, 2, 1))\n sage: B.put_in_front(1, (3, 2, 3, 1, 2, 3, 1, 2, 1))\n ((3, 2, 3, 1, 2, 3, 1, 2, 1),\n (3, 2, 1, 3, 2, 3, 1, 2, 1),\n (3, 2, 1, 3, 2, 3, 2, 1, 2),\n (3, 2, 1, 2, 3, 2, 3, 1, 2),\n (3, 1, 2, 1, 3, 2, 3, 1, 2),\n (1, 3, 2, 1, 3, 2, 3, 1, 2))\n sage: B.put_in_front(1, (1, 3, 2, 3, 2, 1, 2, 3, 2))\n ((1, 3, 2, 3, 2, 1, 2, 3, 2),)\n "
i = input_word[0]
if ((i == 0) or (k == 0)):
raise NotImplementedError
entry = self.coxeter_matrix[(i, k)]
return self._apply_put_in_front_recur_step(k, input_word, entry)
@cached_method
def chain_of_reduced_words(self, start_word, end_word):
"\n Compute the chain of reduced words from ``stard_word``\n to ``end_word``.\n\n INPUT:\n\n - ``start_word``, ``end_word`` -- two reduced expressions\n for the long word\n\n EXAMPLES::\n\n sage: from sage.combinat.root_system.braid_move_calculator import BraidMoveCalculator\n sage: W = CoxeterGroup(['A',5])\n sage: B = BraidMoveCalculator(W)\n sage: B.chain_of_reduced_words((1,2,1,3,2,1,4,3,2,1,5,4,3,2,1), # not tested\n ....: (5,4,5,3,4,5,2,3,4,5,1,2,3,4,5))\n "
if (start_word == end_word):
return (start_word,)
k = end_word[0]
first_word_list = self.put_in_front(k, start_word)
first_last_word = first_word_list[(- 1)]
return (first_word_list[:(- 1)] + tuple([((k,) + word) for word in self.chain_of_reduced_words(first_last_word[1:], end_word[1:])]))
|
def branch_weyl_character(chi, R, S, rule='default'):
'\n A branching rule describes the restriction of representations from\n a Lie group or algebra `G` to a subgroup `H`. See for example, R. C.\n King, Branching rules for classical Lie groups using tensor and\n spinor methods. J. Phys. A 8 (1975), 429-449, Howe, Tan and\n Willenbring, Stable branching rules for classical symmetric pairs,\n Trans. Amer. Math. Soc. 357 (2005), no. 4, 1601-1626, McKay and\n Patera, Tables of Dimensions, Indices and Branching Rules for\n Representations of Simple Lie Algebras (Marcel Dekker, 1981),\n and Fauser, Jarvis, King and Wybourne, New branching rules induced\n by plethysm. J. Phys. A 39 (2006), no. 11, 2611--2655. If `H\\subset G`\n we will write `G\\Rightarrow H` to denote the branching rule, which\n is a homomorphism of WeylCharacterRings.\n\n INPUT:\n\n - ``chi`` -- a character of `G`\n\n - ``R`` -- the Weyl Character Ring of `G`\n\n - ``S`` -- the Weyl Character Ring of `H`\n\n - ``rule`` -- an element of the ``BranchingRule`` class\n or one (most usually) a keyword such as:\n\n * ``"levi"``\n * ``"automorphic"``\n * ``"symmetric"``\n * ``"extended"``\n * ``"orthogonal_sum"``\n * ``"tensor"``\n * ``"triality"``\n * ``"miscellaneous"``\n\n The :class:`BranchingRule` class is a wrapper for functions\n from the weight lattice of `G` to the weight lattice of `H`.\n An instance of this class encodes an embedding of `H` into\n `G`. The usual way to specify an embedding is to supply a\n keyword, which tells Sage to use one of the built-in rules.\n We will discuss these first.\n\n To explain the predefined rules, we survey the most important\n branching rules. These may be classified into several cases, and\n once this is understood, the detailed classification can be read\n off from the Dynkin diagrams. Dynkin classified the maximal\n subgroups of Lie groups in Mat. Sbornik N.S. 30(72):349-462 (1952).\n\n We will list give predefined rules that cover most cases where the\n branching rule is to a maximal subgroup. For convenience, we\n also give some branching rules to subgroups that are not maximal.\n For example, a Levi subgroup may or may not be maximal.\n\n For example, there is a "levi" branching rule defined from `SL(5)` (with\n Cartan type `A_4`) to `SL(4)` (with Cartan type `A_3`), so\n we may compute the branching rule as follows:\n\n EXAMPLES::\n\n sage: A3=WeylCharacterRing("A3",style="coroots")\n sage: A2=WeylCharacterRing("A2",style="coroots")\n sage: [A3(fw).branch(A2,rule="levi") for fw in A3.fundamental_weights()]\n [A2(0,0) + A2(1,0), A2(0,1) + A2(1,0), A2(0,0) + A2(0,1)]\n\n In this case the Levi branching rule is the default branching rule\n so we may omit the specification rule="levi".\n\n If a subgroup is not maximal, you may specify a branching rule\n by finding a chain of intermediate subgroups. For this\n purpose, branching rules may be multiplied as in the following\n example.\n\n EXAMPLES::\n\n sage: A4=WeylCharacterRing("A4",style="coroots")\n sage: A2=WeylCharacterRing("A2",style="coroots")\n sage: br=branching_rule("A4","A3")*branching_rule("A3","A2")\n sage: A4(1,0,0,0).branch(A2,rule=br)\n 2*A2(0,0) + A2(1,0)\n\n You may try omitting the rule if it is "obvious". Default\n rules are provided for the following cases:\n\n .. MATH::\n\n \\begin{aligned}\n A_{2s} & \\Rightarrow B_s,\n \\\\ A_{2s-1} & \\Rightarrow C_s,\n \\\\ A_{2*s-1} & \\Rightarrow D_s.\n \\end{aligned}\n\n The above default rules correspond to embedding the group\n `SO(2s+1)`, `Sp(2s)` or `SO(2s)` into the corresponding general\n or special linear group by the standard representation. Default\n rules are also specified for the following cases:\n\n .. MATH::\n\n \\begin{aligned}\n B_{s+1} & \\Rightarrow D_s,\n \\\\ D_s & \\Rightarrow B_s.\n \\end{aligned}\n\n These correspond to the embedding of `O(n)` into `O(n+1)` where\n `n = 2s` or `2s + 1`. Finally, the branching rule for the embedding of\n a Levi subgroup is also implemented as a default rule.\n\n EXAMPLES::\n\n sage: A1 = WeylCharacterRing("A1", style="coroots")\n sage: A2 = WeylCharacterRing("A2", style="coroots")\n sage: D4 = WeylCharacterRing("D4", style="coroots")\n sage: B3 = WeylCharacterRing("B3", style="coroots")\n sage: B4 = WeylCharacterRing("B4", style="coroots")\n sage: A6 = WeylCharacterRing("A6", style="coroots")\n sage: A7 = WeylCharacterRing("A7", style="coroots")\n sage: def try_default_rule(R,S): return [R(f).branch(S) for f in R.fundamental_weights()]\n sage: try_default_rule(A2,A1)\n [A1(0) + A1(1), A1(0) + A1(1)]\n sage: try_default_rule(D4,B3)\n [B3(0,0,0) + B3(1,0,0), B3(1,0,0) + B3(0,1,0), B3(0,0,1), B3(0,0,1)]\n sage: try_default_rule(B4,D4)\n [D4(0,0,0,0) + D4(1,0,0,0), D4(1,0,0,0) + D4(0,1,0,0),\n D4(0,1,0,0) + D4(0,0,1,1), D4(0,0,1,0) + D4(0,0,0,1)]\n sage: try_default_rule(A7,D4)\n [D4(1,0,0,0), D4(0,1,0,0), D4(0,0,1,1), D4(0,0,2,0) + D4(0,0,0,2),\n D4(0,0,1,1),\n D4(0,1,0,0),\n D4(1,0,0,0)]\n sage: try_default_rule(A6,B3)\n [B3(1,0,0), B3(0,1,0), B3(0,0,2), B3(0,0,2), B3(0,1,0), B3(1,0,0)]\n\n If a default rule is not known, you may cue Sage as to what the\n Lie group embedding is by supplying a rule from the list of\n predefined rules. We will treat these next.\n\n .. RUBRIC:: Levi Type\n\n These can be read off from the Dynkin diagram. If\n removing a node from the Dynkin diagram produces another Dynkin\n diagram, there is a branching rule. A Levi subgroup may\n or may not be maximal. If it is maximal, there may or may not\n be a built-in branching rule for but you may obtain the\n Levi branching rule by first branching to a suitable\n maximal subgroup. For these rules use the option ``rule="levi"``:\n\n .. MATH::\n\n \\begin{aligned}\n A_r & \\Rightarrow A_{r-1}\n \\\\ B_r & \\Rightarrow A_{r-1}\n \\\\ B_r & \\Rightarrow B_{r-1}\n \\\\ C_r & \\Rightarrow A_{r-1}\n \\\\ C_r & \\Rightarrow C_{r-1}\n \\\\ D_r & \\Rightarrow A_{r-1}\n \\\\ D_r & \\Rightarrow D_{r-1}\n \\\\ E_r & \\Rightarrow A_{r-1} \\quad r = 7,8\n \\\\ E_r & \\Rightarrow D_{r-1} \\quad r = 6,7,8\n \\\\ E_r & \\Rightarrow E_{r-1}\n \\\\ F_4 & \\Rightarrow B_3\n \\\\ F_4 & \\Rightarrow C_3\n \\\\ G_2 & \\Rightarrow A_1 \\text{(short root)}\n \\end{aligned}\n\n Not all Levi subgroups are maximal subgroups. If the Levi is not\n maximal there may or may not be a preprogrammed ``rule="levi"`` for\n it. If there is not, the branching rule may still be obtained by going\n through an intermediate subgroup that is maximal using rule="extended".\n Thus the other Levi branching rule from `G_2 \\Rightarrow A_1` corresponding to the\n long root is available by first branching `G_2 \\Rightarrow A_2` then `A_2 \\Rightarrow A_1`.\n Similarly the branching rules to the Levi subgroup:\n\n .. MATH::\n\n E_r \\Rightarrow A_{r-1} \\quad r = 6,7,8\n\n may be obtained by first branching `E_6 \\Rightarrow A_5 \\times A_1`, `E_7 \\Rightarrow A_7`\n or `E_8 \\Rightarrow A_8`.\n\n EXAMPLES::\n\n sage: A1 = WeylCharacterRing("A1")\n sage: A2 = WeylCharacterRing("A2")\n sage: A3 = WeylCharacterRing("A3")\n sage: A4 = WeylCharacterRing("A4")\n sage: A5 = WeylCharacterRing("A5")\n sage: B2 = WeylCharacterRing("B2")\n sage: B3 = WeylCharacterRing("B3")\n sage: B4 = WeylCharacterRing("B4")\n sage: C2 = WeylCharacterRing("C2")\n sage: C3 = WeylCharacterRing("C3")\n sage: D3 = WeylCharacterRing("D3")\n sage: D4 = WeylCharacterRing("D4")\n sage: G2 = WeylCharacterRing("G2")\n sage: F4 = WeylCharacterRing("F4",style="coroots")\n sage: E6=WeylCharacterRing("E6",style="coroots")\n sage: E7=WeylCharacterRing("E7",style="coroots")\n sage: D5=WeylCharacterRing("D5",style="coroots")\n sage: D6=WeylCharacterRing("D6",style="coroots")\n sage: [B3(w).branch(A2,rule="levi") for w in B3.fundamental_weights()]\n [A2(0,0,0) + A2(1,0,0) + A2(0,0,-1),\n A2(0,0,0) + A2(1,0,0) + A2(1,1,0) + A2(1,0,-1) + A2(0,-1,-1) + A2(0,0,-1),\n A2(-1/2,-1/2,-1/2) + A2(1/2,-1/2,-1/2) + A2(1/2,1/2,-1/2) + A2(1/2,1/2,1/2)]\n\n The last example must be understood as follows. The representation\n of `B_3` being branched is spin, which is not a representation of\n `SO(7)` but of its double cover `\\mathrm{spin}(7)`. The group `A_2` is\n really GL(3) and the double cover of `SO(7)` induces a cover of `GL(3)`\n that is trivial over `SL(3)` but not over the center of `GL(3)`. The weight\n lattice for this `GL(3)` consists of triples `(a,b,c)` of half integers\n such that `a - b` and `b - c` are in `\\ZZ`, and this is reflected in the\n last decomposition.\n\n ::\n\n sage: [C3(w).branch(A2,rule="levi") for w in C3.fundamental_weights()]\n [A2(1,0,0) + A2(0,0,-1),\n A2(1,1,0) + A2(1,0,-1) + A2(0,-1,-1),\n A2(-1,-1,-1) + A2(1,-1,-1) + A2(1,1,-1) + A2(1,1,1)]\n sage: [D4(w).branch(A3,rule="levi") for w in D4.fundamental_weights()]\n [A3(1,0,0,0) + A3(0,0,0,-1),\n A3(0,0,0,0) + A3(1,1,0,0) + A3(1,0,0,-1) + A3(0,0,-1,-1),\n A3(1/2,-1/2,-1/2,-1/2) + A3(1/2,1/2,1/2,-1/2),\n A3(-1/2,-1/2,-1/2,-1/2) + A3(1/2,1/2,-1/2,-1/2) + A3(1/2,1/2,1/2,1/2)]\n sage: [B3(w).branch(B2,rule="levi") for w in B3.fundamental_weights()]\n [2*B2(0,0) + B2(1,0), B2(0,0) + 2*B2(1,0) + B2(1,1), 2*B2(1/2,1/2)]\n sage: C3 = WeylCharacterRing([\'C\',3])\n sage: [C3(w).branch(C2,rule="levi") for w in C3.fundamental_weights()]\n [2*C2(0,0) + C2(1,0),\n C2(0,0) + 2*C2(1,0) + C2(1,1),\n C2(1,0) + 2*C2(1,1)]\n sage: [D5(w).branch(D4,rule="levi") for w in D5.fundamental_weights()]\n [2*D4(0,0,0,0) + D4(1,0,0,0),\n D4(0,0,0,0) + 2*D4(1,0,0,0) + D4(1,1,0,0),\n D4(1,0,0,0) + 2*D4(1,1,0,0) + D4(1,1,1,0),\n D4(1/2,1/2,1/2,-1/2) + D4(1/2,1/2,1/2,1/2),\n D4(1/2,1/2,1/2,-1/2) + D4(1/2,1/2,1/2,1/2)]\n sage: G2(1,0,-1).branch(A1,rule="levi")\n A1(1,0) + A1(1,-1) + A1(0,-1)\n sage: E6=WeylCharacterRing("E6",style="coroots")\n sage: D5=WeylCharacterRing("D5",style="coroots")\n sage: fw = E6.fundamental_weights()\n sage: [E6(fw[i]).branch(D5,rule="levi") for i in [1,2,6]]\n [D5(0,0,0,0,0) + D5(0,0,0,0,1) + D5(1,0,0,0,0),\n D5(0,0,0,0,0) + D5(0,0,0,1,0) + D5(0,0,0,0,1) + D5(0,1,0,0,0),\n D5(0,0,0,0,0) + D5(0,0,0,1,0) + D5(1,0,0,0,0)]\n sage: E7=WeylCharacterRing("E7",style="coroots")\n sage: A3xA3xA1=WeylCharacterRing("A3xA3xA1",style="coroots")\n sage: E7(1,0,0,0,0,0,0).branch(A3xA3xA1,rule="extended") # long time (0.7s)\n A3xA3xA1(0,0,1,0,0,1,1) + A3xA3xA1(0,1,0,0,1,0,0) + A3xA3xA1(1,0,0,1,0,0,1) +\n A3xA3xA1(1,0,1,0,0,0,0) + A3xA3xA1(0,0,0,1,0,1,0) + A3xA3xA1(0,0,0,0,0,0,2)\n sage: fw = E7.fundamental_weights()\n sage: [E7(fw[i]).branch(D6,rule="levi") for i in [1,2,7]] # long time (0.3s)\n [3*D6(0,0,0,0,0,0) + 2*D6(0,0,0,0,1,0) + D6(0,1,0,0,0,0),\n 3*D6(0,0,0,0,0,1) + 2*D6(1,0,0,0,0,0) + 2*D6(0,0,1,0,0,0) + D6(1,0,0,0,1,0),\n D6(0,0,0,0,0,1) + 2*D6(1,0,0,0,0,0)]\n sage: D7=WeylCharacterRing("D7",style="coroots")\n sage: E8=WeylCharacterRing("E8",style="coroots")\n sage: D7=WeylCharacterRing("D7",style="coroots")\n sage: E8(1,0,0,0,0,0,0,0).branch(D7,rule="levi") # long time (7s)\n 3*D7(0,0,0,0,0,0,0) + 2*D7(0,0,0,0,0,1,0) + 2*D7(0,0,0,0,0,0,1) + 2*D7(1,0,0,0,0,0,0)\n + D7(0,1,0,0,0,0,0) + 2*D7(0,0,1,0,0,0,0) + D7(0,0,0,1,0,0,0) + D7(1,0,0,0,0,1,0) + D7(1,0,0,0,0,0,1) + D7(2,0,0,0,0,0,0)\n sage: E8(0,0,0,0,0,0,0,1).branch(D7,rule="levi") # long time (0.6s)\n D7(0,0,0,0,0,0,0) + D7(0,0,0,0,0,1,0) + D7(0,0,0,0,0,0,1) + 2*D7(1,0,0,0,0,0,0) + D7(0,1,0,0,0,0,0)\n sage: [F4(fw).branch(B3,rule="levi") for fw in F4.fundamental_weights()] # long time (1s)\n [B3(0,0,0) + 2*B3(1/2,1/2,1/2) + 2*B3(1,0,0) + B3(1,1,0),\n B3(0,0,0) + 6*B3(1/2,1/2,1/2) + 5*B3(1,0,0) + 7*B3(1,1,0) + 3*B3(1,1,1)\n + 6*B3(3/2,1/2,1/2) + 2*B3(3/2,3/2,1/2) + B3(2,0,0) + 2*B3(2,1,0) + B3(2,1,1),\n 3*B3(0,0,0) + 6*B3(1/2,1/2,1/2) + 4*B3(1,0,0) + 3*B3(1,1,0) + B3(1,1,1) + 2*B3(3/2,1/2,1/2),\n 3*B3(0,0,0) + 2*B3(1/2,1/2,1/2) + B3(1,0,0)]\n sage: [F4(fw).branch(C3,rule="levi") for fw in F4.fundamental_weights()] # long time (1s)\n [3*C3(0,0,0) + 2*C3(1,1,1) + C3(2,0,0),\n 3*C3(0,0,0) + 6*C3(1,1,1) + 4*C3(2,0,0) + 2*C3(2,1,0) + 3*C3(2,2,0) + C3(2,2,2) + C3(3,1,0) + 2*C3(3,1,1),\n 2*C3(1,0,0) + 3*C3(1,1,0) + C3(2,0,0) + 2*C3(2,1,0) + C3(2,1,1),\n 2*C3(1,0,0) + C3(1,1,0)]\n sage: A1xA1 = WeylCharacterRing("A1xA1")\n sage: [A3(hwv).branch(A1xA1,rule="levi") for hwv in A3.fundamental_weights()]\n [A1xA1(1,0,0,0) + A1xA1(0,0,1,0),\n A1xA1(1,1,0,0) + A1xA1(1,0,1,0) + A1xA1(0,0,1,1),\n A1xA1(1,1,1,0) + A1xA1(1,0,1,1)]\n sage: A1xB1=WeylCharacterRing("A1xB1",style="coroots")\n sage: [B3(x).branch(A1xB1,rule="levi") for x in B3.fundamental_weights()]\n [2*A1xB1(1,0) + A1xB1(0,2),\n 3*A1xB1(0,0) + 2*A1xB1(1,2) + A1xB1(2,0) + A1xB1(0,2),\n A1xB1(1,1) + 2*A1xB1(0,1)]\n\n .. RUBRIC:: Automorphic Type\n\n If the Dynkin diagram has a symmetry, then there\n is an automorphism that is a special case of a branching rule.\n There is also an exotic "triality" automorphism of `D_4` having order 3.\n Use ``rule="automorphic"`` (or for `D_4` ``rule="triality"``):\n\n .. MATH::\n\n \\begin{aligned}\n A_r & \\Rightarrow A_r\n \\\\ D_r & \\Rightarrow D_r\n \\\\ E_6 & \\Rightarrow E_6\n \\end{aligned}\n\n EXAMPLES::\n\n sage: [A3(chi).branch(A3,rule="automorphic") for chi in A3.fundamental_weights()]\n [A3(0,0,0,-1), A3(0,0,-1,-1), A3(0,-1,-1,-1)]\n sage: [D4(chi).branch(D4,rule="automorphic") for chi in D4.fundamental_weights()]\n [D4(1,0,0,0), D4(1,1,0,0), D4(1/2,1/2,1/2,1/2), D4(1/2,1/2,1/2,-1/2)]\n\n Here is an example with `D_4` triality::\n\n sage: [D4(chi).branch(D4,rule="triality") for chi in D4.fundamental_weights()]\n [D4(1/2,1/2,1/2,-1/2), D4(1,1,0,0), D4(1/2,1/2,1/2,1/2), D4(1,0,0,0)]\n\n .. RUBRIC:: Symmetric Type\n\n Related to the automorphic type, when `G` admits\n an outer automorphism (usually of degree 2) we may consider\n the branching rule to the isotropy subgroup `H`. Outer\n automorphisms correspond to symmetries of the Dynkin diagram.\n For such isotropy subgroups use ``rule="symmetric"``.\n We may thus obtain the following branching rules.\n\n .. MATH::\n\n A_{2r} & \\Rightarrow B_r\n \\\\ A_{2r-1} & \\Rightarrow C_r\n \\\\ A_{2r-1} & \\Rightarrow D_r\n \\\\ D_r & \\Rightarrow B_{r-1}\n \\\\ E_6 & \\Rightarrow F_4\n \\\\ E_6 & \\Rightarrow C_4\n \\\\ D_4 & \\Rightarrow G_2\n\n The last branching rule, `D_4 \\Rightarrow G_2` is not to a maximal subgroup\n since `D_4 \\Rightarrow B_3 \\Rightarrow G_2`, but it is included for convenience.\n\n In some cases, two outer automorphisms that differ by an\n inner automorphism may have different fixed subgroups.\n Thus, while the Dynkin diagram of `E_6` has a single\n involutory automorphism, there are two involutions\n of the group (differing by an inner automorphism) with\n fixed subgroups `F_4` and `C_4`. Similarly\n `SL(2r)`, of Cartan type `A_{2r-1}`, has subgroups\n `SO(2r)` and `Sp(2r)`, both fixed subgroups of outer\n automorphisms that differ from each other by an inner\n automorphism.\n\n In many cases the Dynkin diagram of `H` can be obtained by\n folding the Dynkin diagram of `G`.\n\n EXAMPLES::\n\n sage: [w.branch(B2,rule="symmetric") for w in [A4(1,0,0,0,0),A4(1,1,0,0,0),A4(1,1,1,0,0),A4(2,0,0,0,0)]]\n [B2(1,0), B2(1,1), B2(1,1), B2(0,0) + B2(2,0)]\n sage: [A5(w).branch(C3,rule="symmetric") for w in A5.fundamental_weights()]\n [C3(1,0,0), C3(0,0,0) + C3(1,1,0), C3(1,0,0) + C3(1,1,1), C3(0,0,0) + C3(1,1,0), C3(1,0,0)]\n sage: [A5(w).branch(D3,rule="symmetric") for w in A5.fundamental_weights()]\n [D3(1,0,0), D3(1,1,0), D3(1,1,-1) + D3(1,1,1), D3(1,1,0), D3(1,0,0)]\n sage: [D4(x).branch(B3,rule="symmetric") for x in D4.fundamental_weights()]\n [B3(0,0,0) + B3(1,0,0), B3(1,0,0) + B3(1,1,0), B3(1/2,1/2,1/2), B3(1/2,1/2,1/2)]\n sage: [D4(x).branch(G2,rule="symmetric") for x in D4.fundamental_weights()]\n [G2(0,0,0) + G2(1,0,-1), 2*G2(1,0,-1) + G2(2,-1,-1), G2(0,0,0) + G2(1,0,-1), G2(0,0,0) + G2(1,0,-1)]\n sage: [E6(fw).branch(F4,rule="symmetric") for fw in E6.fundamental_weights()] # long time (4s)\n [F4(0,0,0,0) + F4(0,0,0,1),\n F4(0,0,0,1) + F4(1,0,0,0),\n F4(0,0,0,1) + F4(1,0,0,0) + F4(0,0,1,0),\n F4(1,0,0,0) + 2*F4(0,0,1,0) + F4(1,0,0,1) + F4(0,1,0,0),\n F4(0,0,0,1) + F4(1,0,0,0) + F4(0,0,1,0),\n F4(0,0,0,0) + F4(0,0,0,1)]\n sage: E6=WeylCharacterRing("E6",style="coroots")\n sage: C4=WeylCharacterRing("C4",style="coroots")\n sage: chi = E6(1,0,0,0,0,0); chi.degree()\n 27\n sage: chi.branch(C4,rule="symmetric")\n C4(0,1,0,0)\n\n .. RUBRIC:: Extended Type\n\n If removing a node from the extended Dynkin diagram\n results in a Dynkin diagram, then there is a branching rule. Use\n ``rule="extended"`` for these. We will also use this classification\n for some rules that are not of this type, mainly involving type `B`,\n such as `D_6 \\Rightarrow B_3 \\times B_3`.\n\n Here is the extended Dynkin diagram for `D_6`::\n\n 0 6\n O O\n | |\n | |\n O---O---O---O---O\n 1 2 3 4 6\n\n Removing the node 3 results in an embedding `D_3 \\times D_3 \\Rightarrow D_6`.\n This corresponds to the embedding `SO(6) \\times SO(6) \\Rightarrow SO(12)`, and\n is of extended type. On the other hand the embedding `SO(5) \\times SO(7)\n \\Rightarrow SO(12)` (e.g. `B_2 \\times B_3 \\Rightarrow D_6`) cannot be explained this way\n but for uniformity is implemented under ``rule="extended"``.\n\n The following rules are implemented as special cases\n of ``rule="extended"``:\n\n .. MATH::\n\n \\begin{aligned}\n E_6 & \\Rightarrow A_5 \\times A_1, A_2 \\times A_2 \\times A_2\n \\\\ E_7 & \\Rightarrow A_7, D_6 \\times A_1, A_3 \\times A_3 \\times A_1\n \\\\ E_8 & \\Rightarrow A_8, D_8, E_7 \\times A_1, A_4 \\times A_4,\n D_5 \\times A_3, E_6 \\times A_2\n \\\\ F_4 & \\Rightarrow B_4, C_3 \\times A_1, A_2 \\times A_2, A_3 \\times A_1\n \\\\ G_2 & \\Rightarrow A_1 \\times A_1\n \\end{aligned}\n\n Note that `E_8` has only a limited number of representations of\n reasonably low degree.\n\n EXAMPLES::\n\n sage: [B3(x).branch(D3,rule="extended") for x in B3.fundamental_weights()]\n [D3(0,0,0) + D3(1,0,0),\n D3(1,0,0) + D3(1,1,0),\n D3(1/2,1/2,-1/2) + D3(1/2,1/2,1/2)]\n sage: [G2(w).branch(A2, rule="extended") for w in G2.fundamental_weights()]\n [A2(0,0,0) + A2(1/3,1/3,-2/3) + A2(2/3,-1/3,-1/3),\n A2(1/3,1/3,-2/3) + A2(2/3,-1/3,-1/3) + A2(1,0,-1)]\n sage: [F4(fw).branch(B4,rule="extended") for fw in F4.fundamental_weights()] # long time (2s)\n [B4(1/2,1/2,1/2,1/2) + B4(1,1,0,0),\n B4(1,1,0,0) + B4(1,1,1,0) + B4(3/2,1/2,1/2,1/2) + B4(3/2,3/2,1/2,1/2) + B4(2,1,1,0),\n B4(1/2,1/2,1/2,1/2) + B4(1,0,0,0) + B4(1,1,0,0) + B4(1,1,1,0) + B4(3/2,1/2,1/2,1/2),\n B4(0,0,0,0) + B4(1/2,1/2,1/2,1/2) + B4(1,0,0,0)]\n\n sage: E6 = WeylCharacterRing("E6", style="coroots")\n sage: A2xA2xA2 = WeylCharacterRing("A2xA2xA2",style="coroots")\n sage: A5xA1 = WeylCharacterRing("A5xA1",style="coroots")\n sage: G2 = WeylCharacterRing("G2", style="coroots")\n sage: A1xA1 = WeylCharacterRing("A1xA1", style="coroots")\n sage: F4 = WeylCharacterRing("F4",style="coroots")\n sage: A3xA1 = WeylCharacterRing("A3xA1", style="coroots")\n sage: A2xA2 = WeylCharacterRing("A2xA2", style="coroots")\n sage: A1xC3 = WeylCharacterRing("A1xC3",style="coroots")\n sage: E6(1,0,0,0,0,0).branch(A5xA1,rule="extended") # (0.7s)\n A5xA1(0,0,0,1,0,0) + A5xA1(1,0,0,0,0,1)\n sage: E6(1,0,0,0,0,0).branch(A2xA2xA2, rule="extended") # (0.7s)\n A2xA2xA2(0,1,1,0,0,0) + A2xA2xA2(1,0,0,0,0,1) + A2xA2xA2(0,0,0,1,1,0)\n sage: E7 = WeylCharacterRing("E7",style="coroots")\n sage: A7 = WeylCharacterRing("A7",style="coroots")\n sage: E7(1,0,0,0,0,0,0).branch(A7,rule="extended")\n A7(0,0,0,1,0,0,0) + A7(1,0,0,0,0,0,1)\n sage: D6xA1 = WeylCharacterRing("D6xA1",style="coroots")\n sage: E7(1,0,0,0,0,0,0).branch(D6xA1,rule="extended")\n D6xA1(0,0,0,0,1,0,1) + D6xA1(0,1,0,0,0,0,0) + D6xA1(0,0,0,0,0,0,2)\n sage: A5xA2 = WeylCharacterRing("A5xA2",style="coroots")\n sage: E7(1,0,0,0,0,0,0).branch(A5xA2,rule="extended")\n A5xA2(0,0,0,1,0,1,0) + A5xA2(0,1,0,0,0,0,1) + A5xA2(1,0,0,0,1,0,0) + A5xA2(0,0,0,0,0,1,1)\n sage: E8 = WeylCharacterRing("E8",style="coroots")\n sage: D8 = WeylCharacterRing("D8",style="coroots")\n sage: A8 = WeylCharacterRing("A8",style="coroots")\n sage: E8(0,0,0,0,0,0,0,1).branch(D8,rule="extended") # long time (0.56s)\n D8(0,0,0,0,0,0,1,0) + D8(0,1,0,0,0,0,0,0)\n sage: E8(0,0,0,0,0,0,0,1).branch(A8,rule="extended") # long time (0.73s)\n A8(0,0,0,0,0,1,0,0) + A8(0,0,1,0,0,0,0,0) + A8(1,0,0,0,0,0,0,1)\n sage: F4(1,0,0,0).branch(A1xC3,rule="extended") # (0.05s)\n A1xC3(1,0,0,1) + A1xC3(2,0,0,0) + A1xC3(0,2,0,0)\n sage: G2(0,1).branch(A1xA1, rule="extended")\n A1xA1(2,0) + A1xA1(3,1) + A1xA1(0,2)\n sage: F4(0,0,0,1).branch(A2xA2, rule="extended") # (0.4s)\n A2xA2(0,1,0,1) + A2xA2(1,0,1,0) + A2xA2(0,0,1,1)\n sage: F4(0,0,0,1).branch(A3xA1,rule="extended") # (0.34s)\n A3xA1(0,0,0,0) + A3xA1(0,0,1,1) + A3xA1(0,1,0,0) + A3xA1(1,0,0,1) + A3xA1(0,0,0,2)\n sage: D4=WeylCharacterRing("D4",style="coroots")\n sage: D2xD2=WeylCharacterRing("D2xD2",style="coroots") # We get D4 => A1xA1xA1xA1 by remembering that A1xA1 = D2.\n sage: [D4(fw).branch(D2xD2, rule="extended") for fw in D4.fundamental_weights()]\n [D2xD2(1,1,0,0) + D2xD2(0,0,1,1),\n D2xD2(2,0,0,0) + D2xD2(0,2,0,0) + D2xD2(1,1,1,1) + D2xD2(0,0,2,0) + D2xD2(0,0,0,2),\n D2xD2(1,0,0,1) + D2xD2(0,1,1,0),\n D2xD2(1,0,1,0) + D2xD2(0,1,0,1)]\n\n .. RUBRIC:: Orthogonal Sum\n\n Using ``rule="orthogonal_sum"``, for `n = a + b + c + \\cdots`,\n you can get any branching rule\n\n .. MATH::\n\n \\begin{aligned}\n SO(n) & \\Rightarrow SO(a) \\times SO(b) \\times SO(c) \\times \\cdots,\n \\\\ Sp(2n) & \\Rightarrow Sp(2a) \\times Sp(2b) \\times Sp(2c) x \\times \\cdots,\n \\end{aligned}\n\n where `O(a)` is type `D_r` for `a = 2r` or `B_r` for `a = 2r+1`\n and `Sp(2r)` is type `C_r`. In some cases these are also of\n extended type, as in the case `D_3 \\times D_3 \\Rightarrow D_6` discussed above.\n But in other cases, for example `B_3 \\times B_3 \\Rightarrow D_7`, they are not\n of extended type.\n\n .. RUBRIC:: Tensor\n\n There are branching rules:\n\n .. MATH::\n\n \\begin{aligned}\n A_{rs-1} & \\Rightarrow A_{r-1} \\times A_{s-1},\n \\\\ B_{2rs+r+s} & \\Rightarrow B_r \\times B_s,\n \\\\ D_{2rs+s} & \\Rightarrow B_r \\times D_s,\n \\\\ D_{2rs} & \\Rightarrow D_r \\times D_s,\n \\\\ D_{2rs} & \\Rightarrow C_r \\times C_s,\n \\\\ C_{2rs+s} & \\Rightarrow B_r \\times C_s,\n \\\\ C_{2rs} & \\Rightarrow C_r \\times D_s.\n \\end{aligned}\n\n corresponding to the tensor product homomorphism. For type\n `A`, the homomorphism is `GL(r) \\times GL(s) \\Rightarrow GL(rs)`. For the\n classical types, the relevant fact is that if `V, W` are\n orthogonal or symplectic spaces, that is, spaces endowed\n with symmetric or skew-symmetric bilinear forms, then `V \\otimes W`\n is also an orthogonal space (if `V` and `W` are both\n orthogonal or both symplectic) or symplectic (if one of\n `V` and `W` is orthogonal and the other symplectic).\n\n The corresponding branching rules are obtained using ``rule="tensor"``.\n\n EXAMPLES::\n\n sage: A5=WeylCharacterRing("A5", style="coroots")\n sage: A2xA1=WeylCharacterRing("A2xA1", style="coroots")\n sage: [A5(hwv).branch(A2xA1, rule="tensor") for hwv in A5.fundamental_weights()]\n [A2xA1(1,0,1),\n A2xA1(0,1,2) + A2xA1(2,0,0),\n A2xA1(1,1,1) + A2xA1(0,0,3),\n A2xA1(1,0,2) + A2xA1(0,2,0),\n A2xA1(0,1,1)]\n sage: B4=WeylCharacterRing("B4",style="coroots")\n sage: B1xB1=WeylCharacterRing("B1xB1",style="coroots")\n sage: [B4(f).branch(B1xB1,rule="tensor") for f in B4.fundamental_weights()]\n [B1xB1(2,2),\n B1xB1(2,0) + B1xB1(2,4) + B1xB1(4,2) + B1xB1(0,2),\n B1xB1(2,0) + B1xB1(2,2) + B1xB1(2,4) + B1xB1(4,2) + B1xB1(4,4) + B1xB1(6,0) + B1xB1(0,2) + B1xB1(0,6),\n B1xB1(1,3) + B1xB1(3,1)]\n sage: D4=WeylCharacterRing("D4",style="coroots")\n sage: C2xC1=WeylCharacterRing("C2xC1",style="coroots")\n sage: [D4(f).branch(C2xC1,rule="tensor") for f in D4.fundamental_weights()]\n [C2xC1(1,0,1),\n C2xC1(0,1,2) + C2xC1(2,0,0) + C2xC1(0,0,2),\n C2xC1(1,0,1),\n C2xC1(0,1,0) + C2xC1(0,0,2)]\n sage: C3=WeylCharacterRing("C3",style="coroots")\n sage: B1xC1=WeylCharacterRing("B1xC1",style="coroots")\n sage: [C3(f).branch(B1xC1,rule="tensor") for f in C3.fundamental_weights()]\n [B1xC1(2,1), B1xC1(2,2) + B1xC1(4,0), B1xC1(4,1) + B1xC1(0,3)]\n\n .. RUBRIC:: Symmetric Power\n\n The `k`-th symmetric and exterior power homomorphisms map\n\n .. MATH::\n\n GL(n) \\Rightarrow GL\\left(\\binom{n+k-1}{k}\\right)\n \\times GL\\left(\\binom{n}{k}\\right).\n\n The corresponding branching rules are not implemented but a special\n case is. The `k`-th symmetric power homomorphism `SL(2) \\Rightarrow GL(k+1)`\n has its image inside of `SO(2r+1)` if `k = 2r` and inside of `Sp(2r)` if\n `k = 2r - 1`. Hence there are branching rules:\n\n .. MATH::\n\n \\begin{aligned}\n B_r & \\Rightarrow A_1\n \\\\ C_r & \\Rightarrow A_1\n \\end{aligned}\n\n and these may be obtained using the rule "symmetric_power".\n\n EXAMPLES::\n\n sage: A1=WeylCharacterRing("A1",style="coroots")\n sage: B3=WeylCharacterRing("B3",style="coroots")\n sage: C3=WeylCharacterRing("C3",style="coroots")\n sage: [B3(fw).branch(A1,rule="symmetric_power") for fw in B3.fundamental_weights()]\n [A1(6), A1(2) + A1(6) + A1(10), A1(0) + A1(6)]\n sage: [C3(fw).branch(A1,rule="symmetric_power") for fw in C3.fundamental_weights()]\n [A1(5), A1(4) + A1(8), A1(3) + A1(9)]\n\n .. RUBRIC:: Miscellaneous\n\n Use ``rule="miscellaneous"`` for the following embeddings of maximal subgroups,\n all involving exceptional groups.\n\n .. MATH::\n\n \\begin{aligned}\n B_3 & \\Rightarrow G_2,\n \\\\ E_6 & \\Rightarrow G_2,\n \\\\ E_6 & \\Rightarrow A_2,\n \\\\ F_4 & \\Rightarrow G_2 \\times A_1,\n \\\\ E_6 & \\Rightarrow G_2 \\times A_2,\n \\\\ E_7 & \\Rightarrow G_2 \\times C_3,\n \\\\ E_7 & \\Rightarrow F_4 \\times A_1,\n \\\\ E_7 & \\Rightarrow A_1 \\times A_1,\n \\\\ E_7 & \\Rightarrow G_2 \\times A_1,\n \\\\ E_8 & \\Rightarrow G_2 \\times F_4.\n \\\\ E_8 & \\Rightarrow A2 \\times A_1.\n \\\\ E_8 & \\Rightarrow B2.\n \\end{aligned}\n\n Except for those embeddings available by ``rule="extended"``, these\n are the only embeddings of these groups as maximal subgroups.\n There may be other embeddings besides these. For example,\n there are other more obvious embeddings of `A_2` and `G_2` into `E_6`.\n However the embeddings in this table are characterized as embeddings\n as maximal subgroups. Regarding the embeddings of `A_2` and `G_2` in\n `E_6`, the embeddings in question may be characterized by the condition that the\n 27-dimensional representations of `E_6` restrict irreducibly to `A_2` or\n `G_2`. Since `G_2` has a subgroup isomorphic to `A_2`, it is worth\n mentioning that the composite branching rules::\n\n branching_rule("E6","G2","miscellaneous")*branching_rule("G2","A2","extended")\n branching_rule("E6","A2","miscellaneous")\n\n are distinct.\n\n These embeddings are described more completely (with references\n to the literature) in the thematic tutorial at:\n\n https://doc.sagemath.org/html/en/thematic_tutorials/lie.html\n\n\n EXAMPLES::\n\n sage: G2 = WeylCharacterRing("G2")\n sage: [fw1, fw2, fw3] = B3.fundamental_weights()\n sage: B3(fw1+fw3).branch(G2, rule="miscellaneous")\n G2(1,0,-1) + G2(2,-1,-1) + G2(2,0,-2)\n sage: E6 = WeylCharacterRing("E6",style="coroots")\n sage: G2 = WeylCharacterRing("G2",style="coroots")\n sage: E6(1,0,0,0,0,0).branch(G2,"miscellaneous")\n G2(2,0)\n sage: A2=WeylCharacterRing("A2",style="coroots")\n sage: E6(1,0,0,0,0,0).branch(A2,rule="miscellaneous")\n A2(2,2)\n sage: E6(0,1,0,0,0,0).branch(A2,rule="miscellaneous")\n A2(1,1) + A2(1,4) + A2(4,1)\n sage: E6(0,0,0,0,0,2).branch(G2,"miscellaneous") # long time (0.59s)\n G2(0,0) + G2(2,0) + G2(1,1) + G2(0,2) + G2(4,0)\n sage: F4=WeylCharacterRing("F4",style="coroots")\n sage: G2xA1=WeylCharacterRing("G2xA1",style="coroots")\n sage: F4(0,0,1,0).branch(G2xA1,rule="miscellaneous")\n G2xA1(1,0,0) + G2xA1(1,0,2) + G2xA1(1,0,4) + G2xA1(1,0,6) + G2xA1(0,1,4) + G2xA1(2,0,2) + G2xA1(0,0,2) + G2xA1(0,0,6)\n sage: E6 = WeylCharacterRing("E6",style="coroots")\n sage: A2xG2 = WeylCharacterRing("A2xG2",style="coroots")\n sage: E6(1,0,0,0,0,0).branch(A2xG2,rule="miscellaneous")\n A2xG2(0,1,1,0) + A2xG2(2,0,0,0)\n sage: E7=WeylCharacterRing("E7",style="coroots")\n sage: G2xC3=WeylCharacterRing("G2xC3",style="coroots")\n sage: E7(0,1,0,0,0,0,0).branch(G2xC3,rule="miscellaneous") # long time (1.84s)\n G2xC3(1,0,1,0,0) + G2xC3(1,0,1,1,0) + G2xC3(0,1,0,0,1) + G2xC3(2,0,1,0,0) + G2xC3(0,0,1,1,0)\n sage: F4xA1=WeylCharacterRing("F4xA1",style="coroots")\n sage: E7(0,0,0,0,0,0,1).branch(F4xA1,"miscellaneous")\n F4xA1(0,0,0,1,1) + F4xA1(0,0,0,0,3)\n sage: A1xA1=WeylCharacterRing("A1xA1",style="coroots")\n sage: E7(0,0,0,0,0,0,1).branch(A1xA1,rule="miscellaneous")\n A1xA1(2,5) + A1xA1(4,1) + A1xA1(6,3)\n sage: A2=WeylCharacterRing("A2",style="coroots")\n sage: E7(0,0,0,0,0,0,1).branch(A2,rule="miscellaneous")\n A2(0,6) + A2(6,0)\n sage: G2xA1=WeylCharacterRing("G2xA1",style="coroots")\n sage: E7(1,0,0,0,0,0,0).branch(G2xA1,rule="miscellaneous")\n G2xA1(1,0,4) + G2xA1(0,1,0) + G2xA1(2,0,2) + G2xA1(0,0,2)\n sage: E8 = WeylCharacterRing("E8",style="coroots")\n sage: G2xF4 = WeylCharacterRing("G2xF4",style="coroots")\n sage: E8(0,0,0,0,0,0,0,1).branch(G2xF4,rule="miscellaneous") # long time (0.76s)\n G2xF4(1,0,0,0,0,1) + G2xF4(0,1,0,0,0,0) + G2xF4(0,0,1,0,0,0)\n sage: E8=WeylCharacterRing("E8",style="coroots")\n sage: A1xA2=WeylCharacterRing("A1xA2",style="coroots")\n sage: E8(0,0,0,0,0,0,0,1).branch(A1xA2,rule="miscellaneous") # long time (0.76s)\n A1xA2(2,0,0) + A1xA2(2,2,2) + A1xA2(4,0,3) + A1xA2(4,3,0) + A1xA2(6,1,1) + A1xA2(0,1,1)\n sage: B2=WeylCharacterRing("B2",style="coroots")\n sage: E8(0,0,0,0,0,0,0,1).branch(B2,rule="miscellaneous") # long time (0.53s)\n B2(0,2) + B2(0,6) + B2(3,2)\n\n .. RUBRIC:: A1 maximal subgroups of exceptional groups\n\n There are seven cases where the exceptional group `G_2`, `F_4`,\n `E_7` or `E_8` contains a maximal subgroup of type `A_1`.\n These are tabulated in Theorem 1 of Testerman,\n The construction of the maximal A1\'s in the exceptional algebraic groups,\n Proc. Amer. Math. Soc. 116 (1992), no. 3, 635-644. The\n names of these branching rules are roman numerals referring\n to the seven cases of her Theorem 1. Use these branching\n rules as in the following examples.\n\n EXAMPLES::\n\n sage: A1=WeylCharacterRing("A1",style="coroots")\n sage: G2=WeylCharacterRing("G2",style="coroots")\n sage: F4=WeylCharacterRing("F4",style="coroots")\n sage: E7=WeylCharacterRing("E7",style="coroots")\n sage: E8=WeylCharacterRing("E8",style="coroots")\n sage: [G2(f).branch(A1,rule="i") for f in G2.fundamental_weights()]\n [A1(6), A1(2) + A1(10)]\n sage: F4(1,0,0,0).branch(A1,rule="ii")\n A1(2) + A1(10) + A1(14) + A1(22)\n sage: E7(0,0,0,0,0,0,1).branch(A1,rule="iii")\n A1(9) + A1(17) + A1(27)\n sage: E7(0,0,0,0,0,0,1).branch(A1,rule="iv")\n A1(5) + A1(11) + A1(15) + A1(21)\n sage: E8(0,0,0,0,0,0,0,1).branch(A1,rule="v") # long time (0.6s)\n A1(2) + A1(14) + A1(22) + A1(26) + A1(34) + A1(38) + A1(46) + A1(58)\n sage: E8(0,0,0,0,0,0,0,1).branch(A1,rule="vi") # long time (0.6s)\n A1(2) + A1(10) + A1(14) + A1(18) + A1(22) + A1(26) + A1(28) + A1(34) + A1(38) + A1(46)\n sage: E8(0,0,0,0,0,0,0,1).branch(A1,rule="vii") # long time (0.6s)\n A1(2) + A1(6) + A1(10) + A1(14) + A1(16) + A1(18) + 2*A1(22) + A1(26) + A1(28) + A1(34) + A1(38)\n\n .. RUBRIC:: Branching Rules From Plethysms\n\n Nearly all branching rules `G \\Rightarrow H` where `G` is of type `A`, `B`, `C`\n or `D` are covered by the preceding rules. The function\n :func:`branching_rule_from_plethysm` covers the remaining cases.\n\n This is a general rule that includes any branching rule\n from types `A`, `B`, `C`, or `D` as a special case. Thus it could be\n used in place of the above rules and would give the same\n results. However it is most useful when branching from `G`\n to a maximal subgroup `H` such that\n `\\mathrm{rank}(H) < \\mathrm{rank}(G) - 1`.\n\n We consider a homomorphism `H \\Rightarrow G` where `G` is one of\n `SL(r+1)`, `SO(2r+1)`, `Sp(2r)` or `SO(2r)`. The function\n :func:`branching_rule_from_plethysm` produces the corresponding\n branching rule. The main ingredient is the character\n `\\chi` of the representation of `H` that is the homomorphism\n to `GL(r+1)`, `GL(2r+1)` or `GL(2r)`.\n\n This rule is so powerful that it contains the other\n rules implemented above as special cases. First let\n us consider the symmetric fifth power representation\n of `SL(2)`.\n\n ::\n\n sage: A1=WeylCharacterRing("A1",style="coroots")\n sage: chi=A1([5])\n sage: chi.degree()\n 6\n sage: chi.frobenius_schur_indicator()\n -1\n\n This confirms that the character has degree 6 and\n is symplectic, so it corresponds to a homomorphism\n `SL(2) \\Rightarrow Sp(6)`, and there is a corresponding\n branching rule `C_3 \\Rightarrow A_1`.\n\n ::\n\n sage: C3 = WeylCharacterRing("C3",style="coroots")\n sage: sym5rule = branching_rule_from_plethysm(chi,"C3")\n sage: [C3(hwv).branch(A1,rule=sym5rule) for hwv in C3.fundamental_weights()]\n [A1(5), A1(4) + A1(8), A1(3) + A1(9)]\n\n This is identical to the results we would obtain using\n ``rule="symmetric_power"``. The next example gives a branching\n not available by other standard rules.\n\n ::\n\n sage: G2 = WeylCharacterRing("G2",style="coroots")\n sage: D7 = WeylCharacterRing("D7",style="coroots")\n sage: ad=G2(0,1); ad.degree(); ad.frobenius_schur_indicator()\n 14\n 1\n sage: spin = D7(0,0,0,0,0,1,0); spin.degree()\n 64\n sage: spin.branch(G2, rule=branching_rule_from_plethysm(ad, "D7"))\n G2(1,1)\n\n We have confirmed that the adjoint representation of `G_2`\n gives a homomorphism into `SO(14)`, and that the pullback\n of the one of the two 64 dimensional spin representations\n to `SO(14)` is an irreducible representation of `G_2`.\n\n We do not actually have to create the character or\n its parent WeylCharacterRing to create the\n branching rule::\n\n sage: b = branching_rule("C7","C3(0,0,1)","plethysm"); b\n plethysm (along C3(0,0,1)) branching rule C7 => C3\n\n .. RUBRIC:: Isomorphic Type\n\n Although not usually referred to as a branching\n rule, the effects of the accidental isomorphisms may be handled\n using ``rule="isomorphic"``:\n\n .. MATH::\n\n \\begin{aligned}\n B_2 & \\Rightarrow C_2\n \\\\ C_2 & \\Rightarrow B_2\n \\\\ A_3 & \\Rightarrow D_3\n \\\\ D_3 & \\Rightarrow A_3\n \\\\ D_2 & \\Rightarrow A_1 \\Rightarrow A_1\n \\\\ B_1 & \\Rightarrow A_1\n \\\\ C_1 & \\Rightarrow A_1\n \\end{aligned}\n\n EXAMPLES::\n\n sage: B2 = WeylCharacterRing("B2")\n sage: C2 = WeylCharacterRing("C2")\n sage: [B2(x).branch(C2, rule="isomorphic") for x in B2.fundamental_weights()]\n [C2(1,1), C2(1,0)]\n sage: [C2(x).branch(B2, rule="isomorphic") for x in C2.fundamental_weights()]\n [B2(1/2,1/2), B2(1,0)]\n sage: D3 = WeylCharacterRing("D3")\n sage: A3 = WeylCharacterRing("A3")\n sage: [A3(x).branch(D3,rule="isomorphic") for x in A3.fundamental_weights()]\n [D3(1/2,1/2,1/2), D3(1,0,0), D3(1/2,1/2,-1/2)]\n sage: [D3(x).branch(A3,rule="isomorphic") for x in D3.fundamental_weights()]\n [A3(1/2,1/2,-1/2,-1/2), A3(1/4,1/4,1/4,-3/4), A3(3/4,-1/4,-1/4,-1/4)]\n\n Here `A_3(x,y,z,w)` can be understood as a representation of `SL(4)`.\n The weights `x,y,z,w` and `x+t,y+t,z+t,w+t` represent the same\n representation of `SL(4)` - though not of `GL(4)` - since\n `A_3(x+t,y+t,z+t,w+t)` is the same as `A_3(x,y,z,w)` tensored with\n `\\mathrm{det}^t`. So as a representation of `SL(4)`,\n ``A3(1/4,1/4,1/4,-3/4)`` is the same as ``A3(1,1,1,0)``. The exterior\n square representation `SL(4) \\Rightarrow GL(6)` admits an invariant symmetric\n bilinear form, so is a representation `SL(4) \\Rightarrow SO(6)` that lifts to\n an isomorphism `SL(4) \\Rightarrow \\mathrm{Spin}(6)`. Conversely, there are two\n isomorphisms `SO(6) \\Rightarrow SL(4)`, of which we\'ve selected one.\n\n In cases like this you might prefer ``style="coroots"``::\n\n sage: A3 = WeylCharacterRing("A3",style="coroots")\n sage: D3 = WeylCharacterRing("D3",style="coroots")\n sage: [D3(fw) for fw in D3.fundamental_weights()]\n [D3(1,0,0), D3(0,1,0), D3(0,0,1)]\n sage: [D3(fw).branch(A3,rule="isomorphic") for fw in D3.fundamental_weights()]\n [A3(0,1,0), A3(0,0,1), A3(1,0,0)]\n sage: D2 = WeylCharacterRing("D2", style="coroots")\n sage: A1xA1 = WeylCharacterRing("A1xA1", style="coroots")\n sage: [D2(fw).branch(A1xA1,rule="isomorphic") for fw in D2.fundamental_weights()]\n [A1xA1(1,0), A1xA1(0,1)]\n\n .. RUBRIC:: Branching From a Reducible WeylCharacterRing\n\n If the Cartan Type of R is reducible, we may project a character onto\n any of the components, or any combination of components. The rule to\n project on the first component is specified by the string ``"proj1"``,\n the rule to project on the second component is ``"proj2". To\n project on the first and third components, use ``"proj13"`` and so on.\n\n EXAMPLES::\n\n sage: A2xG2=WeylCharacterRing("A2xG2",style="coroots")\n sage: A2=WeylCharacterRing("A2",style="coroots")\n sage: G2=WeylCharacterRing("G2",style="coroots")\n sage: A2xG2(1,0,1,0).branch(A2,rule="proj1")\n 7*A2(1,0)\n sage: A2xG2(1,0,1,0).branch(G2,rule="proj2")\n 3*G2(1,0)\n sage: A2xA2xG2=WeylCharacterRing("A2xA2xG2",style="coroots")\n sage: A2xA2xG2(0,1,1,1,0,1).branch(A2xG2,rule="proj13")\n 8*A2xG2(0,1,0,1)\n\n A more general way of specifying a branching rule from a reducible type is\n to supply a *list* of rules, one *component rule* for each\n component type in the root system. In the following example, we branch the\n fundamental representations of `D_4` down to `A_1\\times A_1\\times A_1\n \\times A_1` through the intermediate group `D_2\\times D_2`. We use\n multiplicative notation to compose the branching rules. There is no need\n to construct the intermediate WeylCharacterRing with type `D_2\\times D_2`.\n\n EXAMPLES::\n\n sage: D4 = WeylCharacterRing("D4",style="coroots")\n sage: A1xA1xA1xA1 = WeylCharacterRing("A1xA1xA1xA1",style="coroots")\n sage: b = branching_rule("D2","A1xA1","isomorphic")\n sage: br = branching_rule("D4","D2xD2","extended")*branching_rule("D2xD2","A1xA1xA1xA1",[b,b])\n sage: [D4(fw).branch(A1xA1xA1xA1,rule=br) for fw in D4.fundamental_weights()]\n [A1xA1xA1xA1(1,1,0,0) + A1xA1xA1xA1(0,0,1,1),\n A1xA1xA1xA1(1,1,1,1) + A1xA1xA1xA1(2,0,0,0) + A1xA1xA1xA1(0,2,0,0) + A1xA1xA1xA1(0,0,2,0) + A1xA1xA1xA1(0,0,0,2),\n A1xA1xA1xA1(1,0,0,1) + A1xA1xA1xA1(0,1,1,0),\n A1xA1xA1xA1(1,0,1,0) + A1xA1xA1xA1(0,1,0,1)]\n\n In the list of rules to be supplied in branching from a reducible root\n system, we may use two key words "omit" and "identity". The term "omit"\n means that we omit one factor, projecting onto the remaining factors.\n The term "identity" is supplied when the irreducible factor Cartan Types\n of both the target and the source are the same, and the component\n branching rule is to be the identity map. For example, we have\n projection maps from `A_3\\times A_2` to `A_3` and `A_2`, and\n the corresponding branching may be accomplished as follows. In\n this example the same could be accomplished using ``rule="proj2"``.\n\n EXAMPLES::\n\n sage: A3xA2=WeylCharacterRing("A3xA2",style="coroots")\n sage: A3=WeylCharacterRing("A3",style="coroots")\n sage: chi = A3xA2(0,1,0,1,0)\n sage: chi.branch(A3,rule=["identity","omit"])\n 3*A3(0,1,0)\n sage: A2=WeylCharacterRing("A2",style="coroots")\n sage: chi.branch(A2,rule=["omit","identity"])\n 6*A2(1,0)\n\n Yet another way of branching from a reducible root system with\n repeated Cartan types is to embed along the diagonal. The\n branching rule is equivalent to the tensor product, as\n the example shows::\n\n sage: G2=WeylCharacterRing("G2",style="coroots")\n sage: G2xG2=WeylCharacterRing("G2xG2",style="coroots")\n sage: G2=WeylCharacterRing("G2",style="coroots")\n sage: G2xG2(1,0,0,1).branch(G2,rule="diagonal")\n G2(1,0) + G2(2,0) + G2(1,1)\n sage: G2xG2(1,0,0,1).branch(G2,rule="diagonal") == G2(1,0)*G2(0,1)\n True\n\n .. RUBRIC:: Writing Your Own (Branching) Rules\n\n Suppose you want to branch from a group `G` to a subgroup `H`.\n Arrange the embedding so that a Cartan subalgebra `U` of `H` is\n contained in a Cartan subalgebra `T` of `G`. There is thus\n a mapping from the weight spaces `\\mathrm{Lie}(T)^* \\Rightarrow \\mathrm{Lie}(U)^*`.\n Two embeddings will produce identical branching rules if they\n differ by an element of the Weyl group of `H`.\n\n The *rule* is this map `\\mathrm{Lie}(T)^*`, which is ``G.space()``, to\n `\\mathrm{Lie}(U)^*`, which is ``H.space()``,\n which you may implement as a function. As an example, let\n us consider how to implement the branching rule `A_3 \\Rightarrow C_2`.\n Here `H = C_2 = Sp(4)` embedded as a subgroup in `A_3 = GL(4)`. The\n Cartan subalgebra `U` consists of diagonal matrices with\n eigenvalues `u_1, u_2, -u_2, -u_1`. The ``C2.space()`` is the\n two dimensional vector spaces consisting of the linear\n functionals `u_1` and `u_2` on `U`. On the other hand `\\mathrm{Lie}(T)` is\n `\\RR^4`. A convenient way to see the restriction is to\n think of it as the adjoint of the map `(u_1, u_2) \\mapsto\n (u_1,u_2, -u_2, -u_1)`,\n that is, `(x_0, x_1, x_2, x_3) \\Rightarrow (x_0 - x_3, x_1 - x_2)`. Hence we may\n encode the rule as follows::\n\n def rule(x):\n return [x[0]-x[3],x[1]-x[2]]\n\n or simply::\n\n rule = lambda x: [x[0]-x[3],x[1]-x[2]]\n\n We may now make and use the branching rule as follows.\n\n EXAMPLES::\n\n sage: br = BranchingRule("A3", "C2", lambda x: [x[0]-x[3],x[1]-x[2]], "homemade"); br\n homemade branching rule A3 => C2\n sage: [A3,C2]=[WeylCharacterRing(x,style="coroots") for x in ["A3","C2"]]\n sage: A3(0,1,0).branch(C2,rule=br)\n C2(0,0) + C2(0,1)\n '
if isinstance(rule, (str, list)):
rule = branching_rule(R._cartan_type, S._cartan_type, rule)
if hasattr(rule, '_S'):
if (rule._S != S.cartan_type()):
raise ValueError('rule has wrong target Cartan type')
mdict = {}
for k in chi.weight_multiplicities():
if (S._style == 'coroots'):
if (S._cartan_type.is_atomic() and (S._cartan_type[0] == 'E')):
if (S._cartan_type[1] == 6):
h = S._space(rule(list(k.to_vector()))).coerce_to_e6()
elif (S._cartan_type[1] == 7):
h = S._space(rule(list(k.to_vector()))).coerce_to_e7()
else:
h = S._space(rule(list(k.to_vector()))).coerce_to_sl()
else:
h = S._space(rule(list(k.to_vector())))
chi_mdict = chi.weight_multiplicities()
if (h in mdict):
mdict[h] += chi_mdict[k]
else:
mdict[h] = chi_mdict[k]
return S.char_from_weights(mdict)
|
class BranchingRule(SageObject):
'\n A class for branching rules.\n '
def __init__(self, R, S, f, name='default', intermediate_types=[], intermediate_names=[]):
'\n INPUT:\n\n - ``R, S`` -- CartanTypes\n - ``f`` -- a function from the weight lattice of R to the weight lattice of S.\n '
self._R = CartanType(R)
self._S = CartanType(S)
self._f = f
self._intermediate_types = intermediate_types
if intermediate_names:
self._intermediate_names = intermediate_names
else:
self._intermediate_names = [name]
self._name = name
def _repr_(self):
'\n EXAMPLES::\n\n sage: branching_rule("E6","F4","symmetric")\n symmetric branching rule E6 => F4\n sage: b=branching_rule("F4","B3",rule="levi")*branching_rule("B3","G2",rule="miscellaneous"); b\n composite branching rule F4 => (levi) B3 => (miscellaneous) G2\n '
R_repr = self._R._repr_(compact=True)
S_repr = self._S._repr_(compact=True)
if (self._name == 'composite'):
ret = ('composite branching rule %s => ' % R_repr)
for i in range(len(self._intermediate_types)):
intt = self._intermediate_types[i]
intn = self._intermediate_names[i]
ret += ('(%s) %s => ' % (intn, intt._repr_(compact=True)))
ret += ('(%s) %s' % (self._intermediate_names[(- 1)], S_repr))
return ret
return ('%s branching rule %s => %s' % (self._name, R_repr, S_repr))
def __call__(self, x):
'\n EXAMPLES::\n\n sage: b=branching_rule("A3","C2","symmetric")\n sage: b([2,1,0,0])\n [2, 1]\n '
try:
return self._f(x)
except Exception:
return self._f(x.to_vector())
def __eq__(self, other):
'\n Two branching rules with the same source and target Cartan types are\n considered equal if they are the same as mappings from the weight\n lattice of the larger group to the smaller. The last example shows\n that two rules may be different by this criterion yet describe the\n same branching, if they differ by conjugation by an element of the\n Weyl group.\n\n EXAMPLES::\n\n sage: b = branching_rule("E6","F4","symmetric")*branching_rule("F4","B3","levi")*branching_rule("B3","G2","miscellaneous"); b\n composite branching rule E6 => (symmetric) F4 => (levi) B3 => (miscellaneous) G2\n sage: c = branching_rule("E6", "G2xA2", "miscellaneous")*branching_rule("G2xA2", "G2", "proj1"); c\n composite branching rule E6 => (miscellaneous) G2xA2 => (proj1) G2\n sage: b == c\n True\n sage: d = branching_rule("A3","A2","levi")*branching_rule("A2","A1","levi"); d\n composite branching rule A3 => (levi) A2 => (levi) A1\n sage: e = branching_rule("A3","D3","isomorphic")*branching_rule("D3","B2","symmetric")*branching_rule("B2","A1","levi"); e\n composite branching rule A3 => (isomorphic) D3 => (symmetric) B2 => (levi) A1\n sage: d == e\n False\n sage: b1 = BranchingRule("A2","A2",lambda x: [x[2], x[1], x[0]], "long Weyl element conjugation")\n sage: b2 = BranchingRule("A2","A2",lambda x: x, "identity map")\n sage: b1 == b2\n False\n sage: A2 = WeylCharacterRing("A2",style="coroots")\n sage: [A2(f).branch(A2,rule=b1) == A2(f).branch(A2,rule=b2) for f in A2.fundamental_weights()]\n [True, True]\n '
if (not isinstance(other, BranchingRule)):
return False
Rspace = RootSystem(self._R).ambient_space()
Rspace_other = RootSystem(other._R).ambient_space()
if (Rspace != Rspace_other):
return False
Sspace = RootSystem(self._S).ambient_space()
Sspace_other = RootSystem(other._S).ambient_space()
if (Sspace != Sspace_other):
return False
for v in Rspace.fundamental_weights():
w = list(v.to_vector())
if (Sspace(self(w)) != Sspace(other(w))):
return False
return True
def __ne__(self, other):
'\n Test inequality\n\n EXAMPLES::\n\n sage: b1 = BranchingRule("A2","A2",lambda x: [x[2], x[1], x[0]], "long Weyl element conjugation")\n sage: b2 = BranchingRule("A2","A2",lambda x: x, "identity map")\n sage: b1 != b2\n True\n '
return (not (self == other))
def __mul__(self, other):
'\n EXAMPLES::\n\n sage: E6 = WeylCharacterRing("E6",style="coroots")\n sage: A5 = WeylCharacterRing("A5",style="coroots")\n sage: br = branching_rule("E6","A5xA1",rule="extended")*branching_rule("A5xA1","A5",rule="proj1"); br\n composite branching rule E6 => (extended) A5xA1 => (proj1) A5\n sage: E6(1,0,0,0,0,0).branch(A5,rule=br)\n A5(0,0,0,1,0) + 2*A5(1,0,0,0,0)\n '
if (self._S == other._R):
intermediates = flatten([self._intermediate_types, self._S, other._intermediate_types])
internames = flatten([self._intermediate_names, other._intermediate_names])
def f(x):
return other._f(self._f(x))
return BranchingRule(self._R, other._S, f, 'composite', intermediate_types=intermediates, intermediate_names=internames)
else:
raise ValueError("unable to define composite: source and target don't agree")
def Rtype(self):
'\n In a branching rule R => S, returns the Cartan Type of the ambient group R.\n\n EXAMPLES::\n\n sage: branching_rule("A3","A2","levi").Rtype()\n [\'A\', 3]\n '
return self._R
def Stype(self):
'\n In a branching rule R => S, returns the Cartan Type of the subgroup S.\n\n EXAMPLES::\n\n sage: branching_rule("A3","A2","levi").Stype()\n [\'A\', 2]\n '
return self._S
def describe(self, verbose=False, debug=False, no_r=False):
'\n Describes how extended roots restrict under self.\n\n EXAMPLES::\n\n sage: branching_rule("G2","A2","extended").describe()\n <BLANKLINE>\n 3\n O=<=O---O\n 1 2 0\n G2~\n <BLANKLINE>\n root restrictions G2 => A2:\n <BLANKLINE>\n O---O\n 1 2\n A2\n <BLANKLINE>\n 0 => 2\n 2 => 1\n <BLANKLINE>\n For more detailed information use verbose=True\n\n In this example, `0` is the affine root, that is, the negative\n of the highest root, for `"G2"`. If `i => j` is printed, this\n means that the i-th simple (or affine) root of the ambient\n group restricts to the j-th simple root of the subgroup.\n For reference the Dynkin diagrams are also printed. The\n extended Dynkin diagram of the ambient group is printed if\n the affine root restricts to a simple root. More information\n is printed if the parameter `verbose` is true.\n '
Rspace = RootSystem(self._R).ambient_space()
Sspace = RootSystem(self._S).ambient_space()
if self._R.is_compound():
raise ValueError('Cannot describe branching rule from reducible type')
if (not no_r):
print(('\n%r' % self._R.affine().dynkin_diagram()))
if self._S.is_compound():
for j in range(len(self._S.component_types())):
ctype = self._S.component_types()[j]
component_rule = (self * branching_rule(self._S, ctype, ('proj%s' % (j + 1))))
print(('\nprojection %d on %s ' % ((j + 1), ctype._repr_(compact=True))), component_rule.describe(verbose=verbose, no_r=True))
if (not verbose):
print('\nfor more detailed information use verbose=True')
else:
print(('root restrictions %s => %s:' % (self._R._repr_(compact=True), self._S._repr_(compact=True))))
print(('\n%r\n' % self._S.dynkin_diagram()))
for j in self._R.affine().index_set():
if (j == 0):
r = (- Rspace.highest_root())
else:
r = Rspace.simple_roots()[j]
resr = Sspace(self(list(r.to_vector())))
if debug:
print(('root %d: r = %s, b(r)=%s' % (j, r, resr)))
done = False
if (resr == Sspace.zero()):
done = True
print(('%s => (zero)' % j))
else:
for s in Sspace.roots():
if (s == resr):
for i in self._S.index_set():
if (s == Sspace.simple_root(i)):
print(('%s => %s' % (j, i)))
done = True
break
if (not done):
done = True
if verbose:
print(('%s => root %s' % (j, s)))
if (not done):
done = True
if verbose:
print(('%s => weight %s' % (j, resr)))
if verbose:
print(('\nfundamental weight restrictions %s => %s:' % (self._R._repr_(compact=True), self._S._repr_(compact=True))))
for j in self._R.index_set():
resfw = Sspace(self(list(Rspace.fundamental_weight(j).to_vector())))
print(('%d => %s' % (j, tuple([resfw.inner_product(a) for a in Sspace.simple_coroots()]))))
if ((not no_r) and (not verbose)):
print('\nFor more detailed information use verbose=True')
def branch(self, chi, style=None):
'\n INPUT:\n\n - ``chi`` -- A character of the WeylCharacterRing with Cartan type self.Rtype().\n\n Returns the branched character.\n\n EXAMPLES::\n\n sage: G2=WeylCharacterRing("G2",style="coroots")\n sage: chi=G2(1,1); chi.degree()\n 64\n sage: b=G2.maximal_subgroup("A2"); b\n extended branching rule G2 => A2\n sage: b.branch(chi)\n A2(0,1) + A2(1,0) + A2(0,2) + 2*A2(1,1) + A2(2,0) + A2(1,2) + A2(2,1)\n sage: A2=WeylCharacterRing("A2",style="coroots"); A2\n The Weyl Character Ring of Type A2 with Integer Ring coefficients\n sage: chi.branch(A2,rule=b)\n A2(0,1) + A2(1,0) + A2(0,2) + 2*A2(1,1) + A2(2,0) + A2(1,2) + A2(2,1)\n\n '
from sage.combinat.root_system.weyl_characters import WeylCharacterRing
if (style is None):
style = chi.parent()._style
S = WeylCharacterRing(self.Stype(), style=style)
return chi.branch(S, rule=self)
|
def branching_rule(Rtype, Stype, rule='default'):
'\n Creates a branching rule.\n\n INPUT:\n\n - ``R`` -- the Weyl Character Ring of `G`\n\n - ``S`` -- the Weyl Character Ring of `H`\n\n - ``rule`` -- a string describing the branching rule as a map from\n the weight space of `S` to the weight space of `R`.\n\n If the rule parameter is omitted, in some cases, a default rule is supplied. See\n :func:`~sage.combinat.root_system.branching_rules.branch_weyl_character`.\n\n EXAMPLES::\n\n sage: rule = branching_rule(CartanType("A3"),CartanType("C2"),"symmetric")\n sage: [rule(x) for x in WeylCharacterRing("A3").fundamental_weights()]\n [[1, 0], [1, 1], [1, 0]]\n '
if (rule == 'plethysm'):
try:
S = sage.combinat.root_system.weyl_characters.WeylCharacterRing(Stype.split('(')[0], style='coroots')
chi = S(eval(('(' + Stype.split('(')[1])))
except Exception:
S = sage.combinat.root_system.weyl_characters.WeylCharacterRing(Stype.split('.')[0], style='coroots')
chi = eval(('S.' + Stype.split('.')[1]))
return branching_rule_from_plethysm(chi, Rtype)
Rtype = CartanType(Rtype)
Stype = CartanType(Stype)
r = Rtype.rank()
s = Stype.rank()
rdim = Rtype.root_system().ambient_space().dimension()
sdim = Stype.root_system().ambient_space().dimension()
if Rtype.is_compound():
Rtypes = Rtype.component_types()
if isinstance(rule, str):
if (rule[:4] == 'proj'):
name = rule
proj = [(int(j) - 1) for j in rule[4:]]
rule = []
for j in range(len(Rtypes)):
if (j in proj):
rule.append('identity')
else:
rule.append('omit')
elif (rule == 'diagonal'):
if (not Stype.is_compound()):
k = len(Rtypes)
n = RootSystem(Stype).ambient_space().dimension()
return BranchingRule(Rtype, Stype, (lambda x: [sum((x[(i + (n * j))] for j in range(k))) for i in range(n)]), 'diagonal')
raise ValueError('invalid Cartan types for diagonal branching rule')
else:
raise ValueError('Rule not found')
else:
name = repr(rule)
rules = []
stor = []
for i in range(len(Rtypes)):
l = rule[i]
if (l != 'omit'):
if (l == 'identity'):
rules.append(BranchingRule(Rtypes[i], Rtypes[i], (lambda x: x), 'identity'))
else:
rules.append(l)
stor.append(i)
shifts = Rtype._shifts
Stypes = [CartanType(ru._S) for ru in rules]
ntypes = len(Stypes)
if Stype.is_compound():
def br(x):
yl = []
for i in range(ntypes):
yl.append(rules[i](x[shifts[stor[i]]:shifts[(stor[i] + 1)]]))
return flatten(yl)
else:
j = stor[0]
rulej = rules[0]
def br(x):
return rulej(x[shifts[j]:shifts[(j + 1)]])
return BranchingRule(Rtype, Stype, br, name)
if Stype.is_compound():
stypes = Stype.component_types()
if (rule == 'default'):
if (not Rtype.is_compound()):
if (Stype.is_compound() and (s == (r - 1))):
try:
return branching_rule(Rtype, Stype, rule='levi')
except Exception:
pass
if (Rtype[0] == 'A'):
if ((Stype[0] == 'B') and (r == (2 * s))):
return branching_rule(Rtype, Stype, rule='symmetric')
elif ((Stype[0] == 'C') and (r == ((2 * s) - 1))):
return branching_rule(Rtype, Stype, rule='symmetric')
elif ((Stype[0] == 'D') and (r == ((2 * s) - 1))):
return branching_rule(Rtype, Stype, rule='symmetric')
elif ((Rtype[0] == 'B') and (Stype[0] == 'D') and (r == s)):
return branching_rule(Rtype, Stype, rule='extended')
elif ((Rtype[0] == 'D') and (Stype[0] == 'B') and (r == (s + 1))):
return branching_rule(Rtype, Stype, rule='symmetric')
if (s == (r - 1)):
try:
return branching_rule(Rtype, Stype, rule='levi')
except Exception:
pass
raise ValueError('No default rule found (you must specify the rule)')
elif (rule == 'identity'):
if (Rtype is not Stype):
raise ValueError('Cartan types must match for identity rule')
return BranchingRule(Rtype, Stype, (lambda x: x), 'identity')
elif (rule == 'levi'):
if (not (s == (r - 1))):
raise ValueError('Incompatible ranks')
if (Rtype[0] == 'A'):
if Stype.is_compound():
if (all(((ct[0] == 'A') for ct in stypes)) and (rdim == sdim)):
return BranchingRule(Rtype, Stype, (lambda x: x), 'levi')
else:
raise ValueError('Rule not found')
elif (Stype[0] == 'A'):
return BranchingRule(Rtype, Stype, (lambda x: list(x)[:r]), 'levi')
else:
raise ValueError('Rule not found')
elif (Rtype[0] in ['B', 'C', 'D']):
if Stype.is_atomic():
if (Stype[0] == 'A'):
return BranchingRule(Rtype, Stype, (lambda x: x), 'levi')
elif (Stype[0] == Rtype[0]):
return BranchingRule(Rtype, Stype, (lambda x: list(x)[1:]), 'levi')
elif ((stypes[(- 1)][0] == Rtype[0]) and all(((t[0] == 'A') for t in stypes[:(- 1)]))):
return BranchingRule(Rtype, Stype, (lambda x: x), 'levi')
else:
raise ValueError('Rule not found')
elif (Rtype == CartanType('E6')):
if (Stype == CartanType('D5')):
return BranchingRule(Rtype, Stype, (lambda x: [(- x[4]), (- x[3]), (- x[2]), (- x[1]), (- x[0])]), 'levi')
elif (Stype == CartanType('A5')):
return (branching_rule('E6', 'A5xA1', 'extended') * branching_rule('A5xA1', 'A5', 'proj1'))
elif Stype.is_compound():
if ((Stype[0] == CartanType('A4')) and (Stype[1] == CartanType('A1'))):
return (branching_rule('E6', 'A5xA1', 'extended') * branching_rule('A5xA1', 'A4xA1', [branching_rule('A5', 'A4', 'levi'), 'identity']))
if ((Stype[0] == CartanType('A1')) and (Stype[1] == CartanType('A4'))):
return (branching_rule('E6', 'A1xA5', 'extended') * branching_rule('A1xA5', 'A1xA4', ['identity', branching_rule('A5', 'A4', 'levi')]))
elif ((Stype[0] == CartanType('A2')) and (Stype[1] == CartanType('A2')) and (Stype[2] == CartanType('A1'))):
return (branching_rule('E6', 'A2xA2xA2', 'extended') * branching_rule('A2xA2xA2', 'A2xA2xA2', ['identity', 'identity', (branching_rule('A2', 'A2', 'automorphic') * branching_rule('A2', 'A1', 'levi'))]))
elif ((Stype[0] == CartanType('A2')) and (Stype[1] == CartanType('A1')) and (Stype[2] == CartanType('A2'))):
raise ValueError('Not implemented: use A2xA2xA1 levi or A2xA2xA2 extended rule. (Non-maximal Levi.)')
elif ((Stype[0] == CartanType('A1')) and (Stype[1] == CartanType('A2')) and (Stype[2] == CartanType('A2'))):
raise ValueError('Not implemented: use A2xA2xA1 levi or A2xA2xA2 extended rule. (Non-maximal Levi.)')
elif (Rtype == CartanType('E7')):
if (Stype == CartanType('D6')):
return (branching_rule('E7', 'D6xA1', 'extended') * branching_rule('D6xA1', 'D6', 'proj1'))
if (Stype == CartanType('E6')):
return BranchingRule(Rtype, Stype, (lambda x: [x[0], x[1], x[2], x[3], x[4], (((x[5] + x[6]) - x[7]) / 3), ((((2 * x[5]) + (5 * x[6])) + x[7]) / 6), (((((- 2) * x[5]) + x[6]) + (5 * x[7])) / 6)]), 'levi')
elif (Stype == CartanType('A6')):
return ((branching_rule('E7', 'A7', 'extended') * branching_rule('A7', 'A7', 'automorphic')) * branching_rule('A7', 'A6', 'levi'))
if Stype.is_compound():
if ((Stype[0] == CartanType('A5')) and (Stype[1] == CartanType('A1'))):
return (branching_rule('E7', 'A5xA2', 'extended') * branching_rule('A5xA2', 'A5xA1', ['identity', (branching_rule('A2', 'A2', 'automorphic') * branching_rule('A2', 'A1', 'levi'))]))
elif ((Stype[0] == CartanType('A1')) and (Stype[1] == CartanType('A5'))):
raise NotImplementedError('Not implemented: use A5xA1')
elif (Rtype == CartanType('E8')):
if (Stype == CartanType('D7')):
return BranchingRule(Rtype, Stype, (lambda x: [(- x[6]), (- x[5]), (- x[4]), (- x[3]), (- x[2]), (- x[1]), (- x[0])]), 'levi')
elif (Stype == CartanType('E7')):
return BranchingRule(Rtype, Stype, (lambda x: [x[0], x[1], x[2], x[3], x[4], x[5], ((x[6] - x[7]) / 2), ((x[7] - x[6]) / 2)]), 'levi')
elif (Stype == CartanType('A7')):
return (branching_rule('E8', 'A8', 'extended') * branching_rule('A8', 'A7', 'levi'))
raise NotImplementedError('Not implemented yet: branch first using extended rule to get non-maximal levis')
elif (Rtype == CartanType('F4')):
if (Stype == CartanType('B3')):
return BranchingRule(Rtype, Stype, (lambda x: x[1:]), 'levi')
elif (Stype == CartanType('C3')):
return BranchingRule(Rtype, Stype, (lambda x: [(x[1] - x[0]), (x[2] + x[3]), (x[2] - x[3])]), 'levi')
else:
raise NotImplementedError('Not implemented yet')
elif ((Rtype == CartanType('G2')) and (Stype == CartanType('A1'))):
return BranchingRule(Rtype, Stype, (lambda x: list(x)[1:][:2]), 'levi')
else:
raise ValueError('Rule not found')
elif (rule == 'automorphic'):
if (not (Rtype == Stype)):
raise ValueError('Cartan types must agree for automorphic branching rule')
elif (Rtype[0] == 'A'):
def rule(x):
y = [(- i) for i in x]
y.reverse()
return y
return BranchingRule(Rtype, Stype, rule, 'automorphic')
elif (Rtype[0] == 'D'):
def rule(x):
x[(len(x) - 1)] = (- x[(len(x) - 1)])
return x
return BranchingRule(Rtype, Stype, rule, 'automorphic')
elif ((Rtype[0] == 'E') and (r == 6)):
M = (matrix(QQ, [(3, 3, 3, (- 3), 0, 0, 0, 0), (3, 3, (- 3), 3, 0, 0, 0, 0), (3, (- 3), 3, 3, 0, 0, 0, 0), ((- 3), 3, 3, 3, 0, 0, 0, 0), (0, 0, 0, 0, (- 3), (- 3), (- 3), 3), (0, 0, 0, 0, (- 3), 5, (- 1), 1), (0, 0, 0, 0, (- 3), (- 1), 5, 1), (0, 0, 0, 0, 3, 1, 1, 5)]) / 6)
return BranchingRule(Rtype, Stype, (lambda x: tuple((M * vector(x)))), 'automorphic')
else:
raise ValueError('No automorphism found')
elif (rule == 'triality'):
if (not (Rtype == Stype)):
raise ValueError('Triality is an automorphic type (for D4 only)')
elif ((not (Rtype[0] == 'D')) and (r == 4)):
raise ValueError('Triality is for D4 only')
else:
return BranchingRule(Rtype, Stype, (lambda x: [((((x[0] + x[1]) + x[2]) + x[3]) / 2), ((((x[0] + x[1]) - x[2]) - x[3]) / 2), ((((x[0] - x[1]) + x[2]) - x[3]) / 2), (((((- x[0]) + x[1]) + x[2]) - x[3]) / 2)]), 'triality')
elif (rule == 'symmetric'):
if (Rtype[0] == 'A'):
if (((Stype[0] == 'C') or ((Stype[0] == 'D') and (r == ((2 * s) - 1)))) or ((Stype[0] == 'B') and (r == (2 * s)))):
return BranchingRule(Rtype, Stype, (lambda x: [(x[i] - x[(r - i)]) for i in range(s)]), 'symmetric')
else:
raise ValueError('Rule not found')
elif ((Rtype[0] == 'D') and (Stype[0] == 'B') and (s == (r - 1))):
return BranchingRule(Rtype, Stype, (lambda x: x[:s]), 'symmetric')
elif ((Rtype == CartanType('D4')) and (Stype == CartanType('G2'))):
return BranchingRule(Rtype, Stype, (lambda x: [(x[0] + x[1]), ((- x[1]) + x[2]), ((- x[0]) - x[2])]), 'symmetric')
elif ((Rtype == CartanType('E6')) and (Stype == CartanType('F4'))):
return BranchingRule(Rtype, Stype, (lambda x: [((x[4] - (3 * x[5])) / 2), ((((x[0] + x[1]) + x[2]) + x[3]) / 2), (((((- x[0]) - x[1]) + x[2]) + x[3]) / 2), (((((- x[0]) + x[1]) - x[2]) + x[3]) / 2)]), 'symmetric')
elif ((Rtype == CartanType('E6')) and (Stype == CartanType('C4'))):
def f(x):
[x0, x1, x2, x3, x4, x5] = x[:6]
return [((((((x0 + x1) + x2) + x3) + x4) - (3 * x5)) / 2), (((((((- x0) - x1) - x2) - x3) + x4) - (3 * x5)) / 2), ((- x0) + x3), ((- x1) + x2)]
return BranchingRule(Rtype, Stype, f, 'symmetric')
else:
raise ValueError('Rule not found')
elif ((rule == 'extended') or (rule == 'orthogonal_sum')):
if ((rule == 'extended') and (not (s == r))):
raise ValueError('Ranks should be equal for rule="extended"')
if Stype.is_compound():
if ((Rtype[0] in ['B', 'D']) and all(((t[0] in ['B', 'D']) for t in stypes))):
if (Rtype[0] == 'D'):
rdeg = (2 * r)
else:
rdeg = ((2 * r) + 1)
sdeg = 0
for t in stypes:
if (t[0] == 'D'):
sdeg += (2 * t[1])
else:
sdeg += ((2 * t[1]) + 1)
if (rdeg == sdeg):
return BranchingRule(Rtype, Stype, (lambda x: x[:s]), 'orthogonal_sum')
else:
raise ValueError('Rule not found')
elif (Rtype[0] == 'C'):
if all(((t[0] == Rtype[0]) for t in stypes)):
return BranchingRule(Rtype, Stype, (lambda x: x), 'orthogonal_sum')
if (rule == 'orthogonal_sum'):
raise ValueError('Rule not found')
elif (Rtype[0] == 'E'):
if (r == 6):
if (stypes == [CartanType('A5'), CartanType('A1')]):
M = (matrix(QQ, [((- 3), (- 3), (- 3), (- 3), (- 3), (- 5), (- 5), 5), ((- 9), 3, 3, 3, 3, 1, 1, (- 1)), (3, (- 9), 3, 3, 3, 1, 1, (- 1)), (3, 3, (- 9), 3, 3, 1, 1, (- 1)), (3, 3, 3, (- 9), 3, 1, 1, (- 1)), (3, 3, 3, 3, (- 9), 9, (- 3), 3), ((- 3), (- 3), (- 3), (- 3), (- 3), (- 1), 11, 1), (3, 3, 3, 3, 3, 1, 1, 11)]) / 12)
return BranchingRule(Rtype, Stype, (lambda x: tuple((M * vector(x)))), 'extended')
if (stypes == [CartanType('A1'), CartanType('A5')]):
M = (matrix(QQ, [((- 3), (- 3), (- 3), (- 3), (- 3), (- 1), 11, 1), (3, 3, 3, 3, 3, 1, 1, 11), ((- 3), (- 3), (- 3), (- 3), (- 3), (- 5), (- 5), 5), ((- 9), 3, 3, 3, 3, 1, 1, (- 1)), (3, (- 9), 3, 3, 3, 1, 1, (- 1)), (3, 3, (- 9), 3, 3, 1, 1, (- 1)), (3, 3, 3, (- 9), 3, 1, 1, (- 1)), (3, 3, 3, 3, (- 9), 9, (- 3), 3)]) / 12)
return BranchingRule(Rtype, Stype, (lambda x: tuple((M * vector(x)))), 'extended')
if (stypes == [CartanType('A2'), CartanType('A2'), CartanType('A2')]):
M = (matrix(QQ, [(0, 0, (- 2), (- 2), (- 2), (- 2), (- 2), 2), ((- 3), 3, 1, 1, 1, 1, 1, (- 1)), (3, (- 3), 1, 1, 1, 1, 1, (- 1)), (0, 0, (- 2), (- 2), 4, 0, 0, 0), (0, 0, (- 2), 4, (- 2), 0, 0, 0), (0, 0, 4, (- 2), (- 2), 0, 0, 0), (0, 0, (- 2), (- 2), (- 2), 2, 2, (- 2)), (3, 3, 1, 1, 1, (- 1), (- 1), 1), ((- 3), (- 3), 1, 1, 1, (- 1), (- 1), 1)]) / 6)
return BranchingRule(Rtype, Stype, (lambda x: tuple((M * vector(x)))), 'extended')
elif (r == 7):
if (stypes == [CartanType('D6'), CartanType('A1')]):
return BranchingRule(Rtype, Stype, (lambda x: [x[5], x[4], x[3], x[2], x[1], x[0], x[6], x[7]]), 'extended')
elif (stypes == [CartanType('A1'), CartanType('D6')]):
return BranchingRule(Rtype, Stype, (lambda x: [x[6], x[7], x[5], x[4], x[3], x[2], x[1], x[0]]), 'extended')
elif (stypes == [CartanType('A5'), CartanType('A2')]):
M = (matrix(QQ, [(5, 1, 1, 1, 1, 1, 0, 0), ((- 1), (- 5), 1, 1, 1, 1, 0, 0), ((- 1), 1, (- 5), 1, 1, 1, 0, 0), ((- 1), 1, 1, (- 5), 1, 1, 0, 0), ((- 1), 1, 1, 1, (- 5), 1, 0, 0), ((- 1), 1, 1, 1, 1, (- 5), 0, 0), (1, (- 1), (- 1), (- 1), (- 1), (- 1), 0, (- 6)), (1, (- 1), (- 1), (- 1), (- 1), (- 1), (- 6), 0), ((- 2), 2, 2, 2, 2, 2, (- 3), (- 3))]) / 6)
return BranchingRule(Rtype, Stype, (lambda x: tuple((M * vector(x)))), 'extended')
elif (stypes == [CartanType('A3'), CartanType('A3'), CartanType('A1')]):
M = (matrix(QQ, [(0, 0, (- 1), (- 1), (- 1), (- 1), 2, (- 2)), (0, 0, (- 1), (- 1), (- 1), (- 1), (- 2), 2), ((- 2), 2, 1, 1, 1, 1, 0, 0), (2, (- 2), 1, 1, 1, 1, 0, 0), (0, 0, (- 1), (- 1), (- 1), 3, 0, 0), (0, 0, (- 1), (- 1), 3, (- 1), 0, 0), (0, 0, (- 1), 3, (- 1), (- 1), 0, 0), (0, 0, 3, (- 1), (- 1), (- 1), 0, 0), (2, 2, 0, 0, 0, 0, (- 2), (- 2)), ((- 2), (- 2), 0, 0, 0, 0, (- 2), (- 2))]) / 4)
return BranchingRule(Rtype, Stype, (lambda x: tuple((M * vector(x)))), 'extended')
elif (r == 8):
if (stypes == [CartanType('A4'), CartanType('A4')]):
M = (matrix(QQ, [(0, 0, 0, (- 4), (- 4), (- 4), (- 4), 4), ((- 5), 5, 5, 1, 1, 1, 1, (- 1)), (5, (- 5), 5, 1, 1, 1, 1, (- 1)), (5, 5, (- 5), 1, 1, 1, 1, (- 1)), ((- 5), (- 5), (- 5), 1, 1, 1, 1, (- 1)), (0, 0, 0, (- 8), 2, 2, 2, (- 2)), (0, 0, 0, 2, (- 8), 2, 2, (- 2)), (0, 0, 0, 2, 2, (- 8), 2, (- 2)), (0, 0, 0, 2, 2, 2, (- 8), (- 2)), (0, 0, 0, 2, 2, 2, 2, 8)]) / 10)
return BranchingRule(Rtype, Stype, (lambda x: tuple((M * vector(x)))), 'extended')
elif (len(stypes) == 3):
if (5 in stypes[0][i]):
raise NotImplementedError('Not maximal: first branch to A7xA1')
elif (stypes == [CartanType('D5'), CartanType('A3')]):
raise NotImplementedError('Not maximal: first branch to D8 then D5xD3=D5xA3')
elif (stypes == [CartanType('A3'), CartanType('D5')]):
raise NotImplementedError('Not maximal: first branch to D8 then D5xD3=D5xA3')
elif (stypes == [CartanType('E6'), CartanType('A2')]):
def br(x):
return [x[0], x[1], x[2], x[3], x[4], (((x[5] + x[6]) - x[7]) / 3), (((x[5] + x[6]) - x[7]) / 3), ((((- x[5]) - x[6]) + x[7]) / 3), ((((- x[5]) - x[6]) - (2 * x[7])) / 3), ((((- x[5]) + (2 * x[6])) + x[7]) / 3), ((((2 * x[5]) - x[6]) + x[7]) / 3)]
return BranchingRule(Rtype, Stype, br, 'extended')
elif (stypes == [CartanType('E7'), CartanType('A1')]):
def br(x):
return [x[0], x[1], x[2], x[3], x[4], x[5], ((x[6] - x[7]) / 2), (((- x[6]) + x[7]) / 2), (((- x[6]) - x[7]) / 2), ((x[6] + x[7]) / 2)]
return BranchingRule(Rtype, Stype, br, 'extended')
raise ValueError('Rule not found')
elif (Rtype[0] == 'F'):
if (stypes == [CartanType('C3'), CartanType('A1')]):
return BranchingRule(Rtype, Stype, (lambda x: [(x[0] - x[1]), (x[2] + x[3]), (x[2] - x[3]), (((- x[0]) - x[1]) / 2), ((x[0] + x[1]) / 2)]), 'extended')
elif (stypes == [CartanType('A1'), CartanType('C3')]):
return BranchingRule(Rtype, Stype, (lambda x: [(((- x[0]) - x[1]) / 2), ((x[0] + x[1]) / 2), (x[0] - x[1]), (x[2] + x[3]), (x[2] - x[3])]), 'extended')
elif (stypes == [CartanType('A2'), CartanType('A2')]):
M = (matrix(QQ, [((- 2), (- 1), (- 1), 0), (1, 2, (- 1), 0), (1, (- 1), 2, 0), (1, (- 1), (- 1), 3), (1, (- 1), (- 1), (- 3)), ((- 2), 2, 2, 0)]) / 3)
elif (stypes == [CartanType('A3'), CartanType('A1')]):
M = (matrix(QQ, [((- 3), (- 1), (- 1), (- 1)), (1, 3, (- 1), (- 1)), (1, (- 1), 3, (- 1)), (1, (- 1), (- 1), 3), (2, (- 2), (- 2), (- 2)), ((- 2), 2, 2, 2)]) / 4)
elif (stypes == [CartanType('A1'), CartanType('A3')]):
M = (matrix(QQ, [(2, (- 2), (- 2), (- 2)), ((- 2), 2, 2, 2), ((- 3), (- 1), (- 1), (- 1)), (1, 3, (- 1), (- 1)), (1, (- 1), 3, (- 1)), (1, (- 1), (- 1), 3)]) / 4)
else:
raise ValueError('Rule not found')
return BranchingRule(Rtype, Stype, (lambda x: tuple((M * vector(x)))), 'extended')
elif (Rtype[0] == 'G'):
if (stypes == [CartanType('A1'), CartanType('A1')]):
return BranchingRule(Rtype, Stype, (lambda x: [((x[1] - x[2]) / 2), ((- (x[1] - x[2])) / 2), (x[0] / 2), ((- x[0]) / 2)]), 'extended')
raise ValueError('Rule not found')
elif ((Rtype[0] == 'B') and (Stype[0] == 'D')):
return BranchingRule(Rtype, Stype, (lambda x: x), 'extended')
elif (Rtype == CartanType('E7')):
if (Stype == CartanType('A7')):
M = (matrix(QQ, [((- 1), (- 1), (- 1), (- 1), (- 1), (- 1), 2, (- 2)), ((- 1), (- 1), (- 1), (- 1), (- 1), (- 1), (- 2), 2), ((- 3), 1, 1, 1, 1, 1, 0, 0), (1, (- 3), 1, 1, 1, 1, 0, 0), (1, 1, (- 3), 1, 1, 1, 0, 0), (1, 1, 1, (- 3), 1, 1, 0, 0), (1, 1, 1, 1, (- 3), 1, 2, 2), (1, 1, 1, 1, 1, (- 3), 2, 2)]) / 4)
return BranchingRule(Rtype, Stype, (lambda x: tuple((M * vector(x)))), 'extended')
elif (Rtype == CartanType('E8')):
if (Stype == CartanType('D8')):
return BranchingRule(Rtype, Stype, (lambda x: [(- x[7]), x[6], x[5], x[4], x[3], x[2], x[1], x[0]]), 'extended')
elif (Stype == CartanType('A8')):
M = (matrix([((- 2), (- 2), (- 2), (- 2), (- 2), (- 2), (- 2), 2), ((- 5), 1, 1, 1, 1, 1, 1, (- 1)), (1, (- 5), 1, 1, 1, 1, 1, (- 1)), (1, 1, (- 5), 1, 1, 1, 1, (- 1)), (1, 1, 1, (- 5), 1, 1, 1, (- 1)), (1, 1, 1, 1, (- 5), 1, 1, (- 1)), (1, 1, 1, 1, 1, (- 5), 1, (- 1)), (1, 1, 1, 1, 1, 1, (- 5), (- 1)), (1, 1, 1, 1, 1, 1, 1, 5)]) / 6)
return BranchingRule(Rtype, Stype, (lambda x: tuple((M * vector(x)))), 'extended')
elif ((Rtype == CartanType('F4')) and (Stype == CartanType('B4'))):
return BranchingRule(Rtype, Stype, (lambda x: [(- x[0]), x[1], x[2], x[3]]), 'extended')
elif ((Rtype == CartanType('G2')) and (Stype == CartanType('A2'))):
return BranchingRule(Rtype, Stype, (lambda x: [(((- x[1]) + x[2]) / 3), (((- x[0]) + x[1]) / 3), ((x[0] - x[2]) / 3)]), 'extended')
else:
raise ValueError('Rule not found')
elif (rule == 'isomorphic'):
if (r != s):
raise ValueError('Incompatible ranks')
if (Rtype == Stype):
return BranchingRule(Rtype, Stype, (lambda x: x), 'isomorphic')
elif ((Rtype == CartanType('B2')) and (Stype == CartanType('C2'))):
def rule(x):
[x1, x2] = x
return [(x1 + x2), (x1 - x2)]
return BranchingRule(Rtype, Stype, rule, 'isomorphic')
elif ((Rtype == CartanType('C2')) and (Stype == CartanType('B2'))):
def rule(x):
[x1, x2] = x
return [((x1 + x2) / 2), ((x1 - x2) / 2)]
return BranchingRule(Rtype, Stype, rule, 'isomorphic')
elif ((Rtype == CartanType('B1')) and (Stype == CartanType('A1'))):
return BranchingRule(Rtype, Stype, (lambda x: [x[0], (- x[0])]), 'isomorphic')
elif ((Rtype == CartanType('A1')) and (Stype == CartanType('B1'))):
return BranchingRule(Rtype, Stype, (lambda x: [((x[0] - x[1]) / 2)]), 'isomorphic')
elif ((Rtype == CartanType('C1')) and (Stype == CartanType('A1'))):
return BranchingRule(Rtype, Stype, (lambda x: [(x[0] / 2), ((- x[0]) / 2)]), 'isomorphic')
elif ((Rtype == CartanType('A1')) and (Stype == CartanType('C1'))):
return BranchingRule(Rtype, Stype, (lambda x: [(x[0] - x[1])]), 'isomorphic')
elif ((Rtype == CartanType('A3')) and (Stype == CartanType('D3'))):
def rule(x):
[x1, x2, x3, x4] = x
return [((((x1 + x2) - x3) - x4) / 2), ((((x1 - x2) + x3) - x4) / 2), ((((x1 - x2) - x3) + x4) / 2)]
return BranchingRule(Rtype, Stype, rule, 'isomorphic')
elif ((Rtype == CartanType('D3')) and (Stype == CartanType('A3'))):
def rule(x):
[t1, t2, t3] = x
return [(((t1 + t2) + t3) / 2), (((t1 - t2) - t3) / 2), ((((- t1) + t2) - t3) / 2), ((((- t1) - t2) + t3) / 2)]
return BranchingRule(Rtype, Stype, rule, 'isomorphic')
elif ((Rtype == CartanType('D2')) and (Stype == CartanType('A1xA1'))):
def rule(x):
[t1, t2] = x
return [((t1 - t2) / 2), ((- (t1 - t2)) / 2), ((t1 + t2) / 2), ((- (t1 + t2)) / 2)]
return BranchingRule(Rtype, Stype, rule, 'isomorphic')
else:
raise ValueError('Rule not found')
elif ((rule == 'tensor') or (rule == 'tensor-debug')):
if (not Stype.is_compound()):
raise ValueError('Tensor product requires more than one factor')
if (len(stypes) != 2):
raise ValueError('Not implemented')
if (Rtype[0] == 'A'):
nr = (Rtype[1] + 1)
elif (Rtype[0] == 'B'):
nr = ((2 * Rtype[1]) + 1)
elif (Rtype[0] in ['C', 'D']):
nr = (2 * Rtype[1])
else:
raise ValueError('Rule not found')
[s1, s2] = [stypes[i][1] for i in range(2)]
ns = [s1, s2]
for i in range(2):
if (stypes[i][0] == 'A'):
ns[i] = (ns[i] + 1)
if (stypes[i][0] == 'B'):
ns[i] = ((2 * ns[i]) + 1)
if (stypes[i][0] in ['C', 'D']):
ns[i] = (2 * ns[i])
if (nr != (ns[0] * ns[1])):
raise ValueError("Ranks don't agree with tensor product")
if (Rtype[0] == 'A'):
if all(((t[0] == 'A') for t in stypes)):
def rule(x):
ret = [sum(x[(i * ns[1]):((i + 1) * ns[1])]) for i in range(ns[0])]
ret.extend([sum((x[((ns[1] * j) + i)] for j in range(ns[0]))) for i in range(ns[1])])
return ret
return BranchingRule(Rtype, Stype, rule, 'tensor')
else:
raise ValueError('Rule not found')
elif (Rtype[0] == 'B'):
if (not all(((t[0] == 'B') for t in stypes))):
raise ValueError('Rule not found')
elif (Rtype[0] == 'C'):
if ((stypes[0][0] in ['B', 'D']) and (stypes[1][0] == 'C')):
pass
elif ((stypes[1][0] in ['B', 'D']) and (stypes[0][0] == 'C')):
pass
else:
raise ValueError('Rule not found')
elif (Rtype[0] == 'D'):
if ((stypes[0][0] in ['B', 'D']) and (stypes[1][0] == 'D')):
pass
elif ((stypes[1][0] == 'B') and (stypes[0][0] == 'D')):
pass
elif ((stypes[1][0] == 'C') and (stypes[0][0] == 'C')):
pass
else:
raise ValueError('Rule not found')
rows = []
for i in range(s1):
for j in range(s2):
nextrow = ((s1 + s2) * [0])
nextrow[i] = 1
nextrow[(s1 + j)] = 1
rows.append(nextrow)
if (stypes[1][0] == 'B'):
for i in range(s1):
nextrow = ((s1 + s2) * [0])
nextrow[i] = 1
rows.append(nextrow)
for i in range(s1):
for j in range(s2):
nextrow = ((s1 + s2) * [0])
nextrow[i] = 1
nextrow[(s1 + j)] = (- 1)
rows.append(nextrow)
if (stypes[0][0] == 'B'):
for j in range(s2):
nextrow = ((s1 + s2) * [0])
nextrow[(s1 + j)] = 1
rows.append(nextrow)
mat = matrix(rows).transpose()
if (rule == 'tensor-debug'):
print(mat)
return BranchingRule(Rtype, Stype, (lambda x: tuple((mat * vector(x)))), 'tensor')
elif (rule == 'symmetric_power'):
if ((Stype[0] == 'A') and (s == 1)):
if (Rtype[0] == 'B'):
def rule(x):
a = sum((((r - i) * x[i]) for i in range(r)))
return [a, (- a)]
return BranchingRule(Rtype, Stype, rule, 'symmetric_power')
elif (Rtype[0] == 'C'):
def rule(x):
a = sum((((((2 * r) - (2 * i)) - 1) * x[i]) for i in range(r)))
return [(a / 2), ((- a) / 2)]
return BranchingRule(Rtype, Stype, rule, 'symmetric_power')
elif (rule == 'miscellaneous'):
if ((Rtype[0] == 'B') and (Stype[0] == 'G') and (r == 3)):
return BranchingRule(Rtype, Stype, (lambda x: [(x[0] + x[1]), ((- x[1]) + x[2]), ((- x[0]) - x[2])]), 'miscellaneous')
elif (Rtype == CartanType('E6')):
if Stype.is_compound():
if (stypes == [CartanType('A2'), CartanType('G2')]):
return BranchingRule(Rtype, Stype, (lambda x: [((- 2) * x[5]), (x[5] + x[4]), (x[5] - x[4]), (x[2] + x[3]), (x[1] - x[2]), ((- x[1]) - x[3])]), 'miscellaneous')
elif (stypes == [CartanType('G2'), CartanType('A2')]):
return BranchingRule(Rtype, Stype, (lambda x: [(x[2] + x[3]), (x[1] - x[2]), ((- x[1]) - x[3]), ((- 2) * x[5]), (x[5] + x[4]), (x[5] - x[4])]), 'miscellaneous')
else:
if (Stype == CartanType('G2')):
return BranchingRule(Rtype, Stype, (lambda x: [(((x[2] + x[3]) + x[4]) - (3 * x[5])), ((x[1] - (2 * x[2])) - x[3]), ((((- x[1]) + x[2]) - x[4]) + (3 * x[5]))]), 'miscellaneous')
if (Stype == CartanType('A2')):
return BranchingRule(Rtype, Stype, (lambda x: [(((x[2] + x[3]) + x[4]) - (3 * x[5])), ((x[1] - (2 * x[2])) - x[3]), ((((- x[1]) + x[2]) - x[4]) + (3 * x[5]))]), 'miscellaneous')
elif (Rtype == CartanType('E7')):
if Stype.is_compound():
if (stypes == [CartanType('C3'), CartanType('G2')]):
return BranchingRule(Rtype, Stype, (lambda x: [((- 2) * x[6]), (x[4] + x[5]), ((- x[4]) + x[5]), (x[1] + x[3]), (x[2] - x[3]), ((- x[1]) - x[2])]), 'miscellaneous')
elif (stypes == [CartanType('G2'), CartanType('C3')]):
return BranchingRule(Rtype, Stype, (lambda x: [(x[1] + x[3]), (x[2] - x[3]), ((- x[1]) - x[2]), ((- 2) * x[6]), (x[4] + x[5]), ((- x[4]) + x[5])]), 'miscellaneous')
elif (stypes == [CartanType('F4'), CartanType('A1')]):
def f(x):
[x0, x1, x2, x3, x4, x5, x6] = x[:7]
return [(((x4 - x5) / 2) - x6), ((((x0 + x1) + x2) + x3) / 2), (((((- x0) - x1) + x2) + x3) / 2), (((((- x0) + x1) - x2) + x3) / 2), (x5 - x6), (x6 - x5)]
return BranchingRule(Rtype, Stype, f, 'miscellaneous')
elif (stypes == [CartanType('A1'), CartanType('F4')]):
def f(x):
[x0, x1, x2, x3, x4, x5, x6] = x[:7]
return [(x5 - x6), (x6 - x5), (((x4 - x5) / 2) - x6), ((((x0 + x1) + x2) + x3) / 2), (((((- x0) - x1) + x2) + x3) / 2), (((((- x0) + x1) - x2) + x3) / 2)]
return BranchingRule(Rtype, Stype, f, 'miscellaneous')
elif (stypes == [CartanType('A1'), CartanType('A1')]):
return BranchingRule(Rtype, Stype, (lambda x: [((((x[1] + (2 * x[2])) - (2 * x[3])) - x[4]) - (2 * x[6])), (((((- x[1]) - (2 * x[2])) + (2 * x[3])) + x[4]) + (2 * x[6])), (((x[3] + x[4]) + x[5]) - (3 * x[6])), (- (((x[3] + x[4]) + x[5]) - (3 * x[6])))]), 'miscellaneous')
elif (stypes == [CartanType('G2'), CartanType('A1')]):
def f(x):
return [(((((((x[0] - x[1]) + x[2]) + (3 * x[3])) + x[4]) - x[5]) + (2 * x[6])) / 2), (((((((((- 3) * x[0]) - x[1]) - x[2]) - x[3]) + x[4]) + x[5]) - (2 * x[6])) / 2), (((((2 * x[0]) + (2 * x[1])) - (2 * x[3])) - (2 * x[4])) / 2), (((((((x[0] + x[1]) + x[2]) + x[3]) + x[4]) + x[5]) - (4 * x[6])) / 2), ((- ((((((x[0] + x[1]) + x[2]) + x[3]) + x[4]) + x[5]) - (4 * x[6]))) / 2)]
return BranchingRule(Rtype, Stype, f, 'miscellaneous')
elif (stypes == [CartanType('A1'), CartanType('G2')]):
def f(x):
return [(((((((x[0] + x[1]) + x[2]) + x[3]) + x[4]) + x[5]) - (4 * x[6])) / 2), ((- ((((((x[0] + x[1]) + x[2]) + x[3]) + x[4]) + x[5]) - (4 * x[6]))) / 2), (((((((x[0] - x[1]) + x[2]) + (3 * x[3])) + x[4]) - x[5]) + (2 * x[6])) / 2), (((((((((- 3) * x[0]) - x[1]) - x[2]) - x[3]) + x[4]) + x[5]) - (2 * x[6])) / 2), (((((2 * x[0]) + (2 * x[1])) - (2 * x[3])) - (2 * x[4])) / 2)]
return BranchingRule(Rtype, Stype, f, 'miscellaneous')
elif (Stype == CartanType('A2')):
return BranchingRule(Rtype, Stype, (lambda x: ((((x[1] + x[2]) + (2 * x[4])) - (4 * x[6])), ((((((- 2) * x[1]) - x[2]) + x[3]) - (2 * x[4])) + (2 * x[5])), (((x[1] - x[3]) - (2 * x[5])) + (4 * x[6])))), 'miscellaneous')
elif (Rtype == CartanType('E8')):
if Stype.is_compound():
if (stypes == [CartanType('F4'), CartanType('G2')]):
return BranchingRule(Rtype, Stype, (lambda x: [x[7], x[6], x[5], x[4], (x[1] + x[3]), ((- x[3]) + x[2]), ((- x[1]) - x[2])]), 'miscellaneous')
elif (stypes == [CartanType('G2'), CartanType('F4')]):
return BranchingRule(Rtype, Stype, (lambda x: [(x[1] + x[3]), ((- x[3]) + x[2]), ((- x[1]) - x[2]), x[7], x[6], x[5], x[4]]), 'miscellaneous')
elif (stypes == [CartanType('A2'), CartanType('A1')]):
def f(x):
return [((((((((x[0] - x[1]) + x[2]) + x[3]) + (3 * x[4])) + x[5]) - x[6]) - x[7]) / 2), ((((((((((- 3) * x[0]) - x[1]) - x[2]) - x[3]) - x[4]) + x[5]) + x[6]) + x[7]) / 2), (((((2 * x[0]) + (2 * x[1])) - (2 * x[4])) - (2 * x[5])) / 2), ((((((((x[0] + x[1]) + x[2]) + x[3]) + x[4]) + x[5]) + x[6]) + (5 * x[7])) / 2), ((- (((((((x[0] + x[1]) + x[2]) + x[3]) + x[4]) + x[5]) + x[6]) + (5 * x[7]))) / 2)]
return BranchingRule('E8', 'A2xA1', f, 'miscellaneous')
elif (stypes == [CartanType('A1'), CartanType('A2')]):
def f(x):
return [((((((((x[0] + x[1]) + x[2]) + x[3]) + x[4]) + x[5]) + x[6]) + (5 * x[7])) / 2), ((- (((((((x[0] + x[1]) + x[2]) + x[3]) + x[4]) + x[5]) + x[6]) + (5 * x[7]))) / 2), ((((((((x[0] - x[1]) + x[2]) + x[3]) + (3 * x[4])) + x[5]) - x[6]) - x[7]) / 2), ((((((((((- 3) * x[0]) - x[1]) - x[2]) - x[3]) - x[4]) + x[5]) + x[6]) + x[7]) / 2), (((((2 * x[0]) + (2 * x[1])) - (2 * x[4])) - (2 * x[5])) / 2)]
return BranchingRule('E8', 'A1xA2', f, 'miscellaneous')
elif (Stype == CartanType('B2')):
return BranchingRule('E8', 'B2', (lambda x: [((((- x[0]) + x[2]) + x[5]) + (3 * x[7])), ((((((2 * x[0]) - x[2]) + x[3]) + x[4]) + (2 * x[6])) + x[7])]), 'miscellaneous')
elif (Rtype[0] == 'F'):
if Stype.is_compound():
if (stypes == [CartanType('A1'), CartanType('G2')]):
return BranchingRule('F4', 'A1xG2', (lambda x: [(2 * x[0]), ((- 2) * x[0]), (x[1] + x[2]), ((- x[2]) + x[3]), ((- x[1]) - x[3])]), 'miscellaneous')
elif (stypes == [CartanType('G2'), CartanType('A1')]):
return BranchingRule('F4', 'G2xA1', (lambda x: [(x[1] + x[2]), ((- x[2]) + x[3]), ((- x[1]) - x[3]), (2 * x[0]), ((- 2) * x[0])]), 'miscellaneous')
raise ValueError('Rule not found')
elif (rule in ['i', 'ii', 'iii', 'iv', 'v', 'vi', 'vii']):
if (Stype != CartanType('A1')):
raise ValueError(('Wrong target Cartan Type for rule %s' % rule))
if ((rule == 'i') and (Rtype == CartanType('G2'))):
return BranchingRule(Rtype, Stype, (lambda x: [((((5 * x[0]) - x[1]) - (4 * x[2])) / 3), ((- (((5 * x[0]) - x[1]) - (4 * x[2]))) / 3)]), 'i')
elif ((rule == 'ii') and (Rtype == CartanType('F4'))):
return BranchingRule(Rtype, Stype, (lambda x: [((((8 * x[0]) + (3 * x[1])) + (2 * x[2])) + x[3]), (- ((((8 * x[0]) + (3 * x[1])) + (2 * x[2])) + x[3]))]), 'ii')
elif ((rule == 'iii') and (Rtype == CartanType('E7'))):
return BranchingRule(Rtype, Stype, (lambda x: [(((((x[1] + (2 * x[2])) + (3 * x[3])) + (4 * x[4])) + (5 * x[5])) - (17 * x[6])), (- (((((x[1] + (2 * x[2])) + (3 * x[3])) + (4 * x[4])) + (5 * x[5])) - (17 * x[6])))]), 'iii')
elif ((rule == 'iv') and (Rtype == CartanType('E7'))):
return BranchingRule(Rtype, Stype, (lambda x: [(((((x[1] + x[2]) + (2 * x[3])) + (3 * x[4])) + (4 * x[5])) - (13 * x[6])), (- (((((x[1] + x[2]) + (2 * x[3])) + (3 * x[4])) + (4 * x[5])) - (13 * x[6])))]), 'iv')
elif ((rule == 'v') and (Rtype == CartanType('E8'))):
return BranchingRule(Rtype, Stype, (lambda x: [((((((x[1] + (2 * x[2])) + (3 * x[3])) + (4 * x[4])) + (5 * x[5])) + (6 * x[6])) + (23 * x[7])), (- ((((((x[1] + (2 * x[2])) + (3 * x[3])) + (4 * x[4])) + (5 * x[5])) + (6 * x[6])) + (23 * x[7])))]), 'v')
elif ((rule == 'vi') and (Rtype == CartanType('E8'))):
return BranchingRule(Rtype, Stype, (lambda x: [((((((x[1] + x[2]) + (2 * x[3])) + (3 * x[4])) + (4 * x[5])) + (5 * x[6])) + (18 * x[7])), (- ((((((x[1] + x[2]) + (2 * x[3])) + (3 * x[4])) + (4 * x[5])) + (5 * x[6])) + (18 * x[7])))]), 'vi')
elif ((rule == 'vii') and (Rtype == CartanType('E8'))):
return BranchingRule(Rtype, Stype, (lambda x: [((((((x[1] + x[2]) + (2 * x[3])) + (2 * x[4])) + (3 * x[5])) + (4 * x[6])) + (15 * x[7])), (- ((((((x[1] + x[2]) + (2 * x[3])) + (2 * x[4])) + (3 * x[5])) + (4 * x[6])) + (15 * x[7])))]), 'vii')
raise ValueError(('Wrong source Cartan Type for rule %s' % rule))
raise ValueError('Rule not found')
|
def branching_rule_from_plethysm(chi, cartan_type, return_matrix=False):
'\n Create the branching rule of a plethysm.\n\n INPUT:\n\n - ``chi`` -- the character of an irreducible representation `\\pi` of\n a group `G`\n - ``cartan_type`` -- a classical Cartan type (`A`,`B`,`C` or `D`).\n\n It is assumed that the image of the irreducible representation pi\n naturally has its image in the group `G`.\n\n Returns a branching rule for this plethysm.\n\n EXAMPLES:\n\n The adjoint representation `SL(3) \\to GL(8)` factors\n through `SO(8)`. The branching rule in question will\n describe how representations of `SO(8)` composed with\n this homomorphism decompose into irreducible characters\n of `SL(3)`::\n\n sage: A2 = WeylCharacterRing("A2")\n sage: A2 = WeylCharacterRing("A2", style="coroots")\n sage: ad = A2.adjoint_representation(); ad\n A2(1,1)\n sage: ad.degree()\n 8\n sage: ad.frobenius_schur_indicator()\n 1\n\n This confirms that `ad` has degree 8 and is orthogonal,\n hence factors through `SO(8)` which is type `D_4`::\n\n sage: br = branching_rule_from_plethysm(ad,"D4")\n sage: D4 = WeylCharacterRing("D4")\n sage: [D4(f).branch(A2,rule = br) for f in D4.fundamental_weights()]\n [A2(1,1), A2(0,3) + A2(1,1) + A2(3,0), A2(1,1), A2(1,1)]\n '
ct = CartanType(cartan_type)
if (ct[0] not in ['A', 'B', 'C', 'D']):
raise ValueError('not implemented for type {}'.format(ct[0]))
if (ct[0] == 'A'):
ret = []
ml = chi.weight_multiplicities()
for v in ml:
n = ml[v]
ret.extend((n * [v.to_vector()]))
M = matrix(ret).transpose()
if (len(M.columns()) != (ct[1] + 1)):
raise ValueError('representation has wrong degree for type {}'.format(ct))
return BranchingRule(ct, chi.parent().cartan_type(), (lambda x: tuple((M * vector(x)))), ('plethysm (along %s)' % chi))
if (ct[0] in ['B', 'D']):
if (chi.frobenius_schur_indicator() != 1):
raise ValueError('character is not orthogonal')
if (ct[0] == 'C'):
if (chi.frobenius_schur_indicator() != (- 1)):
raise ValueError('character is not symplectic')
if (ct[0] == 'B'):
if is_even(chi.degree()):
raise ValueError('degree is not odd')
if (ct[0] in ['C', 'D']):
if is_odd(chi.degree()):
raise ValueError('degree is not even')
ret = []
ml = chi.weight_multiplicities()
for v in ml:
n = ml[v]
vec = v.to_vector()
if all(((x == 0) for x in vec)):
if (ct[0] == 'B'):
n = ((n - 1) / 2)
else:
n = (n / 2)
elif ([x for x in vec if (x != 0)][0] < 0):
continue
ret.extend((n * [vec]))
M = matrix(ret).transpose()
if (len(M.columns()) != ct.root_system().ambient_space().dimension()):
raise ValueError('representation has wrong degree for type {}'.format(ct))
if return_matrix:
return M
else:
return BranchingRule(ct, chi.parent().cartan_type(), (lambda x: tuple((M * vector(x)))), ('plethysm (along %s)' % chi))
|
def maximal_subgroups(ct, mode='print_rules'):
'\n Given a classical Cartan type (of rank less than or equal to 8)\n this prints the Cartan types of maximal subgroups, with a method\n of obtaining the branching rule. The string to the right of the\n colon in the output is a command to create a branching rule.\n\n INPUT:\n\n - ``ct`` -- a classical irreducible Cartan type\n\n Returns a list of maximal subgroups of ct.\n\n EXAMPLES::\n\n sage: from sage.combinat.root_system.branching_rules import maximal_subgroups\n sage: maximal_subgroups("D4")\n B3:branching_rule("D4","B3","symmetric")\n A2:branching_rule("D4","A2(1,1)","plethysm")\n A1xC2:branching_rule("D4","C1xC2","tensor")*branching_rule("C1xC2","A1xC2",[branching_rule("C1","A1","isomorphic"),"identity"])\n A1xA1xA1xA1:branching_rule("D4","D2xD2","orthogonal_sum")*branching_rule("D2xD2","A1xA1xA1xA1",[branching_rule("D2","A1xA1","isomorphic"),branching_rule("D2","A1xA1","isomorphic")])\n\n .. SEEALSO:: :meth:`~sage.combinat.root_system.weyl_characters.WeylCharacterRing.ParentMethods.maximal_subgroups`\n\n '
if (CartanType(ct) == CartanType('A2')):
rul = ['A1:branching_rule("A2","A1","levi")']
elif (CartanType(ct) == CartanType('A3')):
rul = ['A2:branching_rule("A3","A2","levi")', 'A1xA1:branching_rule("A3","A1xA1","tensor")', 'C2:branching_rule("A3","C2","symmetric")', 'A1xA1:branching_rule("A3","A1xA1","levi")']
elif (CartanType(ct) == CartanType('A4')):
rul = ['A3:branching_rule("A4","A3","levi")', 'B2:branching_rule("A4","B2","symmetric")', 'A1xA2:branching_rule("A4","A1xA2","levi")']
elif (CartanType(ct) == CartanType('A5')):
rul = ['A4:branching_rule("A5","A4","levi")', 'A3:branching_rule("A5","D3","symmetric")*branching_rule("D3","A3","isomorphic")', 'A3:branching_rule("A5","A3(0,1,0)","plethysm") # alternative', 'C3:branching_rule("A5","C3","symmetric")', 'A2:branching_rule("A5","A2(2,0)","plethysm")', 'A1xA2:branching_rule("A5","A1xA2","tensor")', 'A1xA3:branching_rule("A5","A1xA3","levi")', 'A2xA2:branching_rule("A5","A2xA2","levi")']
elif (CartanType(ct) == CartanType('A6')):
rul = ['A5:branching_rule("A6","A5","levi")', 'B3:branching_rule("A6","B3","symmetric")', 'A1xA4:branching_rule("A6","A1xA4","levi")', 'A2xA3:branching_rule("A6","A2xA3","levi")']
elif (CartanType(ct) == CartanType('A7')):
rul = ['A6:branching_rule("A7","A6","levi")', 'C4:branching_rule("A7","C4","symmetric")', 'D4:branching_rule("A7","D4","symmetric")', 'A1xA3:branching_rule("A7","A1xA3","tensor")', 'A1xA5:branching_rule("A7","A1xA5","levi")', 'A2xA4:branching_rule("A7","A2xA4","levi")', 'A3xA3:branching_rule("A7","A3xA3","levi")']
elif (CartanType(ct) == CartanType('A8')):
rul = ['A7:branching_rule("A8","A7","levi")', 'B4:branching_rule("A8","B4","symmetric")', 'A2xA2:branching_rule("A8","A2xA2","tensor")', 'A1xA6:branching_rule("A8","A1xA6","levi")', 'A2xA5:branching_rule("A8","A2xA5","levi")', 'A3xA4:branching_rule("A8","A3xA4","levi")']
elif (CartanType(ct) == CartanType('B3')):
rul = ['G2:branching_rule("B3","G2","miscellaneous")', 'A3:branching_rule("B3","D3","extended")*branching_rule("D3","A3","isomorphic")', 'A1xA1xA1:branching_rule("B3","D2xB1","orthogonal_sum")*branching_rule("D2xB1","A1xA1xA1",[branching_rule("D2","A1xA1","isomorphic"),branching_rule("B1","A1","isomorphic")])']
elif (CartanType(ct) == CartanType('B4')):
rul = ['D4:branching_rule("B4","D4","extended")', 'A1:branching_rule("B4","A1","symmetric_power")', 'A1xA1:branching_rule("B4","B1xB1","tensor")*branching_rule("B1xB1","A1xA1",[branching_rule("B1","A1","isomorphic"),branching_rule("B1","A1","isomorphic")])', 'A1xA1xB2:branching_rule("B4","D2xB2","extended")*branching_rule("D2xB2","A1xA1xB2",[branching_rule("D2","A1xA1","isomorphic"),"identity"])', 'A1xA3:branching_rule("B4","B1xD3","extended")*branching_rule("B1xD3","A1xA3",[branching_rule("B1","A1","isomorphic"),branching_rule("D3","A3","isomorphic")])']
elif (CartanType(ct) == CartanType('B5')):
rul = ['D5:branching_rule("B5","D5","extended")', 'A1:branching_rule("B5","A1","symmetric_power")', 'A1xA2xB3:branching_rule("B5","D2xB3","extended")*branching_rule("D2xB3","A1xA2xB3",[branching_rule("D2","A1xA1","isomorphic"),"identity"])', 'A1xD4:branching_rule("B5","B1xD4","orthogonal_sum")*branching_rule("B1xD4","A1xD4",[branching_rule("B1","A1","isomorphic"),"identity"])', 'A3xB2:branching_rule("B5","D3xB2","orthogonal_sum")*branching_rule("D3xB2","A3xB2",[branching_rule("D3","A3","isomorphic"),"identity"])']
elif (CartanType(ct) == CartanType('B6')):
rul = ['D6:branching_rule("B6","D6","extended")', 'A1:branching_rule("B6","A1","symmetric_power")', 'A1xA1xB4:branching_rule("B6","D2xB4","orthogonal_sum")*branching_rule("D2xB4","A1xA1xB4",[branching_rule("D2","A1xA1","isomorphic"),"identity"])', 'A1xD5:branching_rule("B6","B1xD5","orthogonal_sum")*branching_rule("B1xD5","A1xD5",[branching_rule("B1","A1","isomorphic"),"identity"])', 'A3xB3:branching_rule("B6","D3xB3","orthogonal_sum")*branching_rule("D3xB3","A3xB3",[branching_rule("D3","A3","isomorphic"),"identity"])', 'B2xD4:branching_rule("B6","B2xD4","orthogonal_sum")']
elif (CartanType(ct) == CartanType('B7')):
rul = ['D7:branching_rule("B7","D7","extended")', 'A3:branching_rule("B7","A3(1,0,1)","plethysm")', 'A1:branching_rule("B7","A1","symmetric_power")', 'A1xB2:branching_rule("B7","B1xB2","tensor")*branching_rule("B1xB2","A1xB2",[branching_rule("B1","A1","isomorphic"),"identity"])', 'A1xD6:branching_rule("B7","B1xD6","extended")*branching_rule("B1xD6","A1xD6",[branching_rule("B1","A1","isomorphic"),"identity"])', 'A1xA1xB5:branching_rule("B7","D2xB5","extended")*branching_rule("D2xB5","A1xA1xB5",[branching_rule("D2","A1xA1","isomorphic"),"identity"])', 'B2xD5:branching_rule("B7","B2xD5","orthogonal_sum")', 'A3xB4:branching_rule("B7","D3xB4","orthogonal_sum")*branching_rule("D3xB4","A3xB4",[branching_rule("D3","A3","isomorphic"),"identity"])', 'B3xD4:branching_rule("B7","B3xD4","orthogonal_sum")']
elif (CartanType(ct) == CartanType('B8')):
rul = ['D8:branching_rule("B8","D8","extended")', 'A1:branching_rule("B8","A1","symmetric_power")', 'A1xD7:branching_rule("B8","B1xD7","orthogonal_sum")*branching_rule("B1xD7","A1xD7",[branching_rule("B1","A1","isomorphic"),"identity"])', 'A1xA1xB6:branching_rule("B8","D2xB6","orthogonal_sum")*branching_rule("D2xB6","A1xA1xB6",[branching_rule("D2","A1xA1","isomorphic"),"identity"])', 'B2xD6:branching_rule("B8","B2xD6","orthogonal_sum")', 'A3xB5:branching_rule("B8","D3xB5","orthogonal_sum")*branching_rule("D3xB5","A3xB5",[branching_rule("D3","A3","isomorphic"),"identity"])', 'B3xD5:branching_rule("B8","B3xD5","orthogonal_sum")', 'B4xD4:branching_rule("B8","B4xD4","orthogonal_sum")']
elif (CartanType(ct) == CartanType('C2')):
rul = ['A1:branching_rule("C2","A1","symmetric_power")', 'A1xA1:branching_rule("C2","C1xC1","orthogonal_sum")*branching_rule("C1xC1","A1xA1",[branching_rule("C1","A1","isomorphic"),branching_rule("C1","A1","isomorphic")])']
elif (CartanType(ct) == CartanType('C3')):
rul = ['A2:branching_rule("C3","A2","levi")', 'A1:branching_rule("C3","A1","symmetric_power")', 'A1xA1:branching_rule("C3","B1xC1","tensor")*branching_rule("B1xC1","A1xA1",[branching_rule("B1","A1","isomorphic"),branching_rule("C1","A1","isomorphic")])', 'A1xC2:branching_rule("C3","C1xC2","orthogonal_sum")*branching_rule("C1xC2","A1xC2",[branching_rule("C1","A1","isomorphic"),"identity"])']
elif (CartanType(ct) == CartanType('C4')):
rul = ['A3:branching_rule("C4","A3","levi")', 'A1:branching_rule("C4","A1","symmetric_power")', 'A1xA3:branching_rule("C4","C1xC3","orthogonal_sum")*branching_rule("C1xC3","A1xA3",[branching_rule("C1","A1","isomorphic"),"identity"])', 'C2xC2:branching_rule("C4","C2xC2","orthogonal_sum")', 'A1xA1xA1:branching_rule("C4","C1xD2","tensor")*branching_rule("C1xD2","A1xA1xA1",[branching_rule("C1","A1","isomorphic"),branching_rule("D2","A1xA1","isomorphic")])']
elif (CartanType(ct) == CartanType('C5')):
rul = ['A4:branching_rule("C5","A4","levi")', 'A1:branching_rule("C5","A1","symmetric_power")', 'A1xC4:branching_rule("C5","C1xC4","orthogonal_sum")*branching_rule("C1xC4","A1xC4",[branching_rule("C1","A1","isomorphic"),"identity"])', 'C2xC3:branching_rule("C5","C2xC3","orthogonal_sum")', 'A1xB2:branching_rule("C5","C1xB2","tensor")*branching_rule("C1xB2","A1xB2",[branching_rule("C1","A1","isomorphic"),"identity"])']
elif (CartanType(ct) == CartanType('C6')):
rul = ['A5:branching_rule("C6","A5","levi")', 'A1:branching_rule("C6","A1","symmetric_power")', 'A1xA3:branching_rule("C6","C1xD3","tensor")*branching_rule("C1xD3","A1xA3",[branching_rule("C1","A1","isomorphic"),branching_rule("D3","A3","isomorphic")])', 'A1xC2:branching_rule("C6","B1xC2","tensor")*branching_rule("B1xC2","A1xC2",[branching_rule("B1","A1","isomorphic"),"identity"])', 'A1xC5:branching_rule("C6","C1xC5","orthogonal_sum")*branching_rule("C1xC5","A1xC5",[branching_rule("C1","A1","isomorphic"),"identity"])', 'C2xC4:branching_rule("C6","C2xC4","orthogonal_sum")', 'C3xC3:branching_rule("C6","C3xC3","orthogonal_sum")']
elif (CartanType(ct) == CartanType('C7')):
rul = ['A6:branching_rule("C7","A6","levi")', 'A1:branching_rule("C7","A1","symmetric_power")', 'A1xB3:branching_rule("C7","C1xB3","tensor")*branching_rule("C1xB3","A1xB3",[branching_rule("C1","A1","isomorphic"),"identity"])', 'A1xC6:branching_rule("C7","C1xC6","orthogonal_sum")*branching_rule("C1xC6","A1xC6",[branching_rule("C1","A1","isomorphic"),"identity"])', 'C2xC5:branching_rule("C7","C2xC5","orthogonal_sum")', 'C3xC4:branching_rule("C7","C3xC4","orthogonal_sum")', 'C3:branching_rule("C7","C3(0,0,1)","plethysm") # overlooked by Patera and McKay']
elif (CartanType(ct) == CartanType('C8')):
rul = ['A7:branching_rule("C8","A7","levi")', 'A1:branching_rule("C8","A1","symmetric_power")', 'C2:branching_rule("C8","C2(1,1)","plethysm")', 'A1xD4:branching_rule("C8","C1xD4","tensor")*branching_rule("C1xD4","A1xD4",[branching_rule("C1","A1","isomorphic"),"identity"])', 'A1xC7:branching_rule("C8","C1xC7","orthogonal_sum")*branching_rule("C1xC7","A1xC7",[branching_rule("C1","A1","isomorphic"),"identity"])', 'C2xC6:branching_rule("C8","C2xC6","orthogonal_sum")', 'C3xC5:branching_rule("C8","C3xC5","orthogonal_sum")', 'C4xC4:branching_rule("C8","C4xC4","orthogonal_sum")']
elif (CartanType(ct) == CartanType('D4')):
rul = ['B3:branching_rule("D4","B3","symmetric")', 'A2:branching_rule("D4","A2(1,1)","plethysm")', 'A1xC2:branching_rule("D4","C1xC2","tensor")*branching_rule("C1xC2","A1xC2",[branching_rule("C1","A1","isomorphic"),"identity"])', 'A1xA1xA1xA1:branching_rule("D4","D2xD2","orthogonal_sum")*branching_rule("D2xD2","A1xA1xA1xA1",[branching_rule("D2","A1xA1","isomorphic"),branching_rule("D2","A1xA1","isomorphic")])']
elif (CartanType(ct) == CartanType('D5')):
rul = ['A4:branching_rule("D5","A4","levi")', 'B4:branching_rule("D5","B4","symmetric")', 'C2:branching_rule("D5","C2(2,0)","plethysm")', 'A1xA1xA3:branching_rule("D5","D2xD3","orthogonal_sum")*branching_rule("D2xD3","A1xA1xA3",[branching_rule("D2","A1xA1","isomorphic"),branching_rule("D3","A3","isomorphic")])', 'A1xA3:branching_rule("D5","B1xB3","orthogonal_sum")*branching_rule("B1xB3","A1xA3",[branching_rule("B1","A1","isomorphic"),"identity"])', 'B2xB2:branching_rule("D5","B2xB2","orthogonal_sum")']
elif (CartanType(ct) == CartanType('D6')):
rul = ['A5:branching_rule("D6","A5","levi")', 'B5:branching_rule("D6","B5","symmetric")', 'A1xA3:branching_rule("D6","C1xC3","tensor")*branching_rule("C1xC3","A1xA3",[branching_rule("C1","A1","isomorphic"),"identity"])', 'A1xA1xD4:branching_rule("D6","D2xD4","orthogonal_sum")*branching_rule("D2xD4","A1xA1xD4",[branching_rule("D2","A1xA1","isomorphic"),"identity"])', 'A3xA3:branching_rule("D6","D3xD3","orthogonal_sum")*branching_rule("D3xD3","A3xA3",[branching_rule("D3","A3","isomorphic"),branching_rule("D3","A3","isomorphic")])', 'A1xB4:branching_rule("D6","B1xB4","orthogonal_sum")*branching_rule("B1xB4","A1xB4",[branching_rule("B1","A1","isomorphic"),"identity"])', 'B2xB3:branching_rule("D6","B2xB3","orthogonal_sum")', 'A1xA1xA1:branching_rule("D6","B1xD2","tensor")*branching_rule("B1xD2","A1xA1xA1",[branching_rule("B1","A1","isomorphic"),branching_rule("D2","A1xA1","isomorphic")])']
elif (CartanType(ct) == CartanType('D7')):
rul = ['A6:branching_rule("D7","A6","levi")', 'B6:branching_rule("D7","B6","symmetric")', 'C3:branching_rule("D7","C3(0,1,0)","plethysm")', 'C2:branching_rule("D7","C2(0,2)","plethysm")', 'G2:branching_rule("D7","G2(0,1)","plethysm")', 'A1xA1xD5:branching_rule("D7","D2xD5","orthogonal_sum")*branching_rule("D2xD5","A1xA1xD5",[branching_rule("D2","A1xA1","isomorphic"),"identity"])', 'A3xD4:branching_rule("D7","D3xD4","orthogonal_sum")*branching_rule("D3xD4","A3xD4",[branching_rule("D3","A3","isomorphic"),"identity"])', 'A1xB5:branching_rule("D7","B1xB5","orthogonal_sum")*branching_rule("B1xB5","A1xB5",[branching_rule("B1","A1","isomorphic"),"identity"])', 'B2xB4:branching_rule("D7","B2xB4","orthogonal_sum")', 'B3xB3:branching_rule("D7","B3xB3","orthogonal_sum")']
elif (CartanType(ct) == CartanType('D8')):
rul = ['A7:branching_rule("D8","A7","levi")', 'B7:branching_rule("D8","B7","symmetric")', 'B4:branching_rule("D8","B4(0,0,0,1)","plethysm")', 'A1xC4:branching_rule("D8","C1xC4","tensor")*branching_rule("C1xC4","A1xC4",[branching_rule("C1","A1","isomorphic"),"identity"])', 'A1xA1xD6:branching_rule("D8","D2xD6","orthogonal_sum")*branching_rule("D2xD6","A1xA1xD6",[branching_rule("D2","A1xA1","isomorphic"),"identity"])', 'A3xD5:branching_rule("D8","D3xD5","orthogonal_sum")*branching_rule("D3xD5","A3xD5",[branching_rule("D3","A3","isomorphic"),"identity"])', 'D4xD4:branching_rule("D8","D4xD4","orthogonal_sum")', 'A1xB6:branching_rule("D8","B1xB6","orthogonal_sum")*branching_rule("B1xB6","A1xB6",[branching_rule("B1","A1","isomorphic"),"identity"])', 'B2xB5:branching_rule("D8","B2xB5","orthogonal_sum")', 'B3xB4:branching_rule("D8","B3xB4","orthogonal_sum")', 'C2xC2:branching_rule("D8","C2xC2","tensor")']
elif (CartanType(ct) == CartanType('G2')):
rul = ['A2:branching_rule("G2","A2","extended")', 'A1:branching_rule("G2","A1","i")', 'A1xA1:branching_rule("G2","A1xA1","extended")']
elif (CartanType(ct) == CartanType('F4')):
rul = ['B4:branching_rule("F4","B4","extended")', 'A1:branching_rule("F4","A1","ii")', 'A1xG2:branching_rule("F4","A1xG2","miscellaneous")', 'A1xC3:branching_rule("F4","A1xC3","extended")', 'A2xA2:branching_rule("F4","A2xA2","extended")']
elif (CartanType(ct) == CartanType('E6')):
rul = ['D5:branching_rule("E6","D5","levi")', 'C4:branching_rule("E6","C4","symmetric")', 'F4:branching_rule("E6","F4","symmetric")', 'A2:branching_rule("E6","A2","miscellaneous")', 'G2:branching_rule("E6","G2","miscellaneous")', 'A2xG2:branching_rule("E6","A2xG2","miscellaneous")', 'A1xA5:branching_rule("E6","A1xA5","extended")', 'A2xA2xA2:branching_rule("E6","A2xA2xA2","extended")']
elif (CartanType(ct) == CartanType('E7')):
rul = ['A7:branching_rule("E7","A7","extended")', 'E6:branching_rule("E7","E6","levi")', 'A2:branching_rule("E7","A2","miscellaneous")', 'A1:branching_rule("E7","A1","iii")', 'A1:branching_rule("E7","A1","iv")', 'A1xF4:branching_rule("E7","A1xF4","miscellaneous")', 'G2xC3:branching_rule("E7","G2xC3","miscellaneous")', 'A1xG2:branching_rule("E7","A1xG2","miscellaneous")', 'A1xA1:branching_rule("E7","A1xA1","miscellaneous")', 'A1xD6:branching_rule("E7","A1xD6","extended")', 'A5xA2:branching_rule("E7","A5xA2","extended")']
elif (CartanType(ct) == CartanType('E8')):
rul = ['A4xA4:branching_rule("E8","A4xA4","extended")', 'G2xF4:branching_rule("E8","G2xF4","miscellaneous")', 'E6xA2:branching_rule("E8","E6xA2","extended")', 'E7xA1:branching_rule("E8","E7xA1","extended")', 'D8:branching_rule("E8","D8","extended")', 'A8:branching_rule("E8","A8","extended")', 'B2:branching_rule("E8","B2","miscellaneous")', 'A1xA2:branching_rule("E8","A1xA2","miscellaneous")', 'A1:branching_rule("E8","A1","v")', 'A1:branching_rule("E8","A1","vi")', 'A1:branching_rule("E8","A1","vii")']
else:
raise ValueError('Argument must be an irreducible classical Cartan Type with rank less than or equal to 8')
if (mode == 'print_rules'):
for line in rul:
print(line)
elif (mode == 'get_rule'):
d = {}
for line in rul:
[k, br] = line.split(':')
br = eval(br)
if (k in d):
if (not isinstance(d[k], list)):
d[k] = [d[k]]
d[k].append(br)
else:
d[k] = br
return d
|
class CartanMatrix(Base, CartanType_abstract, metaclass=InheritComparisonClasscallMetaclass):
"\n A (generalized) Cartan matrix.\n\n A matrix `A = (a_{ij})_{i,j \\in I}` for some index set `I` is a\n generalized Cartan matrix if it satisfies the following properties:\n\n - `a_{ii} = 2` for all `i`,\n - `a_{ij} \\leq 0` for all `i \\neq j`,\n - `a_{ij} = 0` if and only if `a_{ji} = 0` for all `i \\neq j`.\n\n Additionally some reference assume that a Cartan matrix is\n *symmetrizable* (see :meth:`is_symmetrizable`). However following Kac, we\n do not make that assumption here.\n\n An even, integral Borcherds--Cartan matrix is an integral matrix\n `A = (a_{ij})_{i,j \\in I}` for some countable index set `I` which satisfies\n the following properties:\n\n - `a_{ii} \\in \\{2\\} \\cup 2\\ZZ_{<0}` for all `i`,\n - `a_{ij} \\leq 0` for all `i \\neq j`,\n - `a_{ij} = 0` if and only if `a_{ji} = 0` for all `i \\neq j`.\n\n INPUT:\n\n Can be anything which is accepted by ``CartanType`` or a matrix.\n\n If given a matrix, one can also use the keyword ``cartan_type`` when giving\n a matrix to explicitly state the type. Otherwise this will try to check the\n input matrix against possible standard types of Cartan matrices. To disable\n this check, use the keyword ``cartan_type_check = False``.\n\n If one wants to initialize a Borcherds-Cartan matrix using matrix data,\n use the keyword ``borcherds=True``. To specify the diagonal entries of\n corresponding to a Cartan type (a Cartan matrix is treated as matrix data),\n use ``borcherds`` with a list of the diagonal entries.\n\n EXAMPLES::\n\n sage: # needs sage.graphs\n sage: CartanMatrix(['A', 4])\n [ 2 -1 0 0]\n [-1 2 -1 0]\n [ 0 -1 2 -1]\n [ 0 0 -1 2]\n sage: CartanMatrix(['B', 6])\n [ 2 -1 0 0 0 0]\n [-1 2 -1 0 0 0]\n [ 0 -1 2 -1 0 0]\n [ 0 0 -1 2 -1 0]\n [ 0 0 0 -1 2 -1]\n [ 0 0 0 0 -2 2]\n sage: CartanMatrix(['C', 4])\n [ 2 -1 0 0]\n [-1 2 -1 0]\n [ 0 -1 2 -2]\n [ 0 0 -1 2]\n sage: CartanMatrix(['D', 6])\n [ 2 -1 0 0 0 0]\n [-1 2 -1 0 0 0]\n [ 0 -1 2 -1 0 0]\n [ 0 0 -1 2 -1 -1]\n [ 0 0 0 -1 2 0]\n [ 0 0 0 -1 0 2]\n sage: CartanMatrix(['E',6])\n [ 2 0 -1 0 0 0]\n [ 0 2 0 -1 0 0]\n [-1 0 2 -1 0 0]\n [ 0 -1 -1 2 -1 0]\n [ 0 0 0 -1 2 -1]\n [ 0 0 0 0 -1 2]\n sage: CartanMatrix(['E',7])\n [ 2 0 -1 0 0 0 0]\n [ 0 2 0 -1 0 0 0]\n [-1 0 2 -1 0 0 0]\n [ 0 -1 -1 2 -1 0 0]\n [ 0 0 0 -1 2 -1 0]\n [ 0 0 0 0 -1 2 -1]\n [ 0 0 0 0 0 -1 2]\n sage: CartanMatrix(['E', 8])\n [ 2 0 -1 0 0 0 0 0]\n [ 0 2 0 -1 0 0 0 0]\n [-1 0 2 -1 0 0 0 0]\n [ 0 -1 -1 2 -1 0 0 0]\n [ 0 0 0 -1 2 -1 0 0]\n [ 0 0 0 0 -1 2 -1 0]\n [ 0 0 0 0 0 -1 2 -1]\n [ 0 0 0 0 0 0 -1 2]\n sage: CartanMatrix(['F', 4])\n [ 2 -1 0 0]\n [-1 2 -1 0]\n [ 0 -2 2 -1]\n [ 0 0 -1 2]\n\n This is different from MuPAD-Combinat, due to different node\n convention?\n\n ::\n\n sage: # needs sage.graphs\n sage: CartanMatrix(['G', 2])\n [ 2 -3]\n [-1 2]\n sage: CartanMatrix(['A',1,1])\n [ 2 -2]\n [-2 2]\n sage: CartanMatrix(['A', 3, 1])\n [ 2 -1 0 -1]\n [-1 2 -1 0]\n [ 0 -1 2 -1]\n [-1 0 -1 2]\n sage: CartanMatrix(['B', 3, 1])\n [ 2 0 -1 0]\n [ 0 2 -1 0]\n [-1 -1 2 -1]\n [ 0 0 -2 2]\n sage: CartanMatrix(['C', 3, 1])\n [ 2 -1 0 0]\n [-2 2 -1 0]\n [ 0 -1 2 -2]\n [ 0 0 -1 2]\n sage: CartanMatrix(['D', 4, 1])\n [ 2 0 -1 0 0]\n [ 0 2 -1 0 0]\n [-1 -1 2 -1 -1]\n [ 0 0 -1 2 0]\n [ 0 0 -1 0 2]\n sage: CartanMatrix(['E', 6, 1])\n [ 2 0 -1 0 0 0 0]\n [ 0 2 0 -1 0 0 0]\n [-1 0 2 0 -1 0 0]\n [ 0 -1 0 2 -1 0 0]\n [ 0 0 -1 -1 2 -1 0]\n [ 0 0 0 0 -1 2 -1]\n [ 0 0 0 0 0 -1 2]\n sage: CartanMatrix(['E', 7, 1])\n [ 2 -1 0 0 0 0 0 0]\n [-1 2 0 -1 0 0 0 0]\n [ 0 0 2 0 -1 0 0 0]\n [ 0 -1 0 2 -1 0 0 0]\n [ 0 0 -1 -1 2 -1 0 0]\n [ 0 0 0 0 -1 2 -1 0]\n [ 0 0 0 0 0 -1 2 -1]\n [ 0 0 0 0 0 0 -1 2]\n sage: CartanMatrix(['E', 8, 1])\n [ 2 0 0 0 0 0 0 0 -1]\n [ 0 2 0 -1 0 0 0 0 0]\n [ 0 0 2 0 -1 0 0 0 0]\n [ 0 -1 0 2 -1 0 0 0 0]\n [ 0 0 -1 -1 2 -1 0 0 0]\n [ 0 0 0 0 -1 2 -1 0 0]\n [ 0 0 0 0 0 -1 2 -1 0]\n [ 0 0 0 0 0 0 -1 2 -1]\n [-1 0 0 0 0 0 0 -1 2]\n sage: CartanMatrix(['F', 4, 1])\n [ 2 -1 0 0 0]\n [-1 2 -1 0 0]\n [ 0 -1 2 -1 0]\n [ 0 0 -2 2 -1]\n [ 0 0 0 -1 2]\n sage: CartanMatrix(['G', 2, 1])\n [ 2 0 -1]\n [ 0 2 -3]\n [-1 -1 2]\n\n Examples of Borcherds-Cartan matrices::\n\n sage: CartanMatrix([[2,-1],[-1,-2]], borcherds=True) # needs sage.graphs\n [ 2 -1]\n [-1 -2]\n sage: CartanMatrix('B3', borcherds=[-4,-6,2]) # needs sage.graphs\n [-4 -1 0]\n [-1 -6 -1]\n [ 0 -2 2]\n\n .. NOTE::\n\n Since this is a matrix, :meth:`row()` and :meth:`column()` will return\n the standard row and column respectively. To get the row with the\n indices as in Dynkin diagrams/Cartan types, use\n :meth:`row_with_indices()` and :meth:`column_with_indices()`\n respectively.\n "
@staticmethod
def __classcall_private__(cls, data=None, index_set=None, cartan_type=None, cartan_type_check=True, borcherds=None):
"\n Normalize input so we can inherit from sparse integer matrix.\n\n .. NOTE::\n\n To disable the Cartan type check, use the optional argument\n ``cartan_type_check = False``.\n\n EXAMPLES::\n\n sage: # needs sage.graphs\n sage: C = CartanMatrix(['A',1,1])\n sage: C2 = CartanMatrix([[2, -2], [-2, 2]])\n sage: C3 = CartanMatrix(matrix([[2, -2], [-2, 2]]), [0, 1])\n sage: C == C2 and C == C3\n True\n\n TESTS:\n\n Check that :trac:`15740` is fixed::\n\n sage: # needs sage.graphs\n sage: d = DynkinDiagram()\n sage: d.add_edge('a', 'b', 2)\n sage: d.index_set()\n ('a', 'b')\n sage: cm = CartanMatrix(d)\n sage: cm.index_set()\n ('a', 'b')\n "
if ((cartan_type is not None) and (data is None)):
data = CartanType(cartan_type)
if (data is None):
data = []
n = 0
index_set = tuple()
cartan_type = None
subdivisions = None
elif isinstance(data, CartanMatrix):
if (index_set is not None):
d = {a: index_set[i] for (i, a) in enumerate(data.index_set())}
return data.relabel(d)
return data
else:
dynkin_diagram = None
subdivisions = None
if isinstance(data, DynkinDiagram_class):
dynkin_diagram = data
cartan_type = data._cartan_type
else:
try:
cartan_type = CartanType(data)
dynkin_diagram = cartan_type.dynkin_diagram()
except (TypeError, ValueError):
pass
if (dynkin_diagram is not None):
n = dynkin_diagram.rank()
index_set = dynkin_diagram.index_set()
oir = dynkin_diagram.odd_isotropic_roots()
reverse = {a: i for (i, a) in enumerate(index_set)}
if isinstance(borcherds, (list, tuple)):
if ((len(borcherds) != len(index_set)) and (not all((((val in ZZ) and ((val == 2) or (((val % 2) == 0) and (val < 0)))) for val in borcherds)))):
raise ValueError('the input data is not a Borcherds-Cartan matrix')
data = {(i, i): (val if (index_set[i] not in oir) else 0) for (i, val) in enumerate(borcherds)}
else:
data = {(i, i): (2 if (index_set[i] not in oir) else 0) for i in range(n)}
for (i, j, l) in dynkin_diagram.edge_iterator():
data[(reverse[j], reverse[i])] = (- l)
else:
M = matrix(data)
if borcherds:
if (not is_borcherds_cartan_matrix(M)):
raise ValueError('the input matrix is not a Borcherds-Cartan matrix')
elif (not is_generalized_cartan_matrix(M)):
raise ValueError('the input matrix is not a generalized Cartan matrix')
n = M.ncols()
data = M.dict()
subdivisions = M._subdivisions
if (index_set is None):
index_set = tuple(range(n))
else:
index_set = tuple(index_set)
if ((len(index_set) != n) and (len(set(index_set)) != n)):
raise ValueError('the given index set is not valid')
mat = typecall(cls, MatrixSpace(ZZ, n, sparse=True), data, False, True)
mat._CM_init(cartan_type, index_set, cartan_type_check)
mat._subdivisions = subdivisions
return mat
def matrix_space(self, nrows=None, ncols=None, sparse=None):
"\n Return a matrix space over the integers.\n\n INPUT:\n\n - ``nrows`` - number of rows\n\n - ``ncols`` - number of columns\n\n - ``sparse`` - (boolean) sparseness\n\n EXAMPLES::\n\n sage: # needs sage.graphs\n sage: cm = CartanMatrix(['A', 3])\n sage: cm.matrix_space()\n Full MatrixSpace of 3 by 3 sparse matrices over Integer Ring\n sage: cm.matrix_space(2, 2)\n Full MatrixSpace of 2 by 2 sparse matrices over Integer Ring\n sage: cm[:2,1:] # indirect doctest\n [-1 0]\n [ 2 -1]\n "
if (nrows is None):
nrows = self.nrows()
if (ncols is None):
ncols = self.ncols()
if (sparse is None):
sparse = True
if ((nrows == self.nrows()) and (ncols == self.ncols()) and sparse):
return self.parent()
else:
from sage.matrix.matrix_space import MatrixSpace
return MatrixSpace(ZZ, nrows, ncols, ((sparse is None) or bool(sparse)))
def _CM_init(self, cartan_type, index_set, cartan_type_check):
'\n Initialize ``self`` as a Cartan matrix.\n\n TESTS::\n\n sage: C = CartanMatrix([\'A\',1,1]) # indirect doctest # needs sage.graphs\n sage: TestSuite(C).run(skip=["_test_category", "_test_change_ring"]) # needs sage.graphs\n '
self._index_set = index_set
self.set_immutable()
if (cartan_type is not None):
cartan_type = CartanType(cartan_type)
elif (self.nrows() == 1):
cartan_type = CartanType(['A', 1])
elif cartan_type_check:
self._cartan_type = None
cartan_type = find_cartan_type_from_matrix(self)
self._cartan_type = cartan_type
def __reduce__(self):
"\n Used for pickling.\n\n TESTS::\n\n sage: CM = CartanMatrix(['A',4]) # needs sage.graphs\n sage: x = loads(dumps(CM)) # needs sage.graphs\n sage: x._index_set # needs sage.graphs\n (1, 2, 3, 4)\n "
if self._cartan_type:
return (CartanMatrix, (self._cartan_type,))
return (CartanMatrix, (self.dynkin_diagram(),))
def root_system(self):
"\n Return the root system corresponding to ``self``.\n\n EXAMPLES::\n\n sage: C = CartanMatrix(['A',3]) # needs sage.graphs\n sage: C.root_system() # needs sage.graphs\n Root system of type ['A', 3]\n "
if (self._cartan_type is not None):
return RootSystem(self._cartan_type)
return self.dynkin_diagram().root_system()
def root_space(self):
"\n Return the root space corresponding to ``self``.\n\n EXAMPLES::\n\n sage: C = CartanMatrix(['A',3]) # needs sage.graphs\n sage: C.root_space() # needs sage.graphs\n Root space over the Rational Field of the Root system of type ['A', 3]\n "
return self.root_system().root_space()
def reflection_group(self, type='matrix'):
"\n Return the reflection group corresponding to ``self``.\n\n EXAMPLES::\n\n sage: C = CartanMatrix(['A',3]) # needs sage.graphs\n sage: C.reflection_group() # needs sage.graphs sage.libs.gap\n Weyl Group of type ['A', 3] (as a matrix group acting on the root space)\n "
RS = self.root_space()
if (type == 'matrix'):
return RS.weyl_group()
if (type == 'permutation'):
if (not self.is_finite()):
raise ValueError('only works for finite types')
Phi = RS.roots()
gens = {}
from sage.groups.perm_gps.permgroup_named import SymmetricGroup
S = SymmetricGroup(len(Phi))
for i in self.index_set():
pi = S([(Phi.index(beta.simple_reflection(i)) + 1) for beta in Phi])
gens[i] = pi
return S.subgroup((gens[i] for i in gens))
raise ValueError('the reflection group is only available as a matrix group or as a permutation group')
def symmetrizer(self):
"\n Return the symmetrizer of ``self``.\n\n EXAMPLES::\n\n sage: cm = CartanMatrix([[2,-5],[-2,2]]) # needs sage.graphs\n sage: cm.symmetrizer() # needs sage.graphs\n Finite family {0: 2, 1: 5}\n\n TESTS:\n\n Check that the symmetrizer computed from the Cartan matrix agrees\n with the values given by the Cartan type::\n\n sage: ct = CartanType(['B',4,1])\n sage: ct.symmetrizer() # needs sage.graphs\n Finite family {0: 2, 1: 2, 2: 2, 3: 2, 4: 1}\n sage: ct.cartan_matrix().symmetrizer() # needs sage.graphs\n Finite family {0: 2, 1: 2, 2: 2, 3: 2, 4: 1}\n "
sym = self.is_symmetrizable(True)
if (not sym):
raise ValueError('the Cartan matrix is not symmetrizable')
iset = self.index_set()
from sage.arith.functions import lcm as LCM
from sage.rings.rational_field import QQ
scalar = LCM([QQ(x).denominator() for x in sym])
return Family({iset[i]: ZZ((val * scalar)) for (i, val) in enumerate(sym)})
@cached_method
def symmetrized_matrix(self):
"\n Return the symmetrized matrix of ``self`` if symmetrizable.\n\n EXAMPLES::\n\n sage: cm = CartanMatrix(['B',4,1]) # needs sage.graphs\n sage: cm.symmetrized_matrix() # needs sage.graphs\n [ 4 0 -2 0 0]\n [ 0 4 -2 0 0]\n [-2 -2 4 -2 0]\n [ 0 0 -2 4 -2]\n [ 0 0 0 -2 2]\n "
M = (matrix.diagonal(list(self.symmetrizer())) * self)
M.set_immutable()
return M
def index_set(self):
"\n Return the index set of ``self``.\n\n EXAMPLES::\n\n sage: # needs sage.graphs\n sage: C = CartanMatrix(['A',1,1])\n sage: C.index_set()\n (0, 1)\n sage: C = CartanMatrix(['E',6])\n sage: C.index_set()\n (1, 2, 3, 4, 5, 6)\n "
return self._index_set
def cartan_type(self):
"\n Return the Cartan type of ``self`` or ``self`` if unknown.\n\n EXAMPLES::\n\n sage: C = CartanMatrix(['A',4,1]) # needs sage.graphs\n sage: C.cartan_type() # needs sage.graphs\n ['A', 4, 1]\n\n If the Cartan type is unknown::\n\n sage: C = CartanMatrix([[2,-1,-2], [-1,2,-1], [-2,-1,2]]) # needs sage.graphs\n sage: C.cartan_type() # needs sage.graphs\n [ 2 -1 -2]\n [-1 2 -1]\n [-2 -1 2]\n "
if (self._cartan_type is None):
return self
if (is_borcherds_cartan_matrix(self) and (not is_generalized_cartan_matrix(self))):
return self
return self._cartan_type
def subtype(self, index_set):
"\n Return a subtype of ``self`` given by ``index_set``.\n\n A subtype can be considered the Dynkin diagram induced from\n the Dynkin diagram of ``self`` by ``index_set``.\n\n EXAMPLES::\n\n sage: # needs sage.graphs\n sage: C = CartanMatrix(['F',4])\n sage: S = C.subtype([1,2,3])\n sage: S\n [ 2 -1 0]\n [-1 2 -1]\n [ 0 -2 2]\n sage: S.index_set()\n (1, 2, 3)\n "
ind = self.index_set()
I = [ind.index(i) for i in index_set]
return CartanMatrix(self.matrix_from_rows_and_columns(I, I), index_set=index_set)
def rank(self):
'\n Return the rank of ``self``.\n\n EXAMPLES::\n\n sage: CartanMatrix([\'C\',3]).rank() # needs sage.graphs\n 3\n sage: CartanMatrix(["A2","B2","F4"]).rank() # needs sage.graphs\n 8\n '
return self.ncols()
def relabel(self, relabelling):
"\n Return the relabelled Cartan matrix.\n\n EXAMPLES::\n\n sage: # needs sage.graphs\n sage: CM = CartanMatrix(['C',3])\n sage: R = CM.relabel({1:0, 2:4, 3:1}); R\n [ 2 0 -1]\n [ 0 2 -1]\n [-1 -2 2]\n sage: R.index_set()\n (0, 1, 4)\n sage: CM\n [ 2 -1 0]\n [-1 2 -2]\n [ 0 -1 2]\n "
return self.dynkin_diagram().relabel(relabelling, inplace=False).cartan_matrix()
@cached_method
def dynkin_diagram(self):
"\n Return the Dynkin diagram corresponding to ``self``.\n\n EXAMPLES::\n\n sage: # needs sage.graphs\n sage: C = CartanMatrix(['A',2])\n sage: C.dynkin_diagram()\n O---O\n 1 2\n A2\n sage: C = CartanMatrix(['F',4,1])\n sage: C.dynkin_diagram()\n O---O---O=>=O---O\n 0 1 2 3 4\n F4~\n sage: C = CartanMatrix([[2,-4],[-4,2]])\n sage: C.dynkin_diagram()\n Dynkin diagram of rank 2\n "
from sage.combinat.root_system.dynkin_diagram import DynkinDiagram
if (self._cartan_type is not None):
return DynkinDiagram(self._cartan_type)
return DynkinDiagram(self)
def cartan_matrix(self):
"\n Return the Cartan matrix of ``self``.\n\n EXAMPLES::\n\n sage: CartanMatrix(['C',3]).cartan_matrix() # needs sage.graphs\n [ 2 -1 0]\n [-1 2 -2]\n [ 0 -1 2]\n "
return self
def dual(self):
"\n Return the dual Cartan matrix of ``self``, which is obtained by taking\n the transpose.\n\n EXAMPLES::\n\n sage: # needs sage.graphs\n sage: ct = CartanType(['C',3])\n sage: M = CartanMatrix(ct); M\n [ 2 -1 0]\n [-1 2 -2]\n [ 0 -1 2]\n sage: M.dual()\n [ 2 -1 0]\n [-1 2 -1]\n [ 0 -2 2]\n sage: M.dual() == CartanMatrix(ct.dual())\n True\n sage: M.dual().cartan_type() == ct.dual()\n True\n\n An example with arbitrary Cartan matrices::\n\n sage: # needs sage.graphs\n sage: cm = CartanMatrix([[2,-5], [-2, 2]]); cm\n [ 2 -5]\n [-2 2]\n sage: cm.dual()\n [ 2 -2]\n [-5 2]\n sage: cm.dual() == CartanMatrix(cm.transpose())\n True\n sage: cm.dual().dual() == cm\n True\n "
if (self._cartan_type is not None):
return CartanMatrix(self._cartan_type.dual())
return CartanMatrix(self.transpose())
def is_simply_laced(self):
'\n Implements :meth:`CartanType_abstract.is_simply_laced()`.\n\n A Cartan matrix is simply-laced if all non diagonal entries are `0`\n or `-1`.\n\n EXAMPLES::\n\n sage: cm = CartanMatrix([[2, -1, -1, -1], [-1, 2, -1, -1], # needs sage.graphs\n ....: [-1, -1, 2, -1], [-1, -1, -1, 2]])\n sage: cm.is_simply_laced() # needs sage.graphs\n True\n '
for i in range(self.nrows()):
for j in range((i + 1), self.ncols()):
if ((self[(i, j)] < (- 1)) or (self[(j, i)] < (- 1))):
return False
return True
def is_crystallographic(self):
"\n Implements :meth:`CartanType_abstract.is_crystallographic`.\n\n A Cartan matrix is crystallographic if it is symmetrizable.\n\n EXAMPLES::\n\n sage: CartanMatrix(['F',4]).is_crystallographic() # needs sage.graphs\n True\n "
return self.is_symmetrizable()
def column_with_indices(self, j):
"\n Return the `j^{th}` column `(a_{i,j})_i` of ``self`` as a container\n (or iterator) of tuples `(i, a_{i,j})`\n\n EXAMPLES::\n\n sage: M = CartanMatrix(['B',4]) # needs sage.graphs\n sage: [ (i,a) for (i,a) in M.column_with_indices(3) ] # needs sage.graphs\n [(3, 2), (2, -1), (4, -2)]\n "
return self.dynkin_diagram().column(j)
def row_with_indices(self, i):
"\n Return the `i^{th}` row `(a_{i,j})_j` of ``self`` as a container\n (or iterator) of tuples `(j, a_{i,j})`\n\n EXAMPLES::\n\n sage: M = CartanMatrix(['C',4]) # needs sage.graphs\n sage: [ (i,a) for (i,a) in M.row_with_indices(3) ] # needs sage.graphs\n [(3, 2), (2, -1), (4, -2)]\n "
return self.dynkin_diagram().row(i)
@cached_method
def is_finite(self):
"\n Return ``True`` if ``self`` is a finite type or ``False`` otherwise.\n\n A generalized Cartan matrix is finite if the determinant of all its\n principal submatrices (see :meth:`principal_submatrices`) is positive.\n Such matrices have a positive definite symmetrized matrix. Note that a\n finite matrix may consist of multiple blocks of Cartan matrices each\n having finite Cartan type.\n\n EXAMPLES::\n\n sage: # needs sage.graphs\n sage: M = CartanMatrix(['C',4])\n sage: M.is_finite()\n True\n sage: M = CartanMatrix(['D',4,1])\n sage: M.is_finite()\n False\n sage: M = CartanMatrix([[2, -4], [-3, 2]])\n sage: M.is_finite()\n False\n "
if (self._cartan_type is None):
if (not self.is_symmetrizable()):
return False
return self.symmetrized_matrix().is_positive_definite()
return self._cartan_type.is_finite()
@cached_method
def is_affine(self):
"\n Return ``True`` if ``self`` is an affine type or ``False`` otherwise.\n\n A generalized Cartan matrix is affine if all of its indecomposable\n blocks are either finite (see :meth:`is_finite`) or have zero\n determinant with all proper principal minors positive.\n\n EXAMPLES::\n\n sage: # needs sage.graphs\n sage: M = CartanMatrix(['C',4])\n sage: M.is_affine()\n False\n sage: M = CartanMatrix(['D',4,1])\n sage: M.is_affine()\n True\n sage: M = CartanMatrix([[2, -4], [-3, 2]])\n sage: M.is_affine()\n False\n "
if (self._cartan_type is None):
if (self.det() != 0):
return False
for b in self.indecomposable_blocks():
if ((b.det() < 0) or (not all(((a.det() > 0) for a in b.principal_submatrices(proper=True))))):
return False
return True
return self._cartan_type.is_affine()
@cached_method
def is_hyperbolic(self, compact=False):
"\n Return if ``True`` if ``self`` is a (compact) hyperbolic type\n or ``False`` otherwise.\n\n An indecomposable generalized Cartan matrix is hyperbolic if it has\n negative determinant and if any proper connected subdiagram of its\n Dynkin diagram is of finite or affine type. It is compact hyperbolic\n if any proper connected subdiagram has finite type.\n\n INPUT:\n\n - ``compact`` -- if ``True``, check if matrix is compact hyperbolic\n\n EXAMPLES::\n\n sage: # needs sage.graphs\n sage: M = CartanMatrix([[2,-2,0],[-2,2,-1],[0,-1,2]])\n sage: M.is_hyperbolic()\n True\n sage: M.is_hyperbolic(compact=True)\n False\n sage: M = CartanMatrix([[2,-3],[-3,2]])\n sage: M.is_hyperbolic()\n True\n sage: M = CartanMatrix(['C',4])\n sage: M.is_hyperbolic()\n False\n "
if ((not self.is_indefinite()) or (not self.is_indecomposable())):
return False
D = self.dynkin_diagram()
verts = tuple(D.vertex_iterator())
for v in verts:
l = (set(verts) - set((v,)))
subg = D.subgraph(vertices=l)
if (compact and (not subg.is_finite())):
return False
elif ((not subg.is_finite()) and (not subg.is_affine())):
return False
return True
@cached_method
def is_lorentzian(self):
'\n Return ``True`` if ``self`` is a Lorentzian type or ``False`` otherwise.\n\n A generalized Cartan matrix is Lorentzian if it has negative determinant\n and exactly one negative eigenvalue.\n\n EXAMPLES::\n\n sage: # needs sage.graphs\n sage: M = CartanMatrix([[2,-3],[-3,2]])\n sage: M.is_lorentzian()\n True\n sage: M = CartanMatrix([[2,-1],[-1,2]])\n sage: M.is_lorentzian()\n False\n '
if (self.det() >= 0):
return False
return (sum((1 for x in self.eigenvalues() if (x < 0))) == 1)
@cached_method
def is_indefinite(self):
'\n Return if ``self`` is an indefinite type or ``False`` otherwise.\n\n EXAMPLES::\n\n sage: # needs sage.graphs\n sage: M = CartanMatrix([[2,-3],[-3,2]])\n sage: M.is_indefinite()\n True\n sage: M = CartanMatrix("A2")\n sage: M.is_indefinite()\n False\n '
return ((not self.is_finite()) and (not self.is_affine()))
@cached_method
def is_indecomposable(self):
"\n Return if ``self`` is an indecomposable matrix or ``False`` otherwise.\n\n EXAMPLES::\n\n sage: # needs sage.graphs\n sage: M = CartanMatrix(['A',5])\n sage: M.is_indecomposable()\n True\n sage: M = CartanMatrix([[2,-1,0],[-1,2,0],[0,0,2]])\n sage: M.is_indecomposable()\n False\n "
comp_num = self.dynkin_diagram().connected_components_number()
return (comp_num <= 1)
@cached_method
def coxeter_matrix(self):
"\n Return the Coxeter matrix for ``self``.\n\n .. SEEALSO:: :meth:`CartanType_abstract.coxeter_matrix`\n\n EXAMPLES::\n\n sage: # needs sage.graphs\n sage: cm = CartanMatrix([[2,-5,0],[-2,2,-1],[0,-1,2]])\n sage: cm.coxeter_matrix()\n [ 1 -1 2]\n [-1 1 3]\n [ 2 3 1]\n sage: ct = CartanType([['A',2,2], ['B',3]])\n sage: ct.coxeter_matrix()\n [ 1 -1 2 2 2]\n [-1 1 2 2 2]\n [ 2 2 1 3 2]\n [ 2 2 3 1 4]\n [ 2 2 2 4 1]\n sage: ct.cartan_matrix().coxeter_matrix() == ct.coxeter_matrix()\n True\n "
scalarproducts_to_order = {0: 2, 1: 3, 2: 4, 3: 6}
from sage.combinat.root_system.coxeter_matrix import CoxeterMatrix
I = self.index_set()
n = len(I)
M = matrix.identity(ZZ, n)
for i in range(n):
for j in range((i + 1), n):
val = (self[(i, j)] * self[(j, i)])
val = scalarproducts_to_order.get(val, (- 1))
M[(i, j)] = val
M[(j, i)] = val
return CoxeterMatrix(M, index_set=self.index_set(), cartan_type=self)
@cached_method
def coxeter_diagram(self):
"\n Construct the Coxeter diagram of ``self``.\n\n .. SEEALSO:: :meth:`CartanType_abstract.coxeter_diagram`\n\n EXAMPLES::\n\n sage: # needs sage.graphs\n sage: cm = CartanMatrix([[2,-5,0],[-2,2,-1],[0,-1,2]])\n sage: G = cm.coxeter_diagram(); G\n Graph on 3 vertices\n sage: G.edges(sort=True)\n [(0, 1, +Infinity), (1, 2, 3)]\n sage: ct = CartanType([['A',2,2], ['B',3]])\n sage: ct.coxeter_diagram()\n Graph on 5 vertices\n sage: ct.cartan_matrix().coxeter_diagram() == ct.coxeter_diagram()\n True\n "
return self.coxeter_matrix().coxeter_graph()
def principal_submatrices(self, proper=False):
"\n Return a list of all principal submatrices of ``self``.\n\n INPUT:\n\n - ``proper`` -- if ``True``, return only proper submatrices\n\n EXAMPLES::\n\n sage: M = CartanMatrix(['A',2]) # needs sage.graphs\n sage: M.principal_submatrices() # needs sage.graphs\n [\n [ 2 -1]\n [], [2], [2], [-1 2]\n ]\n sage: M.principal_submatrices(proper=True) # needs sage.graphs\n [[], [2], [2]]\n\n "
iset = list(range(self.ncols()))
ret = []
for l in powerset(iset):
if ((not proper) or (proper and (l != iset))):
ret.append(self.matrix_from_rows_and_columns(l, l))
return ret
@cached_method
def indecomposable_blocks(self):
"\n Return a tuple of all indecomposable blocks of ``self``.\n\n EXAMPLES::\n\n sage: # needs sage.graphs\n sage: M = CartanMatrix(['A',2])\n sage: M.indecomposable_blocks()\n (\n [ 2 -1]\n [-1 2]\n )\n sage: M = CartanMatrix([['A',2,1],['A',3,1]])\n sage: M.indecomposable_blocks()\n (\n [ 2 -1 0 -1]\n [-1 2 -1 0] [ 2 -1 -1]\n [ 0 -1 2 -1] [-1 2 -1]\n [-1 0 -1 2], [-1 -1 2]\n )\n "
subgraphs = self.dynkin_diagram().connected_components_subgraphs()
return tuple((CartanMatrix(subg._matrix_().rows()) for subg in subgraphs))
|
def is_borcherds_cartan_matrix(M):
'\n Return ``True`` if ``M`` is an even, integral Borcherds-Cartan matrix.\n For a definition of such a matrix, see :class:`CartanMatrix`.\n\n EXAMPLES::\n\n sage: from sage.combinat.root_system.cartan_matrix import is_borcherds_cartan_matrix\n sage: M = Matrix([[2,-1],[-1,2]])\n sage: is_borcherds_cartan_matrix(M)\n True\n sage: N = Matrix([[2,-1],[-1,0]])\n sage: is_borcherds_cartan_matrix(N)\n False\n sage: O = Matrix([[2,-1],[-1,-2]])\n sage: is_borcherds_cartan_matrix(O)\n True\n sage: O = Matrix([[2,-1],[-1,-3]])\n sage: is_borcherds_cartan_matrix(O)\n False\n '
if (not is_Matrix(M)):
return False
if (not M.is_square()):
return False
n = M.ncols()
for i in range(n):
if (M[(i, i)] == 0):
return False
if ((M[(i, i)] % 2) == 1):
return False
for j in range((i + 1), n):
if ((M[(i, j)] > 0) or (M[(j, i)] > 0)):
return False
elif ((M[(i, j)] == 0) and (M[(j, i)] != 0)):
return False
elif ((M[(j, i)] == 0) and (M[(i, j)] != 0)):
return False
return True
|
def is_generalized_cartan_matrix(M):
'\n Return ``True`` if ``M`` is a generalized Cartan matrix. For a definition\n of a generalized Cartan matrix, see :class:`CartanMatrix`.\n\n EXAMPLES::\n\n sage: from sage.combinat.root_system.cartan_matrix import is_generalized_cartan_matrix\n sage: M = matrix([[2,-1,-2], [-1,2,-1], [-2,-1,2]])\n sage: is_generalized_cartan_matrix(M)\n True\n sage: M = matrix([[2,-1,-2], [-1,2,-1], [0,-1,2]])\n sage: is_generalized_cartan_matrix(M)\n False\n sage: M = matrix([[1,-1,-2], [-1,2,-1], [-2,-1,2]])\n sage: is_generalized_cartan_matrix(M)\n False\n\n A non-symmetrizable example::\n\n sage: M = matrix([[2,-1,-2], [-1,2,-1], [-1,-1,2]])\n sage: is_generalized_cartan_matrix(M)\n True\n '
if (not is_borcherds_cartan_matrix(M)):
return False
n = M.ncols()
return all(((M[(i, i)] == 2) for i in range(n)))
|
def find_cartan_type_from_matrix(CM):
"\n Find a Cartan type by direct comparison of Dynkin diagrams given from\n the generalized Cartan matrix ``CM`` and return ``None`` if not found.\n\n INPUT:\n\n - ``CM`` -- a generalized Cartan matrix\n\n EXAMPLES::\n\n sage: # needs sage.graphs\n sage: from sage.combinat.root_system.cartan_matrix import find_cartan_type_from_matrix\n sage: CM = CartanMatrix([[2,-1,-1], [-1,2,-1], [-1,-1,2]])\n sage: find_cartan_type_from_matrix(CM)\n ['A', 2, 1]\n sage: CM = CartanMatrix([[2,-1,0], [-1,2,-2], [0,-1,2]])\n sage: find_cartan_type_from_matrix(CM)\n ['C', 3] relabelled by {1: 0, 2: 1, 3: 2}\n sage: CM = CartanMatrix([[2,-1,-2], [-1,2,-1], [-2,-1,2]])\n sage: find_cartan_type_from_matrix(CM)\n\n TESTS:\n\n Check that :issue:`35987` is fixed::\n\n sage: from sage.combinat.root_system.cartan_matrix import find_cartan_type_from_matrix\n sage: cm = CartanMatrix(['A',7]).subtype([2,3,5])\n sage: find_cartan_type_from_matrix(cm)\n A2xA1 relabelled by {1: 2, 2: 3, 3: 5}\n\n sage: cm = CartanMatrix(['B',10,1]).subtype([0,1,2,3,5,6,8,9,10])\n sage: ct = find_cartan_type_from_matrix(cm); ct\n D4xB3xA2 relabelled by {1: 0, 2: 2, 3: 1, 4: 3, 5: 8, 6: 9, 7: 10, 8: 5, 9: 6}\n sage: ct.dynkin_diagram()\n O 3\n |\n |\n O---O---O\n 0 2 1\n O---O=>=O\n 8 9 10\n O---O\n 5 6\n D4xB3xA2 relabelled by {1: 0, 2: 2, 3: 1, 4: 3, 5: 8, 6: 9, 7: 10, 8: 5, 9: 6}\n "
types = []
relabel = []
for S in CM.dynkin_diagram().connected_components_subgraphs():
S = DiGraph(S)
n = S.num_verts()
if (n == 1):
relabel.append({1: S.vertices()[0]})
types.append(CartanType(['A', 1]))
continue
test = [['A', n]]
if (n >= 2):
if (n == 2):
test += [['G', 2], ['A', 2, 2]]
test += [['B', n], ['A', (n - 1), 1]]
if (n >= 3):
if (n == 3):
test.append(['G', 2, 1])
test += [['C', n], ['BC', (n - 1), 2], ['C', (n - 1), 1]]
if (n >= 4):
if (n == 4):
test.append(['F', 4])
test += [['D', n], ['B', (n - 1), 1]]
if (n >= 5):
if (n == 5):
test.append(['F', 4, 1])
test.append(['D', (n - 1), 1])
if (n == 6):
test.append(['E', 6])
elif (n == 7):
test += [['E', 7], ['E', 6, 1]]
elif (n == 8):
test += [['E', 8], ['E', 7, 1]]
elif (n == 9):
test.append(['E', 8, 1])
found = False
for x in test:
ct = CartanType(x)
T = DiGraph(ct.dynkin_diagram())
(iso, match) = T.is_isomorphic(S, certificate=True, edge_labels=True)
if iso:
types.append(ct)
relabel.append(match)
found = True
break
if (ct == ct.dual()):
continue
ct = ct.dual()
T = DiGraph(ct.dynkin_diagram())
(iso, match) = T.is_isomorphic(S, certificate=True, edge_labels=True)
if iso:
types.append(ct)
relabel.append(match)
found = True
break
if (not found):
return None
if (len(types) == 1):
return CartanType(types[0]).relabel(relabel[0])
ct = CartanType(types)
mapping = {i: relabel[d[0]][d[1]] for (d, i) in ct._index_relabelling.items()}
return ct.relabel(mapping)
|
class CartanTypeFactory(SageObject):
def __call__(self, *args):
'\n Constructs a Cartan type object.\n\n INPUT:\n\n - ``[letter, rank]`` -- letter is one of \'A\', \'B\', \'C\', \'D\', \'E\', \'F\', \'G\'\n and rank is an integer or a pair of integers\n\n - ``[letter, rank, twist]`` -- letter is one of \'A\', \'B\', \'C\', \'D\', \'E\', \'F\', \'G\', \'BC\'\n and rank and twist are integers\n\n - ``str`` -- a string\n\n - ``object`` -- a Cartan type, or an object with a Cartan type method\n\n EXAMPLES:\n\n We construct the Cartan type `D_4`::\n\n sage: d4 = CartanType([\'D\',4])\n sage: d4\n [\'D\', 4]\n\n or, for short::\n\n sage: CartanType("D4")\n [\'D\', 4]\n\n .. SEEALSO:: :func:`~sage.combinat.root_system.cartan_type.CartanType`\n\n TESTS:\n\n Check that this is compatible with :class:`CartanTypeFolded`::\n\n sage: fct = CartanType([\'C\', 4, 1]).as_folding()\n sage: CartanType(fct)\n [\'C\', 4, 1]\n\n Check that :trac:`13774` is fixed::\n\n sage: CT = CartanType([[\'A\',2]])\n sage: CT.is_irreducible()\n True\n sage: CT.cartan_matrix() # needs sage.graphs\n [ 2 -1]\n [-1 2]\n sage: CT = CartanType([\'A2\'])\n sage: CT.is_irreducible()\n True\n sage: CartanType(\'A2\')\n [\'A\', 2]\n\n Check that we can pass any Cartan type as a single element list::\n\n sage: CT = CartanType([\'A2\', \'A2\', \'A2\'])\n sage: CartanType([CT])\n A2xA2xA2\n\n sage: CT = CartanType(\'A2\').relabel({1:-1, 2:-2})\n sage: CartanType([CT])\n [\'A\', 2] relabelled by {1: -1, 2: -2}\n\n Check the errors from :trac:`20973`::\n\n sage: CartanType([\'A\',-1])\n Traceback (most recent call last):\n ...\n ValueError: [\'A\', -1] is not a valid Cartan type\n\n Check that unicode is handled properly (:trac:`23323`)::\n\n sage: CartanType(u"A3")\n [\'A\', 3]\n '
if (len(args) == 1):
t = args[0]
else:
t = args
if isinstance(t, (CartanType_abstract, SuperCartanType_standard)):
return t
if hasattr(t, 'cartan_type'):
return t.cartan_type()
if (len(t) == 1):
t = t[0]
if isinstance(t, (CartanType_abstract, SuperCartanType_standard)):
return t
from sage.rings.semirings.non_negative_integer_semiring import NN
if isinstance(t, str):
if ('x' in t):
from . import type_reducible
return type_reducible.CartanType([CartanType(u) for u in t.split('x')])
elif (t[(- 1)] == '*'):
return CartanType(t[:(- 1)]).dual()
elif (t[(- 1)] == '~'):
return CartanType(t[:(- 1)]).affine()
elif (t in ['Aoo', 'A∞']):
return CartanType(['A', Infinity])
elif (t == 'A+oo'):
from . import type_A_infinity
return type_A_infinity.CartanType(NN)
else:
return CartanType([t[0], eval(t[1:])])
t = list(t)
if (isinstance(t[0], str) and (t[1] in [Infinity, ZZ, NN])):
(letter, n) = (t[0], t[1])
if (letter == 'A'):
from . import type_A_infinity
if (t[1] == NN):
return type_A_infinity.CartanType(NN)
else:
return type_A_infinity.CartanType(ZZ)
if (isinstance(t[0], str) and (t[1] in ZZ) and (t[1] >= 0)):
(letter, n) = (t[0], t[1])
if (len(t) == 2):
if (letter == 'A'):
if (n >= 0):
from . import type_A
return type_A.CartanType(n)
if (letter == 'B'):
if (n >= 1):
from . import type_B
return type_B.CartanType(n)
if (letter == 'C'):
if (n >= 1):
from . import type_C
return type_C.CartanType(n)
if (letter == 'D'):
from . import type_D
if (n >= 2):
return type_D.CartanType(n)
if (letter == 'E'):
if ((n >= 6) and (n <= 8)):
from . import type_E
return type_E.CartanType(n)
if (letter == 'F'):
if (n == 4):
from . import type_F
return type_F.CartanType()
if (letter == 'G'):
if (n == 2):
from . import type_G
return type_G.CartanType()
if (letter == 'H'):
if (n in [3, 4]):
from . import type_H
return type_H.CartanType(n)
if (letter == 'I'):
if (n == 1):
return CartanType([['A', 1], ['A', 1]])
if (n == 3):
return CartanType(['A', 2])
if (n == 4):
return CartanType(['C', 2])
if (n == 6):
return CartanType(['G', 2])
if (n >= 1):
from . import type_I
return type_I.CartanType(n)
if (letter == 'Q'):
if (n >= 1):
from . import type_Q
return type_Q.CartanType(n)
if (len(t) == 3):
if (t[2] == 1):
if (letter == 'A'):
if (n >= 1):
from . import type_A_affine
return type_A_affine.CartanType(n)
if (letter == 'B'):
if (n >= 1):
from . import type_B_affine
return type_B_affine.CartanType(n)
if (letter == 'C'):
if (n >= 1):
from . import type_C_affine
return type_C_affine.CartanType(n)
if (letter == 'D'):
from . import type_D_affine
if (n >= 3):
return type_D_affine.CartanType(n)
if (letter == 'E'):
if ((n >= 6) and (n <= 8)):
from . import type_E_affine
return type_E_affine.CartanType(n)
if (letter == 'F'):
if (n == 4):
from . import type_F_affine
return type_F_affine.CartanType()
if (letter == 'G'):
if (n == 2):
from . import type_G_affine
return type_G_affine.CartanType()
if (t[2] in [2, 3]):
if ((letter == 'BC') and (t[2] == 2)):
if (n >= 1):
from . import type_BC_affine
return type_BC_affine.CartanType(n)
if ((letter == 'A') and (t[2] == 2)):
if ((n % 2) == 0):
return CartanType(['BC', ZZ((n // 2)), 2])
else:
return CartanType(['B', ZZ(((n + 1) // 2)), 1]).dual()
if ((letter == 'D') and (t[2] == 2)):
return CartanType(['C', (n - 1), 1]).dual()
if ((letter == 'D') and (t[2] == 3) and (n == 4)):
return CartanType(['G', 2, 1]).dual().relabel([0, 2, 1])
if ((letter == 'E') and (t[2] == 2) and (n == 6)):
return CartanType(['F', 4, 1]).dual()
raise ValueError(('%s is not a valid Cartan type' % t))
if (isinstance(t[0], str) and isinstance(t[1], (list, tuple))):
(letter, n) = (t[0], t[1])
if ((len(t) == 2) and (len(n) == 2)):
from . import type_super_A
return type_super_A.CartanType(n[0], n[1])
raise ValueError(('%s is not a valid super Cartan type' % t))
from . import type_reducible
try:
return type_reducible.CartanType([CartanType(subtype) for subtype in t])
except (SyntaxError, ValueError):
raise ValueError(('%s is not a valid Cartan type' % t))
def _repr_(self):
'\n EXAMPLES::\n\n sage: CartanType # indirect doctest\n CartanType\n '
return 'CartanType'
def samples(self, finite=None, affine=None, crystallographic=None):
"\n Return a sample of the available Cartan types.\n\n INPUT:\n\n - ``finite`` -- a boolean or ``None`` (default: ``None``)\n\n - ``affine`` -- a boolean or ``None`` (default: ``None``)\n\n - ``crystallographic`` -- a boolean or ``None`` (default: ``None``)\n\n The sample contains all the exceptional finite and affine\n Cartan types, as well as typical representatives of the\n infinite families.\n\n EXAMPLES::\n\n sage: CartanType.samples()\n [['A', 1], ['A', 5], ['B', 1], ['B', 5], ['C', 1], ['C', 5], ['D', 2], ['D', 3], ['D', 5],\n ['E', 6], ['E', 7], ['E', 8], ['F', 4], ['G', 2], ['I', 5], ['H', 3], ['H', 4],\n ['A', 1, 1], ['A', 5, 1], ['B', 1, 1], ['B', 5, 1],\n ['C', 1, 1], ['C', 5, 1], ['D', 3, 1], ['D', 5, 1],\n ['E', 6, 1], ['E', 7, 1], ['E', 8, 1], ['F', 4, 1], ['G', 2, 1], ['BC', 1, 2], ['BC', 5, 2],\n ['B', 5, 1]^*, ['C', 4, 1]^*, ['F', 4, 1]^*, ['G', 2, 1]^*, ['BC', 1, 2]^*, ['BC', 5, 2]^*]\n\n The finite, affine and crystallographic options allow\n respectively for restricting to (non) finite, (non) affine,\n and (non) crystallographic Cartan types::\n\n sage: CartanType.samples(finite=True)\n [['A', 1], ['A', 5], ['B', 1], ['B', 5], ['C', 1], ['C', 5], ['D', 2], ['D', 3], ['D', 5],\n ['E', 6], ['E', 7], ['E', 8], ['F', 4], ['G', 2], ['I', 5], ['H', 3], ['H', 4]]\n\n sage: CartanType.samples(affine=True)\n [['A', 1, 1], ['A', 5, 1], ['B', 1, 1], ['B', 5, 1],\n ['C', 1, 1], ['C', 5, 1], ['D', 3, 1], ['D', 5, 1],\n ['E', 6, 1], ['E', 7, 1], ['E', 8, 1], ['F', 4, 1], ['G', 2, 1], ['BC', 1, 2], ['BC', 5, 2],\n ['B', 5, 1]^*, ['C', 4, 1]^*, ['F', 4, 1]^*, ['G', 2, 1]^*, ['BC', 1, 2]^*, ['BC', 5, 2]^*]\n\n sage: CartanType.samples(crystallographic=True)\n [['A', 1], ['A', 5], ['B', 1], ['B', 5], ['C', 1], ['C', 5], ['D', 2], ['D', 3], ['D', 5],\n ['E', 6], ['E', 7], ['E', 8], ['F', 4], ['G', 2],\n ['A', 1, 1], ['A', 5, 1], ['B', 1, 1], ['B', 5, 1],\n ['C', 1, 1], ['C', 5, 1], ['D', 3, 1], ['D', 5, 1],\n ['E', 6, 1], ['E', 7, 1], ['E', 8, 1], ['F', 4, 1], ['G', 2, 1], ['BC', 1, 2], ['BC', 5, 2],\n ['B', 5, 1]^*, ['C', 4, 1]^*, ['F', 4, 1]^*, ['G', 2, 1]^*, ['BC', 1, 2]^*, ['BC', 5, 2]^*]\n\n sage: CartanType.samples(crystallographic=False)\n [['I', 5], ['H', 3], ['H', 4]]\n\n .. TODO:: add some reducible Cartan types (suggestions?)\n\n TESTS::\n\n sage: for ct in CartanType.samples(): TestSuite(ct).run()\n "
result = self._samples()
if (crystallographic is not None):
result = [t for t in result if (t.is_crystallographic() == crystallographic)]
if (finite is not None):
result = [t for t in result if (t.is_finite() == finite)]
if (affine is not None):
result = [t for t in result if (t.is_affine() == affine)]
return result
@cached_method
def _samples(self):
"\n Return a sample of all implemented Cartan types.\n\n .. NOTE:: This is intended to be used through :meth:`samples`.\n\n EXAMPLES::\n\n sage: CartanType._samples()\n [['A', 1], ['A', 5], ['B', 1], ['B', 5], ['C', 1], ['C', 5], ['D', 2], ['D', 3], ['D', 5],\n ['E', 6], ['E', 7], ['E', 8], ['F', 4], ['G', 2], ['I', 5], ['H', 3], ['H', 4],\n ['A', 1, 1], ['A', 5, 1], ['B', 1, 1], ['B', 5, 1],\n ['C', 1, 1], ['C', 5, 1], ['D', 3, 1], ['D', 5, 1],\n ['E', 6, 1], ['E', 7, 1], ['E', 8, 1], ['F', 4, 1], ['G', 2, 1], ['BC', 1, 2], ['BC', 5, 2],\n ['B', 5, 1]^*, ['C', 4, 1]^*, ['F', 4, 1]^*, ['G', 2, 1]^*, ['BC', 1, 2]^*, ['BC', 5, 2]^*]\n "
finite_crystallographic = [CartanType(t) for t in [['A', 1], ['A', 5], ['B', 1], ['B', 5], ['C', 1], ['C', 5], ['D', 2], ['D', 3], ['D', 5], ['E', 6], ['E', 7], ['E', 8], ['F', 4], ['G', 2]]]
return ((((finite_crystallographic + [CartanType(t) for t in [['I', 5], ['H', 3], ['H', 4]]]) + [t.affine() for t in finite_crystallographic if t.is_irreducible()]) + [CartanType(t) for t in [['BC', 1, 2], ['BC', 5, 2]]]) + [CartanType(t).dual() for t in [['B', 5, 1], ['C', 4, 1], ['F', 4, 1], ['G', 2, 1], ['BC', 1, 2], ['BC', 5, 2]]])
_colors = {1: 'blue', (- 1): 'blue', 2: 'red', (- 2): 'red', 3: 'green', (- 3): 'green', 4: 'cyan', (- 4): 'cyan', 5: 'magenta', (- 5): 'magenta', 6: 'yellow', (- 6): 'yellow'}
@classmethod
def color(cls, i):
"\n Default color scheme for the vertices of a Dynkin diagram (and associated objects)\n\n EXAMPLES::\n\n sage: CartanType.color(1)\n 'blue'\n sage: CartanType.color(2)\n 'red'\n sage: CartanType.color(3)\n 'green'\n\n The default color is black::\n\n sage: CartanType.color(0)\n 'black'\n\n Negative indices get the same color as their positive counterparts::\n\n sage: CartanType.color(-1)\n 'blue'\n sage: CartanType.color(-2)\n 'red'\n sage: CartanType.color(-3)\n 'green'\n "
return cls._colors.get(i, 'black')
class options(GlobalOptions):
"\n Sets and displays the options for Cartan types. If no parameters\n are set, then the function returns a copy of the options dictionary.\n\n The ``options`` to partitions can be accessed as the method\n :obj:`CartanType.options` of\n :class:`CartanType <CartanTypeFactory>`.\n\n @OPTIONS@\n\n EXAMPLES::\n\n sage: ct = CartanType(['D',5,2]); ct\n ['C', 4, 1]^*\n sage: ct.dynkin_diagram() # needs sage.graphs\n O=<=O---O---O=>=O\n 0 1 2 3 4\n C4~*\n sage: latex(ct)\n C_{4}^{(1)\\vee}\n sage: CartanType.options(dual_str='#', dual_latex='\\\\ast',)\n sage: ct\n ['C', 4, 1]^#\n sage: ct.dynkin_diagram() # needs sage.graphs\n O=<=O---O---O=>=O\n 0 1 2 3 4\n C4~#\n sage: latex(ct)\n C_{4}^{(1)\\ast}\n sage: CartanType.options(notation='kac', mark_special_node='both')\n sage: ct\n ['D', 5, 2]\n sage: ct.dynkin_diagram() # needs sage.graphs\n @=<=O---O---O=>=O\n 0 1 2 3 4\n D5^2\n sage: latex(ct)\n D_{5}^{(2)}\n\n For type `A_{2n}^{(2)\\dagger}`, the dual string/latex options are\n automatically overridden::\n\n sage: dct = CartanType(['A',8,2]).dual(); dct\n ['A', 8, 2]^+\n sage: latex(dct)\n A_{8}^{(2)\\dagger}\n sage: dct.dynkin_diagram() # needs sage.graphs\n @=>=O---O---O=>=O\n 0 1 2 3 4\n A8^2+\n sage: CartanType.options._reset()\n "
NAME = 'CartanType'
module = 'sage.combinat.root_system.cartan_type'
option_class = 'CartanTypeFactory'
notation = dict(default='Stembridge', description='Specifies which notation Cartan types should use when printed', values=dict(Stembridge="use Stembridge's notation", Kac="use Kac's notation"), case_sensitive=False, alias=dict(BC='Stembridge', tilde='Stembridge', twisted='Kac'))
dual_str = dict(default='*', description='The string used for dual Cartan types when printing', checker=(lambda char: isinstance(char, str)))
dual_latex = dict(default='\\vee', description='The latex used for dual CartanTypes when latexing', checker=(lambda char: isinstance(char, str)))
mark_special_node = dict(default='none', description='Make the special nodes', values=dict(none='no markup', latex='only in latex', printing='only in printing', both='both in latex and printing'), case_sensitive=False)
special_node_str = dict(default='@', description='The string used to indicate which node is special when printing', checker=(lambda char: isinstance(char, str)))
marked_node_str = dict(default='X', description='The string used to indicate a marked node when printing', checker=(lambda char: isinstance(char, str)))
latex_relabel = dict(default=True, description='Indicate in the latex output if a Cartan type has been relabelled', checker=(lambda x: isinstance(x, bool)))
latex_marked = dict(default=True, description='Indicate in the latex output if a Cartan type has been marked', checker=(lambda x: isinstance(x, bool)))
|
class CartanType_abstract():
'\n Abstract class for Cartan types\n\n Subclasses should implement:\n\n - :meth:`dynkin_diagram()`\n\n - :meth:`cartan_matrix()`\n\n - :meth:`is_finite()`\n\n - :meth:`is_affine()`\n\n - :meth:`is_irreducible()`\n '
def type(self):
'\n Return the type of ``self``, or ``None`` if unknown.\n\n This method should be overridden in any subclass.\n\n EXAMPLES::\n\n sage: from sage.combinat.root_system.cartan_type import CartanType_abstract\n sage: C = CartanType_abstract()\n sage: C.type() is None\n True\n '
return None
def _add_abstract_superclass(self, classes):
'\n Add abstract super-classes to the class of ``self``.\n\n INPUT:\n\n - ``classes`` -- an abstract class or tuple thereof\n\n EXAMPLES::\n\n sage: C = CartanType(["A",3,1])\n sage: class MyCartanType:\n ....: def my_method(self):\n ....: return \'I am here!\'\n sage: C._add_abstract_superclass(MyCartanType)\n sage: C.__class__\n <class \'sage.combinat.root_system.type_A_affine.CartanType_with_superclass_with_superclass\'>\n sage: C.__class__.__bases__\n (<class \'sage.combinat.root_system.type_A_affine.CartanType_with_superclass\'>,\n <class ...__main__.MyCartanType...>)\n sage: C.my_method()\n \'I am here!\'\n\n .. TODO:: Generalize to :class:`SageObject`?\n '
from sage.structure.dynamic_class import dynamic_class
assert isinstance(classes, (tuple, type))
if (not isinstance(classes, tuple)):
classes = (classes,)
bases = ((self.__class__,) + classes)
self.__class__ = dynamic_class((self.__class__.__name__ + '_with_superclass'), bases)
def _ascii_art_node(self, label):
"\n Return the ascii art for the node labelled by ``label``.\n\n EXAMPLES::\n\n sage: CartanType(['A',3])._ascii_art_node(2)\n 'O'\n "
return 'O'
def _latex_draw_node(self, x, y, label, position='below=4pt', fill='white'):
"\n Draw (possibly marked [crossed out]) circular node ``i`` at the\n position ``(x,y)`` with node label ``label`` .\n\n - ``position`` -- position of the label relative to the node\n - ``anchor`` -- (optional) the anchor point for the label\n\n EXAMPLES::\n\n sage: CartanType(['A',3])._latex_draw_node(0, 0, 1)\n '\\\\draw[fill=white] (0 cm, 0 cm) circle (.25cm) node[below=4pt]{$1$};\\n'\n "
return '\\draw[fill={}] ({} cm, {} cm) circle (.25cm) node[{}]{{${}$}};\n'.format(fill, x, y, position, label)
def _latex_draw_arrow_tip(self, x, y, rot=0):
"\n Draw an arrow tip at the point ``(x, y)`` rotated by ``rot``\n\n INPUT:\n\n - ``(x, y)`` -- the coordinates of a point, in cm\n\n - ``rot`` -- an angle, in degrees\n\n This is an internal function used to assist drawing the Dynkin\n diagrams. See e.g. :meth:`~sage.combinat.root_system.type_B.CartanType._latex_dynkin_diagram`.\n\n EXAMPLES::\n\n sage: CartanType(['B',2])._latex_draw_arrow_tip(1, 0, 180)\n '\\\\draw[shift={(1, 0)}, rotate=180] (135 : 0.45cm) -- (0,0) -- (-135 : 0.45cm);\\n'\n "
return ('\\draw[shift={(%s, %s)}, rotate=%s] (135 : 0.45cm) -- (0,0) -- (-135 : 0.45cm);\n' % (x, y, rot))
@abstract_method
def rank(self):
"\n Return the rank of ``self``.\n\n This is the number of nodes of the associated Coxeter or\n Dynkin diagram.\n\n EXAMPLES::\n\n sage: CartanType(['A', 4]).rank()\n 4\n sage: CartanType(['A', 7, 2]).rank()\n 5\n sage: CartanType(['I', 8]).rank()\n 2\n "
@abstract_method
def index_set(self):
"\n Return the index set for ``self``.\n\n This is the list of the nodes of the associated Coxeter or\n Dynkin diagram.\n\n EXAMPLES::\n\n sage: CartanType(['A', 3, 1]).index_set()\n (0, 1, 2, 3)\n sage: CartanType(['D', 4]).index_set()\n (1, 2, 3, 4)\n sage: CartanType(['A', 7, 2]).index_set()\n (0, 1, 2, 3, 4)\n sage: CartanType(['A', 7, 2]).index_set()\n (0, 1, 2, 3, 4)\n sage: CartanType(['A', 6, 2]).index_set()\n (0, 1, 2, 3)\n sage: CartanType(['D', 6, 2]).index_set()\n (0, 1, 2, 3, 4, 5)\n sage: CartanType(['E', 6, 1]).index_set()\n (0, 1, 2, 3, 4, 5, 6)\n sage: CartanType(['E', 6, 2]).index_set()\n (0, 1, 2, 3, 4)\n sage: CartanType(['A', 2, 2]).index_set()\n (0, 1)\n sage: CartanType(['G', 2, 1]).index_set()\n (0, 1, 2)\n sage: CartanType(['F', 4, 1]).index_set()\n (0, 1, 2, 3, 4)\n "
_index_set_coloring = {1: 'blue', 2: 'red', 3: 'green'}
@abstract_method(optional=True)
def coxeter_diagram(self):
"\n Return the Coxeter diagram for ``self``.\n\n EXAMPLES::\n\n sage: # needs sage.graphs\n sage: CartanType(['B',3]).coxeter_diagram()\n Graph on 3 vertices\n sage: CartanType(['A',3]).coxeter_diagram().edges(sort=True)\n [(1, 2, 3), (2, 3, 3)]\n sage: CartanType(['B',3]).coxeter_diagram().edges(sort=True)\n [(1, 2, 3), (2, 3, 4)]\n sage: CartanType(['G',2]).coxeter_diagram().edges(sort=True)\n [(1, 2, 6)]\n sage: CartanType(['F',4]).coxeter_diagram().edges(sort=True)\n [(1, 2, 3), (2, 3, 4), (3, 4, 3)]\n "
@cached_method
def coxeter_matrix(self):
"\n Return the Coxeter matrix for ``self``.\n\n EXAMPLES::\n\n sage: CartanType(['A', 4]).coxeter_matrix() # needs sage.graphs\n [1 3 2 2]\n [3 1 3 2]\n [2 3 1 3]\n [2 2 3 1]\n "
from sage.combinat.root_system.coxeter_matrix import CoxeterMatrix
return CoxeterMatrix(self)
def coxeter_type(self):
"\n Return the Coxeter type for ``self``.\n\n EXAMPLES::\n\n sage: CartanType(['A', 4]).coxeter_type()\n Coxeter type of ['A', 4]\n "
from sage.combinat.root_system.coxeter_type import CoxeterType
return CoxeterType(self)
def dual(self):
'\n Return the dual Cartan type, possibly just as a formal dual.\n\n EXAMPLES::\n\n sage: CartanType([\'A\',3]).dual()\n [\'A\', 3]\n sage: CartanType(["B", 3]).dual()\n [\'C\', 3]\n sage: CartanType([\'C\',2]).dual()\n [\'B\', 2]\n sage: CartanType([\'D\',4]).dual()\n [\'D\', 4]\n sage: CartanType([\'E\',8]).dual()\n [\'E\', 8]\n sage: CartanType([\'F\',4]).dual()\n [\'F\', 4] relabelled by {1: 4, 2: 3, 3: 2, 4: 1}\n '
from . import type_dual
return type_dual.CartanType(self)
def relabel(self, relabelling):
"\n Return a relabelled copy of this Cartan type.\n\n INPUT:\n\n - ``relabelling`` -- a function (or a list or dictionary)\n\n OUTPUT:\n\n an isomorphic Cartan type obtained by relabelling the nodes of\n the Dynkin diagram. Namely, the node with label ``i`` is\n relabelled ``f(i)`` (or, by ``f[i]`` if ``f`` is a list or\n dictionary).\n\n EXAMPLES::\n\n sage: CartanType(['F',4]).relabel({ 1:4, 2:3, 3:2, 4:1 }).dynkin_diagram() # needs sage.graphs\n O---O=>=O---O\n 4 3 2 1\n F4 relabelled by {1: 4, 2: 3, 3: 2, 4: 1}\n "
from . import type_relabel
return type_relabel.CartanType(self, relabelling)
def subtype(self, index_set):
"\n Return a subtype of ``self`` given by ``index_set``.\n\n A subtype can be considered the Dynkin diagram induced from\n the Dynkin diagram of ``self`` by ``index_set``.\n\n EXAMPLES::\n\n sage: ct = CartanType(['A',6,2])\n sage: ct.dynkin_diagram() # needs sage.graphs\n O=<=O---O=<=O\n 0 1 2 3\n BC3~\n sage: ct.subtype([1,2,3]) # needs sage.graphs\n ['C', 3]\n "
return self.cartan_matrix().subtype(index_set).cartan_type()
def marked_nodes(self, marked_nodes):
"\n Return a Cartan type with the nodes ``marked_nodes`` marked.\n\n INPUT:\n\n - ``marked_nodes`` -- a list of nodes to mark\n\n EXAMPLES::\n\n sage: CartanType(['F',4]).marked_nodes([1, 3]).dynkin_diagram() # needs sage.graphs\n X---O=>=X---O\n 1 2 3 4\n F4 with nodes (1, 3) marked\n "
if (not marked_nodes):
return self
from . import type_marked
return type_marked.CartanType(self, marked_nodes)
def is_reducible(self):
'\n Report whether the root system is reducible (i.e. not simple), that\n is whether it can be factored as a product of root systems.\n\n EXAMPLES::\n\n sage: CartanType("A2xB3").is_reducible()\n True\n sage: CartanType([\'A\',2]).is_reducible()\n False\n '
return (not self.is_irreducible())
def is_irreducible(self):
'\n Report whether this Cartan type is irreducible (i.e. simple). This\n should be overridden in any subclass.\n\n This returns ``False`` by default. Derived class should override this\n appropriately.\n\n EXAMPLES::\n\n sage: from sage.combinat.root_system.cartan_type import CartanType_abstract\n sage: C = CartanType_abstract()\n sage: C.is_irreducible()\n False\n '
return False
def is_atomic(self):
'\n This method is usually equivalent to :meth:`is_reducible`,\n except for the Cartan type `D_2`.\n\n `D_2` is not a standard Cartan type. It is equivalent to type\n `A_1 \\times A_1` which is reducible; however the isomorphism\n from its ambient space (for the orthogonal group of degree 4)\n to that of `A_1 \\times A_1` is non trivial, and it is useful to\n have it.\n\n From a programming point of view its implementation is more\n similar to the irreducible types, and so the method\n :meth:`is_atomic()` is supplied.\n\n EXAMPLES::\n\n sage: CartanType("D2").is_atomic()\n True\n sage: CartanType("D2").is_irreducible()\n False\n\n TESTS::\n\n sage: all( T.is_irreducible() == T.is_atomic() for T in CartanType.samples() if T != CartanType("D2"))\n True\n '
return self.is_irreducible()
def is_compound(self):
'\n A short hand for not :meth:`is_atomic`.\n\n TESTS::\n\n sage: all( T.is_compound() == (not T.is_atomic()) for T in CartanType.samples())\n True\n '
return (not self.is_atomic())
@abstract_method
def is_finite(self):
"\n Return whether this Cartan type is finite.\n\n EXAMPLES::\n\n sage: from sage.combinat.root_system.cartan_type import CartanType_abstract\n sage: C = CartanType_abstract()\n sage: C.is_finite()\n Traceback (most recent call last):\n ...\n NotImplementedError: <abstract method is_finite at ...>\n\n ::\n\n sage: CartanType(['A',4]).is_finite()\n True\n sage: CartanType(['A',4, 1]).is_finite()\n False\n "
@abstract_method
def is_affine(self):
"\n Return whether ``self`` is affine.\n\n EXAMPLES::\n\n sage: CartanType(['A', 3]).is_affine()\n False\n sage: CartanType(['A', 3, 1]).is_affine()\n True\n "
def is_crystallographic(self):
"\n Return whether this Cartan type is crystallographic.\n\n This returns ``False`` by default. Derived class should override this\n appropriately.\n\n EXAMPLES::\n\n sage: [ [t, t.is_crystallographic() ] for t in CartanType.samples(finite=True) ]\n [[['A', 1], True], [['A', 5], True],\n [['B', 1], True], [['B', 5], True],\n [['C', 1], True], [['C', 5], True],\n [['D', 2], True], [['D', 3], True], [['D', 5], True],\n [['E', 6], True], [['E', 7], True], [['E', 8], True],\n [['F', 4], True], [['G', 2], True],\n [['I', 5], False], [['H', 3], False], [['H', 4], False]]\n "
return False
def is_simply_laced(self):
"\n Return whether this Cartan type is simply laced.\n\n This returns ``False`` by default. Derived class should override this\n appropriately.\n\n EXAMPLES::\n\n sage: [ [t, t.is_simply_laced() ] for t in CartanType.samples() ]\n [[['A', 1], True], [['A', 5], True],\n [['B', 1], True], [['B', 5], False],\n [['C', 1], True], [['C', 5], False],\n [['D', 2], True], [['D', 3], True], [['D', 5], True],\n [['E', 6], True], [['E', 7], True], [['E', 8], True],\n [['F', 4], False], [['G', 2], False], [['I', 5], False],\n [['H', 3], False], [['H', 4], False],\n [['A', 1, 1], False], [['A', 5, 1], True],\n [['B', 1, 1], False], [['B', 5, 1], False],\n [['C', 1, 1], False], [['C', 5, 1], False],\n [['D', 3, 1], True], [['D', 5, 1], True],\n [['E', 6, 1], True], [['E', 7, 1], True], [['E', 8, 1], True],\n [['F', 4, 1], False], [['G', 2, 1], False],\n [['BC', 1, 2], False], [['BC', 5, 2], False],\n [['B', 5, 1]^*, False], [['C', 4, 1]^*, False],\n [['F', 4, 1]^*, False], [['G', 2, 1]^*, False],\n [['BC', 1, 2]^*, False], [['BC', 5, 2]^*, False]]\n "
return False
def is_implemented(self):
'\n Check whether the Cartan datum for ``self`` is actually implemented.\n\n EXAMPLES::\n\n sage: CartanType(["A",4,1]).is_implemented() # needs sage.graphs\n True\n sage: CartanType([\'H\',3]).is_implemented()\n True\n '
try:
self.coxeter_diagram()
return True
except Exception:
return False
def root_system(self):
"\n Return the root system associated to ``self``.\n\n EXAMPLES::\n\n sage: CartanType(['A',4]).root_system()\n Root system of type ['A', 4]\n "
from sage.combinat.root_system.root_system import RootSystem
return RootSystem(self)
def as_folding(self, folding_of=None, sigma=None):
"\n Return ``self`` realized as a folded Cartan type.\n\n For finite and affine types, this is realized by the Dynkin\n diagram foldings:\n\n .. MATH::\n\n \\begin{array}{ccl}\n C_n^{(1)}, A_{2n}^{(2)}, A_{2n}^{(2)\\dagger}, D_{n+1}^{(2)}\n & \\hookrightarrow & A_{2n-1}^{(1)}, \\\\\n A_{2n-1}^{(2)}, B_n^{(1)} & \\hookrightarrow & D_{n+1}^{(1)}, \\\\\n E_6^{(2)}, F_4^{(1)} & \\hookrightarrow & E_6^{(1)}, \\\\\n D_4^{(3)}, G_2^{(1)} & \\hookrightarrow & D_4^{(1)}, \\\\\n C_n & \\hookrightarrow & A_{2n-1}, \\\\\n B_n & \\hookrightarrow & D_{n+1}, \\\\\n F_4 & \\hookrightarrow & E_6, \\\\\n G_2 & \\hookrightarrow & D_4.\n \\end{array}\n\n For general types, this returns ``self`` as a folded type of ``self``\n with `\\sigma` as the identity map.\n\n For more information on these foldings and folded Cartan types, see\n :class:`sage.combinat.root_system.type_folded.CartanTypeFolded`.\n\n If the optional inputs ``folding_of`` and ``sigma`` are specified, then\n this returns the folded Cartan type of ``self`` in ``folding_of`` given\n by the automorphism ``sigma``.\n\n EXAMPLES::\n\n sage: CartanType(['B', 3, 1]).as_folding()\n ['B', 3, 1] as a folding of ['D', 4, 1]\n sage: CartanType(['F', 4]).as_folding()\n ['F', 4] as a folding of ['E', 6]\n sage: CartanType(['BC', 3, 2]).as_folding()\n ['BC', 3, 2] as a folding of ['A', 5, 1]\n sage: CartanType(['D', 4, 3]).as_folding()\n ['G', 2, 1]^* relabelled by {0: 0, 1: 2, 2: 1} as a folding of ['D', 4, 1]\n "
from sage.combinat.root_system.type_folded import CartanTypeFolded
if ((folding_of is None) and (sigma is None)):
return self._default_folded_cartan_type()
if ((folding_of is None) or (sigma is None)):
raise ValueError('Both folding_of and sigma must be given')
return CartanTypeFolded(self, folding_of, sigma)
def _default_folded_cartan_type(self):
'\n Return the default folded Cartan type.\n\n In general, this just returns ``self`` in ``self`` with `\\sigma` as\n the identity map.\n\n EXAMPLES::\n\n sage: D = CartanMatrix([[2, -3], [-2, 2]]).dynkin_diagram() # needs sage.graphs\n sage: D._default_folded_cartan_type() # needs sage.graphs\n Dynkin diagram of rank 2 as a folding of Dynkin diagram of rank 2\n '
from sage.combinat.root_system.type_folded import CartanTypeFolded
return CartanTypeFolded(self, self, [[i] for i in self.index_set()])
options = CartanType.options
|
class CartanType_crystallographic(CartanType_abstract):
'\n An abstract class for crystallographic Cartan types.\n '
@abstract_method(optional=True)
def ascii_art(self, label='lambda x: x', node=None):
"\n Return an ascii art representation of the Dynkin diagram.\n\n INPUT:\n\n - ``label`` -- (default: the identity) a relabeling function\n for the nodes\n - ``node`` -- (optional) a function which returns\n the character for a node\n\n EXAMPLES::\n\n sage: cartan_type = CartanType(['B',5,1])\n sage: print(cartan_type.ascii_art())\n O 0\n |\n |\n O---O---O---O=>=O\n 1 2 3 4 5\n\n The label option is useful to visualize various statistics on\n the nodes of the Dynkin diagram::\n\n sage: a = cartan_type.col_annihilator(); a # needs sage.graphs\n Finite family {0: 1, 1: 1, 2: 2, 3: 2, 4: 2, 5: 2}\n sage: print(CartanType(['B',5,1]).ascii_art(label=a.__getitem__)) # needs sage.graphs\n O 1\n |\n |\n O---O---O---O=>=O\n 1 2 2 2 2\n "
@abstract_method(optional=True)
def _latex_dynkin_diagram(self, label='lambda i: i', node=None, node_dist=2):
"\n Return a latex representation of the Dynkin diagram.\n\n INPUT:\n\n - ``label`` -- (default: the identity) a relabeling function\n for the nodes\n\n - ``node`` -- (optional) a function which returns the latex for a node\n\n - ``node_dist`` -- (default: 2) the distance between nodes in cm\n\n EXAMPLES::\n\n sage: latex(CartanType(['A',4]).dynkin_diagram()) # indirect doctest # needs sage.graphs\n \\begin{tikzpicture}[scale=0.5]\n \\draw (-1,0) node[anchor=east] {$A_{4}$};\n \\draw (0 cm,0) -- (6 cm,0);\n \\draw[fill=white] (0 cm, 0 cm) circle (.25cm) node[below=4pt]{$1$};\n \\draw[fill=white] (2 cm, 0 cm) circle (.25cm) node[below=4pt]{$2$};\n \\draw[fill=white] (4 cm, 0 cm) circle (.25cm) node[below=4pt]{$3$};\n \\draw[fill=white] (6 cm, 0 cm) circle (.25cm) node[below=4pt]{$4$};\n \\end{tikzpicture}\n "
@abstract_method
def dynkin_diagram(self):
"\n Return the Dynkin diagram associated with ``self``.\n\n EXAMPLES::\n\n sage: CartanType(['A',4]).dynkin_diagram() # needs sage.graphs\n O---O---O---O\n 1 2 3 4\n A4\n\n .. NOTE::\n\n Derived subclasses should typically implement this as a cached\n method.\n "
@cached_method
def cartan_matrix(self):
"\n Return the Cartan matrix associated with ``self``.\n\n EXAMPLES::\n\n sage: CartanType(['A',4]).cartan_matrix() # needs sage.graphs\n [ 2 -1 0 0]\n [-1 2 -1 0]\n [ 0 -1 2 -1]\n [ 0 0 -1 2]\n "
from sage.combinat.root_system.cartan_matrix import CartanMatrix
return CartanMatrix(self.dynkin_diagram())
def coxeter_diagram(self):
"\n Return the Coxeter diagram for ``self``.\n\n This implementation constructs it from the Dynkin diagram.\n\n .. SEEALSO:: :meth:`CartanType_abstract.coxeter_diagram`\n\n EXAMPLES::\n\n sage: # needs sage.graphs\n sage: CartanType(['A',3]).coxeter_diagram()\n Graph on 3 vertices\n sage: CartanType(['A',3]).coxeter_diagram().edges(sort=True)\n [(1, 2, 3), (2, 3, 3)]\n sage: CartanType(['B',3]).coxeter_diagram().edges(sort=True)\n [(1, 2, 3), (2, 3, 4)]\n sage: CartanType(['G',2]).coxeter_diagram().edges(sort=True)\n [(1, 2, 6)]\n sage: CartanType(['F',4]).coxeter_diagram().edges(sort=True)\n [(1, 2, 3), (2, 3, 4), (3, 4, 3)]\n sage: CartanType(['A',2,2]).coxeter_diagram().edges(sort=True)\n [(0, 1, +Infinity)]\n "
return self.dynkin_diagram().coxeter_diagram()
def is_crystallographic(self):
"\n Implements :meth:`CartanType_abstract.is_crystallographic`\n by returning ``True``.\n\n EXAMPLES::\n\n sage: CartanType(['A', 3, 1]).is_crystallographic()\n True\n "
return True
@cached_method
def symmetrizer(self):
'\n Return the symmetrizer of the Cartan matrix of ``self``.\n\n A Cartan matrix `M` is symmetrizable if there exists a non\n trivial diagonal matrix `D` such that `DM` is a symmetric\n matrix, that is `DM = M^tD`. In that case, `D` is unique, up\n to a scalar factor for each connected component of the Dynkin\n diagram.\n\n This method computes the unique minimal such `D` with positive\n integral coefficients. If `D` exists, it is returned as a\n family. Otherwise ``None`` is returned.\n\n The coefficients are coerced to ``base_ring``.\n\n EXAMPLES::\n\n sage: CartanType(["B",5]).symmetrizer() # needs sage.graphs\n Finite family {1: 2, 2: 2, 3: 2, 4: 2, 5: 1}\n\n Here is a neat trick to visualize it better::\n\n sage: T = CartanType(["B",5])\n sage: print(T.ascii_art(T.symmetrizer().__getitem__)) # needs sage.graphs\n O---O---O---O=>=O\n 2 2 2 2 1\n\n sage: T = CartanType(["BC",5, 2])\n sage: print(T.ascii_art(T.symmetrizer().__getitem__)) # needs sage.graphs\n O=<=O---O---O---O=<=O\n 1 2 2 2 2 4\n\n Here is the symmetrizer of some reducible Cartan types::\n\n sage: T = CartanType(["D", 2])\n sage: print(T.ascii_art(T.symmetrizer().__getitem__)) # needs sage.graphs\n O O\n 1 1\n\n sage: T = CartanType(["B",5],["BC",5, 2])\n sage: print(T.ascii_art(T.symmetrizer().__getitem__)) # needs sage.graphs\n O---O---O---O=>=O\n 2 2 2 2 1\n O=<=O---O---O---O=<=O\n 1 2 2 2 2 4\n\n Property: up to an overall scalar factor, this gives the norm\n of the simple roots in the ambient space::\n\n sage: T = CartanType(["C",5])\n sage: print(T.ascii_art(T.symmetrizer().__getitem__)) # needs sage.graphs\n O---O---O---O=<=O\n 1 1 1 1 2\n\n sage: alpha = RootSystem(T).ambient_space().simple_roots()\n sage: print(T.ascii_art(lambda i: alpha[i].scalar(alpha[i])))\n O---O---O---O=<=O\n 2 2 2 2 4\n '
from sage.matrix.constructor import matrix, diagonal_matrix
m = self.cartan_matrix()
n = m.nrows()
M = matrix(ZZ, n, (n * n), sparse=True)
for (i, j) in m.nonzero_positions():
M[(i, ((n * i) + j))] = m[(i, j)]
M[(j, ((n * i) + j))] -= m[(j, i)]
kern = M.integer_kernel()
c = len(self.dynkin_diagram().connected_components(sort=False))
if (kern.dimension() < c):
return None
assert (kern.dimension() == c)
D = sum(kern.basis())
assert ((diagonal_matrix(D) * m) == (m.transpose() * diagonal_matrix(D)))
I = self.index_set()
return Family(dict(((I[i], D[i]) for i in range(n))))
def index_set_bipartition(self):
"\n Return a bipartition `\\{L,R\\}` of the vertices of the Dynkin diagram.\n\n For `i` and `j` both in `L` (or both in `R`), the simple\n reflections `s_i` and `s_j` commute.\n\n Of course, the Dynkin diagram should be bipartite. This is\n always the case for all finite types.\n\n EXAMPLES::\n\n sage: CartanType(['A',5]).index_set_bipartition() # needs sage.graphs\n ({1, 3, 5}, {2, 4})\n\n sage: CartanType(['A',2,1]).index_set_bipartition() # needs sage.graphs\n Traceback (most recent call last):\n ...\n ValueError: the Dynkin diagram must be bipartite\n "
from sage.graphs.graph import Graph
G = Graph(self.dynkin_diagram())
if (not G.is_bipartite()):
raise ValueError('the Dynkin diagram must be bipartite')
return G.bipartite_sets()
|
class CartanType_simply_laced(CartanType_crystallographic):
'\n An abstract class for simply laced Cartan types.\n '
def is_simply_laced(self):
"\n Return whether ``self`` is simply laced, which is ``True``.\n\n EXAMPLES::\n\n sage: CartanType(['A',3,1]).is_simply_laced()\n True\n sage: CartanType(['A',2]).is_simply_laced()\n True\n "
return True
def dual(self):
'\n Simply laced Cartan types are self-dual, so return ``self``.\n\n EXAMPLES::\n\n sage: CartanType(["A", 3]).dual()\n [\'A\', 3]\n sage: CartanType(["A", 3, 1]).dual()\n [\'A\', 3, 1]\n sage: CartanType(["D", 3]).dual()\n [\'D\', 3]\n sage: CartanType(["D", 4, 1]).dual()\n [\'D\', 4, 1]\n sage: CartanType(["E", 6]).dual()\n [\'E\', 6]\n sage: CartanType(["E", 6, 1]).dual()\n [\'E\', 6, 1]\n '
return self
|
class CartanType_simple(CartanType_abstract):
'\n An abstract class for simple Cartan types.\n '
def is_irreducible(self):
"\n Return whether ``self`` is irreducible, which is ``True``.\n\n EXAMPLES::\n\n sage: CartanType(['A', 3]).is_irreducible()\n True\n "
return True
|
class CartanType_finite(CartanType_abstract):
'\n An abstract class for simple affine Cartan types.\n '
def is_finite(self):
'\n EXAMPLES::\n\n sage: CartanType(["A", 3]).is_finite()\n True\n '
return True
def is_affine(self):
'\n EXAMPLES::\n\n sage: CartanType(["A", 3]).is_affine()\n False\n '
return False
|
class CartanType_affine(CartanType_simple, CartanType_crystallographic):
'\n An abstract class for simple affine Cartan types\n '
AmbientSpace = LazyImport('sage.combinat.root_system.type_affine', 'AmbientSpace')
def _ascii_art_node(self, label):
"\n Return the ascii art for the node labeled by ``label``.\n\n EXAMPLES::\n\n sage: ct = CartanType(['A',4,1])\n sage: CartanType.options(mark_special_node='both')\n sage: ct._ascii_art_node(0)\n '@'\n sage: CartanType.options._reset()\n "
if ((label == self.special_node()) and (self.options('mark_special_node') in ['printing', 'both'])):
return self.options('special_node_str')
return super()._ascii_art_node(label)
def _latex_draw_node(self, x, y, label, position='below=4pt'):
"\n Draw (possibly marked [crossed out]) circular node ``i`` at the\n position ``(x,y)`` with node label ``label`` .\n\n - ``position`` -- position of the label relative to the node\n - ``anchor`` -- (optional) the anchor point for the label\n\n EXAMPLES::\n\n sage: CartanType.options(mark_special_node='both')\n sage: CartanType(['A',3,1])._latex_draw_node(0, 0, 0)\n '\\\\draw[fill=black] (0 cm, 0 cm) circle (.25cm) node[below=4pt]{$0$};\\n'\n sage: CartanType.options._reset()\n "
if ((label == self.special_node()) and (self.options('mark_special_node') in ['latex', 'both'])):
fill = 'black'
else:
fill = 'white'
return super()._latex_draw_node(x, y, label, position, fill)
def is_finite(self):
"\n EXAMPLES::\n\n sage: CartanType(['A', 3, 1]).is_finite()\n False\n "
return False
def is_affine(self):
"\n EXAMPLES::\n\n sage: CartanType(['A', 3, 1]).is_affine()\n True\n "
return True
def is_untwisted_affine(self):
"\n Return whether ``self`` is untwisted affine\n\n A Cartan type is untwisted affine if it is the canonical\n affine extension of some finite type. Every affine type is\n either untwisted affine, dual thereof, or of type ``BC``.\n\n EXAMPLES::\n\n sage: CartanType(['A', 3, 1]).is_untwisted_affine()\n True\n sage: CartanType(['A', 3, 1]).dual().is_untwisted_affine() # this one is self dual!\n True\n sage: CartanType(['B', 3, 1]).dual().is_untwisted_affine()\n False\n sage: CartanType(['BC', 3, 2]).is_untwisted_affine()\n False\n "
return False
@abstract_method
def special_node(self):
"\n Return a special node of the Dynkin diagram.\n\n A *special* node is a node of the Dynkin diagram such that\n pruning it yields a Dynkin diagram for the associated\n classical type (see :meth:`classical`).\n\n This method returns the label of some special node. This is\n usually `0` in the standard conventions.\n\n EXAMPLES::\n\n sage: CartanType(['A', 3, 1]).special_node()\n 0\n\n The choice is guaranteed to be consistent with the indexing of\n the nodes of the classical Dynkin diagram::\n\n sage: CartanType(['A', 3, 1]).index_set()\n (0, 1, 2, 3)\n sage: CartanType(['A', 3, 1]).classical().index_set()\n (1, 2, 3)\n "
@cached_method
def special_nodes(self):
"\n Return the set of special nodes of the affine Dynkin diagram.\n\n EXAMPLES::\n\n sage: # needs sage.graphs sage.groups\n sage: CartanType(['A',3,1]).special_nodes()\n (0, 1, 2, 3)\n sage: CartanType(['C',2,1]).special_nodes()\n (0, 2)\n sage: CartanType(['D',4,1]).special_nodes()\n (0, 1, 3, 4)\n sage: CartanType(['E',6,1]).special_nodes()\n (0, 1, 6)\n sage: CartanType(['D',3,2]).special_nodes()\n (0, 2)\n sage: CartanType(['A',4,2]).special_nodes()\n (0,)\n "
return tuple(sorted(self.dynkin_diagram().automorphism_group(edge_labels=True).orbit(self.special_node())))
@abstract_method
def classical(self):
"\n Return the classical Cartan type associated with this affine Cartan type.\n\n EXAMPLES::\n\n sage: CartanType(['A', 1, 1]).classical()\n ['A', 1]\n sage: CartanType(['A', 3, 1]).classical()\n ['A', 3]\n sage: CartanType(['B', 3, 1]).classical()\n ['B', 3]\n\n sage: CartanType(['A', 2, 2]).classical()\n ['C', 1]\n sage: CartanType(['BC', 1, 2]).classical()\n ['C', 1]\n sage: CartanType(['A', 4, 2]).classical()\n ['C', 2]\n sage: CartanType(['BC', 2, 2]).classical()\n ['C', 2]\n sage: CartanType(['A', 10, 2]).classical()\n ['C', 5]\n sage: CartanType(['BC', 5, 2]).classical()\n ['C', 5]\n\n sage: CartanType(['D', 5, 2]).classical()\n ['B', 4]\n sage: CartanType(['E', 6, 1]).classical()\n ['E', 6]\n sage: CartanType(['G', 2, 1]).classical()\n ['G', 2]\n sage: CartanType(['E', 6, 2]).classical()\n ['F', 4] relabelled by {1: 4, 2: 3, 3: 2, 4: 1}\n sage: CartanType(['D', 4, 3]).classical()\n ['G', 2]\n\n We check that :meth:`classical`,\n :meth:`sage.combinat.root_system.cartan_type.CartanType_crystallographic.dynkin_diagram`,\n and :meth:`special_node` are consistent::\n\n sage: for ct in CartanType.samples(affine=True): # needs sage.graphs\n ....: g1 = ct.classical().dynkin_diagram()\n ....: g2 = ct.dynkin_diagram()\n ....: g2.delete_vertex(ct.special_node())\n ....: assert g1.vertices(sort=True) == g2.vertices(sort=True)\n ....: assert g1.edges(sort=True) == g2.edges(sort=True)\n\n "
@abstract_method
def basic_untwisted(self):
"\n Return the basic untwisted Cartan type associated with this affine\n Cartan type.\n\n Given an affine type `X_n^{(r)}`, the basic untwisted type is `X_n`.\n In other words, it is the classical Cartan type that is twisted to\n obtain ``self``.\n\n EXAMPLES::\n\n sage: CartanType(['A', 1, 1]).basic_untwisted()\n ['A', 1]\n sage: CartanType(['A', 3, 1]).basic_untwisted()\n ['A', 3]\n sage: CartanType(['B', 3, 1]).basic_untwisted()\n ['B', 3]\n sage: CartanType(['E', 6, 1]).basic_untwisted()\n ['E', 6]\n sage: CartanType(['G', 2, 1]).basic_untwisted()\n ['G', 2]\n\n sage: CartanType(['A', 2, 2]).basic_untwisted()\n ['A', 2]\n sage: CartanType(['A', 4, 2]).basic_untwisted()\n ['A', 4]\n sage: CartanType(['A', 11, 2]).basic_untwisted()\n ['A', 11]\n sage: CartanType(['D', 5, 2]).basic_untwisted()\n ['D', 5]\n sage: CartanType(['E', 6, 2]).basic_untwisted()\n ['E', 6]\n sage: CartanType(['D', 4, 3]).basic_untwisted()\n ['D', 4]\n "
def row_annihilator(self, m=None):
"\n Return the unique minimal non trivial annihilating linear\n combination of `\\alpha_0, \\alpha_1, \\ldots, \\alpha_n` with\n nonnegative coefficients (or alternatively, the unique minimal\n non trivial annihilating linear combination of the rows of the\n Cartan matrix with non-negative coefficients).\n\n Throw an error if the existence of uniqueness does not hold\n\n The optional argument ``m`` is for internal use only.\n\n EXAMPLES::\n\n sage: # needs sage.graphs\n sage: RootSystem(['C',2,1]).cartan_type().acheck()\n Finite family {0: 1, 1: 1, 2: 1}\n sage: RootSystem(['D',4,1]).cartan_type().acheck()\n Finite family {0: 1, 1: 1, 2: 2, 3: 1, 4: 1}\n sage: RootSystem(['F',4,1]).cartan_type().acheck()\n Finite family {0: 1, 1: 2, 2: 3, 3: 2, 4: 1}\n sage: RootSystem(['BC',4,2]).cartan_type().acheck()\n Finite family {0: 1, 1: 2, 2: 2, 3: 2, 4: 2}\n\n ``acheck`` is a shortcut for row_annihilator::\n\n sage: RootSystem(['BC',4,2]).cartan_type().row_annihilator() # needs sage.graphs\n Finite family {0: 1, 1: 2, 2: 2, 3: 2, 4: 2}\n\n FIXME:\n\n - The current implementation assumes that the Cartan matrix\n is indexed by `[0,1,...]`, in the same order as the index set.\n - This really should be a method of :class:`CartanMatrix`.\n "
if (m is None):
m = self.cartan_matrix()
if (self.index_set() != tuple(range(m.ncols()))):
raise NotImplementedError('the Cartan matrix currently must be indexed by [0,1,...,{}]'.format(m.ncols()))
annihilator_basis = m.integer_kernel().gens()
if (len(annihilator_basis) != 1):
raise ValueError('the kernel is not 1 dimensional')
assert all(((coef > 0) for coef in annihilator_basis[0]))
return Family(dict(((i, annihilator_basis[0][i]) for i in self.index_set())))
acheck = row_annihilator
def col_annihilator(self):
"\n Return the unique minimal non trivial annihilating linear\n combination of `\\alpha^\\vee_0, \\alpha^\\vee, \\ldots, \\alpha^\\vee` with\n nonnegative coefficients (or alternatively, the unique minimal\n non trivial annihilating linear combination of the columns of the\n Cartan matrix with non-negative coefficients).\n\n Throw an error if the existence or uniqueness does not hold\n\n FIXME: the current implementation assumes that the Cartan\n matrix is indexed by `[0,1,...]`, in the same order as the\n index set.\n\n EXAMPLES::\n\n sage: # needs sage.graphs\n sage: RootSystem(['C',2,1]).cartan_type().a()\n Finite family {0: 1, 1: 2, 2: 1}\n sage: RootSystem(['D',4,1]).cartan_type().a()\n Finite family {0: 1, 1: 1, 2: 2, 3: 1, 4: 1}\n sage: RootSystem(['F',4,1]).cartan_type().a()\n Finite family {0: 1, 1: 2, 2: 3, 3: 4, 4: 2}\n sage: RootSystem(['BC',4,2]).cartan_type().a()\n Finite family {0: 2, 1: 2, 2: 2, 3: 2, 4: 1}\n\n ``a`` is a shortcut for col_annihilator::\n\n sage: RootSystem(['BC',4,2]).cartan_type().col_annihilator() # needs sage.graphs\n Finite family {0: 2, 1: 2, 2: 2, 3: 2, 4: 1}\n "
return self.row_annihilator(self.cartan_matrix().transpose())
a = col_annihilator
def c(self):
'\n Returns the family (c_i)_i of integer coefficients defined by\n `c_i=max(1, a_i/a^vee_i)` (see e.g. [FSS07]_ p. 3)\n\n FIXME: the current implementation assumes that the Cartan\n matrix is indexed by `[0,1,...]`, in the same order as the\n index set.\n\n EXAMPLES::\n\n sage: # needs sage.graphs\n sage: RootSystem([\'C\',2,1]).cartan_type().c()\n Finite family {0: 1, 1: 2, 2: 1}\n sage: RootSystem([\'D\',4,1]).cartan_type().c()\n Finite family {0: 1, 1: 1, 2: 1, 3: 1, 4: 1}\n sage: RootSystem([\'F\',4,1]).cartan_type().c()\n Finite family {0: 1, 1: 1, 2: 1, 3: 2, 4: 2}\n sage: RootSystem([\'BC\',4,2]).cartan_type().c()\n Finite family {0: 2, 1: 1, 2: 1, 3: 1, 4: 1}\n\n TESTS::\n\n sage: CartanType(["B", 3, 1]).c().map(parent) # needs sage.graphs\n Finite family {0: Integer Ring, 1: Integer Ring, 2: Integer Ring, 3: Integer Ring}\n\n REFERENCES:\n\n .. [FSS07] \\G. Fourier, A. Schilling, and M. Shimozono,\n *Demazure structure inside Kirillov-Reshetikhin crystals*,\n J. Algebra, Vol. 309, (2007), p. 386-404\n :arxiv:`math/0605451`\n '
a = self.a()
acheck = self.acheck()
return Family(dict(((i, max(ZZ(1), (a[i] // acheck[i]))) for i in self.index_set())))
def translation_factors(self):
'\n Return the translation factors for ``self``.\n\n Those are the smallest factors `t_i` such that the translation\n by `t_i \\alpha_i` maps the fundamental polygon to another\n polygon in the alcove picture.\n\n OUTPUT:\n\n a dictionary from ``self.index_set()`` to `\\ZZ`\n (or `\\QQ` for affine type `BC`)\n\n Those coefficients are all `1` for dual untwisted, and in\n particular for simply laced. They coincide with the usual\n `c_i` coefficients (see :meth:`c`) for untwisted and dual\n thereof. See the discussion below for affine type `BC`.\n\n .. NOTE::\n\n One usually realizes the alcove picture in the coweight\n lattice, with translations by coroots; in that case, one will\n use the translation factors for the dual Cartan type.\n\n FIXME: the current implementation assumes that the Cartan\n matrix is indexed by `[0,1,...]`, in the same order as the\n index set.\n\n EXAMPLES::\n\n sage: # needs sage.graphs\n sage: CartanType([\'C\',2,1]).translation_factors()\n Finite family {0: 1, 1: 2, 2: 1}\n sage: CartanType([\'C\',2,1]).dual().translation_factors()\n Finite family {0: 1, 1: 1, 2: 1}\n sage: CartanType([\'D\',4,1]).translation_factors()\n Finite family {0: 1, 1: 1, 2: 1, 3: 1, 4: 1}\n sage: CartanType([\'F\',4,1]).translation_factors()\n Finite family {0: 1, 1: 1, 2: 1, 3: 2, 4: 2}\n sage: CartanType([\'BC\',4,2]).translation_factors()\n Finite family {0: 1, 1: 1, 2: 1, 3: 1, 4: 1/2}\n\n We proceed with systematic tests taken from MuPAD-Combinat\'s\n testsuite::\n\n sage: # needs sage.graphs\n sage: list(CartanType(["A", 1, 1]).translation_factors())\n [1, 1]\n sage: list(CartanType(["A", 5, 1]).translation_factors())\n [1, 1, 1, 1, 1, 1]\n sage: list(CartanType(["B", 5, 1]).translation_factors())\n [1, 1, 1, 1, 1, 2]\n sage: list(CartanType(["C", 5, 1]).translation_factors())\n [1, 2, 2, 2, 2, 1]\n sage: list(CartanType(["D", 5, 1]).translation_factors())\n [1, 1, 1, 1, 1, 1]\n sage: list(CartanType(["E", 6, 1]).translation_factors())\n [1, 1, 1, 1, 1, 1, 1]\n sage: list(CartanType(["E", 7, 1]).translation_factors())\n [1, 1, 1, 1, 1, 1, 1, 1]\n sage: list(CartanType(["E", 8, 1]).translation_factors())\n [1, 1, 1, 1, 1, 1, 1, 1, 1]\n sage: list(CartanType(["F", 4, 1]).translation_factors())\n [1, 1, 1, 2, 2]\n sage: list(CartanType(["G", 2, 1]).translation_factors())\n [1, 3, 1]\n sage: list(CartanType(["A", 2, 2]).translation_factors())\n [1, 1/2]\n sage: list(CartanType(["A", 2, 2]).dual().translation_factors())\n [1/2, 1]\n sage: list(CartanType(["A", 10, 2]).translation_factors())\n [1, 1, 1, 1, 1, 1/2]\n sage: list(CartanType(["A", 10, 2]).dual().translation_factors())\n [1/2, 1, 1, 1, 1, 1]\n sage: list(CartanType(["A", 9, 2]).translation_factors())\n [1, 1, 1, 1, 1, 1]\n sage: list(CartanType(["D", 5, 2]).translation_factors())\n [1, 1, 1, 1, 1]\n sage: list(CartanType(["D", 4, 3]).translation_factors())\n [1, 1, 1]\n sage: list(CartanType(["E", 6, 2]).translation_factors())\n [1, 1, 1, 1, 1]\n\n We conclude with a discussion of the appropriate value for\n affine type `BC`. Let us consider the alcove picture realized\n in the weight lattice. It is obtained by taking the level-`1`\n affine hyperplane in the weight lattice, and projecting it\n along `\\Lambda_0`::\n\n sage: R = RootSystem(["BC",2,2])\n sage: alpha = R.weight_space().simple_roots() # needs sage.graphs\n sage: alphacheck = R.coroot_space().simple_roots()\n sage: Lambda = R.weight_space().fundamental_weights()\n\n Here are the levels of the fundamental weights::\n\n sage: Lambda[0].level(), Lambda[1].level(), Lambda[2].level() # needs sage.graphs\n (1, 2, 2)\n\n So the "center" of the fundamental polygon at level `1` is::\n\n sage: O = Lambda[0]\n sage: O.level() # needs sage.graphs\n 1\n\n We take the projection `\\omega_1` at level `0` of `\\Lambda_1`\n as unit vector on the `x`-axis, and the projection `\\omega_2`\n at level 0 of `\\Lambda_2` as unit vector of the `y`-axis::\n\n sage: omega1 = Lambda[1] - 2*Lambda[0]\n sage: omega2 = Lambda[2] - 2*Lambda[0]\n sage: omega1.level(), omega2.level() # needs sage.graphs\n (0, 0)\n\n The projections of the simple roots can be read off::\n\n sage: alpha[0] # needs sage.graphs\n 2*Lambda[0] - Lambda[1]\n sage: alpha[1] # needs sage.graphs\n -2*Lambda[0] + 2*Lambda[1] - Lambda[2]\n sage: alpha[2] # needs sage.graphs\n -2*Lambda[1] + 2*Lambda[2]\n\n Namely `\\alpha_0 = -\\omega_1`, `\\alpha_1 = 2\\omega_1 -\n \\omega_2` and `\\alpha_2 = -2 \\omega_1 + 2 \\omega_2`.\n\n The reflection hyperplane defined by `\\alpha_0^\\vee` goes\n through the points `O+1/2 \\omega_1` and `O+1/2 \\omega_2`::\n\n sage: (O+(1/2)*omega1).scalar(alphacheck[0])\n 0\n sage: (O+(1/2)*omega2).scalar(alphacheck[0])\n 0\n\n Hence, the fundamental alcove is the triangle `(O, O+1/2\n \\omega_1, O+1/2 \\omega_2)`. By successive reflections, one can\n tile the full plane. This induces a tiling of the full plane\n by translates of the fundamental polygon.\n\n .. TODO::\n\n Add the picture here, once root system plots in the\n weight lattice will be implemented. In the mean time, the\n reader may look up the dual picture on Figure 2 of [HST09]_\n which was produced by MuPAD-Combinat.\n\n From this picture, one can read that translations by\n `\\alpha_0`, `\\alpha_1`, and `1/2\\alpha_2` map the fundamental\n polygon to translates of it in the alcove picture, and are\n smallest with this property. Hence, the translation factors\n for affine type `BC` are `t_0=1, t_1=1, t_2=1/2`::\n\n sage: CartanType([\'BC\',2,2]).translation_factors() # needs sage.graphs\n Finite family {0: 1, 1: 1, 2: 1/2}\n\n TESTS::\n\n sage: CartanType(["B", 3, 1]).translation_factors().map(parent) # needs sage.graphs\n Finite family {0: Integer Ring, 1: Integer Ring, 2: Integer Ring, 3: Integer Ring}\n sage: CartanType(["BC", 3, 2]).translation_factors().map(parent) # needs sage.graphs\n Finite family {0: Integer Ring, 1: Integer Ring, 2: Integer Ring, 3: Rational Field}\n\n REFERENCES:\n\n .. [HST09] \\F. Hivert, A. Schilling, and N. M. Thiery,\n *Hecke group algebras as quotients of affine Hecke\n algebras at level 0*, JCT A, Vol. 116, (2009) p. 844-863\n :arxiv:`0804.3781`\n '
a = self.a()
acheck = self.acheck()
if set([(1 / ZZ(2)), 2]).issubset(set(((a[i] / acheck[i]) for i in self.index_set()))):
return Family(dict(((i, min(ZZ(1), (a[i] / acheck[i]))) for i in self.index_set())))
else:
return self.c()
def _test_dual_classical(self, **options):
"\n Tests whether the special node of the dual is still the same and whether\n the methods dual and classical commute.\n\n TESTS::\n\n sage: C = CartanType(['A',2,2])\n sage: C._test_dual_classical()\n "
tester = self._tester(**options)
tester.assertEqual(self.classical().dual(), self.dual().classical())
tester.assertEqual(self.special_node(), self.dual().special_node())
def other_affinization(self):
'\n Return the other affinization of the same classical type.\n\n EXAMPLES::\n\n sage: CartanType(["A", 3, 1]).other_affinization()\n [\'A\', 3, 1]\n sage: CartanType(["B", 3, 1]).other_affinization()\n [\'C\', 3, 1]^*\n sage: CartanType(["C", 3, 1]).dual().other_affinization()\n [\'B\', 3, 1]\n\n Is this what we want?::\n\n sage: CartanType(["BC", 3, 2]).dual().other_affinization()\n [\'B\', 3, 1]\n '
if self.is_untwisted_affine():
result = self.classical().dual().affine().dual()
else:
result = self.dual().classical().dual().affine()
assert (result.classical() is self.classical())
return result
|
class CartanType_standard(UniqueRepresentation, SageObject):
def _repr_(self, compact=False):
'\n TESTS::\n\n sage: ct = CartanType([\'A\',3])\n sage: repr(ct)\n "[\'A\', 3]"\n sage: ct._repr_(compact=True)\n \'A3\'\n '
format = ('%s%s' if compact else "['%s', %s]")
return (format % (self.letter, self.n))
def __len__(self):
"\n EXAMPLES::\n\n sage: len(CartanType(['A',4]))\n 2\n sage: len(CartanType(['A',4,1]))\n 3\n "
return (3 if self.is_affine() else 2)
def __getitem__(self, i):
"\n EXAMPLES::\n\n sage: t = CartanType(['B', 3])\n sage: t[0]\n 'B'\n sage: t[1]\n 3\n sage: t[2]\n Traceback (most recent call last):\n ...\n IndexError: index out of range\n "
if (i == 0):
return self.letter
elif (i == 1):
return self.n
else:
raise IndexError('index out of range')
|
class CartanType_standard_finite(CartanType_standard, CartanType_finite):
"\n A concrete base class for the finite standard Cartan types.\n\n This includes for example `A_3`, `D_4`, or `E_8`.\n\n TESTS::\n\n sage: ct1 = CartanType(['A',4])\n sage: ct2 = CartanType(['A',4])\n sage: ct3 = CartanType(['A',5])\n sage: ct1 == ct2\n True\n sage: ct1 != ct3\n True\n "
def __init__(self, letter, n):
"\n EXAMPLES::\n\n sage: ct = CartanType(['A',4])\n\n TESTS::\n\n sage: TestSuite(ct).run(verbose = True)\n running ._test_category() . . . pass\n running ._test_new() . . . pass\n running ._test_not_implemented_methods() . . . pass\n running ._test_pickling() . . . pass\n "
self.letter = letter
self.n = n
def __reduce__(self):
"\n TESTS::\n\n sage: T = CartanType(['D', 4])\n sage: T.__reduce__()\n (CartanType, ('D', 4))\n sage: T == loads(dumps(T))\n True\n\n "
return (CartanType, (self.letter, self.n))
def __hash__(self):
"\n EXAMPLES::\n\n sage: ct = CartanType(['A',2])\n sage: hash(ct) #random\n -5684143898951441983\n "
return hash((self.n, self.letter))
def index_set(self):
"\n Implements :meth:`CartanType_abstract.index_set`.\n\n The index set for all standard finite Cartan types is of the form\n `\\{1, \\ldots, n\\}`. (See :mod:`~sage.combinat.root_system.type_I`\n for a slight abuse of this).\n\n EXAMPLES::\n\n sage: CartanType(['A', 5]).index_set()\n (1, 2, 3, 4, 5)\n "
return tuple(range(1, (self.n + 1)))
def rank(self):
"\n Return the rank of ``self`` which for type `X_n` is `n`.\n\n EXAMPLES::\n\n sage: CartanType(['A', 3]).rank()\n 3\n sage: CartanType(['B', 3]).rank()\n 3\n sage: CartanType(['C', 3]).rank()\n 3\n sage: CartanType(['D', 4]).rank()\n 4\n sage: CartanType(['E', 6]).rank()\n 6\n "
return self.n
def affine(self):
"\n Return the corresponding untwisted affine Cartan type.\n\n EXAMPLES::\n\n sage: CartanType(['A',3]).affine()\n ['A', 3, 1]\n "
return CartanType([self.letter, self.n, 1])
def coxeter_number(self):
"\n Return the Coxeter number associated with ``self``.\n\n The Coxeter number is the order of a Coxeter element of the\n corresponding Weyl group.\n\n See Bourbaki, Lie Groups and Lie Algebras V.6.1 or\n :wikipedia:`Coxeter_element` for more information.\n\n EXAMPLES::\n\n sage: CartanType(['A',4]).coxeter_number()\n 5\n sage: CartanType(['B',4]).coxeter_number()\n 8\n sage: CartanType(['C',4]).coxeter_number()\n 8\n "
return sum(self.affine().a())
def dual_coxeter_number(self):
"\n Return the Coxeter number associated with ``self``.\n\n EXAMPLES::\n\n sage: CartanType(['A',4]).dual_coxeter_number()\n 5\n sage: CartanType(['B',4]).dual_coxeter_number()\n 7\n sage: CartanType(['C',4]).dual_coxeter_number()\n 5\n "
return sum(self.affine().acheck())
def type(self):
"\n Return the type of ``self``.\n\n EXAMPLES::\n\n sage: CartanType(['A', 4]).type()\n 'A'\n sage: CartanType(['A', 4, 1]).type()\n 'A'\n "
return self.letter
@cached_method
def opposition_automorphism(self):
"\n Return the opposition automorphism\n\n The *opposition automorphism* is the automorphism\n `i \\mapsto i^*` of the vertices Dynkin diagram such that,\n for `w_0` the longest element of the Weyl group, and any\n simple root `\\alpha_i`, one has `\\alpha_{i^*} = -w_0(\\alpha_i)`.\n\n The automorphism is returned as a :class:`Family`.\n\n EXAMPLES::\n\n sage: ct = CartanType(['A', 5])\n sage: ct.opposition_automorphism() # needs sage.libs.gap\n Finite family {1: 5, 2: 4, 3: 3, 4: 2, 5: 1}\n\n sage: ct = CartanType(['D', 4])\n sage: ct.opposition_automorphism() # needs sage.libs.gap\n Finite family {1: 1, 2: 2, 3: 3, 4: 4}\n\n sage: ct = CartanType(['D', 5])\n sage: ct.opposition_automorphism() # needs sage.libs.gap\n Finite family {1: 1, 2: 2, 3: 3, 4: 5, 5: 4}\n\n sage: ct = CartanType(['C', 4])\n sage: ct.opposition_automorphism() # needs sage.libs.gap\n Finite family {1: 1, 2: 2, 3: 3, 4: 4}\n "
Q = self.root_system().root_lattice()
W = Q.weyl_group()
w0 = W.long_element()
alpha = Q.simple_roots()
d = {i: w0.action(alpha[i]).leading_support() for i in self.index_set()}
return Family(d)
|
class CartanType_standard_affine(CartanType_standard, CartanType_affine):
'\n A concrete class for affine simple Cartan types.\n '
def __init__(self, letter, n, affine=1):
"\n EXAMPLES::\n\n sage: ct = CartanType(['A',4,1])\n sage: TestSuite(ct).run()\n\n TESTS::\n\n sage: ct1 = CartanType(['A',3, 1])\n sage: ct2 = CartanType(['B',3, 1])\n sage: ct3 = CartanType(['A',3])\n sage: ct1 == ct1\n True\n sage: ct1 == ct2\n False\n sage: ct1 == ct3\n False\n\n "
assert (letter in ['A', 'B', 'C', 'BC', 'D', 'E', 'F', 'G'])
self.letter = letter
self.n = n
self.affine = affine
def _repr_(self, compact=False):
'\n TESTS::\n\n sage: ct = CartanType([\'A\',3, 1])\n sage: repr(ct)\n "[\'A\', 3, 1]"\n sage: ct._repr_(compact=True)\n \'A3~\'\n '
letter = self.letter
n = self.n
aff = self.affine
if (self.options('notation') == 'Kac'):
if (letter == 'BC'):
letter = 'A'
n *= 2
if compact:
return ('%s%s^%s' % (letter, n, aff))
if compact:
return ('%s%s~' % (letter, n))
else:
return ("['%s', %s, %s]" % (letter, n, aff))
def __reduce__(self):
"\n TESTS::\n\n sage: T = CartanType(['D', 4, 1])\n sage: T.__reduce__()\n (CartanType, ('D', 4, 1))\n sage: T == loads(dumps(T))\n True\n\n "
return (CartanType, (self.letter, self.n, self.affine))
def __getitem__(self, i):
"\n EXAMPLES::\n\n sage: t = CartanType(['A', 3, 1])\n sage: t[0]\n 'A'\n sage: t[1]\n 3\n sage: t[2]\n 1\n sage: t[3]\n Traceback (most recent call last):\n ...\n IndexError: index out of range\n "
if (i == 0):
return self.letter
elif (i == 1):
return self.n
elif (i == 2):
return self.affine
else:
raise IndexError('index out of range')
def rank(self):
"\n Return the rank of ``self`` which for type `X_n^{(1)}` is `n + 1`.\n\n EXAMPLES::\n\n sage: CartanType(['A', 4, 1]).rank()\n 5\n sage: CartanType(['B', 4, 1]).rank()\n 5\n sage: CartanType(['C', 3, 1]).rank()\n 4\n sage: CartanType(['D', 4, 1]).rank()\n 5\n sage: CartanType(['E', 6, 1]).rank()\n 7\n sage: CartanType(['E', 7, 1]).rank()\n 8\n sage: CartanType(['F', 4, 1]).rank()\n 5\n sage: CartanType(['G', 2, 1]).rank()\n 3\n sage: CartanType(['A', 2, 2]).rank()\n 2\n sage: CartanType(['A', 6, 2]).rank()\n 4\n sage: CartanType(['A', 7, 2]).rank()\n 5\n sage: CartanType(['D', 5, 2]).rank()\n 5\n sage: CartanType(['E', 6, 2]).rank()\n 5\n sage: CartanType(['D', 4, 3]).rank()\n 3\n "
return (self.n + 1)
def index_set(self):
"\n Implements :meth:`CartanType_abstract.index_set`.\n\n The index set for all standard affine Cartan types is of the form\n `\\{0, \\ldots, n\\}`.\n\n EXAMPLES::\n\n sage: CartanType(['A', 5, 1]).index_set()\n (0, 1, 2, 3, 4, 5)\n "
return tuple(range((self.n + 1)))
def special_node(self):
"\n Implement :meth:`CartanType_abstract.special_node`.\n\n With the standard labelling conventions, `0` is always a\n special node.\n\n EXAMPLES::\n\n sage: CartanType(['A', 3, 1]).special_node()\n 0\n "
return 0
def type(self):
"\n Return the type of ``self``.\n\n EXAMPLES::\n\n sage: CartanType(['A', 4, 1]).type()\n 'A'\n "
return self.letter
|
class CartanType_standard_untwisted_affine(CartanType_standard_affine):
'\n A concrete class for the standard untwisted affine Cartan types.\n '
def classical(self):
"\n Return the classical Cartan type associated with ``self``.\n\n EXAMPLES::\n\n sage: CartanType(['A', 3, 1]).classical()\n ['A', 3]\n sage: CartanType(['B', 3, 1]).classical()\n ['B', 3]\n sage: CartanType(['C', 3, 1]).classical()\n ['C', 3]\n sage: CartanType(['D', 4, 1]).classical()\n ['D', 4]\n sage: CartanType(['E', 6, 1]).classical()\n ['E', 6]\n sage: CartanType(['F', 4, 1]).classical()\n ['F', 4]\n sage: CartanType(['G', 2, 1]).classical()\n ['G', 2]\n "
return CartanType([self.letter, self.n])
def basic_untwisted(self):
"\n Return the basic_untwisted Cartan type associated with this affine\n Cartan type.\n\n Given an affine type `X_n^{(r)}`, the basic_untwisted type is `X_n`. In\n other words, it is the classical Cartan type that is twisted to\n obtain ``self``.\n\n EXAMPLES::\n\n sage: CartanType(['A', 1, 1]).basic_untwisted()\n ['A', 1]\n sage: CartanType(['A', 3, 1]).basic_untwisted()\n ['A', 3]\n sage: CartanType(['B', 3, 1]).basic_untwisted()\n ['B', 3]\n sage: CartanType(['E', 6, 1]).basic_untwisted()\n ['E', 6]\n sage: CartanType(['G', 2, 1]).basic_untwisted()\n ['G', 2]\n "
return self.classical()
def is_untwisted_affine(self):
"\n Implement :meth:`CartanType_affine.is_untwisted_affine` by\n returning ``True``.\n\n EXAMPLES::\n\n sage: CartanType(['B', 3, 1]).is_untwisted_affine()\n True\n\n "
return True
def _latex_(self):
"\n Return a latex representation of ``self``.\n\n EXAMPLES::\n\n sage: latex(CartanType(['B',4,1]))\n B_{4}^{(1)}\n sage: latex(CartanType(['C',4,1]))\n C_{4}^{(1)}\n sage: latex(CartanType(['D',4,1]))\n D_{4}^{(1)}\n sage: latex(CartanType(['F',4,1]))\n F_4^{(1)}\n sage: latex(CartanType(['G',2,1]))\n G_2^{(1)}\n "
return (self.classical()._latex_() + '^{(1)}')
|
class CartanType_decorator(UniqueRepresentation, SageObject, CartanType_abstract):
'\n Concrete base class for Cartan types that decorate another Cartan type.\n '
def __init__(self, ct):
"\n Initialize ``self``.\n\n EXAMPLES::\n\n sage: ct = CartanType(['G', 2]).relabel({1:2,2:1})\n sage: TestSuite(ct).run()\n "
self._type = ct
def is_irreducible(self):
"\n EXAMPLES::\n\n sage: ct = CartanType(['G', 2]).relabel({1:2,2:1})\n sage: ct.is_irreducible()\n True\n "
return self._type.is_irreducible()
def is_finite(self):
"\n EXAMPLES::\n\n sage: ct = CartanType(['G', 2]).relabel({1:2,2:1})\n sage: ct.is_finite()\n True\n "
return self._type.is_finite()
def is_crystallographic(self):
"\n EXAMPLES::\n\n sage: ct = CartanType(['G', 2]).relabel({1:2,2:1})\n sage: ct.is_crystallographic()\n True\n "
return self._type.is_crystallographic()
def is_affine(self):
"\n EXAMPLES::\n\n sage: ct = CartanType(['G', 2]).relabel({1:2,2:1})\n sage: ct.is_affine()\n False\n "
return self._type.is_affine()
def rank(self):
"\n EXAMPLES::\n\n sage: ct = CartanType(['G', 2]).relabel({1:2,2:1})\n sage: ct.rank()\n 2\n "
return self._type.rank()
def index_set(self):
"\n EXAMPLES::\n\n sage: ct = CartanType(['F', 4, 1]).dual()\n sage: ct.index_set()\n (0, 1, 2, 3, 4)\n "
return self._type.index_set()
|
class SuperCartanType_standard(UniqueRepresentation, SageObject):
def _repr_(self, compact=False):
'\n TESTS::\n\n sage: ct = CartanType([\'A\', [3,2]])\n sage: repr(ct)\n "[\'A\', [3, 2]]"\n sage: ct._repr_(compact=True)\n \'A3|2\'\n '
formatstr = ('%s%s|%s' if compact else "['%s', [%s, %s]]")
return (formatstr % (self.letter, self.m, self.n))
def __len__(self):
"\n EXAMPLES::\n\n sage: len(CartanType(['A',[4,3]]))\n 2\n "
return 2
def __getitem__(self, i):
"\n EXAMPLES::\n\n sage: t = CartanType(['A', [3,6]])\n sage: t[0]\n 'A'\n sage: t[1]\n [3, 6]\n sage: t[2]\n Traceback (most recent call last):\n ...\n IndexError: index out of range\n "
if (i == 0):
return self.letter
elif (i == 1):
return [self.m, self.n]
else:
raise IndexError('index out of range')
options = CartanType.options
|
class CartanType_simple_finite():
def __setstate__(self, dict):
'\n Implements the unpickling of Cartan types pickled by Sage <= 4.0.\n\n EXAMPLES:\n\n This is the pickle for CartanType(["A", 4])::\n\n sage: pg_CartanType_simple_finite = unpickle_global(\'sage.combinat.root_system.cartan_type\', \'CartanType_simple_finite\')\n sage: si1 = unpickle_newobj(pg_CartanType_simple_finite, ())\n sage: from sage.misc.fpickle import unpickleModule\n sage: pg_make_integer = unpickle_global(\'sage.rings.integer\', \'make_integer\')\n sage: si2 = pg_make_integer(\'4\')\n sage: unpickle_build(si1, {\'tools\':unpickleModule(\'sage.combinat.root_system.type_A\'), \'t\':[\'A\', si2], \'letter\':\'A\', \'n\':si2})\n\n sage: si1\n [\'A\', 4]\n sage: si1.dynkin_diagram() # needs sage.graphs\n O---O---O---O\n 1 2 3 4\n A4\n\n This is quite hacky; in particular unique representation is not preserved::\n\n sage: si1 == CartanType(["A", 4]) # todo: not implemented\n True\n '
T = CartanType([dict['letter'], dict['n']])
self.__class__ = T.__class__
self.__dict__ = T.__dict__
|
def CoxeterGroup(data, implementation='reflection', base_ring=None, index_set=None):
'\n Return an implementation of the Coxeter group given by ``data``.\n\n INPUT:\n\n - ``data`` -- a Cartan type (or coercible into; see :class:`CartanType`)\n or a Coxeter matrix or graph\n\n - ``implementation`` -- (default: ``\'reflection\'``) can be one of\n the following:\n\n * ``\'permutation\'`` - as a permutation representation\n * ``\'matrix\'`` - as a Weyl group (as a matrix group acting on the\n root space); if this is not implemented, this uses the "reflection"\n implementation\n * ``\'coxeter3\'`` - using the coxeter3 package\n * ``\'reflection\'`` - as elements in the reflection representation; see\n :class:`~sage.groups.matrix_gps.coxeter_groups.CoxeterMatrixGroup`\n\n - ``base_ring`` -- (optional) the base ring for the ``\'reflection\'``\n implementation\n\n - ``index_set`` -- (optional) the index set for the ``\'reflection\'``\n implementation\n\n EXAMPLES:\n\n Now assume that ``data`` represents a Cartan type. If\n ``implementation`` is not specified, the reflection representation\n is returned::\n\n sage: W = CoxeterGroup(["A",2]); W # needs sage.libs.gap\n Finite Coxeter group over Integer Ring with Coxeter matrix:\n [1 3]\n [3 1]\n\n sage: W = CoxeterGroup(["A",3,1]); W # needs sage.libs.gap\n Coxeter group over Integer Ring with Coxeter matrix:\n [1 3 2 3]\n [3 1 3 2]\n [2 3 1 3]\n [3 2 3 1]\n\n sage: W = CoxeterGroup([\'H\',3]); W # needs sage.libs.gap\n Finite Coxeter group over Number Field in a with defining polynomial x^2 - 5\n with a = 2.236067977499790? with Coxeter matrix:\n [1 3 2]\n [3 1 5]\n [2 5 1]\n\n We now use the ``implementation`` option::\n\n sage: W = CoxeterGroup(["A",2], implementation="permutation"); W # optional - gap3\n Permutation Group with generators [(1,4)(2,3)(5,6), (1,3)(2,5)(4,6)]\n sage: W.category() # optional - gap3\n Join of Category of finite enumerated permutation groups\n and Category of finite Weyl groups\n and Category of well generated finite irreducible complex reflection groups\n\n sage: W = CoxeterGroup(["A",2], implementation="matrix"); W # needs sage.libs.gap\n Weyl Group of type [\'A\', 2] (as a matrix group acting on the ambient space)\n\n sage: W = CoxeterGroup(["H",3], implementation="matrix"); W # needs sage.libs.gap sage.rings.number_field\n Finite Coxeter group over Number Field in a with defining polynomial x^2 - 5\n with a = 2.236067977499790? with Coxeter matrix:\n [1 3 2]\n [3 1 5]\n [2 5 1]\n\n sage: W = CoxeterGroup(["H",3], implementation="reflection"); W # needs sage.libs.gap sage.rings.number_field\n Finite Coxeter group over Number Field in a with defining polynomial x^2 - 5\n with a = 2.236067977499790? with Coxeter matrix:\n [1 3 2]\n [3 1 5]\n [2 5 1]\n\n sage: W = CoxeterGroup(["A",4,1], implementation="permutation") # needs sage.libs.gap\n Traceback (most recent call last):\n ...\n ValueError: the type must be finite\n\n sage: W = CoxeterGroup(["A",4], implementation="chevie"); W # optional - gap3\n Irreducible real reflection group of rank 4 and type A4\n\n We use the different options for the "reflection" implementation::\n\n sage: W = CoxeterGroup(["H",3], implementation="reflection", base_ring=RR); W # needs sage.libs.gap\n Finite Coxeter group over Real Field with 53 bits of precision with Coxeter matrix:\n [1 3 2]\n [3 1 5]\n [2 5 1]\n sage: W = CoxeterGroup([[1,10],[10,1]], implementation="reflection", # needs sage.symbolics\n ....: index_set=[\'a\',\'b\'], base_ring=SR); W\n Finite Coxeter group over Symbolic Ring with Coxeter matrix:\n [ 1 10]\n [10 1]\n\n TESTS::\n\n sage: W = groups.misc.CoxeterGroup(["H",3]) # needs sage.graphs sage.groups\n '
if (implementation not in ['permutation', 'matrix', 'coxeter3', 'reflection', 'chevie', None]):
raise ValueError('invalid type implementation')
from sage.groups.matrix_gps.coxeter_group import CoxeterMatrixGroup
try:
cartan_type = CartanType(data)
except (TypeError, ValueError):
return CoxeterMatrixGroup(data, base_ring, index_set)
if (implementation is None):
implementation = 'matrix'
if (implementation == 'reflection'):
return CoxeterMatrixGroup(cartan_type, base_ring, index_set)
if (implementation == 'coxeter3'):
try:
from sage.libs.coxeter3.coxeter_group import CoxeterGroup
except ImportError:
raise RuntimeError('coxeter3 must be installed')
else:
return CoxeterGroup(cartan_type)
if (implementation == 'permutation'):
if (not cartan_type.is_finite()):
raise ValueError('the type must be finite')
if cartan_type.is_crystallographic():
return WeylGroup(cartan_type, implementation='permutation')
return ReflectionGroup(cartan_type, index_set=index_set)
elif (implementation == 'matrix'):
if cartan_type.is_crystallographic():
return WeylGroup(cartan_type)
return CoxeterMatrixGroup(cartan_type, base_ring, index_set)
elif (implementation == 'chevie'):
return ReflectionGroup(cartan_type, index_set=index_set)
raise NotImplementedError('Coxeter group of type {} as {} group not implemented'.format(cartan_type, implementation))
|
class CoxeterMatrix(CoxeterType, metaclass=ClasscallMetaclass):
"\n A Coxeter matrix.\n\n A Coxeter matrix `M = (m_{ij})_{i,j \\in I}` is a matrix encoding\n a Coxeter system `(W, S)`, where the relations are given by\n `(s_i s_j)^{m_{ij}}`. Thus `M` is symmetric and has entries\n in `\\{1, 2, 3, \\ldots, \\infty\\}` with `m_{ij} = 1` if and only\n if `i = j`.\n\n We represent `m_{ij} = \\infty` by any number `m_{ij} \\leq -1`. In\n particular, we can construct a bilinear form `B = (b_{ij})_{i,j \\in I}`\n from `M` by\n\n .. MATH::\n\n b_{ij} = \\begin{cases}\n m_{ij} & m_{ij} < 0\\ (\\text{i.e., } m_{ij} = \\infty), \\\\\n -\\cos\\left( \\frac{\\pi}{m_{ij}} \\right) & \\text{otherwise}.\n \\end{cases}\n\n EXAMPLES::\n\n sage: CoxeterMatrix(['A', 4])\n [1 3 2 2]\n [3 1 3 2]\n [2 3 1 3]\n [2 2 3 1]\n sage: CoxeterMatrix(['B', 4])\n [1 3 2 2]\n [3 1 3 2]\n [2 3 1 4]\n [2 2 4 1]\n sage: CoxeterMatrix(['C', 4])\n [1 3 2 2]\n [3 1 3 2]\n [2 3 1 4]\n [2 2 4 1]\n sage: CoxeterMatrix(['D', 4])\n [1 3 2 2]\n [3 1 3 3]\n [2 3 1 2]\n [2 3 2 1]\n\n sage: CoxeterMatrix(['E', 6])\n [1 2 3 2 2 2]\n [2 1 2 3 2 2]\n [3 2 1 3 2 2]\n [2 3 3 1 3 2]\n [2 2 2 3 1 3]\n [2 2 2 2 3 1]\n\n sage: CoxeterMatrix(['F', 4])\n [1 3 2 2]\n [3 1 4 2]\n [2 4 1 3]\n [2 2 3 1]\n\n sage: CoxeterMatrix(['G', 2])\n [1 6]\n [6 1]\n\n By default, entries representing `\\infty` are given by `-1`\n in the Coxeter matrix::\n\n sage: G = Graph([(0,1,None), (1,2,4), (0,2,oo)])\n sage: CoxeterMatrix(G)\n [ 1 3 -1]\n [ 3 1 4]\n [-1 4 1]\n\n It is possible to give a number `\\leq -1` to represent an infinite label::\n\n sage: CoxeterMatrix([[1,-1],[-1,1]])\n [ 1 -1]\n [-1 1]\n sage: CoxeterMatrix([[1,-3/2],[-3/2,1]])\n [ 1 -3/2]\n [-3/2 1]\n "
@staticmethod
def __classcall_private__(cls, data=None, index_set=None, coxeter_type=None, cartan_type=None, coxeter_type_check=True):
"\n A Coxeter matrix can we created via a graph, a Coxeter type, or\n a matrix.\n\n .. NOTE::\n\n To disable the Coxeter type check, use the optional argument\n ``coxeter_type_check = False``.\n\n EXAMPLES::\n\n sage: C = CoxeterMatrix(['A',1,1],['a','b'])\n sage: C2 = CoxeterMatrix([[1, -1], [-1, 1]])\n sage: C3 = CoxeterMatrix(matrix([[1, -1], [-1, 1]]), [0, 1])\n sage: C == C2 and C == C3\n True\n\n Check with `\\infty` because of the hack of using `-1` to represent\n `\\infty` in the Coxeter matrix::\n\n sage: G = Graph([(0, 1, 3), (1, 2, oo)])\n sage: W1 = CoxeterMatrix([[1, 3, 2], [3, 1, -1], [2, -1, 1]])\n sage: W2 = CoxeterMatrix(G)\n sage: W1 == W2\n True\n sage: CoxeterMatrix(W1.coxeter_graph()) == W1\n True\n\n The base ring of the matrix depends on the entries given::\n\n sage: CoxeterMatrix([[1,-1],[-1,1]])._matrix.base_ring()\n Integer Ring\n sage: CoxeterMatrix([[1,-3/2],[-3/2,1]])._matrix.base_ring()\n Rational Field\n sage: CoxeterMatrix([[1,-1.5],[-1.5,1]])._matrix.base_ring()\n Real Field with 53 bits of precision\n "
if (not data):
if coxeter_type:
data = CoxeterType(coxeter_type)
elif cartan_type:
data = CoxeterType(CartanType(cartan_type))
if (not data):
data = []
n = 0
index_set = tuple()
coxeter_type = None
base_ring = ZZ
mat = typecall(cls, MatrixSpace(base_ring, n, sparse=False), data, coxeter_type, index_set)
mat._subdivisions = None
return mat
if isinstance(data, CoxeterMatrix):
return data
if isinstance(data, Graph):
return cls._from_graph(data, coxeter_type_check)
coxeter_type = None
from sage.combinat.root_system.cartan_type import CartanType_abstract
if isinstance(data, CartanType_abstract):
coxeter_type = data.coxeter_type()
else:
try:
coxeter_type = CoxeterType(data)
except (TypeError, ValueError, NotImplementedError):
pass
if coxeter_type:
return cls._from_coxetertype(coxeter_type)
n = len(data[0])
data = [(x if (x != infinity) else (- 1)) for r in data for x in r]
data = matrix(n, n, data)
if index_set:
index_set = tuple(index_set)
else:
index_set = tuple(range(1, (n + 1)))
if (len(set(index_set)) != n):
raise ValueError('the given index set is not valid')
return cls._from_matrix(data, coxeter_type, index_set, coxeter_type_check)
def __init__(self, parent, data, coxeter_type, index_set):
'\n Initialize ``self``.\n\n TESTS::\n\n sage: C = CoxeterMatrix([\'A\', 2, 1])\n sage: TestSuite(C).run(skip=["_test_category", "_test_change_ring"])\n '
self._matrix = Matrix_generic_dense(parent, data, False, True)
self._matrix.set_immutable()
if (self._matrix.base_ring() not in [ZZ, QQ]):
self._is_cyclotomic = False
else:
self._is_cyclotomic = True
self._coxeter_type = coxeter_type
if (self._coxeter_type is not None):
if self._coxeter_type.is_finite():
self._is_finite = True
self._is_affine = False
elif self._coxeter_type.is_affine():
self._is_finite = False
self._is_affine = True
else:
self._is_finite = False
self._is_affine = False
else:
self._is_finite = False
self._is_affine = False
self._index_set = index_set
self._rank = self._matrix.nrows()
self._dict = {(self._index_set[i], self._index_set[j]): self._matrix[(i, j)] for i in range(self._rank) for j in range(self._rank)}
for (i, key) in enumerate(self._index_set):
self._dict[key] = {key2: self._matrix[(i, j)] for (j, key2) in enumerate(self._index_set)}
@classmethod
def _from_matrix(cls, data, coxeter_type, index_set, coxeter_type_check):
'\n Initiate the Coxeter matrix from a matrix.\n\n TESTS::\n\n sage: CM = CoxeterMatrix([[1,2],[2,1]]); CM\n [1 2]\n [2 1]\n sage: CM = CoxeterMatrix([[1,-1],[-1,1]]); CM\n [ 1 -1]\n [-1 1]\n sage: CM = CoxeterMatrix([[1,-1.5],[-1.5,1]]); CM\n [ 1.00000000000000 -1.50000000000000]\n [-1.50000000000000 1.00000000000000]\n sage: CM = CoxeterMatrix([[1,-3/2],[-3/2,1]]); CM\n [ 1 -3/2]\n [-3/2 1]\n sage: CM = CoxeterMatrix([[1,-3/2,5],[-3/2,1,-1],[5,-1,1]]); CM\n [ 1 -3/2 5]\n [-3/2 1 -1]\n [ 5 -1 1]\n sage: CM = CoxeterMatrix([[1,-3/2,5],[-3/2,1,oo],[5,oo,1]]); CM\n [ 1 -3/2 5]\n [-3/2 1 -1]\n [ 5 -1 1]\n '
check_coxeter_matrix(data)
M = matrix(data)
n = M.ncols()
base_ring = M.base_ring()
if (not coxeter_type):
if (n == 1):
coxeter_type = CoxeterType(['A', 1])
elif coxeter_type_check:
coxeter_type = recognize_coxeter_type_from_matrix(M, index_set)
else:
coxeter_type = None
raw_data = M.list()
mat = typecall(cls, MatrixSpace(base_ring, n, sparse=False), raw_data, coxeter_type, index_set)
mat._subdivisions = M._subdivisions
return mat
@classmethod
def _from_graph(cls, graph, coxeter_type_check):
"\n Initiate the Coxeter matrix from a graph.\n\n TESTS::\n\n sage: CoxeterMatrix(CoxeterMatrix(['A',4,1]).coxeter_graph())\n [1 3 2 2 3]\n [3 1 3 2 2]\n [2 3 1 3 2]\n [2 2 3 1 3]\n [3 2 2 3 1]\n sage: CoxeterMatrix(CoxeterMatrix(['B',4,1]).coxeter_graph())\n [1 2 3 2 2]\n [2 1 3 2 2]\n [3 3 1 3 2]\n [2 2 3 1 4]\n [2 2 2 4 1]\n sage: CoxeterMatrix(CoxeterMatrix(['F',4]).coxeter_graph())\n [1 3 2 2]\n [3 1 4 2]\n [2 4 1 3]\n [2 2 3 1]\n\n sage: G = Graph()\n sage: G.add_edge([0,1,oo])\n sage: CoxeterMatrix(G)\n [ 1 -1]\n [-1 1]\n sage: H = Graph()\n sage: H.add_edge([0,1,-1.5])\n sage: CoxeterMatrix(H)\n [ 1.00000000000000 -1.50000000000000]\n [-1.50000000000000 1.00000000000000]\n "
verts = graph.vertices(sort=True)
index_set = tuple(verts)
n = len(index_set)
data = []
for i in range(n):
data += [[]]
for j in range(n):
if (i == j):
data[(- 1)] += [ZZ.one()]
else:
data[(- 1)] += [2]
for e in graph.edges(sort=True):
label = e[2]
if (label is None):
label = 3
elif (label == infinity):
label = (- 1)
elif ((label not in ZZ) and (label > (- 1))):
raise ValueError('invalid Coxeter graph label')
elif ((label == 0) or (label == 1)):
raise ValueError('invalid Coxeter graph label')
i = verts.index(e[0])
j = verts.index(e[1])
data[j][i] = data[i][j] = label
return cls._from_matrix(data, None, index_set, coxeter_type_check)
@classmethod
def _from_coxetertype(cls, coxeter_type):
"\n Initiate the Coxeter matrix from a Coxeter type.\n\n TESTS::\n\n sage: CoxeterMatrix(['A',4]).coxeter_type()\n Coxeter type of ['A', 4]\n sage: CoxeterMatrix(['A',4,1]).coxeter_type()\n Coxeter type of ['A', 4, 1]\n sage: CoxeterMatrix(['D',4,1]).coxeter_type()\n Coxeter type of ['D', 4, 1]\n "
index_set = coxeter_type.index_set()
n = len(index_set)
reverse = {index_set[i]: i for i in range(n)}
data = [[(1 if (i == j) else 2) for j in range(n)] for i in range(n)]
for (i, j, l) in coxeter_type.coxeter_graph().edge_iterator():
if (l == infinity):
l = (- 1)
data[reverse[i]][reverse[j]] = l
data[reverse[j]][reverse[i]] = l
return cls._from_matrix(data, coxeter_type, index_set, False)
@classmethod
def samples(self, finite=None, affine=None, crystallographic=None, higher_rank=None):
"\n Return a sample of the available Coxeter types.\n\n INPUT:\n\n - ``finite`` -- (default: ``None``) a boolean or ``None``\n\n - ``affine`` -- (default: ``None``) a boolean or ``None``\n\n - ``crystallographic`` -- (default: ``None``) a boolean or ``None``\n\n - ``higher_rank`` -- (default: ``None``) a boolean or ``None``\n\n The sample contains all the exceptional finite and affine\n Coxeter types, as well as typical representatives of the\n infinite families.\n\n Here the ``higher_rank`` term denotes non-finite, non-affine,\n Coxeter groups (including hyperbolic types).\n\n .. TODO:: Implement the hyperbolic and compact hyperbolic in the samples.\n\n EXAMPLES::\n\n sage: [CM.coxeter_type() for CM in CoxeterMatrix.samples()]\n [\n Coxeter type of ['A', 1], Coxeter type of ['A', 5],\n <BLANKLINE>\n Coxeter type of ['B', 5], Coxeter type of ['D', 4],\n <BLANKLINE>\n Coxeter type of ['D', 5], Coxeter type of ['E', 6],\n <BLANKLINE>\n Coxeter type of ['E', 7], Coxeter type of ['E', 8],\n <BLANKLINE>\n Coxeter type of ['F', 4], Coxeter type of ['H', 3],\n <BLANKLINE>\n Coxeter type of ['H', 4], Coxeter type of ['I', 10],\n <BLANKLINE>\n Coxeter type of ['A', 2, 1], Coxeter type of ['B', 5, 1],\n <BLANKLINE>\n Coxeter type of ['C', 5, 1], Coxeter type of ['D', 5, 1],\n <BLANKLINE>\n Coxeter type of ['E', 6, 1], Coxeter type of ['E', 7, 1],\n <BLANKLINE>\n Coxeter type of ['E', 8, 1], Coxeter type of ['F', 4, 1],\n <BLANKLINE>\n [ 1 -1 -1]\n [-1 1 -1]\n Coxeter type of ['G', 2, 1], Coxeter type of ['A', 1, 1], [-1 -1 1],\n <BLANKLINE>\n [ 1 -2 3 2]\n [1 2 3] [-2 1 2 3]\n [2 1 7] [ 3 2 1 -8]\n [3 7 1], [ 2 3 -8 1]\n ]\n\n The finite, affine and crystallographic options allow\n respectively for restricting to (non) finite, (non) affine,\n and (non) crystallographic Cartan types::\n\n sage: [CM.coxeter_type() for CM in CoxeterMatrix.samples(finite=True)]\n [Coxeter type of ['A', 1], Coxeter type of ['A', 5],\n Coxeter type of ['B', 5], Coxeter type of ['D', 4],\n Coxeter type of ['D', 5], Coxeter type of ['E', 6],\n Coxeter type of ['E', 7], Coxeter type of ['E', 8],\n Coxeter type of ['F', 4], Coxeter type of ['H', 3],\n Coxeter type of ['H', 4], Coxeter type of ['I', 10]]\n\n sage: [CM.coxeter_type() for CM in CoxeterMatrix.samples(affine=True)]\n [Coxeter type of ['A', 2, 1], Coxeter type of ['B', 5, 1],\n Coxeter type of ['C', 5, 1], Coxeter type of ['D', 5, 1],\n Coxeter type of ['E', 6, 1], Coxeter type of ['E', 7, 1],\n Coxeter type of ['E', 8, 1], Coxeter type of ['F', 4, 1],\n Coxeter type of ['G', 2, 1], Coxeter type of ['A', 1, 1]]\n\n sage: [CM.coxeter_type() for CM in CoxeterMatrix.samples(crystallographic=True)]\n [Coxeter type of ['A', 1], Coxeter type of ['A', 5],\n Coxeter type of ['B', 5], Coxeter type of ['D', 4],\n Coxeter type of ['D', 5], Coxeter type of ['E', 6],\n Coxeter type of ['E', 7], Coxeter type of ['E', 8],\n Coxeter type of ['F', 4], Coxeter type of ['A', 2, 1],\n Coxeter type of ['B', 5, 1], Coxeter type of ['C', 5, 1],\n Coxeter type of ['D', 5, 1], Coxeter type of ['E', 6, 1],\n Coxeter type of ['E', 7, 1], Coxeter type of ['E', 8, 1],\n Coxeter type of ['F', 4, 1], Coxeter type of ['G', 2, 1]]\n\n sage: CoxeterMatrix.samples(crystallographic=False)\n [\n [1 3 2 2]\n [1 3 2] [3 1 3 2] [ 1 -1 -1] [1 2 3]\n [3 1 5] [2 3 1 5] [ 1 10] [ 1 -1] [-1 1 -1] [2 1 7]\n [2 5 1], [2 2 5 1], [10 1], [-1 1], [-1 -1 1], [3 7 1],\n <BLANKLINE>\n [ 1 -2 3 2]\n [-2 1 2 3]\n [ 3 2 1 -8]\n [ 2 3 -8 1]\n ]\n\n .. TODO:: add some reducible Coxeter types (suggestions?)\n\n TESTS::\n\n sage: for ct in CoxeterMatrix.samples(): TestSuite(ct).run()\n "
result = self._samples()
if (crystallographic is not None):
result = [t for t in result if (t.is_crystallographic() == crystallographic)]
if (finite is not None):
result = [t for t in result if (t.is_finite() == finite)]
if (affine is not None):
result = [t for t in result if (t.is_affine() == affine)]
if (higher_rank is not None):
result = [t for t in result if ((not t.is_affine()) and (not t.is_finite()))]
return result
@cached_method
def _samples(self):
"\n Return a sample of all implemented Coxeter types.\n\n .. NOTE:: This is intended to be used through :meth:`samples`.\n\n EXAMPLES::\n\n sage: [CM.coxeter_type() for CM in CoxeterMatrix._samples()]\n [\n Coxeter type of ['A', 1], Coxeter type of ['A', 5],\n <BLANKLINE>\n Coxeter type of ['B', 5], Coxeter type of ['D', 4],\n <BLANKLINE>\n Coxeter type of ['D', 5], Coxeter type of ['E', 6],\n <BLANKLINE>\n Coxeter type of ['E', 7], Coxeter type of ['E', 8],\n <BLANKLINE>\n Coxeter type of ['F', 4], Coxeter type of ['H', 3],\n <BLANKLINE>\n Coxeter type of ['H', 4], Coxeter type of ['I', 10],\n <BLANKLINE>\n Coxeter type of ['A', 2, 1], Coxeter type of ['B', 5, 1],\n <BLANKLINE>\n Coxeter type of ['C', 5, 1], Coxeter type of ['D', 5, 1],\n <BLANKLINE>\n Coxeter type of ['E', 6, 1], Coxeter type of ['E', 7, 1],\n <BLANKLINE>\n Coxeter type of ['E', 8, 1], Coxeter type of ['F', 4, 1],\n <BLANKLINE>\n [ 1 -1 -1]\n [-1 1 -1]\n Coxeter type of ['G', 2, 1], Coxeter type of ['A', 1, 1], [-1 -1 1],\n <BLANKLINE>\n [ 1 -2 3 2]\n [1 2 3] [-2 1 2 3]\n [2 1 7] [ 3 2 1 -8]\n [3 7 1], [ 2 3 -8 1]\n ]\n "
finite = [CoxeterMatrix(t) for t in [['A', 1], ['A', 5], ['B', 5], ['D', 4], ['D', 5], ['E', 6], ['E', 7], ['E', 8], ['F', 4], ['H', 3], ['H', 4], ['I', 10]]]
affine = [CoxeterMatrix(t) for t in [['A', 2, 1], ['B', 5, 1], ['C', 5, 1], ['D', 5, 1], ['E', 6, 1], ['E', 7, 1], ['E', 8, 1], ['F', 4, 1], ['G', 2, 1], ['A', 1, 1]]]
higher_matrices = [[[1, (- 1), (- 1)], [(- 1), 1, (- 1)], [(- 1), (- 1), 1]], [[1, 2, 3], [2, 1, 7], [3, 7, 1]], [[1, (- 2), 3, 2], [(- 2), 1, 2, 3], [3, 2, 1, (- 8)], [2, 3, (- 8), 1]]]
higher = [CoxeterMatrix(m) for m in higher_matrices]
return ((finite + affine) + higher)
def relabel(self, relabelling):
"\n Return a relabelled copy of this Coxeter matrix.\n\n INPUT:\n\n - ``relabelling`` -- a function (or dictionary)\n\n OUTPUT:\n\n an isomorphic Coxeter type obtained by relabelling the nodes of\n the Coxeter graph. Namely, the node with label ``i`` is\n relabelled ``f(i)`` (or, by ``f[i]`` if ``f`` is a dictionary).\n\n EXAMPLES::\n\n sage: CoxeterMatrix(['F',4]).relabel({ 1:2, 2:3, 3:4, 4:1})\n [1 4 2 3]\n [4 1 3 2]\n [2 3 1 2]\n [3 2 2 1]\n sage: CoxeterMatrix(['F',4]).relabel(lambda x: x+1 if x<4 else 1)\n [1 4 2 3]\n [4 1 3 2]\n [2 3 1 2]\n [3 2 2 1]\n "
if isinstance(relabelling, dict):
data = [[self[relabelling[i]][relabelling[j]] for j in self.index_set()] for i in self.index_set()]
else:
data = [[self[relabelling(i)][relabelling(j)] for j in self.index_set()] for i in self.index_set()]
return CoxeterMatrix(data)
def __reduce__(self):
"\n Used for pickling.\n\n TESTS::\n\n sage: C = CoxeterMatrix(['A',4])\n sage: M = loads(dumps(C))\n sage: M._index_set\n (1, 2, 3, 4)\n "
if self._coxeter_type:
return (CoxeterMatrix, (self._coxeter_type,))
return (CoxeterMatrix, (self._matrix, self._index_set))
def _repr_(self):
"\n String representation of the Coxeter matrix.\n\n EXAMPLES::\n\n sage: CM = CoxeterMatrix(['A',3]); CM\n [1 3 2]\n [3 1 3]\n [2 3 1]\n sage: CM = CoxeterMatrix([[1,-3/2],[-3/2,1]]); CM\n [ 1 -3/2]\n [-3/2 1]\n "
return repr(self._matrix)
def _repr_option(self, key):
"\n Metadata about the :meth:`_repr_` output.\n\n See :meth:`sage.structure.parent._repr_option` for details.\n\n EXAMPLES::\n\n sage: CM = CoxeterMatrix(['A',3])\n sage: CM._repr_option('ascii_art')\n True\n "
if ((key == 'ascii_art') or (key == 'element_ascii_art')):
return (self._matrix.nrows() > 1)
return super()._repr_option(key)
def _latex_(self):
"\n Latex representation of the Coxeter matrix.\n\n EXAMPLES::\n\n sage: CM = CoxeterMatrix(['A',3])\n sage: latex(CM)\n \\left(\\begin{array}{rrr}\n 1 & 3 & 2 \\\\\n 3 & 1 & 3 \\\\\n 2 & 3 & 1\n \\end{array}\\right)\n "
return self._matrix._latex_()
def __iter__(self):
'\n Return an iterator for the rows of the Coxeter matrix.\n\n EXAMPLES::\n\n sage: CM = CoxeterMatrix([[1,8],[8,1]])\n sage: next(CM.__iter__())\n (1, 8)\n '
return iter(self._matrix)
def __getitem__(self, key):
"\n Return a dictionary of labels adjacent to a node or\n the label of an edge in the Coxeter graph.\n\n EXAMPLES::\n\n sage: CM = CoxeterMatrix([[1,-2],[-2,1]])\n sage: CM = CoxeterMatrix([[1,-2],[-2,1]], ['a','b'])\n sage: CM['a']\n {'a': 1, 'b': -2}\n sage: CM['b']\n {'a': -2, 'b': 1}\n sage: CM['a','b']\n -2\n sage: CM['a','a']\n 1\n "
return self._dict[key]
def __hash__(self):
"\n Return hash of the Coxeter matrix.\n\n EXAMPLES::\n\n sage: CM = CoxeterMatrix([[1, -2], [-2, 1]], ['a', 'b'])\n sage: CM.__hash__()\n -337812865737895661 # 64-bit\n 153276691 # 32-bit\n sage: CM = CoxeterMatrix([[1, -3], [-3, 1]], ['1', '2'])\n sage: CM.__hash__()\n -506719298606843492 # 64-bit\n -1917568612 # 32-bit\n "
return hash(self._matrix)
def __eq__(self, other):
"\n Return if ``self`` and ``other`` are equal.\n\n EXAMPLES::\n\n sage: CM = CoxeterMatrix([[1,-2],[-2,1]],['a','b'])\n sage: CM2 = CoxeterMatrix([[1,-2],[-2,1]],['1','2'])\n sage: CM == CM2\n True\n sage: CM == matrix(CM)\n False\n sage: CM3 = CoxeterMatrix([[1,-3],[-3,1]],['1','2'])\n sage: CM == CM3\n False\n "
return (isinstance(other, CoxeterMatrix) and (self._matrix == other._matrix))
def __ne__(self, other):
"\n Return if ``self`` and ``other`` are not equal.\n\n EXAMPLES::\n\n sage: CM = CoxeterMatrix([[1,-2],[-2,1]],['a','b'])\n sage: CM2 = CoxeterMatrix([[1,-2],[-2,1]],['1','2'])\n sage: CM != CM2\n False\n sage: matrix(CM) != CM\n True\n sage: CM3 = CoxeterMatrix([[1,-3],[-3,1]],['1','2'])\n sage: CM != CM3\n True\n "
return (not (self == other))
def _matrix_(self, R=None):
'\n Return ``self`` as a matrix over the ring ``R``.\n\n EXAMPLES::\n\n sage: CM = CoxeterMatrix([[1,-3],[-3,1]])\n sage: matrix(CM)\n [ 1 -3]\n [-3 1]\n sage: matrix(RR, CM)\n [ 1.00000000000000 -3.00000000000000]\n [-3.00000000000000 1.00000000000000]\n '
if (R is not None):
return self._matrix.change_ring(R)
else:
return self._matrix
def index_set(self):
"\n Return the index set of ``self``.\n\n EXAMPLES::\n\n sage: C = CoxeterMatrix(['A',1,1])\n sage: C.index_set()\n (0, 1)\n sage: C = CoxeterMatrix(['E',6])\n sage: C.index_set()\n (1, 2, 3, 4, 5, 6)\n "
return self._index_set
def coxeter_type(self):
"\n Return the Coxeter type of ``self`` or ``self`` if unknown.\n\n EXAMPLES::\n\n sage: C = CoxeterMatrix(['A',4,1])\n sage: C.coxeter_type()\n Coxeter type of ['A', 4, 1]\n\n If the Coxeter type is unknown::\n\n sage: C = CoxeterMatrix([[1,3,4], [3,1,-1], [4,-1,1]])\n sage: C.coxeter_type()\n [ 1 3 4]\n [ 3 1 -1]\n [ 4 -1 1]\n "
if (self._coxeter_type is None):
return self
return self._coxeter_type
def rank(self):
'\n Return the rank of ``self``.\n\n EXAMPLES::\n\n sage: CoxeterMatrix([\'C\',3]).rank()\n 3\n sage: CoxeterMatrix(["A2","B2","F4"]).rank()\n 8\n '
return self._rank
def coxeter_matrix(self):
"\n Return the Coxeter matrix of ``self``.\n\n EXAMPLES::\n\n sage: CoxeterMatrix(['C',3]).coxeter_matrix()\n [1 3 2]\n [3 1 4]\n [2 4 1]\n "
return self
def bilinear_form(self, R=None):
"\n Return the bilinear form of ``self``.\n\n EXAMPLES::\n\n sage: # needs sage.libs.gap\n sage: CoxeterType(['A', 2, 1]).bilinear_form()\n [ 1 -1/2 -1/2]\n [-1/2 1 -1/2]\n [-1/2 -1/2 1]\n sage: CoxeterType(['H', 3]).bilinear_form()\n [ 1 -1/2 0]\n [ -1/2 1 1/2*E(5)^2 + 1/2*E(5)^3]\n [ 0 1/2*E(5)^2 + 1/2*E(5)^3 1]\n sage: C = CoxeterMatrix([[1,-1,-1],[-1,1,-1],[-1,-1,1]])\n sage: C.bilinear_form()\n [ 1 -1 -1]\n [-1 1 -1]\n [-1 -1 1]\n "
return CoxeterType.bilinear_form(self, R=R)
@cached_method
def coxeter_graph(self):
"\n Return the Coxeter graph of ``self``.\n\n EXAMPLES::\n\n sage: C = CoxeterMatrix(['A',3])\n sage: C.coxeter_graph()\n Graph on 3 vertices\n\n sage: C = CoxeterMatrix([['A',3],['A',1]])\n sage: C.coxeter_graph()\n Graph on 4 vertices\n "
n = self.rank()
I = self.index_set()
def val(x):
return (infinity if (x == (- 1)) else x)
G = Graph([(I[i], I[j], val(self._matrix[(i, j)])) for i in range(n) for j in range(i) if (self._matrix[(i, j)] not in [1, 2])], format='list_of_edges')
G.add_vertices(I)
return G.copy(immutable=True)
def is_simply_laced(self):
'\n Return if ``self`` is simply-laced.\n\n A Coxeter matrix is simply-laced if all non-diagonal entries are\n either 2 or 3.\n\n EXAMPLES::\n\n sage: cm = CoxeterMatrix([[1,3,3,3], [3,1,3,3], [3,3,1,3], [3,3,3,1]])\n sage: cm.is_simply_laced()\n True\n '
L = [1, 2, 3]
return all(((x in L) for row in self for x in row))
def is_crystallographic(self):
"\n Return whether ``self`` is crystallographic.\n\n A Coxeter matrix is crystallographic if all non-diagonal entries\n are either 2, 3, 4, or 6.\n\n EXAMPLES::\n\n sage: CoxeterMatrix(['F',4]).is_crystallographic()\n True\n sage: CoxeterMatrix(['H',3]).is_crystallographic()\n False\n "
L = [1, 2, 3, 4, 6]
return all(((x in L) for row in self for x in row))
def is_irreducible(self):
"\n Return whether ``self`` is irreducible.\n\n A Coxeter matrix is irreducible if the Coxeter graph is connected.\n\n EXAMPLES::\n\n sage: CoxeterMatrix([['F',4],['A',1]]).is_irreducible()\n False\n sage: CoxeterMatrix(['H',3]).is_irreducible()\n True\n "
return self.coxeter_graph().is_connected()
def is_finite(self):
"\n Return if ``self`` is a finite type or ``False`` if unknown.\n\n EXAMPLES::\n\n sage: M = CoxeterMatrix(['C',4])\n sage: M.is_finite()\n True\n sage: M = CoxeterMatrix(['D',4,1])\n sage: M.is_finite()\n False\n sage: M = CoxeterMatrix([[1, -1], [-1, 1]])\n sage: M.is_finite()\n False\n "
return self._is_finite
def is_affine(self):
"\n Return if ``self`` is an affine type or ``False`` if unknown.\n\n EXAMPLES::\n\n sage: M = CoxeterMatrix(['C',4])\n sage: M.is_affine()\n False\n sage: M = CoxeterMatrix(['D',4,1])\n sage: M.is_affine()\n True\n sage: M = CoxeterMatrix([[1, 3],[3,1]])\n sage: M.is_affine()\n False\n sage: M = CoxeterMatrix([[1, -1, 7], [-1, 1, 3], [7, 3, 1]])\n sage: M.is_affine()\n False\n "
return self._is_affine
|
def recognize_coxeter_type_from_matrix(coxeter_matrix, index_set):
"\n Return the Coxeter type of ``coxeter_matrix`` if known,\n otherwise return ``None``.\n\n EXAMPLES:\n\n Some infinite ones::\n\n sage: C = CoxeterMatrix([[1,3,2],[3,1,-1],[2,-1,1]])\n sage: C.is_finite() # indirect doctest\n False\n sage: C = CoxeterMatrix([[1,-1,-1],[-1,1,-1],[-1,-1,1]])\n sage: C.is_finite() # indirect doctest\n False\n\n Some finite ones::\n\n sage: m = matrix(CoxeterMatrix(['D', 4]))\n sage: CoxeterMatrix(m).is_finite() # indirect doctest\n True\n sage: m = matrix(CoxeterMatrix(['H', 4]))\n sage: CoxeterMatrix(m).is_finite() # indirect doctest\n True\n\n sage: CoxeterMatrix(CoxeterType(['A',10]).coxeter_graph()).coxeter_type()\n Coxeter type of ['A', 10]\n sage: CoxeterMatrix(CoxeterType(['B',10]).coxeter_graph()).coxeter_type()\n Coxeter type of ['B', 10]\n sage: CoxeterMatrix(CoxeterType(['C',10]).coxeter_graph()).coxeter_type()\n Coxeter type of ['B', 10]\n sage: CoxeterMatrix(CoxeterType(['D',10]).coxeter_graph()).coxeter_type()\n Coxeter type of ['D', 10]\n sage: CoxeterMatrix(CoxeterType(['E',6]).coxeter_graph()).coxeter_type()\n Coxeter type of ['E', 6]\n sage: CoxeterMatrix(CoxeterType(['E',7]).coxeter_graph()).coxeter_type()\n Coxeter type of ['E', 7]\n sage: CoxeterMatrix(CoxeterType(['E',8]).coxeter_graph()).coxeter_type()\n Coxeter type of ['E', 8]\n sage: CoxeterMatrix(CoxeterType(['F',4]).coxeter_graph()).coxeter_type()\n Coxeter type of ['F', 4]\n sage: CoxeterMatrix(CoxeterType(['G',2]).coxeter_graph()).coxeter_type()\n Coxeter type of ['G', 2]\n sage: CoxeterMatrix(CoxeterType(['H',3]).coxeter_graph()).coxeter_type()\n Coxeter type of ['H', 3]\n sage: CoxeterMatrix(CoxeterType(['H',4]).coxeter_graph()).coxeter_type()\n Coxeter type of ['H', 4]\n sage: CoxeterMatrix(CoxeterType(['I',100]).coxeter_graph()).coxeter_type()\n Coxeter type of ['I', 100]\n\n Some affine graphs::\n\n sage: CoxeterMatrix(CoxeterType(['A',1,1]).coxeter_graph()).coxeter_type()\n Coxeter type of ['A', 1, 1]\n sage: CoxeterMatrix(CoxeterType(['A',10,1]).coxeter_graph()).coxeter_type()\n Coxeter type of ['A', 10, 1]\n sage: CoxeterMatrix(CoxeterType(['B',10,1]).coxeter_graph()).coxeter_type()\n Coxeter type of ['B', 10, 1]\n sage: CoxeterMatrix(CoxeterType(['C',10,1]).coxeter_graph()).coxeter_type()\n Coxeter type of ['C', 10, 1]\n sage: CoxeterMatrix(CoxeterType(['D',10,1]).coxeter_graph()).coxeter_type()\n Coxeter type of ['D', 10, 1]\n sage: CoxeterMatrix(CoxeterType(['E',6,1]).coxeter_graph()).coxeter_type()\n Coxeter type of ['E', 6, 1]\n sage: CoxeterMatrix(CoxeterType(['E',7,1]).coxeter_graph()).coxeter_type()\n Coxeter type of ['E', 7, 1]\n sage: CoxeterMatrix(CoxeterType(['E',8,1]).coxeter_graph()).coxeter_type()\n Coxeter type of ['E', 8, 1]\n sage: CoxeterMatrix(CoxeterType(['F',4,1]).coxeter_graph()).coxeter_type()\n Coxeter type of ['F', 4, 1]\n sage: CoxeterMatrix(CoxeterType(['G',2,1]).coxeter_graph()).coxeter_type()\n Coxeter type of ['G', 2, 1]\n\n TESTS:\n\n Check that we detect relabellings::\n\n sage: M = CoxeterMatrix([[1,2,3],[2,1,6],[3,6,1]], index_set=['a', 'b', 'c'])\n sage: M.coxeter_type()\n Coxeter type of ['G', 2, 1] relabelled by {0: 'a', 1: 'b', 2: 'c'}\n\n sage: from sage.combinat.root_system.coxeter_matrix import recognize_coxeter_type_from_matrix\n sage: for C in CoxeterMatrix.samples():\n ....: relabelling_perm = Permutations(C.index_set()).random_element()\n ....: relabelling_dict = {C.index_set()[i]: relabelling_perm[i] for i in range(C.rank())}\n ....: relabeled_matrix = C.relabel(relabelling_dict)._matrix\n ....: recognized_type = recognize_coxeter_type_from_matrix(relabeled_matrix, relabelling_perm)\n ....: if C.is_finite() or C.is_affine():\n ....: assert recognized_type == C.coxeter_type()\n\n We check the rank 2 cases (:trac:`20419`)::\n\n sage: for i in range(2, 10):\n ....: M = matrix([[1,i],[i,1]])\n ....: CoxeterMatrix(M).coxeter_type()\n Coxeter type of A1xA1 relabelled by {1: 2}\n Coxeter type of ['A', 2]\n Coxeter type of ['B', 2]\n Coxeter type of ['I', 5]\n Coxeter type of ['G', 2]\n Coxeter type of ['I', 7]\n Coxeter type of ['I', 8]\n Coxeter type of ['I', 9]\n sage: CoxeterMatrix(matrix([[1,-1],[-1,1]]), index_set=[0,1]).coxeter_type()\n Coxeter type of ['A', 1, 1]\n\n Check that this works for reducible types with relabellings\n (:trac:`24892`)::\n\n sage: CM = CoxeterMatrix([[1,2,5],[2,1,2],[5,2,1]]); CM\n [1 2 5]\n [2 1 2]\n [5 2 1]\n sage: CM.coxeter_type()\n Coxeter type of I5 relabelled by {1: 1, 2: 3}xA1 relabelled by {1: 2}\n "
n = ZZ(coxeter_matrix.nrows())
G = Graph([index_set, [(index_set[i], index_set[j], coxeter_matrix[(i, j)]) for i in range(n) for j in range(i, n) if (coxeter_matrix[(i, j)] not in [1, 2])]], format='vertices_and_edges')
types = []
for S in G.connected_components_subgraphs():
r = S.num_verts()
if (r == 1):
types.append(CoxeterType(['A', 1]).relabel({1: S.vertices(sort=True)[0]}))
continue
if (r == 2):
e = S.edge_labels()[0]
if (e == 3):
ct = CoxeterType(['A', 2])
elif (e == 4):
ct = CoxeterType(['B', 2])
elif (e == 6):
ct = CoxeterType(['G', 2])
elif ((e > 0) and (e < float('inf'))):
ct = CoxeterType(['I', e])
else:
ct = CoxeterType(['A', 1, 1])
SV = S.vertices(sort=True)
if (not ct.is_affine()):
types.append(ct.relabel({1: SV[0], 2: SV[1]}))
else:
types.append(ct.relabel({0: SV[0], 1: SV[1]}))
continue
test = [['A', r], ['B', r], ['A', (r - 1), 1]]
if (r >= 3):
if (r == 3):
test += [['G', 2, 1], ['H', 3]]
test.append(['C', (r - 1), 1])
if (r >= 4):
if (r == 4):
test += [['F', 4], ['H', 4]]
test += [['D', r], ['B', (r - 1), 1]]
if (r >= 5):
if (r == 5):
test.append(['F', 4, 1])
test.append(['D', (r - 1), 1])
if (r == 6):
test.append(['E', 6])
elif (r == 7):
test += [['E', 7], ['E', 6, 1]]
elif (r == 8):
test += [['E', 8], ['E', 7, 1]]
elif (r == 9):
test.append(['E', 8, 1])
found = False
for ct in test:
ct = CoxeterType(ct)
T = ct.coxeter_graph()
(iso, match) = T.is_isomorphic(S, certificate=True, edge_labels=True)
if iso:
types.append(ct.relabel(match))
found = True
break
if (not found):
return None
return CoxeterType(types)
|
def check_coxeter_matrix(m):
'\n Check if ``m`` represents a generalized Coxeter matrix and raise\n and error if not.\n\n EXAMPLES::\n\n sage: from sage.combinat.root_system.coxeter_matrix import check_coxeter_matrix\n sage: m = matrix([[1,3,2],[3,1,-1],[2,-1,1]])\n sage: check_coxeter_matrix(m)\n\n sage: m = matrix([[1,3],[3,1],[2,-1]])\n sage: check_coxeter_matrix(m)\n Traceback (most recent call last):\n ...\n ValueError: not a square matrix\n\n sage: m = matrix([[1,3,2],[3,1,-1],[2,-1,2]])\n sage: check_coxeter_matrix(m)\n Traceback (most recent call last):\n ...\n ValueError: the matrix diagonal is not all 1\n\n sage: m = matrix([[1,3,3],[3,1,-1],[2,-1,1]])\n sage: check_coxeter_matrix(m)\n Traceback (most recent call last):\n ...\n ValueError: the matrix is not symmetric\n\n sage: m = matrix([[1,3,1/2],[3,1,-1],[1/2,-1,1]])\n sage: check_coxeter_matrix(m)\n Traceback (most recent call last):\n ...\n ValueError: invalid Coxeter label 1/2\n\n sage: m = matrix([[1,3,1],[3,1,-1],[1,-1,1]])\n sage: check_coxeter_matrix(m)\n Traceback (most recent call last):\n ...\n ValueError: invalid Coxeter label 1\n '
mat = matrix(m)
if (not mat.is_square()):
raise ValueError('not a square matrix')
for (i, row) in enumerate(m):
if (mat[(i, i)] != 1):
raise ValueError('the matrix diagonal is not all 1')
for (j, val) in enumerate(row[(i + 1):]):
if (val != m[((j + i) + 1)][i]):
raise ValueError('the matrix is not symmetric')
if (val not in ZZ):
if ((val > (- 1)) and (val in RR) and (val != infinity)):
raise ValueError('invalid Coxeter label {}'.format(val))
elif ((val == 1) or (val == 0)):
raise ValueError('invalid Coxeter label {}'.format(val))
|
def coxeter_matrix_as_function(t):
"\n Return the Coxeter matrix, as a function.\n\n INPUT:\n\n - ``t`` -- a Cartan type\n\n EXAMPLES::\n\n sage: from sage.combinat.root_system.coxeter_matrix import coxeter_matrix_as_function\n sage: f = coxeter_matrix_as_function(['A',4])\n sage: matrix([[f(i,j) for j in range(1,5)] for i in range(1,5)])\n [1 3 2 2]\n [3 1 3 2]\n [2 3 1 3]\n [2 2 3 1]\n "
m = CartanType(t).coxeter_matrix()
return (lambda i, j: m[(i, j)])
|
class CoxeterType(SageObject, metaclass=ClasscallMetaclass):
'\n Abstract class for Coxeter types.\n '
@staticmethod
def __classcall_private__(cls, *x):
"\n Parse input ``x``.\n\n EXAMPLES::\n\n sage: CoxeterType(['A',3])\n Coxeter type of ['A', 3]\n "
if (len(x) == 1):
x = x[0]
if isinstance(x, CoxeterType):
return x
try:
return CoxeterTypeFromCartanType(CartanType(x))
except (ValueError, TypeError):
pass
if (len(x) == 1):
return CoxeterType(x[0])
raise NotImplementedError('Coxeter types not from Cartan types not yet implemented')
@classmethod
def samples(self, finite=None, affine=None, crystallographic=None):
"\n Return a sample of the available Coxeter types.\n\n INPUT:\n\n - ``finite`` -- a boolean or ``None`` (default: ``None``)\n\n - ``affine`` -- a boolean or ``None`` (default: ``None``)\n\n - ``crystallographic`` -- a boolean or ``None`` (default: ``None``)\n\n The sample contains all the exceptional finite and affine\n Coxeter types, as well as typical representatives of the\n infinite families.\n\n EXAMPLES::\n\n sage: CoxeterType.samples()\n [Coxeter type of ['A', 1], Coxeter type of ['A', 5],\n Coxeter type of ['B', 1], Coxeter type of ['B', 5],\n Coxeter type of ['C', 1], Coxeter type of ['C', 5],\n Coxeter type of ['D', 4], Coxeter type of ['D', 5],\n Coxeter type of ['E', 6], Coxeter type of ['E', 7],\n Coxeter type of ['E', 8], Coxeter type of ['F', 4],\n Coxeter type of ['H', 3], Coxeter type of ['H', 4],\n Coxeter type of ['I', 10], Coxeter type of ['A', 2, 1],\n Coxeter type of ['B', 5, 1], Coxeter type of ['C', 5, 1],\n Coxeter type of ['D', 5, 1], Coxeter type of ['E', 6, 1],\n Coxeter type of ['E', 7, 1], Coxeter type of ['E', 8, 1],\n Coxeter type of ['F', 4, 1], Coxeter type of ['G', 2, 1],\n Coxeter type of ['A', 1, 1]]\n\n The finite, affine and crystallographic options allow\n respectively for restricting to (non) finite, (non) affine,\n and (non) crystallographic Cartan types::\n\n sage: CoxeterType.samples(finite=True)\n [Coxeter type of ['A', 1], Coxeter type of ['A', 5],\n Coxeter type of ['B', 1], Coxeter type of ['B', 5],\n Coxeter type of ['C', 1], Coxeter type of ['C', 5],\n Coxeter type of ['D', 4], Coxeter type of ['D', 5],\n Coxeter type of ['E', 6], Coxeter type of ['E', 7],\n Coxeter type of ['E', 8], Coxeter type of ['F', 4],\n Coxeter type of ['H', 3], Coxeter type of ['H', 4],\n Coxeter type of ['I', 10]]\n\n sage: CoxeterType.samples(affine=True)\n [Coxeter type of ['A', 2, 1], Coxeter type of ['B', 5, 1],\n Coxeter type of ['C', 5, 1], Coxeter type of ['D', 5, 1],\n Coxeter type of ['E', 6, 1], Coxeter type of ['E', 7, 1],\n Coxeter type of ['E', 8, 1], Coxeter type of ['F', 4, 1],\n Coxeter type of ['G', 2, 1], Coxeter type of ['A', 1, 1]]\n\n sage: CoxeterType.samples(crystallographic=True)\n [Coxeter type of ['A', 1], Coxeter type of ['A', 5],\n Coxeter type of ['B', 1], Coxeter type of ['B', 5],\n Coxeter type of ['C', 1], Coxeter type of ['C', 5],\n Coxeter type of ['D', 4], Coxeter type of ['D', 5],\n Coxeter type of ['E', 6], Coxeter type of ['E', 7],\n Coxeter type of ['E', 8], Coxeter type of ['F', 4],\n Coxeter type of ['A', 2, 1], Coxeter type of ['B', 5, 1],\n Coxeter type of ['C', 5, 1], Coxeter type of ['D', 5, 1],\n Coxeter type of ['E', 6, 1], Coxeter type of ['E', 7, 1],\n Coxeter type of ['E', 8, 1], Coxeter type of ['F', 4, 1],\n Coxeter type of ['G', 2, 1], Coxeter type of ['A', 1, 1]]\n\n sage: CoxeterType.samples(crystallographic=False)\n [Coxeter type of ['H', 3],\n Coxeter type of ['H', 4],\n Coxeter type of ['I', 10]]\n\n .. TODO:: add some reducible Coxeter types (suggestions?)\n\n TESTS::\n\n sage: for ct in CoxeterType.samples(): TestSuite(ct).run()\n "
result = self._samples()
if (crystallographic is not None):
result = [t for t in result if (t.is_crystallographic() == crystallographic)]
if (finite is not None):
result = [t for t in result if (t.is_finite() == finite)]
if (affine is not None):
result = [t for t in result if (t.is_affine() == affine)]
return result
@cached_method
def _samples(self):
"\n Return a sample of all implemented Coxeter types.\n\n .. NOTE::\n\n This is intended to be used through :meth:`samples`.\n\n EXAMPLES::\n\n sage: CoxeterType._samples()\n [Coxeter type of ['A', 1], Coxeter type of ['A', 5],\n Coxeter type of ['B', 1], Coxeter type of ['B', 5],\n Coxeter type of ['C', 1], Coxeter type of ['C', 5],\n Coxeter type of ['D', 4], Coxeter type of ['D', 5],\n Coxeter type of ['E', 6], Coxeter type of ['E', 7],\n Coxeter type of ['E', 8], Coxeter type of ['F', 4],\n Coxeter type of ['H', 3], Coxeter type of ['H', 4],\n Coxeter type of ['I', 10], Coxeter type of ['A', 2, 1],\n Coxeter type of ['B', 5, 1], Coxeter type of ['C', 5, 1],\n Coxeter type of ['D', 5, 1], Coxeter type of ['E', 6, 1],\n Coxeter type of ['E', 7, 1], Coxeter type of ['E', 8, 1],\n Coxeter type of ['F', 4, 1], Coxeter type of ['G', 2, 1],\n Coxeter type of ['A', 1, 1]]\n "
finite = [CoxeterType(t) for t in [['A', 1], ['A', 5], ['B', 1], ['B', 5], ['C', 1], ['C', 5], ['D', 4], ['D', 5], ['E', 6], ['E', 7], ['E', 8], ['F', 4], ['H', 3], ['H', 4], ['I', 10]]]
affine = [CoxeterType(t) for t in [['A', 2, 1], ['B', 5, 1], ['C', 5, 1], ['D', 5, 1], ['E', 6, 1], ['E', 7, 1], ['E', 8, 1], ['F', 4, 1], ['G', 2, 1], ['A', 1, 1]]]
return (finite + affine)
@abstract_method
def rank(self):
"\n Return the rank of ``self``.\n\n This is the number of nodes of the associated Coxeter graph.\n\n EXAMPLES::\n\n sage: CoxeterType(['A', 4]).rank()\n 4\n sage: CoxeterType(['A', 7, 2]).rank()\n 5\n sage: CoxeterType(['I', 8]).rank()\n 2\n "
@abstract_method
def index_set(self):
"\n Return the index set for ``self``.\n\n This is the list of the nodes of the associated Coxeter graph.\n\n EXAMPLES::\n\n sage: CoxeterType(['A', 3, 1]).index_set()\n (0, 1, 2, 3)\n sage: CoxeterType(['D', 4]).index_set()\n (1, 2, 3, 4)\n sage: CoxeterType(['A', 7, 2]).index_set()\n (0, 1, 2, 3, 4)\n sage: CoxeterType(['A', 7, 2]).index_set()\n (0, 1, 2, 3, 4)\n sage: CoxeterType(['A', 6, 2]).index_set()\n (0, 1, 2, 3)\n sage: CoxeterType(['D', 6, 2]).index_set()\n (0, 1, 2, 3, 4, 5)\n sage: CoxeterType(['E', 6, 1]).index_set()\n (0, 1, 2, 3, 4, 5, 6)\n sage: CoxeterType(['E', 6, 2]).index_set()\n (0, 1, 2, 3, 4)\n sage: CoxeterType(['A', 2, 2]).index_set()\n (0, 1)\n sage: CoxeterType(['G', 2, 1]).index_set()\n (0, 1, 2)\n sage: CoxeterType(['F', 4, 1]).index_set()\n (0, 1, 2, 3, 4)\n "
@abstract_method
def coxeter_matrix(self):
"\n Return the Coxeter matrix associated to ``self``.\n\n EXAMPLES::\n\n sage: CoxeterType(['A', 3]).coxeter_matrix() # needs sage.graphs\n [1 3 2]\n [3 1 3]\n [2 3 1]\n sage: CoxeterType(['A', 3, 1]).coxeter_matrix() # needs sage.graphs\n [1 3 2 3]\n [3 1 3 2]\n [2 3 1 3]\n [3 2 3 1]\n "
@abstract_method
def coxeter_graph(self):
"\n Return the Coxeter graph associated to ``self``.\n\n EXAMPLES::\n\n sage: CoxeterType(['A', 3]).coxeter_graph() # needs sage.graphs\n Graph on 3 vertices\n sage: CoxeterType(['A', 3, 1]).coxeter_graph() # needs sage.graphs\n Graph on 4 vertices\n "
@abstract_method
def is_finite(self):
"\n Return whether ``self`` is finite.\n\n EXAMPLES::\n\n sage: CoxeterType(['A',4]).is_finite()\n True\n sage: CoxeterType(['A',4, 1]).is_finite()\n False\n "
@abstract_method
def is_affine(self):
"\n Return whether ``self`` is affine.\n\n EXAMPLES::\n\n sage: CoxeterType(['A', 3]).is_affine()\n False\n sage: CoxeterType(['A', 3, 1]).is_affine()\n True\n "
def is_crystallographic(self):
"\n Return whether ``self`` is crystallographic.\n\n This returns ``False`` by default. Derived class should override this\n appropriately.\n\n EXAMPLES::\n\n sage: [ [t, t.is_crystallographic() ] for t in CartanType.samples(finite=True) ]\n [[['A', 1], True], [['A', 5], True],\n [['B', 1], True], [['B', 5], True],\n [['C', 1], True], [['C', 5], True],\n [['D', 2], True], [['D', 3], True], [['D', 5], True],\n [['E', 6], True], [['E', 7], True], [['E', 8], True],\n [['F', 4], True], [['G', 2], True],\n [['I', 5], False], [['H', 3], False], [['H', 4], False]]\n "
return False
def is_simply_laced(self):
"\n Return whether ``self`` is simply laced.\n\n This returns ``False`` by default. Derived class should override this\n appropriately.\n\n EXAMPLES::\n\n sage: [ [t, t.is_simply_laced() ] for t in CartanType.samples() ]\n [[['A', 1], True], [['A', 5], True],\n [['B', 1], True], [['B', 5], False],\n [['C', 1], True], [['C', 5], False],\n [['D', 2], True], [['D', 3], True], [['D', 5], True],\n [['E', 6], True], [['E', 7], True], [['E', 8], True],\n [['F', 4], False], [['G', 2], False],\n [['I', 5], False], [['H', 3], False], [['H', 4], False],\n [['A', 1, 1], False], [['A', 5, 1], True],\n [['B', 1, 1], False], [['B', 5, 1], False],\n [['C', 1, 1], False], [['C', 5, 1], False],\n [['D', 3, 1], True], [['D', 5, 1], True],\n [['E', 6, 1], True], [['E', 7, 1], True], [['E', 8, 1], True],\n [['F', 4, 1], False], [['G', 2, 1], False],\n [['BC', 1, 2], False], [['BC', 5, 2], False],\n [['B', 5, 1]^*, False], [['C', 4, 1]^*, False],\n [['F', 4, 1]^*, False], [['G', 2, 1]^*, False],\n [['BC', 1, 2]^*, False], [['BC', 5, 2]^*, False]]\n "
return False
@cached_method
def bilinear_form(self, R=None):
"\n Return the bilinear form over ``R`` associated to ``self``.\n\n INPUT:\n\n - ``R`` -- (default: universal cyclotomic field) a ring used to\n compute the bilinear form\n\n EXAMPLES::\n\n sage: # needs sage.graphs sage.libs.gap\n sage: CoxeterType(['A', 2, 1]).bilinear_form()\n [ 1 -1/2 -1/2]\n [-1/2 1 -1/2]\n [-1/2 -1/2 1]\n sage: CoxeterType(['H', 3]).bilinear_form()\n [ 1 -1/2 0]\n [ -1/2 1 1/2*E(5)^2 + 1/2*E(5)^3]\n [ 0 1/2*E(5)^2 + 1/2*E(5)^3 1]\n sage: C = CoxeterMatrix([[1,-1,-1],[-1,1,-1],[-1,-1,1]])\n sage: C.bilinear_form()\n [ 1 -1 -1]\n [-1 1 -1]\n [-1 -1 1]\n "
n = self.rank()
mat = self.coxeter_matrix()._matrix
if (R is None):
R = UniversalCyclotomicField()
if isinstance(R, sage.rings.abc.UniversalCyclotomicField):
E = R.gen
def val(x):
if (x > (- 1)):
return ((E((2 * x)) + (~ E((2 * x)))) / R((- 2)))
else:
return R(x)
elif isinstance(R, sage.rings.abc.NumberField_quadratic):
E = UniversalCyclotomicField().gen
def val(x):
if (x > (- 1)):
return (R((E((2 * x)) + (~ E((2 * x)))).to_cyclotomic_field()) / R((- 2)))
else:
return R(x)
else:
from sage.functions.trig import cos
from sage.symbolic.constants import pi
from sage.symbolic.ring import SR
def val(x):
if (x > (- 1)):
return (- R(cos((pi / SR(x)))))
else:
return R(x)
entries = [SparseEntry(i, j, val(mat[(i, j)])) for i in range(n) for j in range(n) if (mat[(i, j)] != 2)]
bilinear = Matrix(R, n, entries)
bilinear.set_immutable()
return bilinear
|
class CoxeterTypeFromCartanType(UniqueRepresentation, CoxeterType):
'\n A Coxeter type associated to a Cartan type.\n '
@staticmethod
def __classcall_private__(cls, cartan_type):
"\n Normalize input to ensure a unique representation.\n\n EXAMPLES::\n\n sage: from sage.combinat.root_system.coxeter_type import CoxeterTypeFromCartanType\n sage: C1 = CoxeterTypeFromCartanType(['A',3])\n sage: C2 = CoxeterTypeFromCartanType(CartanType(['A',3]))\n sage: C1 is C2\n True\n "
return super().__classcall__(cls, CartanType(cartan_type))
def __init__(self, cartan_type):
"\n Initialize ``self``.\n\n EXAMPLES::\n\n sage: C = CoxeterType(['A',3])\n sage: TestSuite(C).run()\n sage: C = CoxeterType(['H',4])\n sage: TestSuite(C).run()\n sage: C = CoxeterType(['C',3,1])\n sage: TestSuite(C).run()\n "
self._cartan_type = cartan_type
def _repr_(self, compact=False):
"\n Return a string representation of ``self``.\n\n EXAMPLES::\n\n sage: CoxeterType(['A',3])\n Coxeter type of ['A', 3]\n "
if compact:
return self._cartan_type._repr_(compact)
return 'Coxeter type of {}'.format(self._cartan_type)
def _latex_(self):
"\n Return a latex representation of ``self``.\n\n EXAMPLES::\n\n sage: latex(CoxeterType(['A',3]))\n A_{3}\n "
return self._cartan_type._latex_()
def coxeter_matrix(self):
"\n Return the Coxeter matrix associated to ``self``.\n\n EXAMPLES::\n\n sage: C = CoxeterType(['H',3])\n sage: C.coxeter_matrix() # needs sage.graphs\n [1 3 2]\n [3 1 5]\n [2 5 1]\n "
return self._cartan_type.coxeter_matrix()
def coxeter_graph(self):
"\n Return the Coxeter graph of ``self``.\n\n EXAMPLES::\n\n sage: C = CoxeterType(['H',3])\n sage: C.coxeter_graph().edges(sort=True) # needs sage.graphs\n [(1, 2, 3), (2, 3, 5)]\n "
return self._cartan_type.coxeter_diagram()
def cartan_type(self):
"\n Return the Cartan type used to construct ``self``.\n\n EXAMPLES::\n\n sage: C = CoxeterType(['C',3])\n sage: C.cartan_type()\n ['C', 3]\n "
return self._cartan_type
def type(self):
"\n Return the type of ``self``.\n\n EXAMPLES::\n\n sage: C = CoxeterType(['A', 4])\n sage: C.type()\n 'A'\n "
return self._cartan_type.type()
def rank(self):
"\n Return the rank of ``self``.\n\n EXAMPLES::\n\n sage: C = CoxeterType(['I', 16])\n sage: C.rank()\n 2\n "
return self._cartan_type.rank()
def index_set(self):
"\n Return the index set of ``self``.\n\n EXAMPLES::\n\n sage: C = CoxeterType(['A', 4])\n sage: C.index_set()\n (1, 2, 3, 4)\n "
return self._cartan_type.index_set()
def is_finite(self):
"\n Return if ``self`` is a finite type.\n\n EXAMPLES::\n\n sage: C = CoxeterType(['E', 6])\n sage: C.is_finite()\n True\n "
return self._cartan_type.is_finite()
def is_affine(self):
"\n Return if ``self`` is an affine type.\n\n EXAMPLES::\n\n sage: C = CoxeterType(['F', 4, 1])\n sage: C.is_affine()\n True\n "
return self._cartan_type.is_affine()
def is_crystallographic(self):
"\n Return if ``self`` is crystallographic.\n\n EXAMPLES::\n\n sage: C = CoxeterType(['C', 3])\n sage: C.is_crystallographic()\n True\n\n sage: C = CoxeterType(['H', 3])\n sage: C.is_crystallographic()\n False\n "
return self._cartan_type.is_crystallographic()
def is_simply_laced(self):
"\n Return if ``self`` is simply-laced.\n\n EXAMPLES::\n\n sage: C = CoxeterType(['A', 5])\n sage: C.is_simply_laced()\n True\n\n sage: C = CoxeterType(['B', 3])\n sage: C.is_simply_laced()\n False\n "
return self._cartan_type.is_simply_laced()
def is_reducible(self):
"\n Return if ``self`` is reducible.\n\n EXAMPLES::\n\n sage: C = CoxeterType(['A', 5])\n sage: C.is_reducible()\n False\n\n sage: C = CoxeterType('A2xA2')\n sage: C.is_reducible()\n True\n "
return self._cartan_type.is_reducible()
def is_irreducible(self):
"\n Return if ``self`` is irreducible.\n\n EXAMPLES::\n\n sage: C = CoxeterType(['A', 5])\n sage: C.is_irreducible()\n True\n\n sage: C = CoxeterType('B3xB3')\n sage: C.is_irreducible()\n False\n "
return self._cartan_type.is_irreducible()
def component_types(self):
"\n A list of Coxeter types making up the reducible type.\n\n EXAMPLES::\n\n sage: CoxeterType(['A',2],['B',2]).component_types()\n [Coxeter type of ['A', 2], Coxeter type of ['B', 2]]\n\n sage: CoxeterType('A4xB3').component_types()\n [Coxeter type of ['A', 4], Coxeter type of ['B', 3]]\n\n sage: CoxeterType(['A', 2]).component_types()\n Traceback (most recent call last):\n ...\n ValueError: component types only defined for reducible types\n "
if self.is_irreducible():
raise ValueError('component types only defined for reducible types')
return [CoxeterType(t) for t in self._cartan_type.component_types()]
def relabel(self, relabelling):
"\n Return a relabelled copy of ``self``.\n\n EXAMPLES::\n\n sage: ct = CoxeterType(['A',2])\n sage: ct.relabel({1:-1, 2:-2})\n Coxeter type of ['A', 2] relabelled by {1: -1, 2: -2}\n "
return CoxeterType(self._cartan_type.relabel(relabelling))
|
def DynkinDiagram(*args, **kwds):
'\n Return the Dynkin diagram corresponding to the input.\n\n INPUT:\n\n The input can be one of the following:\n\n - empty to obtain an empty Dynkin diagram\n - a Cartan type\n - a Cartan matrix\n - a Cartan matrix and an indexing set\n\n One can also input an indexing set by passing a tuple using the optional\n argument ``index_set``.\n\n The edge multiplicities are encoded as edge labels. For the corresponding\n Cartan matrices, this uses the convention in Hong and Kang, Kac,\n Fulton and Harris, and crystals. This is the **opposite** convention\n in Bourbaki and Wikipedia\'s Dynkin diagram (:wikipedia:`Dynkin_diagram`).\n That is for `i \\neq j`::\n\n i <--k-- j <==> a_ij = -k\n <==> -scalar(coroot[i], root[j]) = k\n <==> multiple arrows point from the longer root\n to the shorter one\n\n For example, in type `C_2`, we have::\n\n sage: C2 = DynkinDiagram([\'C\',2]); C2\n O=<=O\n 1 2\n C2\n sage: C2.cartan_matrix()\n [ 2 -2]\n [-1 2]\n\n However Bourbaki would have the Cartan matrix as:\n\n .. MATH::\n\n \\begin{bmatrix}\n 2 & -1 \\\\\n -2 & 2\n \\end{bmatrix}.\n\n EXAMPLES::\n\n sage: DynkinDiagram([\'A\', 4])\n O---O---O---O\n 1 2 3 4\n A4\n\n sage: DynkinDiagram([\'A\',1],[\'A\',1])\n O\n 1\n O\n 2\n A1xA1\n\n sage: R = RootSystem("A2xB2xF4")\n sage: DynkinDiagram(R)\n O---O\n 1 2\n O=>=O\n 3 4\n O---O=>=O---O\n 5 6 7 8\n A2xB2xF4\n\n sage: R = RootSystem("A2xB2xF4")\n sage: CM = R.cartan_matrix(); CM\n [ 2 -1| 0 0| 0 0 0 0]\n [-1 2| 0 0| 0 0 0 0]\n [-----+-----+-----------]\n [ 0 0| 2 -1| 0 0 0 0]\n [ 0 0|-2 2| 0 0 0 0]\n [-----+-----+-----------]\n [ 0 0| 0 0| 2 -1 0 0]\n [ 0 0| 0 0|-1 2 -1 0]\n [ 0 0| 0 0| 0 -2 2 -1]\n [ 0 0| 0 0| 0 0 -1 2]\n sage: DD = DynkinDiagram(CM); DD\n O---O\n 1 2\n O=>=O\n 3 4\n O---O=>=O---O\n 5 6 7 8\n A2xB2xF4\n sage: DD.cartan_matrix()\n [ 2 -1 0 0 0 0 0 0]\n [-1 2 0 0 0 0 0 0]\n [ 0 0 2 -1 0 0 0 0]\n [ 0 0 -2 2 0 0 0 0]\n [ 0 0 0 0 2 -1 0 0]\n [ 0 0 0 0 -1 2 -1 0]\n [ 0 0 0 0 0 -2 2 -1]\n [ 0 0 0 0 0 0 -1 2]\n\n We can also create Dynkin diagrams from arbitrary Cartan matrices::\n\n sage: C = CartanMatrix([[2, -3], [-4, 2]])\n sage: DynkinDiagram(C)\n Dynkin diagram of rank 2\n sage: C.index_set()\n (0, 1)\n sage: CI = CartanMatrix([[2, -3], [-4, 2]], [3, 5])\n sage: DI = DynkinDiagram(CI)\n sage: DI.index_set()\n (3, 5)\n sage: CII = CartanMatrix([[2, -3], [-4, 2]])\n sage: DII = DynkinDiagram(CII, (\'y\', \'x\'))\n sage: DII.index_set()\n (\'x\', \'y\')\n\n .. SEEALSO::\n\n :func:`CartanType` for a general discussion on Cartan\n types and in particular node labeling conventions.\n\n TESTS:\n\n Check that :trac:`15277` is fixed by not having edges from 0\'s::\n\n sage: CM = CartanMatrix([[2,-1,0,0],[-3,2,-2,-2],[0,-1,2,-1],[0,-1,-1,2]])\n sage: CM\n [ 2 -1 0 0]\n [-3 2 -2 -2]\n [ 0 -1 2 -1]\n [ 0 -1 -1 2]\n sage: CM.dynkin_diagram().edges(sort=True)\n [(0, 1, 3),\n (1, 0, 1),\n (1, 2, 1),\n (1, 3, 1),\n (2, 1, 2),\n (2, 3, 1),\n (3, 1, 2),\n (3, 2, 1)]\n '
if (len(args) == 0):
return DynkinDiagram_class()
mat = args[0]
if is_Matrix(mat):
mat = CartanMatrix(*args)
if isinstance(mat, CartanMatrix):
if (mat.cartan_type() is not mat):
try:
return mat.cartan_type().dynkin_diagram()
except AttributeError:
ct = CartanType(*args)
raise ValueError(('Dynkin diagram data not yet hardcoded for type %s' % ct))
if (len(args) > 1):
index_set = tuple(args[1])
elif ('index_set' in kwds):
index_set = tuple(kwds['index_set'])
else:
index_set = mat.index_set()
D = DynkinDiagram_class(index_set=index_set)
for (i, j) in mat.nonzero_positions():
if (i != j):
D.add_edge(index_set[i], index_set[j], (- mat[(j, i)]))
return D
ct = CartanType(*args)
try:
return ct.dynkin_diagram()
except AttributeError:
raise ValueError(('Dynkin diagram data not yet hardcoded for type %s' % ct))
|
class DynkinDiagram_class(DiGraph, CartanType_abstract):
"\n A Dynkin diagram.\n\n .. SEEALSO::\n\n :func:`DynkinDiagram()`\n\n INPUT:\n\n - ``t`` -- a Cartan type, Cartan matrix, or ``None``\n\n EXAMPLES::\n\n sage: DynkinDiagram(['A', 3])\n O---O---O\n 1 2 3\n A3\n sage: C = CartanMatrix([[2, -3], [-4, 2]])\n sage: DynkinDiagram(C)\n Dynkin diagram of rank 2\n sage: C.dynkin_diagram().cartan_matrix() == C\n True\n\n TESTS:\n\n Check that the correct type is returned when copied::\n\n sage: d = DynkinDiagram(['A', 3])\n sage: type(copy(d))\n <class 'sage.combinat.root_system.dynkin_diagram.DynkinDiagram_class'>\n\n We check that :trac:`14655` is fixed::\n\n sage: cd = copy(d)\n sage: cd.add_vertex(4)\n sage: d.vertices(sort=True) != cd.vertices(sort=True)\n True\n\n Implementation note: if a Cartan type is given, then the nodes\n are initialized from the index set of this Cartan type.\n "
def __init__(self, t=None, index_set=None, odd_isotropic_roots=[], **options):
'\n Initialize ``self``.\n\n EXAMPLES::\n\n sage: d = DynkinDiagram(["A", 3])\n sage: TestSuite(d).run()\n '
if isinstance(t, DiGraph):
if isinstance(t, DynkinDiagram_class):
self._cartan_type = t._cartan_type
self._odd_isotropic_roots = tuple(odd_isotropic_roots)
else:
self._cartan_type = None
self._odd_isotropic_roots = ()
DiGraph.__init__(self, data=t, **options)
return
DiGraph.__init__(self, **options)
self._cartan_type = t
self._odd_isotropic_roots = tuple(odd_isotropic_roots)
if (index_set is not None):
self.add_vertices(index_set)
elif (t is not None):
self.add_vertices(t.index_set())
def _repr_(self, compact=False):
"\n EXAMPLES::\n\n sage: DynkinDiagram(['G',2]) # indirect doctest\n 3\n O=<=O\n 1 2\n G2\n "
ct = self.cartan_type()
result = ((ct.ascii_art() + '\n') if hasattr(ct, 'ascii_art') else '')
if ((ct is None) or isinstance(ct, CartanMatrix)):
return (result + ('Dynkin diagram of rank %s' % self.rank()))
else:
return (result + ('%s' % ct._repr_(compact=True)))
def _rich_repr_(self, display_manager, **kwds):
"\n Rich Output Magic Method\n\n Override rich output because :meth:`_repr_` outputs ascii\n art. The proper fix will be in :trac:`18328`.\n\n See :mod:`sage.repl.rich_output` for details.\n\n EXAMPLES::\n\n sage: from sage.repl.rich_output import get_display_manager\n sage: dm = get_display_manager()\n sage: E8 = WeylCharacterRing('E8')\n sage: E8.dynkin_diagram()._rich_repr_(dm)\n OutputAsciiArt container\n "
OutputAsciiArt = display_manager.types.OutputAsciiArt
OutputPlainText = display_manager.types.OutputPlainText
if (OutputAsciiArt in display_manager.supported_output()):
return OutputAsciiArt(self._repr_())
else:
return OutputPlainText(self._repr_())
def _latex_(self, scale=0.5):
"\n Return a latex representation of this Dynkin diagram\n\n EXAMPLES::\n\n sage: latex(DynkinDiagram(['A',3,1]))\n \\begin{tikzpicture}[scale=0.5]\n \\draw (-1,0) node[anchor=east] {$A_{3}^{(1)}$};\n \\draw (0 cm,0) -- (4 cm,0);\n \\draw (0 cm,0) -- (2.0 cm, 1.2 cm);\n \\draw (2.0 cm, 1.2 cm) -- (4 cm, 0);\n \\draw[fill=white] (0 cm, 0 cm) circle (.25cm) node[below=4pt]{$1$};\n \\draw[fill=white] (2 cm, 0 cm) circle (.25cm) node[below=4pt]{$2$};\n \\draw[fill=white] (4 cm, 0 cm) circle (.25cm) node[below=4pt]{$3$};\n \\draw[fill=white] (2.0 cm, 1.2 cm) circle (.25cm) node[anchor=south east]{$0$};\n \\end{tikzpicture}\n "
if (self.cartan_type() is None):
return 'Dynkin diagram of rank {}'.format(self.rank())
from sage.graphs.graph_latex import setup_latex_preamble
setup_latex_preamble()
ret = '\\begin{{tikzpicture}}[scale={}]\n'.format(scale)
ret += '\\draw (-1,0) node[anchor=east] {{${}$}};\n'.format(self.cartan_type()._latex_())
ret += self.cartan_type()._latex_dynkin_diagram()
ret += '\\end{tikzpicture}'
return ret
def _matrix_(self):
"\n Return a regular matrix from ``self``.\n\n EXAMPLES::\n\n sage: M = DynkinDiagram(['C',3])._matrix_(); M\n [ 2 -1 0]\n [-1 2 -2]\n [ 0 -1 2]\n sage: type(M)\n <class 'sage.combinat.root_system.cartan_matrix.CartanMatrix'>\n "
return self.cartan_matrix()._matrix_()
def add_edge(self, i, j, label=1):
"\n EXAMPLES::\n\n sage: from sage.combinat.root_system.dynkin_diagram import DynkinDiagram_class\n sage: d = DynkinDiagram_class(CartanType(['A',3]))\n sage: sorted(d.edges(sort=True))\n []\n sage: d.add_edge(2, 3)\n sage: sorted(d.edges(sort=True))\n [(2, 3, 1), (3, 2, 1)]\n "
DiGraph.add_edge(self, i, j, label)
if (not self.has_edge(j, i)):
self.add_edge(j, i, 1)
def __hash__(self):
"\n EXAMPLES::\n\n sage: d = CartanType(['A',3]).dynkin_diagram()\n sage: dv = d.vertices(sort=True)\n sage: hash(d) == hash((d.cartan_type(), tuple(dv), tuple(d.edge_iterator(dv))))\n True\n "
verts = self.vertices(sort=True)
return hash((self.cartan_type(), tuple(verts), tuple(self.edge_iterator(verts))))
@staticmethod
def an_instance():
'\n Returns an example of Dynkin diagram\n\n EXAMPLES::\n\n sage: from sage.combinat.root_system.dynkin_diagram import DynkinDiagram_class\n sage: g = DynkinDiagram_class.an_instance()\n sage: g\n Dynkin diagram of rank 3\n sage: g.cartan_matrix()\n [ 2 -1 -1]\n [-2 2 -1]\n [-1 -1 2]\n\n '
g = DynkinDiagram()
g.add_vertices([1, 2, 3])
g.add_edge(1, 2, 2)
g.add_edge(1, 3)
g.add_edge(2, 3)
return g
@cached_method
def index_set(self):
'\n EXAMPLES::\n\n sage: DynkinDiagram([\'C\',3]).index_set()\n (1, 2, 3)\n sage: DynkinDiagram("A2","B2","F4").index_set()\n (1, 2, 3, 4, 5, 6, 7, 8)\n '
return tuple(self.vertices(sort=True))
def cartan_type(self):
'\n EXAMPLES::\n\n sage: DynkinDiagram("A2","B2","F4").cartan_type()\n A2xB2xF4\n '
return self._cartan_type
def rank(self):
'\n Returns the index set for this Dynkin diagram\n\n EXAMPLES::\n\n sage: DynkinDiagram([\'C\',3]).rank()\n 3\n sage: DynkinDiagram("A2","B2","F4").rank()\n 8\n '
return self.num_verts()
def dynkin_diagram(self):
"\n EXAMPLES::\n\n sage: DynkinDiagram(['C',3]).dynkin_diagram()\n O---O=<=O\n 1 2 3\n C3\n "
return self
@cached_method
def cartan_matrix(self):
"\n Returns the Cartan matrix for this Dynkin diagram\n\n EXAMPLES::\n\n sage: DynkinDiagram(['C',3]).cartan_matrix()\n [ 2 -1 0]\n [-1 2 -2]\n [ 0 -1 2]\n "
return CartanMatrix(self)
def dual(self):
"\n Returns the dual Dynkin diagram, obtained by reversing all edges.\n\n EXAMPLES::\n\n sage: D = DynkinDiagram(['C',3])\n sage: D.edges(sort=True)\n [(1, 2, 1), (2, 1, 1), (2, 3, 1), (3, 2, 2)]\n sage: D.dual()\n O---O=>=O\n 1 2 3\n B3\n sage: D.dual().edges(sort=True)\n [(1, 2, 1), (2, 1, 1), (2, 3, 2), (3, 2, 1)]\n sage: D.dual() == DynkinDiagram(['B',3])\n True\n\n TESTS::\n\n sage: D = DynkinDiagram(['A',0]); D\n A0\n sage: D.edges(sort=True)\n []\n sage: D.dual()\n A0\n sage: D.dual().edges(sort=True)\n []\n sage: D = DynkinDiagram(['A',1])\n sage: D.edges(sort=True)\n []\n sage: D.dual()\n O\n 1\n A1\n sage: D.dual().edges(sort=True)\n []\n "
result = DynkinDiagram_class(None, odd_isotropic_roots=self._odd_isotropic_roots)
result.add_vertices(self.vertices(sort=True))
for (source, target, label) in self.edges(sort=False):
result.add_edge(target, source, label)
result._cartan_type = (self._cartan_type.dual() if (self._cartan_type is not None) else None)
return result
def relabel(self, *args, **kwds):
"\n Return the relabelled Dynkin diagram of ``self``.\n\n INPUT: see :meth:`~sage.graphs.generic_graph.GenericGraph.relabel`\n\n There is one difference: the default value for ``inplace`` is\n ``False`` instead of ``True``.\n\n EXAMPLES::\n\n sage: D = DynkinDiagram(['C',3])\n sage: D.relabel({1:0, 2:4, 3:1})\n O---O=<=O\n 0 4 1\n C3 relabelled by {1: 0, 2: 4, 3: 1}\n sage: D\n O---O=<=O\n 1 2 3\n C3\n\n sage: _ = D.relabel({1:0, 2:4, 3:1}, inplace=True)\n sage: D\n O---O=<=O\n 0 4 1\n C3 relabelled by {1: 0, 2: 4, 3: 1}\n\n sage: D = DynkinDiagram(['A', [1,2]])\n sage: Dp = D.relabel({-1:4, 0:-3, 1:3, 2:2})\n sage: Dp\n O---X---O---O\n 4 -3 3 2\n A1|2 relabelled by {-1: 4, 0: -3, 1: 3, 2: 2}\n sage: Dp.odd_isotropic_roots()\n (-3,)\n\n sage: D = DynkinDiagram(['D', 5])\n sage: G, perm = D.relabel(range(5), return_map=True)\n sage: G\n O 4\n |\n |\n O---O---O---O\n 0 1 2 3\n D5 relabelled by {1: 0, 2: 1, 3: 2, 4: 3, 5: 4}\n sage: perm\n {1: 0, 2: 1, 3: 2, 4: 3, 5: 4}\n\n sage: perm = D.relabel(range(5), return_map=True, inplace=True)\n sage: D\n O 4\n |\n |\n O---O---O---O\n 0 1 2 3\n D5 relabelled by {1: 0, 2: 1, 3: 2, 4: 3, 5: 4}\n sage: perm\n {1: 0, 2: 1, 3: 2, 4: 3, 5: 4}\n "
return_map = kwds.pop('return_map', False)
inplace = kwds.pop('inplace', False)
if inplace:
G = self
else:
G = self.copy()
perm = DiGraph.relabel(G, *args, inplace=True, return_map=True, **kwds)
new_odds = [perm[i] for i in self._odd_isotropic_roots]
G._odd_isotropic_roots = tuple(new_odds)
if (self._cartan_type is not None):
G._cartan_type = self._cartan_type.relabel(perm.__getitem__)
if return_map:
if inplace:
return perm
else:
return (G, perm)
else:
return G
def subtype(self, index_set):
"\n Return a subtype of ``self`` given by ``index_set``.\n\n A subtype can be considered the Dynkin diagram induced from\n the Dynkin diagram of ``self`` by ``index_set``.\n\n EXAMPLES::\n\n sage: D = DynkinDiagram(['A',6,2]); D\n O=<=O---O=<=O\n 0 1 2 3\n BC3~\n sage: D.subtype([1,2,3])\n Dynkin diagram of rank 3\n "
return self.cartan_matrix().subtype(index_set).dynkin_diagram()
def is_finite(self):
"\n Check if ``self`` corresponds to a finite root system.\n\n EXAMPLES::\n\n sage: CartanType(['F',4]).dynkin_diagram().is_finite()\n True\n sage: D = DynkinDiagram(CartanMatrix([[2, -4], [-3, 2]]))\n sage: D.is_finite()\n False\n "
if (self._cartan_type is not None):
return self._cartan_type.is_finite()
return self.cartan_matrix().is_finite()
def is_affine(self):
"\n Check if ``self`` corresponds to an affine root system.\n\n EXAMPLES::\n\n sage: CartanType(['F',4]).dynkin_diagram().is_affine()\n False\n sage: D = DynkinDiagram(CartanMatrix([[2, -4], [-3, 2]]))\n sage: D.is_affine()\n False\n "
if (self._cartan_type is not None):
return self._cartan_type.is_affine()
return self.cartan_matrix().is_affine()
def is_irreducible(self):
'\n Check if ``self`` corresponds to an irreducible root system.\n\n EXAMPLES::\n\n sage: CartanType([\'F\',4]).dynkin_diagram().is_irreducible()\n True\n sage: CM = CartanMatrix([[2,-6],[-4,2]])\n sage: CM.dynkin_diagram().is_irreducible()\n True\n sage: CartanType("A2xB3").dynkin_diagram().is_irreducible()\n False\n sage: CM = CartanMatrix([[2,-6,0],[-4,2,0],[0,0,2]])\n sage: CM.dynkin_diagram().is_irreducible()\n False\n '
if (self._cartan_type is not None):
return self._cartan_type.is_irreducible()
return (self.connected_components_number() == 1)
def is_crystallographic(self):
"\n Implements :meth:`CartanType_abstract.is_crystallographic`\n\n A Dynkin diagram always corresponds to a crystallographic root system.\n\n EXAMPLES::\n\n sage: CartanType(['F',4]).dynkin_diagram().is_crystallographic()\n True\n\n TESTS::\n\n sage: CartanType(['G',2]).dynkin_diagram().is_crystallographic()\n True\n "
return True
def symmetrizer(self):
'\n Return the symmetrizer of the corresponding Cartan matrix.\n\n EXAMPLES::\n\n sage: d = DynkinDiagram()\n sage: d.add_edge(1,2,3)\n sage: d.add_edge(2,3)\n sage: d.add_edge(3,4,3)\n sage: d.symmetrizer()\n Finite family {1: 9, 2: 3, 3: 3, 4: 1}\n\n TESTS:\n\n We check that :trac:`15740` is fixed::\n\n sage: d = DynkinDiagram()\n sage: d.add_edge(1,2,3)\n sage: d.add_edge(2,3)\n sage: d.add_edge(3,4,3)\n sage: L = d.root_system().root_lattice()\n sage: al = L.simple_roots()\n sage: al[1].associated_coroot()\n alphacheck[1]\n sage: al[1].reflection(al[2])\n alpha[1] + 3*alpha[2]\n '
return self.cartan_matrix().symmetrizer()
def odd_isotropic_roots(self):
"\n Return the odd isotropic roots of ``self``.\n\n EXAMPLES::\n\n sage: g = DynkinDiagram(['A',4])\n sage: g.odd_isotropic_roots()\n ()\n sage: g = DynkinDiagram(['A',[4,3]])\n sage: g.odd_isotropic_roots()\n (0,)\n "
return self._odd_isotropic_roots
def __getitem__(self, i):
"\n With a tuple (i,j) as argument, returns the scalar product\n `\\langle \\alpha^\\vee_i, \\alpha_j\\rangle`.\n\n Otherwise, behaves as the usual ``DiGraph.__getitem__``\n\n EXAMPLES:\n\n We use the `C_4` Dynkin diagram as a Cartan matrix::\n\n sage: g = DynkinDiagram(['C',4])\n sage: matrix([[g[i,j] for j in range(1,5)] for i in range(1,5)])\n [ 2 -1 0 0]\n [-1 2 -1 0]\n [ 0 -1 2 -2]\n [ 0 0 -1 2]\n\n The neighbors of a node can still be obtained in the usual way::\n\n sage: [g[i] for i in range(1,5)]\n [[2], [1, 3], [2, 4], [3]]\n "
if (not isinstance(i, tuple)):
return DiGraph.__getitem__(self, i)
[i, j] = i
if (i == j):
if (i in self._odd_isotropic_roots):
return 0
return 2
elif self.has_edge(j, i):
return (- self.edge_label(j, i))
else:
return 0
def column(self, j):
'\n Returns the `j^{th}` column `(a_{i,j})_i` of the\n Cartan matrix corresponding to this Dynkin diagram, as a container\n (or iterator) of tuples `(i, a_{i,j})`\n\n EXAMPLES::\n\n sage: g = DynkinDiagram(["B",4])\n sage: [ (i,a) for (i,a) in g.column(3) ]\n [(3, 2), (2, -1), (4, -2)]\n '
val = (2 if (j not in self._odd_isotropic_roots) else 0)
return ([(j, val)] + [(i, (- m)) for (j1, i, m) in self.outgoing_edges(j)])
def row(self, i):
'\n Returns the `i^{th}` row `(a_{i,j})_j` of the\n Cartan matrix corresponding to this Dynkin diagram, as a container\n (or iterator) of tuples `(j, a_{i,j})`\n\n EXAMPLES::\n\n sage: g = DynkinDiagram(["C",4])\n sage: [ (i,a) for (i,a) in g.row(3) ]\n [(3, 2), (2, -1), (4, -2)]\n '
val = (2 if (i not in self._odd_isotropic_roots) else 0)
return ([(i, val)] + [(j, (- m)) for (j, i1, m) in self.incoming_edges(i)])
@cached_method
def coxeter_diagram(self):
"\n Construct the Coxeter diagram of ``self``.\n\n .. SEEALSO:: :meth:`CartanType_abstract.coxeter_diagram`\n\n EXAMPLES::\n\n sage: cm = CartanMatrix([[2,-5,0],[-2,2,-1],[0,-1,2]])\n sage: D = cm.dynkin_diagram()\n sage: G = D.coxeter_diagram(); G\n Graph on 3 vertices\n sage: G.edges(sort=True)\n [(0, 1, +Infinity), (1, 2, 3)]\n\n sage: ct = CartanType([['A',2,2], ['B',3]])\n sage: ct.coxeter_diagram()\n Graph on 5 vertices\n sage: ct.dynkin_diagram().coxeter_diagram() == ct.coxeter_diagram()\n True\n "
from sage.rings.infinity import infinity
scalarproducts_to_order = {0: 2, 1: 3, 2: 4, 3: 6}
from sage.graphs.graph import Graph
coxeter_diagram = Graph(multiedges=False)
I = self.index_set()
coxeter_diagram.add_vertices(I)
for i in I:
for j in self.neighbors_out(i):
if (not coxeter_diagram.has_edge(i, j)):
val = scalarproducts_to_order.get((self[(i, j)] * self[(j, i)]), infinity)
coxeter_diagram.add_edge(i, j, val)
return coxeter_diagram.copy(immutable=True)
|
def precheck(t, letter=None, length=None, affine=None, n_ge=None, n=None):
"\n EXAMPLES::\n\n sage: from sage.combinat.root_system.dynkin_diagram import precheck\n sage: ct = CartanType(['A',4])\n sage: precheck(ct, letter='C')\n Traceback (most recent call last):\n ...\n ValueError: t[0] must be = 'C'\n sage: precheck(ct, affine=1)\n Traceback (most recent call last):\n ...\n ValueError: t[2] must be = 1\n sage: precheck(ct, length=3)\n Traceback (most recent call last):\n ...\n ValueError: len(t) must be = 3\n sage: precheck(ct, n=3)\n Traceback (most recent call last):\n ...\n ValueError: t[1] must be = 3\n sage: precheck(ct, n_ge=5)\n Traceback (most recent call last):\n ...\n ValueError: t[1] must be >= 5\n "
if (letter is not None):
if (t[0] != letter):
raise ValueError(("t[0] must be = '%s'" % letter))
if (length is not None):
if (len(t) != length):
raise ValueError(('len(t) must be = %s' % length))
if (affine is not None):
try:
if (t[2] != affine):
raise ValueError(('t[2] must be = %s' % affine))
except IndexError:
raise ValueError(('t[2] must be = %s' % affine))
if (n_ge is not None):
if (t[1] < n_ge):
raise ValueError(('t[1] must be >= %s' % n_ge))
if (n is not None):
if (t[1] != n):
raise ValueError(('t[1] must be = %s' % n))
|
def ExtendedAffineWeylGroup(cartan_type, general_linear=None, **print_options):
'\n The extended affine Weyl group.\n\n INPUT:\n\n - ``cartan_type`` -- An affine or finite Cartan type (a finite Cartan type is an\n abbreviation for its untwisted affinization)\n - ``general_linear`` -- (default: ``None``) If ``True`` and ``cartan_type`` indicates\n untwisted type A, returns the universal central extension\n - ``print_options`` -- Special instructions for printing elements (see below)\n\n .. RUBRIC:: Mnemonics\n\n - "P" -- subgroup of translations\n - "Pv" -- subgroup of translations in a dual form\n - "W0" -- classical Weyl group\n - "W" -- affine Weyl group\n - "F" -- fundamental group of length zero elements\n\n There are currently six realizations: "PW0", "W0P, "WF", "FW", "PvW0", and "W0Pv".\n\n "PW0" means the semidirect product of "P" with "W0" acting from the right.\n "W0P" is similar but with "W0" acting from the left.\n "WF" is the semidirect product of "W" with "F" acting from the right, etc.\n\n Recognized arguments for ``print_options`` are:\n\n - ``print_tuple`` -- ``True`` or ``False`` (default: ``False``)\n If ``True``, elements are printed `(a,b)`, otherwise as `a * b`\n - ``affine`` -- Prefix for simple reflections in the affine Weyl group\n - ``classical`` -- Prefix for simple reflections in the classical Weyl group\n - ``translation`` -- Prefix for the translation elements\n - ``fundamental`` -- Prefix for the elements of the fundamental group\n\n These options are not mutable.\n\n The *extended affine Weyl group* was introduced in the following references.\n\n REFERENCES:\n\n .. [Iwahori] Iwahori,\n *Generalized Tits system (Bruhat decomposition) on p-adic semisimple groups*.\n 1966 Algebraic Groups and Discontinuous\n Subgroups (AMS Proc. Symp. Pure Math.., 1965) pp. 71-83 Amer. Math. Soc.,\n Providence, R.I.\n\n .. [Bour] Bourbaki, *Lie Groups and Lie Algebras* IV.2\n\n - [Ka1990]_\n\n .. RUBRIC:: Notation\n\n - `R` -- An irreducible affine root system\n - `I` -- Set of nodes of the Dynkin diagram of `R`\n - `R_0` -- The classical subsystem of `R`\n - `I_0` -- Set of nodes of the Dynkin diagram of `R_0`\n - `E` -- Extended affine Weyl group of type `R`\n - `W` -- Affine Weyl group of type `R`\n - `W_0` -- finite (classical) Weyl group (of type `R_0`)\n - `M` -- translation lattice for `W`\n - `L` -- translation lattice for `E`\n - `F` -- Fundamental subgroup of `E` (the length zero elements)\n - `P` -- Finite weight lattice\n - `Q` -- Finite root lattice\n - `P^\\vee` -- Finite coweight lattice\n - `Q^\\vee` -- Finite coroot lattice\n\n .. RUBRIC:: Translation lattices\n\n The styles "PW0" and "W0P" use the following lattices:\n\n - Untwisted affine: `L = P^\\vee`, `M = Q^\\vee`\n - Dual of untwisted affine: `L = P`, `M = Q`\n - `BC_n` (`A_{2n}^{(2)}`): `L = M = P`\n - Dual of `BC_n` (`A_{2n}^{(2)\\dagger}`): `L = M = P^\\vee`\n\n The styles "PvW0" and "W0Pv" use the following lattices:\n\n - Untwisted affine: The weight lattice of the dual finite Cartan type.\n - Dual untwisted affine: The same as for "PW0" and "W0P".\n\n For mixed affine type (`A_{2n}^{(2)}`, aka `\\tilde{BC}_n`, and their affine duals)\n the styles "PvW0" and "W0Pv" are not implemented.\n\n .. RUBRIC:: Finite and affine Weyl groups `W_0` and `W`\n\n The finite Weyl group `W_0` is generated by the simple reflections `s_i` for `i \\in I_0` where\n `s_i` is the reflection across a suitable hyperplane `H_i` through the origin in the\n real span `V` of the lattice `M`.\n\n `R` specifies another (affine) hyperplane `H_0`. The affine Weyl group `W` is generated by `W_0`\n and the reflection `S_0` across `H_0`.\n\n .. RUBRIC:: Extended affine Weyl group `E`\n\n The complement in `V` of the set `H` of hyperplanes obtained from the `H_i` by the action of\n `W`, has connected components called alcoves. `W` acts freely and transitively on the set\n of alcoves. After the choice of a certain alcove (the fundamental alcove),\n there is an induced bijection from `W` to the set of alcoves under which the identity\n in `W` maps to the fundamental alcove.\n\n Then `L` is the largest sublattice of `V`, whose translations stabilize the set of alcoves.\n\n There are isomorphisms\n\n .. MATH::\n\n \\begin{aligned}\n W &\\cong M \\rtimes W_0 \\cong W_0 \\ltimes M \\\\\n E &\\cong L \\rtimes W_0 \\cong W_0 \\ltimes L\n \\end{aligned}\n\n .. RUBRIC:: Fundamental group of affine Dynkin automorphisms\n\n Since `L` acts on the set of alcoves, the group `F = L/M` may be viewed as a\n subgroup of the symmetries of the fundamental alcove or equivalently the\n symmetries of the affine Dynkin diagram.\n `F` acts on the set of alcoves and hence on `W`. Conjugation by an element of `F`\n acts on `W` by permuting the indices of simple reflections.\n\n There are isomorphisms\n\n .. MATH::\n\n E \\cong F \\ltimes W \\cong W \\rtimes F\n\n An affine Dynkin node is *special* if it is conjugate to the zero node under some\n affine Dynkin automorphism.\n\n There is a bijection `i` `\\mapsto` `\\pi_i` from the set of special nodes\n to the group `F`, where `\\pi_i` is the unique element of `F` that sends `0` to `i`.\n When `L=P` (resp. `L=P^\\vee`) the element `\\pi_i` is induced\n (under the isomorphism `F \\cong L/M`) by addition of the coset of the\n `i`-th fundamental weight (resp. coweight).\n\n The length function of the Coxeter group `W` may be extended to `E` by\n `\\ell(w \\pi) = \\ell(w)` where `w \\in W` and `\\pi\\in F`.\n This is the number of hyperplanes in `H` separating the\n fundamental alcove from its image by `w \\pi` (or equivalently `w`).\n\n It is known that if `G` is the compact Lie group of adjoint type with root\n system `R_0` then `F` is isomorphic to the fundamental group of `G`, or\n to the center of its simply-connected covering group. That is why we\n call `F` the *fundamental group*.\n\n In the future we may want to build an element of the group from an appropriate linear map f\n on some of the root lattice realizations for this Cartan type: W.from_endomorphism(f).\n\n EXAMPLES::\n\n sage: E = ExtendedAffineWeylGroup(["A",2,1]); E\n Extended affine Weyl group of type [\'A\', 2, 1]\n sage: type(E)\n <class \'sage.combinat.root_system.extended_affine_weyl_group.ExtendedAffineWeylGroup_Class_with_category\'>\n\n sage: PW0 = E.PW0(); PW0\n Extended affine Weyl group of type [\'A\', 2, 1] realized by Semidirect product of\n Multiplicative form of Coweight lattice of the Root system of type [\'A\', 2]\n acted upon by Weyl Group of type [\'A\', 2]\n (as a matrix group acting on the coweight lattice)\n\n sage: W0P = E.W0P(); W0P\n Extended affine Weyl group of type [\'A\', 2, 1] realized by Semidirect product of\n Weyl Group of type [\'A\', 2] (as a matrix group acting on the coweight lattice)\n acting on Multiplicative form of Coweight lattice of the Root system of type [\'A\', 2]\n\n sage: PvW0 = E.PvW0(); PvW0\n Extended affine Weyl group of type [\'A\', 2, 1] realized by Semidirect product of\n Multiplicative form of Weight lattice of the Root system of type [\'A\', 2]\n acted upon by Weyl Group of type [\'A\', 2]\n (as a matrix group acting on the weight lattice)\n\n sage: W0Pv = E.W0Pv(); W0Pv\n Extended affine Weyl group of type [\'A\', 2, 1] realized by Semidirect product of\n Weyl Group of type [\'A\', 2] (as a matrix group acting on the weight lattice)\n acting on Multiplicative form of Weight lattice of the Root system of type [\'A\', 2]\n\n sage: WF = E.WF(); WF\n Extended affine Weyl group of type [\'A\', 2, 1] realized by Semidirect product of\n Weyl Group of type [\'A\', 2, 1] (as a matrix group acting on the root lattice)\n acted upon by Fundamental group of type [\'A\', 2, 1]\n\n sage: FW = E.FW(); FW\n Extended affine Weyl group of type [\'A\', 2, 1] realized by Semidirect product of\n Fundamental group of type [\'A\', 2, 1] acting on Weyl Group of type [\'A\', 2, 1]\n (as a matrix group acting on the root lattice)\n\n When the realizations are constructed from each other as above, there are built-in coercions between them. ::\n\n sage: F = E.fundamental_group()\n sage: x = WF.from_reduced_word([0,1,2]) * WF(F(2)); x\n S0*S1*S2 * pi[2]\n sage: FW(x)\n pi[2] * S1*S2*S0\n sage: W0P(x)\n s1*s2*s1 * t[-2*Lambdacheck[1] - Lambdacheck[2]]\n sage: PW0(x)\n t[Lambdacheck[1] + 2*Lambdacheck[2]] * s1*s2*s1\n sage: PvW0(x)\n t[Lambda[1] + 2*Lambda[2]] * s1*s2*s1\n\n The translation lattice and its distinguished basis are obtained from ``E``::\n\n sage: L = E.lattice(); L\n Coweight lattice of the Root system of type [\'A\', 2]\n sage: b = E.lattice_basis(); b\n Finite family {1: Lambdacheck[1], 2: Lambdacheck[2]}\n\n Translation lattice elements can be coerced into any realization::\n\n sage: PW0(b[1]-b[2])\n t[Lambdacheck[1] - Lambdacheck[2]]\n sage: FW(b[1]-b[2])\n pi[2] * S0*S1\n\n The dual form of the translation lattice and its basis are similarly obtained::\n\n sage: Lv = E.dual_lattice(); Lv\n Weight lattice of the Root system of type [\'A\', 2]\n sage: bv = E.dual_lattice_basis(); bv\n Finite family {1: Lambda[1], 2: Lambda[2]}\n sage: FW(bv[1]-bv[2])\n pi[2] * S0*S1\n\n The abstract fundamental group is accessed from ``E``::\n\n sage: F = E.fundamental_group(); F\n Fundamental group of type [\'A\', 2, 1]\n\n Its elements are indexed by the set of special nodes of the affine Dynkin diagram::\n\n sage: E.cartan_type().special_nodes()\n (0, 1, 2)\n sage: F.special_nodes()\n (0, 1, 2)\n sage: [F(i) for i in F.special_nodes()]\n [pi[0], pi[1], pi[2]]\n\n There is a coercion from the fundamental group into each realization::\n\n sage: F(2)\n pi[2]\n sage: WF(F(2))\n pi[2]\n sage: W0P(F(2))\n s2*s1 * t[-Lambdacheck[1]]\n sage: W0Pv(F(2))\n s2*s1 * t[-Lambda[1]]\n\n Using ``E`` one may access the classical and affine Weyl groups and their morphisms\n into each realization::\n\n sage: W0 = E.classical_weyl(); W0\n Weyl Group of type [\'A\', 2] (as a matrix group acting on the coweight lattice)\n sage: v = W0.from_reduced_word([1,2,1]); v\n s1*s2*s1\n sage: PW0(v)\n s1*s2*s1\n sage: WF(v)\n S1*S2*S1\n sage: W = E.affine_weyl(); W\n Weyl Group of type [\'A\', 2, 1] (as a matrix group acting on the root lattice)\n sage: w = W.from_reduced_word([2,1,0]); w\n S2*S1*S0\n sage: WF(w)\n S2*S1*S0\n sage: PW0(w)\n t[Lambdacheck[1] - 2*Lambdacheck[2]] * s1\n\n Note that for untwisted affine type, the dual form of the classical\n Weyl group is isomorphic to the usual one, but acts on a different\n lattice and is therefore different to sage::\n\n sage: W0v = E.dual_classical_weyl(); W0v\n Weyl Group of type [\'A\', 2] (as a matrix group acting on the weight lattice)\n sage: v = W0v.from_reduced_word([1,2])\n sage: x = PvW0(v); x\n s1*s2\n sage: y = PW0(v); y\n s1*s2\n sage: x.parent() == y.parent()\n False\n\n However, because there is a coercion from ``PvW0`` to ``PW0``,\n the elements ``x`` and ``y`` compare as equal::\n\n sage: x == y\n True\n\n An element can be created directly from a reduced word::\n\n sage: PW0.from_reduced_word([2,1,0])\n t[Lambdacheck[1] - 2*Lambdacheck[2]] * s1\n\n Here is a demonstration of the printing options::\n\n sage: E = ExtendedAffineWeylGroup(["A",2,1], affine="sx", classical="Sx",\n ....: translation="x", fundamental="pix")\n sage: PW0 = E.PW0()\n sage: y = PW0(E.lattice_basis()[1]); y\n x[Lambdacheck[1]]\n sage: FW = E.FW()\n sage: FW(y)\n pix[1] * sx2*sx1\n sage: PW0.an_element()\n x[2*Lambdacheck[1] + 2*Lambdacheck[2]] * Sx1*Sx2\n\n .. TODO::\n\n - Implement a "slow" action of `E` on any affine root or weight lattice realization.\n - Implement the level `m` actions of `E` and `W` on the lattices of finite type.\n - Implement the relevant methods from the usual affine Weyl group\n - Implementation by matrices: style "M".\n - Use case: implement the Hecke algebra on top of this\n\n The semidirect product construction in sage currently only\n admits multiplicative groups. Therefore for the styles involving "P" and "Pv", one must\n convert the additive group of translations `L` into a multiplicative group by\n applying the :class:`sage.groups.group_exp.GroupExp` functor.\n\n .. RUBRIC:: The general linear case\n\n The general linear group is not semisimple. Sage can build its extended\n affine Weyl group::\n\n sage: E = ExtendedAffineWeylGroup([\'A\',2,1], general_linear=True); E\n Extended affine Weyl group of GL(3)\n\n If the Cartan type is ``[\'A\', n-1, 1]`` and the parameter ``general_linear`` is not\n True, the extended affine Weyl group that is built will be for `SL_n`, not\n `GL_n`. But if ``general_linear`` is True, let `W_a` and `W_e` be the affine and\n extended affine Weyl groups. We make the following nonstandard definition: the\n extended affine Weyl group `W_e(GL_n)` is defined by\n\n .. MATH::\n\n W_e(GL_n) = P(GL_n) \\rtimes W\n\n where `W` is the finite Weyl group (the symmetric group `S_n`) and `P(GL_n)` is the weight lattice\n of `GL_n`, which is usually identified with the lattice `\\ZZ^n` of `n`-tuples of integers::\n\n sage: PW0 = E.PW0(); PW0\n Extended affine Weyl group of GL(3) realized by Semidirect product of\n Multiplicative form of Ambient space of the Root system of type [\'A\', 2] acted upon\n by Weyl Group of type [\'A\', 2] (as a matrix group acting on the ambient space)\n sage: PW0.an_element()\n t[(2, 2, 3)] * s1*s2\n\n There is an isomorphism\n\n .. MATH::\n\n W_e(GL_n) = \\ZZ \\ltimes W_a\n\n where the group of integers `\\ZZ` (with generator `\\pi`) acts on `W_a` by\n\n .. MATH::\n\n \\pi\\, s_i\\, \\pi^{-1} = s_{i+1}\n\n and the indices of the simple reflections are taken modulo `n`::\n\n sage: FW = E.FW(); FW\n Extended affine Weyl group of GL(3) realized by\n Semidirect product of Fundamental group of GL(3) acting on\n Weyl Group of type [\'A\', 2, 1] (as a matrix group acting on the root lattice)\n sage: FW.an_element()\n pi[5] * S0*S1*S2\n\n We regard `\\ZZ` as the fundamental group of affine type `GL_n`::\n\n sage: F = E.fundamental_group(); F\n Fundamental group of GL(3)\n sage: F.special_nodes()\n Integer Ring\n\n sage: x = FW.from_fundamental(F(10)); x\n pi[10]\n sage: x*x\n pi[20]\n sage: E.PvW0()(x*x)\n t[(7, 7, 6)] * s2*s1\n '
cartan_type = CartanType(cartan_type)
if cartan_type.is_reducible():
raise ValueError('Extended affine Weyl groups are only implemented for irreducible affine Cartan types')
if cartan_type.is_finite():
cartan_type = cartan_type.affine()
elif (not cartan_type.is_affine()):
raise ValueError('Cartan type must be finite or affine')
return ExtendedAffineWeylGroup_Class(cartan_type, general_linear, **print_options)
|
class ExtendedAffineWeylGroup_Class(UniqueRepresentation, Parent):
'\n The parent-with-realization class of an extended affine Weyl group.\n '
def __init__(self, cartan_type, general_linear, **print_options):
'\n\n EXAMPLES::\n\n sage: E = ExtendedAffineWeylGroup(["D",3,2])\n sage: E in Groups().Infinite()\n True\n sage: TestSuite(E).run()\n '
if (not cartan_type.is_affine()):
raise ValueError(('%s is not affine' % cartan_type))
self._cartan_type = cartan_type
self._prefixt = 't'
self._prefixf = 'pi'
self._prefixcl = None
self._prefixaf = None
self._print_tuple = False
if (general_linear is True):
self._general_linear = True
self._n = (self._cartan_type.n + 1)
else:
self._general_linear = False
for option in print_options:
if (option == 'translation'):
self._prefixt = print_options['translation']
elif (option == 'fundamental'):
self._prefixf = print_options['fundamental']
elif (option == 'print_tuple'):
self._print_tuple = print_options['print_tuple']
elif (option == 'affine'):
self._prefixaf = print_options['affine']
elif (option == 'classical'):
self._prefixcl = print_options['classical']
else:
raise ValueError(('Print option %s is unrecognized' % option))
if self._prefixaf:
if (not self._prefixcl):
if self._prefixaf.islower():
self._prefixcl = self._prefixaf.upper()
else:
self._prefixcl = self._prefixaf.lower()
elif self._prefixcl:
if self._prefixcl.islower():
self._prefixaf = self._prefixcl.upper()
else:
self._prefixaf = self._prefixcl.lower()
else:
self._prefixaf = 'S'
self._prefixcl = 's'
self._ct0 = cartan_type.classical()
self._R0 = self._ct0.root_system()
self._I0 = self._ct0.index_set()
self._ct0v = self._ct0.dual()
self._R0v = self._ct0v.root_system()
self._a0check = self._cartan_type.acheck()[self._cartan_type.special_node()]
if self._cartan_type.is_untwisted_affine():
self._type = 'untwisted'
elif self._cartan_type.dual().is_untwisted_affine():
self._type = 'dual_untwisted'
elif (self._a0check == 1):
self._type = 'special_extra_short'
else:
self._type = 'special_extra_long'
self._untwisted = (self._type in ('untwisted', 'special_extra_long'))
self._fundamental_group = FundamentalGroupOfExtendedAffineWeylGroup(cartan_type, prefix=self._prefixf, general_linear=self._general_linear)
if self._untwisted:
if self._general_linear:
self._lattice = self._R0.ambient_space()
self._simpleR0 = self._lattice.simple_roots()
else:
self._lattice = self._R0.coweight_lattice()
self._basis_name = 'Lambdacheck'
self._simpleR0 = self._R0.root_lattice().simple_roots()
self._basis = self._lattice.fundamental_weights()
if (self._type == 'special_extra_long'):
self._special_root = self._R0.coroot_lattice().highest_root()
node_adjacent_to_special = self._cartan_type.dynkin_diagram().neighbors(self._cartan_type.special_node())[0]
self._special_translation = self._lattice.fundamental_weight(node_adjacent_to_special)
else:
self._special_root = self._R0.root_lattice().highest_root().associated_coroot()
self._special_translation = self._special_root
self._special_translation_covector = self._special_root.associated_coroot()
if self._general_linear:
self._dual_lattice = self._lattice
else:
self._dual_lattice = self._R0v.weight_lattice()
self._dual_basis_name = 'Lambda'
self._dual_basis = self._dual_lattice.fundamental_weights()
else:
self._lattice = self._R0.weight_lattice()
self._basis = self._lattice.fundamental_weights()
self._basis_name = 'Lambda'
self._simpleR0 = self._R0.coroot_lattice().simple_roots()
if (self._type == 'special_extra_short'):
self._special_root = self._R0.root_lattice().highest_root()
node_adjacent_to_special = self._cartan_type.dynkin_diagram().neighbors(self._cartan_type.special_node())[0]
self._special_translation = self._lattice.fundamental_weight(node_adjacent_to_special)
self._special_translation_covector = (2 * self._special_root.associated_coroot())
else:
self._special_root = self._R0.coroot_lattice().highest_root().associated_coroot()
self._special_translation = self._special_root
self._special_translation_covector = self._special_root.associated_coroot()
self._dual_lattice = self._lattice
self._dual_basis = self._basis
self._dual_basis_name = 'Lambda'
self._W0 = WeylGroup(self._lattice, prefix=self._prefixcl)
self._W = WeylGroup(self._cartan_type.root_system().root_lattice(), prefix=self._prefixaf)
self._special_reflection = self._W0.from_reduced_word(self._special_root.associated_reflection())
if self._general_linear:
self._special_root = self._special_root.to_ambient()
self._special_translation = self._special_root
self._special_translation_covector = self._special_root
self._W0v = WeylGroup(self._dual_lattice, prefix=self._prefixcl)
self._exp_lattice = GroupExp()(self._lattice)
self._exp_dual_lattice = GroupExp()(self._dual_lattice)
self._extended = True
Parent.__init__(self, category=Groups().WithRealizations().Infinite())
PW0 = self.PW0()
W0P = self.W0P()
WF = self.WF()
FW = self.FW()
PvW0 = self.PvW0()
W0Pv = self.W0Pv()
W0P_to_PW0 = SetMorphism(Hom(W0P, PW0, Groups()), (lambda x: PW0(x.to_opposite())))
W0P_to_PW0.register_as_coercion()
PW0_to_W0P = SetMorphism(Hom(PW0, W0P, Groups()), (lambda x: W0P(x.to_opposite())))
PW0_to_W0P.register_as_coercion()
FW_to_WF = SetMorphism(Hom(FW, WF, Groups()), (lambda x: WF(x.to_opposite())))
FW_to_WF.register_as_coercion()
WF_to_FW = SetMorphism(Hom(WF, FW, Groups()), (lambda x: FW(x.to_opposite())))
WF_to_FW.register_as_coercion()
PW0_to_WF = SetMorphism(Hom(PW0, WF, Groups()), self.PW0_to_WF_func)
PW0_to_WF.register_as_coercion()
WF_to_PW0 = SetMorphism(Hom(WF, PW0, Groups()), self.WF_to_PW0_func)
WF_to_PW0.register_as_coercion()
PvW0_to_W0Pv = SetMorphism(Hom(PvW0, W0Pv, Groups()), (lambda x: W0Pv(x.to_opposite())))
PvW0_to_W0Pv.register_as_coercion()
W0Pv_to_PvW0 = SetMorphism(Hom(W0Pv, PvW0, Groups()), (lambda x: PvW0(x.to_opposite())))
W0Pv_to_PvW0.register_as_coercion()
if self._general_linear:
PW0_to_PvW0 = SetMorphism(Hom(PW0, PvW0, Groups()), (lambda x: PvW0((x.cartesian_projection(0), x.cartesian_projection(1)))))
PvW0_to_PW0 = SetMorphism(Hom(PvW0, PW0, Groups()), (lambda x: PW0((x.cartesian_projection(0), x.cartesian_projection(1)))))
W0P_to_W0Pv = SetMorphism(Hom(W0P, W0Pv, Groups()), (lambda x: W0Pv((x.cartesian_projection(0), x.cartesian_projection(1)))))
W0Pv_to_W0P = SetMorphism(Hom(W0Pv, W0P, Groups()), (lambda x: W0P((x.cartesian_projection(0), x.cartesian_projection(1)))))
elif self._untwisted:
PW0_to_PvW0 = SetMorphism(Hom(PW0, PvW0, Groups()), (lambda x: PvW0((self.exp_dual_lattice()(x.cartesian_projection(0).value.to_dual_type_cospace()), self.dual_classical_weyl().from_reduced_word(x.cartesian_projection(1).reduced_word())))))
PvW0_to_PW0 = SetMorphism(Hom(PvW0, PW0, Groups()), (lambda x: PW0((self.exp_lattice()(x.cartesian_projection(0).value.to_dual_type_cospace()), self.classical_weyl().from_reduced_word(x.cartesian_projection(1).reduced_word())))))
W0P_to_W0Pv = SetMorphism(Hom(W0P, W0Pv, Groups()), (lambda x: W0Pv((self.dual_classical_weyl().from_reduced_word(x.cartesian_projection(0).reduced_word()), self.exp_dual_lattice()(x.cartesian_projection(1).value.to_dual_type_cospace())))))
W0Pv_to_W0P = SetMorphism(Hom(W0Pv, W0P, Groups()), (lambda x: W0P((self.classical_weyl().from_reduced_word(x.cartesian_projection(0).reduced_word()), self.exp_lattice()(x.cartesian_projection(1).value.to_dual_type_cospace())))))
else:
PW0_to_PvW0 = SetMorphism(Hom(PW0, PvW0, Groups()), (lambda x: PvW0((x.cartesian_projection(0), self.dual_classical_weyl().from_reduced_word(x.cartesian_projection(1).reduced_word())))))
PvW0_to_PW0 = SetMorphism(Hom(PvW0, PW0, Groups()), (lambda x: PW0((x.cartesian_projection(0), self.classical_weyl().from_reduced_word(x.cartesian_projection(1).reduced_word())))))
W0P_to_W0Pv = SetMorphism(Hom(W0P, W0Pv, Groups()), (lambda x: W0Pv((self.dual_classical_weyl().from_reduced_word(x.cartesian_projection(0).reduced_word()), x.cartesian_projection(1)))))
W0Pv_to_W0P = SetMorphism(Hom(W0Pv, W0P, Groups()), (lambda x: W0P((self.classical_weyl().from_reduced_word(x.cartesian_projection(0).reduced_word()), x.cartesian_projection(1)))))
PW0_to_PvW0.register_as_coercion()
PvW0_to_PW0.register_as_coercion()
W0P_to_W0Pv.register_as_coercion()
W0Pv_to_W0P.register_as_coercion()
P_to_PW0 = SetMorphism(Hom(self.lattice(), PW0, Sets()), PW0.from_translation)
P_to_PW0.register_as_coercion()
P_to_W0P = SetMorphism(Hom(self.lattice(), W0P, Sets()), W0P.from_translation)
P_to_W0P.register_as_coercion()
Pv_to_PvW0 = SetMorphism(Hom(self.dual_lattice(), PvW0, Sets()), PvW0.from_dual_translation)
Pv_to_PvW0.register_as_coercion()
Pv_to_W0Pv = SetMorphism(Hom(self.dual_lattice(), W0Pv, Sets()), W0Pv.from_dual_translation)
Pv_to_W0Pv.register_as_coercion()
W0_to_PW0 = SetMorphism(Hom(self.classical_weyl(), PW0, Groups()), PW0.from_classical_weyl)
W0_to_PW0.register_as_coercion()
W0_to_W0P = SetMorphism(Hom(self.classical_weyl(), W0P, Groups()), W0P.from_classical_weyl)
W0_to_W0P.register_as_coercion()
W0v_to_PvW0 = SetMorphism(Hom(self.dual_classical_weyl(), PvW0, Groups()), PvW0.from_dual_classical_weyl)
W0v_to_PvW0.register_as_coercion()
W0v_to_W0Pv = SetMorphism(Hom(self.dual_classical_weyl(), W0Pv, Groups()), W0Pv.from_dual_classical_weyl)
W0v_to_W0Pv.register_as_coercion()
F_to_WF = SetMorphism(Hom(self.fundamental_group(), WF, Groups()), WF.from_fundamental)
F_to_WF.register_as_coercion()
F_to_FW = SetMorphism(Hom(self.fundamental_group(), FW, Groups()), FW.from_fundamental)
F_to_FW.register_as_coercion()
W_to_WF = SetMorphism(Hom(self.affine_weyl(), WF, Groups()), WF.from_affine_weyl)
W_to_WF.register_as_coercion()
W_to_FW = SetMorphism(Hom(self.affine_weyl(), FW, Groups()), FW.from_affine_weyl)
W_to_FW.register_as_coercion()
def PW0(self):
'\n Realizes ``self`` in "PW0"-style.\n\n EXAMPLES::\n\n sage: ExtendedAffineWeylGroup([\'A\',2,1]).PW0()\n Extended affine Weyl group of type [\'A\', 2, 1] realized by\n Semidirect product of Multiplicative form of\n Coweight lattice of the Root system of type [\'A\', 2] acted upon by\n Weyl Group of type [\'A\', 2] (as a matrix group acting on the coweight lattice)\n '
return self.ExtendedAffineWeylGroupPW0()
def W0P(self):
'\n Realizes ``self`` in "W0P"-style.\n\n EXAMPLES::\n\n sage: ExtendedAffineWeylGroup([\'A\',2,1]).W0P()\n Extended affine Weyl group of type [\'A\', 2, 1] realized by Semidirect product of\n Weyl Group of type [\'A\', 2] (as a matrix group acting on the coweight lattice)\n acting on Multiplicative form of Coweight lattice of the Root system of type [\'A\', 2]\n '
return self.ExtendedAffineWeylGroupW0P()
def WF(self):
'\n Realizes ``self`` in "WF"-style.\n\n EXAMPLES::\n\n sage: ExtendedAffineWeylGroup([\'A\',2,1]).WF()\n Extended affine Weyl group of type [\'A\', 2, 1] realized by Semidirect product of\n Weyl Group of type [\'A\', 2, 1] (as a matrix group acting on the root lattice)\n acted upon by Fundamental group of type [\'A\', 2, 1]\n '
return self.ExtendedAffineWeylGroupWF()
def FW(self):
'\n Realizes ``self`` in "FW"-style.\n\n EXAMPLES::\n\n sage: ExtendedAffineWeylGroup([\'A\',2,1]).FW()\n Extended affine Weyl group of type [\'A\', 2, 1] realized by Semidirect product of\n Fundamental group of type [\'A\', 2, 1] acting on\n Weyl Group of type [\'A\', 2, 1] (as a matrix group acting on the root lattice)\n '
return self.ExtendedAffineWeylGroupFW()
def PvW0(self):
'\n Realizes ``self`` in "PvW0"-style.\n\n EXAMPLES::\n\n sage: ExtendedAffineWeylGroup([\'A\',2,1]).PvW0()\n Extended affine Weyl group of type [\'A\', 2, 1] realized by Semidirect product of\n Multiplicative form of Weight lattice of the Root system of type [\'A\', 2]\n acted upon by Weyl Group of type [\'A\', 2] (as a matrix group acting on the weight lattice)\n '
return self.ExtendedAffineWeylGroupPvW0()
def W0Pv(self):
'\n Realizes ``self`` in "W0Pv"-style.\n\n EXAMPLES::\n\n sage: ExtendedAffineWeylGroup([\'A\',2,1]).W0Pv()\n Extended affine Weyl group of type [\'A\', 2, 1] realized by Semidirect product of\n Weyl Group of type [\'A\', 2] (as a matrix group acting on the weight lattice)\n acting on Multiplicative form of Weight lattice of the Root system of type [\'A\', 2]\n '
return self.ExtendedAffineWeylGroupW0Pv()
def cartan_type(self):
'\n The Cartan type of ``self``.\n\n EXAMPLES::\n\n sage: ExtendedAffineWeylGroup(["D",3,2]).cartan_type()\n [\'C\', 2, 1]^*\n '
return self._cartan_type
def _repr_(self):
"\n A string representing ``self``.\n\n EXAMPLES::\n\n sage: ExtendedAffineWeylGroup(['A',2,1])\n Extended affine Weyl group of type ['A', 2, 1]\n "
if self._general_linear:
return ('Extended affine Weyl group of GL(%s)' % self._n)
return ('Extended affine Weyl group of type %s' % self.cartan_type())
def fundamental_group(self):
"\n Return the abstract fundamental group.\n\n EXAMPLES::\n\n sage: F = ExtendedAffineWeylGroup(['D',5,1]).fundamental_group(); F\n Fundamental group of type ['D', 5, 1]\n sage: [a for a in F]\n [pi[0], pi[1], pi[4], pi[5]]\n "
return self._fundamental_group
def lattice(self):
"\n Return the translation lattice for ``self``.\n\n EXAMPLES::\n\n sage: ExtendedAffineWeylGroup(['A',2,1]).lattice()\n Coweight lattice of the Root system of type ['A', 2]\n sage: ExtendedAffineWeylGroup(['A',5,2]).lattice()\n Weight lattice of the Root system of type ['C', 3]\n sage: ExtendedAffineWeylGroup(['A',4,2]).lattice()\n Weight lattice of the Root system of type ['C', 2]\n sage: ExtendedAffineWeylGroup(CartanType(['A',4,2]).dual()).lattice()\n Coweight lattice of the Root system of type ['B', 2]\n sage: ExtendedAffineWeylGroup(CartanType(['A',2,1]),\n ....: general_linear=True).lattice()\n Ambient space of the Root system of type ['A', 2]\n "
return self._lattice
def exp_lattice(self):
"\n Return the multiplicative version of the translation lattice for ``self``.\n\n EXAMPLES::\n\n sage: ExtendedAffineWeylGroup(['A',2,1]).exp_lattice()\n Multiplicative form of Coweight lattice of the Root system of type ['A', 2]\n "
return self._exp_lattice
def lattice_basis(self):
"\n Return the distinguished basis of the translation lattice for ``self``.\n\n EXAMPLES::\n\n sage: ExtendedAffineWeylGroup(['A',2,1]).lattice_basis()\n Finite family {1: Lambdacheck[1], 2: Lambdacheck[2]}\n sage: ExtendedAffineWeylGroup(['A',5,2]).lattice_basis()\n Finite family {1: Lambda[1], 2: Lambda[2], 3: Lambda[3]}\n sage: ExtendedAffineWeylGroup(['A',4,2]).lattice_basis()\n Finite family {1: Lambda[1], 2: Lambda[2]}\n sage: ExtendedAffineWeylGroup(CartanType(['A',4,2]).dual()).lattice_basis()\n Finite family {1: Lambdacheck[1], 2: Lambdacheck[2]}\n "
return self._basis
def dual_lattice(self):
"\n Return the dual version of the translation lattice for ``self``.\n\n EXAMPLES::\n\n sage: ExtendedAffineWeylGroup(['A',2,1]).dual_lattice()\n Weight lattice of the Root system of type ['A', 2]\n sage: ExtendedAffineWeylGroup(['A',5,2]).dual_lattice()\n Weight lattice of the Root system of type ['C', 3]\n "
return self._dual_lattice
def exp_dual_lattice(self):
"\n Return the multiplicative version of the dual version of the translation lattice for ``self``.\n\n EXAMPLES::\n\n sage: ExtendedAffineWeylGroup(['A',2,1]).exp_dual_lattice()\n Multiplicative form of Weight lattice of the Root system of type ['A', 2]\n "
return self._exp_dual_lattice
def dual_lattice_basis(self):
"\n Return the distinguished basis of the dual version of the translation lattice for ``self``.\n\n EXAMPLES::\n\n sage: ExtendedAffineWeylGroup(['A',2,1]).dual_lattice_basis()\n Finite family {1: Lambda[1], 2: Lambda[2]}\n sage: ExtendedAffineWeylGroup(['A',5,2]).dual_lattice_basis()\n Finite family {1: Lambda[1], 2: Lambda[2], 3: Lambda[3]}\n "
return self._dual_basis
def classical_weyl(self):
"\n Return the classical Weyl group of ``self``.\n\n EXAMPLES::\n\n sage: ExtendedAffineWeylGroup(['A',2,1]).classical_weyl()\n Weyl Group of type ['A', 2] (as a matrix group acting on the coweight lattice)\n sage: ExtendedAffineWeylGroup(['A',5,2]).classical_weyl()\n Weyl Group of type ['C', 3] (as a matrix group acting on the weight lattice)\n sage: ExtendedAffineWeylGroup(['A',4,2]).classical_weyl()\n Weyl Group of type ['C', 2] (as a matrix group acting on the weight lattice)\n sage: ExtendedAffineWeylGroup(CartanType(['A',4,2]).dual()).classical_weyl()\n Weyl Group of type ['C', 2] (as a matrix group acting on the coweight lattice)\n "
return self._W0
def dual_classical_weyl(self):
"\n Return the dual version of the classical Weyl group of ``self``.\n\n EXAMPLES::\n\n sage: ExtendedAffineWeylGroup(['A',2,1]).dual_classical_weyl()\n Weyl Group of type ['A', 2] (as a matrix group acting on the weight lattice)\n sage: ExtendedAffineWeylGroup(['A',5,2]).dual_classical_weyl()\n Weyl Group of type ['C', 3] (as a matrix group acting on the weight lattice)\n "
return self._W0v
def affine_weyl(self):
"\n Return the affine Weyl group of ``self``.\n\n EXAMPLES::\n\n sage: ExtendedAffineWeylGroup(['A',2,1]).affine_weyl()\n Weyl Group of type ['A', 2, 1] (as a matrix group acting on the root lattice)\n sage: ExtendedAffineWeylGroup(['A',5,2]).affine_weyl()\n Weyl Group of type ['B', 3, 1]^* (as a matrix group acting on the root lattice)\n sage: ExtendedAffineWeylGroup(['A',4,2]).affine_weyl()\n Weyl Group of type ['BC', 2, 2] (as a matrix group acting on the root lattice)\n sage: ExtendedAffineWeylGroup(CartanType(['A',4,2]).dual()).affine_weyl()\n Weyl Group of type ['BC', 2, 2]^* (as a matrix group acting on the root lattice)\n "
return self._W
def classical_weyl_to_affine(self, w):
"\n The image of `w` under the homomorphism from the classical Weyl group into the affine Weyl group.\n\n EXAMPLES::\n\n sage: E = ExtendedAffineWeylGroup(['A',2,1])\n sage: W0 = E.classical_weyl()\n sage: w = W0.from_reduced_word([1,2]); w\n s1*s2\n sage: v = E.classical_weyl_to_affine(w); v\n S1*S2\n "
return self.affine_weyl().from_reduced_word(w.reduced_word())
def dual_classical_weyl_to_affine(self, w):
"\n The image of `w` under the homomorphism from the dual version of the classical\n Weyl group into the affine Weyl group.\n\n EXAMPLES::\n\n sage: E = ExtendedAffineWeylGroup(['A',2,1])\n sage: W0v = E.dual_classical_weyl()\n sage: w = W0v.from_reduced_word([1,2]); w\n s1*s2\n sage: v = E.dual_classical_weyl_to_affine(w); v\n S1*S2\n "
return self.affine_weyl().from_reduced_word(w.reduced_word())
def a_realization(self):
"\n Return the default realization of an extended affine Weyl group.\n\n EXAMPLES::\n\n sage: ExtendedAffineWeylGroup(['A',2,1]).a_realization()\n Extended affine Weyl group of type ['A', 2, 1] realized by Semidirect product of\n Multiplicative form of Coweight lattice of the Root system of type ['A', 2]\n acted upon by Weyl Group of type ['A', 2] (as a matrix group acting on the coweight lattice)\n "
return self.PW0()
def group_generators(self):
"\n Return a set of generators for the default realization of ``self``.\n\n EXAMPLES::\n\n sage: ExtendedAffineWeylGroup(['A',2,1]).group_generators()\n (t[Lambdacheck[1]], t[Lambdacheck[2]], s1, s2)\n "
return self.a_realization().group_generators()
@cached_method
def PW0_to_WF_func(self, x):
'\n Implements coercion from style "PW0" to "WF".\n\n EXAMPLES::\n\n sage: E = ExtendedAffineWeylGroup(["A", 2, 1])\n sage: x = E.PW0().an_element(); x\n t[2*Lambdacheck[1] + 2*Lambdacheck[2]] * s1*s2\n sage: E.PW0_to_WF_func(x)\n S0*S1*S2*S0*S1*S0\n\n .. WARNING::\n\n This function cannot use coercion, because it is used to define the coercion maps.\n '
i = x.first_descent(side='left')
if (i is None):
t = x.to_translation_left()
if self._general_linear:
ispecial = ZZ.sum([t[j] for j in t.support()])
elif (t == self.lattice().zero()):
ispecial = 0
else:
supp = t.support()
assert (len(supp) == 1)
ispecial = supp[0]
return self.WF().from_fundamental(self.fundamental_group()(ispecial))
return self.PW0_to_WF_func(x.apply_simple_reflection(i, side='left')).apply_simple_reflection(i, side='left')
@cached_method
def WF_to_PW0_func(self, x):
'\n Coercion from style "WF" to "PW0".\n\n EXAMPLES::\n\n sage: E = ExtendedAffineWeylGroup(["A", 2, 1])\n sage: x = E.WF().an_element(); x\n S0*S1*S2 * pi[2]\n sage: E.WF_to_PW0_func(x)\n t[Lambdacheck[1] + 2*Lambdacheck[2]] * s1*s2*s1\n\n .. WARNING::\n\n Since this is used to define some coercion maps it cannot itself use coercion.\n '
w = x.to_affine_weyl_left()
f = x.to_fundamental_group()
i = w.first_descent(side='left')
if (i is not None):
return self.WF_to_PW0_func(x.apply_simple_reflection(i, side='left')).apply_simple_reflection(i, side='left')
PW0 = self.PW0()
ispecial = f.value()
W = self.classical_weyl()
if self._general_linear:
r = ZZ(Mod(ispecial, self._n))
weight = self.lattice().from_vector(vector(([ZZ(((ispecial - r) / self._n))] * self._n)))
if (r != ZZ(0)):
weight = (weight + self.lattice_basis()[r])
wo = W.from_reduced_word(self.fundamental_group().reduced_word(r))
else:
wo = W.one()
elif (ispecial == 0):
weight = self.lattice().zero()
wo = W.one()
else:
weight = self.lattice_basis()[ispecial]
wo = W.from_reduced_word(self.fundamental_group().reduced_word(ispecial))
return PW0((weight, wo))
class Realizations(Category_realization_of_parent):
'\n The category of the realizations of an extended affine Weyl group\n '
def super_categories(self):
"\n EXAMPLES::\n\n sage: R = ExtendedAffineWeylGroup(['A',2,1]).Realizations(); R\n Category of realizations of Extended affine Weyl group of type ['A', 2, 1]\n sage: R.super_categories()\n [Category of associative inverse realizations of unital magmas]\n "
return [Groups().Realizations()]
class ParentMethods():
@cached_method
def from_fundamental(self, x):
'\n Return the image of `x` under the homomorphism from the fundamental group into\n ``self``.\n\n EXAMPLES::\n\n sage: E = ExtendedAffineWeylGroup([\'A\',3,1])\n sage: PW0=E.PW0()\n sage: F = E.fundamental_group()\n sage: Is = F.special_nodes()\n sage: [(i, PW0.from_fundamental(F(i))) for i in Is]\n [(0, 1),\n (1, t[Lambdacheck[1]] * s1*s2*s3),\n (2, t[Lambdacheck[2]] * s2*s3*s1*s2),\n (3, t[Lambdacheck[3]] * s3*s2*s1)]\n sage: [(i, E.W0P().from_fundamental((F(i)))) for i in Is]\n [(0, 1),\n (1, s1*s2*s3 * t[-Lambdacheck[3]]),\n (2, s2*s3*s1*s2 * t[-Lambdacheck[2]]),\n (3, s3*s2*s1 * t[-Lambdacheck[1]])]\n sage: [(i, E.WF().from_fundamental(F(i))) for i in Is]\n [(0, 1), (1, pi[1]), (2, pi[2]), (3, pi[3])]\n\n .. WARNING::\n\n This method must be implemented by the "WF" and "FW" realizations.\n '
WF = self.realization_of().WF()
return self(WF.from_fundamental(x))
def from_translation(self, la):
'\n Return the element of translation by ``la`` in ``self``.\n\n INPUT:\n\n - ``self`` -- a realization of the extended affine Weyl group\n - ``la`` -- an element of the translation lattice\n\n In the notation of the documentation for :meth:`ExtendedAffineWeylGroup`,\n ``la`` must be an element of "P".\n\n EXAMPLES::\n\n sage: E = ExtendedAffineWeylGroup([\'A\',2,1]); PW0 = E.PW0()\n sage: b = E.lattice_basis(); b\n Finite family {1: Lambdacheck[1], 2: Lambdacheck[2]}\n sage: x = PW0.from_translation(2*b[1] - b[2]); x\n t[2*Lambdacheck[1] - Lambdacheck[2]]\n sage: FW = E.FW()\n sage: y = FW.from_translation(2*b[1] - b[2]); y\n S0*S2*S0*S1\n sage: FW(x) == y\n True\n\n Since the implementation as a semidirect product requires\n wrapping the lattice group to make it multiplicative,\n we cannot declare that this map is a morphism for\n sage ``Groups()``.\n\n .. WARNING::\n\n This method must be implemented by the "PW0" and "W0P" realizations.\n '
PW0 = self.realization_of().PW0()
return self(PW0.from_translation(la))
def from_dual_translation(self, la):
"\n Return the image of ``la`` under the homomorphism of the dual version of the\n translation lattice into ``self``.\n\n EXAMPLES::\n\n sage: E = ExtendedAffineWeylGroup(['A',2,1]); PvW0 = E.PvW0()\n sage: bv = E.dual_lattice_basis(); bv\n Finite family {1: Lambda[1], 2: Lambda[2]}\n sage: x = PvW0.from_dual_translation(2*bv[1] - bv[2]); x\n t[2*Lambda[1] - Lambda[2]]\n sage: FW = E.FW()\n sage: y = FW.from_dual_translation(2*bv[1] - bv[2]); y\n S0*S2*S0*S1\n sage: FW(x) == y\n True\n "
return self(self.realization_of().PvW0().from_dual_translation(la))
@abstract_method
def simple_reflections(self):
'\n Return a family from the set of affine Dynkin nodes to the simple reflections\n in the realization of the extended affine Weyl group.\n\n EXAMPLES::\n\n sage: ExtendedAffineWeylGroup([\'A\',3,1]).W0P().simple_reflections()\n Finite family {0: s1*s2*s3*s2*s1 * t[-Lambdacheck[1] - Lambdacheck[3]],\n 1: s1, 2: s2, 3: s3}\n sage: ExtendedAffineWeylGroup([\'A\',3,1]).WF().simple_reflections()\n Finite family {0: S0, 1: S1, 2: S2, 3: S3}\n sage: ExtendedAffineWeylGroup([\'A\',3,1],\n ....: print_tuple=True).FW().simple_reflections()\n Finite family {0: (pi[0], S0), 1: (pi[0], S1),\n 2: (pi[0], S2), 3: (pi[0], S3)}\n sage: ExtendedAffineWeylGroup([\'A\',3,1],\n ....: fundamental="f",\n ....: print_tuple=True).FW().simple_reflections()\n Finite family {0: (f[0], S0), 1: (f[0], S1),\n 2: (f[0], S2), 3: (f[0], S3)}\n sage: ExtendedAffineWeylGroup([\'A\',3,1]).PvW0().simple_reflections()\n Finite family {0: t[Lambda[1] + Lambda[3]] * s1*s2*s3*s2*s1,\n 1: s1, 2: s2, 3: s3}\n '
def simple_reflection(self, i):
"\n Return the `i`-th simple reflection in ``self``.\n\n INPUT:\n\n - ``self`` -- a realization of the extended affine Weyl group\n - ``i`` -- An affine Dynkin node\n\n EXAMPLES::\n\n sage: ExtendedAffineWeylGroup(['A',3,1]).PW0().simple_reflection(0)\n t[Lambdacheck[1] + Lambdacheck[3]] * s1*s2*s3*s2*s1\n sage: ExtendedAffineWeylGroup(['C',2,1]).WF().simple_reflection(0)\n S0\n sage: ExtendedAffineWeylGroup(['D',3,2]).PvW0().simple_reflection(1)\n s1\n "
return self.simple_reflections()[i]
def from_classical_weyl(self, w):
'\n Return the image of `w` from the finite Weyl group into ``self``.\n\n EXAMPLES::\n\n sage: E = ExtendedAffineWeylGroup([\'A\',3,1]); PW0=E.PW0()\n sage: W0 = E.classical_weyl()\n sage: w = W0.from_reduced_word([2,1,3])\n sage: y = PW0.from_classical_weyl(w); y\n s2*s3*s1\n sage: y.parent() == PW0\n True\n sage: y.to_classical_weyl() == w\n True\n sage: W0P = E.W0P()\n sage: z = W0P.from_classical_weyl(w); z\n s2*s3*s1\n sage: z.parent() == W0P\n True\n sage: W0P(y) == z\n True\n sage: FW = E.FW()\n sage: x = FW.from_classical_weyl(w); x\n S2*S3*S1\n sage: x.parent() == FW\n True\n sage: FW(y) == x\n True\n sage: FW(z) == x\n True\n\n .. WARNING::\n\n Must be implemented in style "PW0" and "W0P".\n '
PW0 = self.realization_of().PW0()
return self(PW0.from_classical_weyl(w))
def from_dual_classical_weyl(self, w):
'\n Return the image of `w` from the finite Weyl group of dual form into ``self``.\n\n EXAMPLES::\n\n sage: E = ExtendedAffineWeylGroup([\'A\',3,1]); PvW0 = E.PvW0()\n sage: W0v = E.dual_classical_weyl()\n sage: w = W0v.from_reduced_word([2,1,3])\n sage: y = PvW0.from_dual_classical_weyl(w); y\n s2*s3*s1\n sage: y.parent() == PvW0\n True\n sage: y.to_dual_classical_weyl() == w\n True\n sage: x = E.FW().from_dual_classical_weyl(w); x\n S2*S3*S1\n sage: PvW0(x) == y\n True\n\n .. WARNING::\n\n Must be implemented in style "PvW0" and "W0Pv".\n '
return self(self.realization_of().PvW0().from_dual_classical_weyl(w))
def from_affine_weyl(self, w):
'\n Return the image of `w` under the homomorphism from the affine Weyl group\n into ``self``.\n\n EXAMPLES::\n\n sage: E = ExtendedAffineWeylGroup([\'A\',3,1]); PW0 = E.PW0()\n sage: W = E.affine_weyl()\n sage: w = W.from_reduced_word([2,1,3,0])\n sage: x = PW0.from_affine_weyl(w); x\n t[Lambdacheck[1] - 2*Lambdacheck[2] + Lambdacheck[3]] * s3*s1\n sage: FW = E.FW()\n sage: y = FW.from_affine_weyl(w); y\n S2*S3*S1*S0\n sage: FW(x) == y\n True\n\n .. WARNING::\n\n Must be implemented in style "WF" and "FW".\n '
WF = self.realization_of().WF()
return self(WF.from_affine_weyl(w))
def from_reduced_word(self, word):
"\n Converts an affine or finite reduced word into a group element.\n\n EXAMPLES::\n\n sage: ExtendedAffineWeylGroup(['A',2,1]).PW0().from_reduced_word([1,0,1,2])\n t[-Lambdacheck[1] + 2*Lambdacheck[2]]\n "
return self.from_affine_weyl(self.realization_of().affine_weyl().from_reduced_word(word))
class ElementMethods():
@abstract_method
def has_descent(self, i, side='right', positive=False):
'\n Return whether ``self`` * `s_i` < ``self`` where `s_i` is the `i`-th simple\n reflection in the realized group.\n\n INPUT:\n\n - ``i`` -- an affine Dynkin index\n\n OPTIONAL:\n\n - ``side`` -- ``\'right\'`` or ``\'left\'`` (default: ``\'right\'``)\n - ``positive`` -- ``True`` or ``False`` (default: ``False``)\n\n If ``side=\'left\'``, then the reflection acts\n on the left. If ``positive=True``, then the inequality is reversed.\n\n EXAMPLES::\n\n sage: E = ExtendedAffineWeylGroup([\'A\',3,1]); WF = E.WF()\n sage: F = E.fundamental_group()\n sage: x = WF.an_element(); x\n S0*S1*S2*S3 * pi[3]\n sage: I = E.cartan_type().index_set()\n sage: [(i, x.has_descent(i)) for i in I]\n [(0, True), (1, False), (2, False), (3, False)]\n sage: [(i, x.has_descent(i,side=\'left\')) for i in I]\n [(0, True), (1, False), (2, False), (3, False)]\n sage: [(i, x.has_descent(i,positive=True)) for i in I]\n [(0, False), (1, True), (2, True), (3, True)]\n\n .. WARNING::\n\n This method is abstract because it is used in the recursive coercions\n between "PW0" and "WF" and other methods use this coercion.\n '
def first_descent(self, side='right', positive=False, index_set=None):
"\n Return the first descent of ``self``.\n\n INPUT:\n\n - ``side`` -- ``'left'`` or ``'right'`` (default: ``'right'``)\n - ``positive`` -- ``True`` or ``False`` (default: ``False``)\n - ``index_set`` -- an optional subset of Dynkin nodes\n\n If ``index_set`` is not ``None``, then the descent must be in the ``index_set``.\n\n EXAMPLES::\n\n sage: x = ExtendedAffineWeylGroup(['A',3,1]).WF().an_element(); x\n S0*S1*S2*S3 * pi[3]\n sage: x.first_descent()\n 0\n sage: x.first_descent(side='left')\n 0\n sage: x.first_descent(positive=True)\n 1\n sage: x.first_descent(side='left',positive=True)\n 1\n "
if (index_set is None):
index_set = self.parent().realization_of().cartan_type().index_set()
for i in index_set:
if self.has_descent(i, side=side, positive=positive):
return i
return None
def apply_simple_reflection(self, i, side='right'):
"\n Apply the `i`-th simple reflection to ``self``.\n\n EXAMPLES::\n\n sage: x = ExtendedAffineWeylGroup(['A',3,1]).WF().an_element(); x\n S0*S1*S2*S3 * pi[3]\n sage: x.apply_simple_reflection(1)\n S0*S1*S2*S3*S0 * pi[3]\n sage: x.apply_simple_reflection(0, side='left')\n S1*S2*S3 * pi[3]\n "
s = self.parent().simple_reflection(i)
if (side == 'right'):
return (self * s)
else:
return (s * self)
def apply_simple_projection(self, i, side='right', length_increasing=True):
'\n Return the product of ``self`` by the simple reflection `s_i` if that product is\n of greater length than ``self`` and otherwise return ``self``.\n\n INPUT:\n\n - ``self`` -- an element of the extended affine Weyl group\n - `i` -- a Dynkin node (index of a simple reflection `s_i`)\n - ``side`` -- ``\'right\'`` or ``\'left\'`` (default: ``\'right\'``)\n according to which side of ``self`` the reflection `s_i`\n should be multiplied\n - ``length_increasing`` -- ``True`` or ``False`` (default ``True``).\n If ``False``, do the above with the word "greater" replaced by "less".\n\n EXAMPLES::\n\n sage: x = ExtendedAffineWeylGroup([\'A\',3,1]).WF().an_element(); x\n S0*S1*S2*S3 * pi[3]\n sage: x.apply_simple_projection(1)\n S0*S1*S2*S3*S0 * pi[3]\n sage: x.apply_simple_projection(1, length_increasing=False)\n S0*S1*S2*S3 * pi[3]\n '
if self.has_descent(i, side=side, positive=length_increasing):
return self.apply_simple_reflection(i, side=side)
return self
def to_fundamental_group(self):
'\n Return the image of ``self`` under the homomorphism to the fundamental group.\n\n EXAMPLES::\n\n sage: PW0 = ExtendedAffineWeylGroup([\'A\',3,1]).PW0()\n sage: b = PW0.realization_of().lattice_basis()\n sage: [(x, PW0.from_translation(x).to_fundamental_group()) for x in b]\n [(Lambdacheck[1], pi[1]), (Lambdacheck[2], pi[2]), (Lambdacheck[3], pi[3])]\n\n .. WARNING::\n\n Must be implemented in style "WF".\n '
WF = self.parent().realization_of().WF()
return WF(self).to_fundamental_group()
def to_classical_weyl(self):
'\n Return the image of ``self`` under the homomorphism to the classical Weyl group.\n\n EXAMPLES::\n\n sage: ExtendedAffineWeylGroup([\'A\',3,1]).WF().simple_reflection(0).to_classical_weyl()\n s1*s2*s3*s2*s1\n\n .. WARNING::\n\n Must be implemented in style "PW0".\n '
PW0 = self.parent().realization_of().PW0()
return PW0(self).to_classical_weyl()
def to_dual_classical_weyl(self):
'\n Return the image of ``self`` under the homomorphism to the dual form of the classical Weyl group.\n\n EXAMPLES::\n\n sage: x = ExtendedAffineWeylGroup([\'A\',3,1]).WF().simple_reflection(0).to_dual_classical_weyl(); x\n s1*s2*s3*s2*s1\n sage: x.parent()\n Weyl Group of type [\'A\', 3] (as a matrix group acting on the weight lattice)\n\n .. WARNING::\n\n Must be implemented in style "PvW0".\n '
PvW0 = self.parent().realization_of().PvW0()
return PvW0(self).to_dual_classical_weyl()
def to_affine_weyl_left(self):
'\n Return the projection of ``self`` to the affine Weyl group on the left,\n after factorizing using the style "WF".\n\n EXAMPLES::\n\n sage: E = ExtendedAffineWeylGroup([\'A\',3,1]); PW0 = E.PW0()\n sage: b = E.lattice_basis()\n sage: [(x, PW0.from_translation(x).to_affine_weyl_left()) for x in b]\n [(Lambdacheck[1], S0*S3*S2),\n (Lambdacheck[2], S0*S3*S1*S0),\n (Lambdacheck[3], S0*S1*S2)]\n\n .. WARNING::\n\n Must be implemented in style "WF".\n '
WF = self.parent().realization_of().WF()
return WF(self).to_affine_weyl_left()
def to_affine_weyl_right(self):
'\n Return the projection of ``self`` to the affine Weyl group on the right,\n after factorizing using the style "FW".\n\n EXAMPLES::\n\n sage: E = ExtendedAffineWeylGroup([\'A\',3,1]); PW0 = E.PW0()\n sage: b = E.lattice_basis()\n sage: [(x, PW0.from_translation(x).to_affine_weyl_right()) for x in b]\n [(Lambdacheck[1], S3*S2*S1),\n (Lambdacheck[2], S2*S3*S1*S2),\n (Lambdacheck[3], S1*S2*S3)]\n\n .. WARNING::\n\n Must be implemented in style "FW".\n '
FW = self.parent().realization_of().FW()
return FW(self).to_affine_weyl_right()
def to_translation_left(self):
'\n Return the projection of ``self`` to the translation lattice after factorizing\n it to the left using the style "PW0".\n\n EXAMPLES::\n\n sage: ExtendedAffineWeylGroup([\'A\',3,1]).PW0().simple_reflection(0).to_translation_left()\n Lambdacheck[1] + Lambdacheck[3]\n\n .. WARNING::\n\n Must be implemented in style "PW0".\n '
PW0 = self.parent().realization_of().PW0()
return PW0(self).to_translation_left()
def to_translation_right(self):
'\n Return the projection of ``self`` to the translation lattice after factorizing\n it to the right using the style "W0P".\n\n EXAMPLES::\n\n sage: ExtendedAffineWeylGroup([\'A\',3,1]).PW0().simple_reflection(0).to_translation_right()\n -Lambdacheck[1] - Lambdacheck[3]\n\n .. WARNING::\n\n Must be implemented in style "W0P".\n '
W0P = self.parent().realization_of().W0P()
return W0P(self).to_translation_right()
def to_dual_translation_left(self):
'\n Return the projection of ``self`` to the dual translation lattice after factorizing\n it to the left using the style "PvW0".\n\n EXAMPLES::\n\n sage: ExtendedAffineWeylGroup([\'A\',3,1]).PvW0().simple_reflection(0).to_dual_translation_left()\n Lambda[1] + Lambda[3]\n\n .. WARNING::\n\n Must be implemented in style "PvW0".\n '
PvW0 = self.parent().realization_of().PvW0()
return PvW0(self).to_dual_translation_left()
def to_dual_translation_right(self):
'\n Return the projection of ``self`` to the dual translation lattice after factorizing\n it to the right using the style "W0Pv".\n\n EXAMPLES::\n\n sage: ExtendedAffineWeylGroup([\'A\',3,1]).PW0().simple_reflection(0).to_dual_translation_right()\n -Lambda[1] - Lambda[3]\n\n .. WARNING::\n\n Must be implemented in style "W0Pv".\n '
W0Pv = self.parent().realization_of().W0Pv()
return W0Pv(self).to_dual_translation_right()
def length(self):
"\n Return the length of ``self`` in the Coxeter group sense.\n\n EXAMPLES::\n\n sage: E = ExtendedAffineWeylGroup(['A',3,1]); PW0 = E.PW0()\n sage: I0 = E.cartan_type().classical().index_set()\n sage: [PW0.from_translation(E.lattice_basis()[i]).length() for i in I0]\n [3, 4, 3]\n "
return self.to_affine_weyl_left().length()
def coset_representative(self, index_set, side='right'):
"\n Return the minimum length representative in the coset of ``self`` with respect to\n the subgroup generated by the reflections given by ``index_set``.\n\n INPUT:\n\n - ``self`` -- an element of the extended affine Weyl group\n - ``index_set`` -- a subset of the set of Dynkin nodes\n - ``side`` -- ``'right'`` or ``'left'`` (default: ``'right'``)\n the side on which the subgroup acts\n\n EXAMPLES::\n\n sage: E = ExtendedAffineWeylGroup(['A',3,1]); WF = E.WF()\n sage: b = E.lattice_basis()\n sage: I0 = E.cartan_type().classical().index_set()\n sage: [WF.from_translation(x).coset_representative(index_set=I0) for x in b]\n [pi[1], pi[2], pi[3]]\n "
while True:
i = self.first_descent(index_set=index_set, side=side)
if (i is None):
return self
self = self.apply_simple_reflection(i, side=side)
def is_grassmannian(self, index_set, side='right'):
"\n Return whether ``self`` is of minimum length in its coset with respect to the\n subgroup generated by the reflections of ``index_set``.\n\n EXAMPLES::\n\n sage: E = ExtendedAffineWeylGroup(['A',3,1]); PW0 = E.PW0()\n sage: x = PW0.from_translation(E.lattice_basis()[1]); x\n t[Lambdacheck[1]]\n sage: I = E.cartan_type().index_set()\n sage: [(i, x.is_grassmannian(index_set=[i])) for i in I]\n [(0, True), (1, False), (2, True), (3, True)]\n sage: [(i, x.is_grassmannian(index_set=[i], side='left')) for i in I]\n [(0, False), (1, True), (2, True), (3, True)]\n "
return (self == self.coset_representative(index_set=index_set, side=side))
def to_affine_grassmannian(self):
"\n Return the unique affine Grassmannian element in the same coset of ``self``\n with respect to the finite Weyl group acting on the right.\n\n EXAMPLES::\n\n sage: elts = ExtendedAffineWeylGroup(['A',2,1]).PW0().some_elements()\n sage: [(x, x.to_affine_grassmannian()) for x in elts]\n [(t[2*Lambdacheck[1] + 2*Lambdacheck[2]] * s1*s2,\n t[2*Lambdacheck[1] + 2*Lambdacheck[2]] * s1*s2*s1)]\n "
return self.coset_representative(index_set=self.parent().realization_of().cartan_type().classical().index_set())
def is_affine_grassmannian(self):
"\n Return whether ``self`` is affine Grassmannian.\n\n EXAMPLES::\n\n sage: E = ExtendedAffineWeylGroup(['A',2,1]); PW0 = E.PW0()\n sage: F = E.fundamental_group()\n sage: [(x,PW0.from_fundamental(x).is_affine_grassmannian()) for x in F]\n [(pi[0], True), (pi[1], True), (pi[2], True)]\n sage: b = E.lattice_basis()\n sage: [(-x,PW0.from_translation(-x).is_affine_grassmannian()) for x in b]\n [(-Lambdacheck[1], True), (-Lambdacheck[2], True)]\n "
return (self == self.to_affine_grassmannian())
def bruhat_le(self, x):
'\n Return whether ``self`` <= `x` in Bruhat order.\n\n INPUT:\n\n - ``self`` -- an element of the extended affine Weyl group\n - `x` -- another element with the same parent as ``self``\n\n EXAMPLES::\n\n sage: E = ExtendedAffineWeylGroup([\'A\',2,1], print_tuple=True); WF = E.WF()\n sage: W = E.affine_weyl()\n sage: v = W.from_reduced_word([2,1,0])\n sage: w = W.from_reduced_word([2,0,1,0])\n sage: v.bruhat_le(w)\n True\n sage: vx = WF.from_affine_weyl(v); vx\n (S2*S1*S0, pi[0])\n sage: wx = WF.from_affine_weyl(w); wx\n (S2*S0*S1*S0, pi[0])\n sage: vx.bruhat_le(wx)\n True\n sage: F = E.fundamental_group()\n sage: f = WF.from_fundamental(F(2))\n sage: vx.bruhat_le(wx*f)\n False\n sage: (vx*f).bruhat_le(wx*f)\n True\n\n .. WARNING::\n\n Must be implemented by "WF".\n '
WF = self.parent().realization_of().WF()
return WF(self).bruhat_le(WF(x))
def is_translation(self):
"\n Return whether ``self`` is a translation element or not.\n\n EXAMPLES::\n\n sage: E = ExtendedAffineWeylGroup(['A',2,1]); FW = E.FW()\n sage: F = E.fundamental_group()\n sage: FW.from_affine_weyl(E.affine_weyl().from_reduced_word([1,2,1,0])).is_translation()\n True\n sage: FW.from_translation(E.lattice_basis()[1]).is_translation()\n True\n sage: FW.simple_reflection(0).is_translation()\n False\n "
w = self.to_classical_weyl()
return (w == w.parent().one())
def action(self, la):
'\n Action of ``self`` on a lattice element ``la``.\n\n INPUT:\n\n - ``self`` -- an element of the extended affine Weyl group\n - ``la`` -- an element of the translation lattice of the extended\n affine Weyl group, the lattice denoted by the mnemonic "P" in the\n documentation for :meth:`ExtendedAffineWeylGroup`.\n\n EXAMPLES::\n\n sage: E = ExtendedAffineWeylGroup([\'A\',2,1], affine="s")\n sage: x = E.FW().an_element(); x\n pi[2] * s0*s1*s2\n sage: la = E.lattice().an_element(); la\n 2*Lambdacheck[1] + 2*Lambdacheck[2]\n sage: x.action(la)\n 5*Lambdacheck[1] - 3*Lambdacheck[2]\n sage: E = ExtendedAffineWeylGroup([\'C\',2,1], affine="s")\n sage: x = E.PW0().from_translation(E.lattice_basis()[1])\n sage: x.action(E.lattice_basis()[2])\n Lambdacheck[1] + Lambdacheck[2]\n\n .. WARNING::\n\n Must be implemented by style "PW0".\n '
PW0 = self.parent().realization_of().PW0()
return PW0(self).action(la)
def dual_action(self, la):
'\n Action of ``self`` on a dual lattice element ``la``.\n\n INPUT:\n\n - ``self`` -- an element of the extended affine Weyl group\n - ``la`` -- an element of the dual translation lattice of the extended\n affine Weyl group, the lattice denoted by the mnemonic "Pv" in\n the documentation for :meth:`ExtendedAffineWeylGroup`.\n\n EXAMPLES::\n\n sage: E = ExtendedAffineWeylGroup([\'A\',2,1], affine="s")\n sage: x = E.FW().an_element(); x\n pi[2] * s0*s1*s2\n sage: la = E.dual_lattice().an_element(); la\n 2*Lambda[1] + 2*Lambda[2]\n sage: x.dual_action(la)\n 5*Lambda[1] - 3*Lambda[2]\n sage: E = ExtendedAffineWeylGroup([\'C\',2,1], affine="s")\n sage: x = E.PvW0().from_dual_translation(E.dual_lattice_basis()[1])\n sage: x.dual_action(E.dual_lattice_basis()[2])\n Lambda[1] + Lambda[2]\n\n .. WARNING::\n\n Must be implemented by style "PvW0".\n '
PvW0 = self.parent().realization_of().PvW0()
return PvW0(self).dual_action(la)
def action_on_affine_roots(self, beta):
'\n Act by ``self`` on the affine root lattice element ``beta``.\n\n EXAMPLES::\n\n sage: E = ExtendedAffineWeylGroup([\'A\',2,1])\n sage: beta = E.cartan_type().root_system().root_lattice().an_element(); beta\n 2*alpha[0] + 2*alpha[1] + 3*alpha[2]\n sage: x = E.FW().an_element(); x\n pi[2] * S0*S1*S2\n sage: x.action_on_affine_roots(beta)\n alpha[0] + alpha[1]\n\n .. WARNING::\n\n Must be implemented by style "FW".\n '
E = self.parent().realization_of()
assert (beta in RootSystem(E.cartan_type()).root_lattice())
return E.FW()(self).action_on_affine_roots(beta)
def face_data(self, i):
"\n Return a description of one of the bounding hyperplanes of the alcove of an extended affine Weyl group element.\n\n INPUT:\n\n - ``self`` -- An element of the extended affine Weyl group\n - ``i`` -- an affine Dynkin node\n\n OUTPUT:\n\n - A 2-tuple `(m,\\beta)` defined as follows.\n\n ALGORITHM:\n\n Each element of the extended affine Weyl group corresponds to an alcove,\n and each alcove has a face for each affine Dynkin node. Given the data of ``self`` and `i`,\n let the extended affine Weyl group element ``self`` act on the affine simple root `\\alpha_i`,\n yielding a real affine root, which can be expressed uniquely as\n\n .. MATH::\n\n ``self`` \\cdot \\alpha_i = m \\delta + \\beta\n\n where `m` is an integer (the height of the `i`-th bounding hyperplane of the alcove of ``self``)\n and `\\beta` is a classical root (the normal vector for the hyperplane which points towards the alcove).\n\n EXAMPLES::\n\n sage: x = ExtendedAffineWeylGroup(['A',2,1]).PW0().an_element(); x\n t[2*Lambdacheck[1] + 2*Lambdacheck[2]] * s1*s2\n sage: x.face_data(0)\n (-1, alpha[1])\n "
Qaf = self.parent().realization_of().cartan_type().root_system().root_lattice()
gamma = self.action_on_affine_roots(Qaf.simple_root(i))
return (gamma[0], Qaf.classical()(gamma))
def alcove_walk_signs(self):
"\n Return a signed alcove walk for ``self``.\n\n INPUT:\n\n - An element ``self`` of the extended affine Weyl group.\n\n OUTPUT:\n\n - A 3-tuple (`g`, ``rw``, ``signs``).\n\n ALGORITHM:\n\n The element ``self`` can be uniquely written ``self`` = `g` * `w`\n where `g` has length zero and `w` is an element of the nonextended affine Weyl group.\n Let `w` have reduced word ``rw``.\n Starting with `g` and applying simple reflections from ``rw``, one obtains\n a sequence of extended affine Weyl group elements (that is, alcoves) and simple roots.\n The signs give the sequence of sides on which the alcoves lie, relative to the face\n indicated by the simple roots.\n\n EXAMPLES::\n\n sage: E = ExtendedAffineWeylGroup(['A',3,1]); FW=E.FW()\n sage: w = FW.from_reduced_word([0,2,1,3,0])*FW.from_fundamental(1); w\n pi[1] * S3*S1*S2*S0*S3\n sage: w.alcove_walk_signs()\n (pi[1], [3, 1, 2, 0, 3], [-1, 1, -1, -1, 1])\n "
We = self.parent()
gw = We.realization_of().FW()(self)
g = gw.cartesian_projection(0)
w = gw.cartesian_projection(1)
rw = w.reduced_word()
u_curr = We.from_fundamental(g.value())
signs = []
for i in rw:
(m, beta) = u_curr.face_data(i)
if beta.is_positive_root():
signs = (signs + [1])
else:
signs = (signs + [(- 1)])
u_curr = (u_curr * We.simple_reflection(i))
return (g, rw, signs)
class ExtendedAffineWeylGroupPW0Element(GroupSemidirectProduct.Element):
'\n The element class for the "PW0" realization.\n '
def has_descent(self, i, side='right', positive=False):
"\n Return whether ``self`` has `i` as a descent.\n\n INPUT:\n\n - ``i`` -- an affine Dynkin node\n\n OPTIONAL:\n\n - ``side`` -- ``'left'`` or ``'right'`` (default: ``'right'``)\n - ``positive`` -- ``True`` or ``False`` (default: ``False``)\n\n EXAMPLES::\n\n sage: w = ExtendedAffineWeylGroup(['A',4,2]).PW0().from_reduced_word([0,1]); w\n t[Lambda[1]] * s1*s2\n sage: w.has_descent(0, side='left')\n True\n "
E = self.parent().realization_of()
if (side == 'right'):
self = (~ self)
if positive:
return (not self.has_descent(i, side='left'))
la = self.cartesian_projection(0).value
w = self.cartesian_projection(1)
if (i == 0):
ip = (la.scalar(E._special_translation_covector) * E._a0check)
if (ip > 1):
return True
if (ip < 1):
return False
return E._special_root.weyl_action(w, inverse=True).is_positive_root()
ip = la.scalar(E._simpleR0[i])
if (ip < 0):
return True
if (ip > 0):
return False
return w.has_descent(i, side='left')
def action(self, la):
"\n Return the action of ``self`` on an element ``la`` of the translation lattice.\n\n EXAMPLES::\n\n sage: E = ExtendedAffineWeylGroup(['A',2,1]); PW0 = E.PW0()\n sage: x = PW0.an_element(); x\n t[2*Lambdacheck[1] + 2*Lambdacheck[2]] * s1*s2\n sage: la = E.lattice().an_element(); la\n 2*Lambdacheck[1] + 2*Lambdacheck[2]\n sage: x.action(la)\n -2*Lambdacheck[1] + 4*Lambdacheck[2]\n "
w = self.cartesian_projection(1)
assert (la in w.parent().domain())
return (self.cartesian_projection(0).value + w.action(la))
def to_translation_left(self):
'\n The image of ``self`` under the map that projects to the translation lattice\n factor after factoring it to the left as in style "PW0".\n\n EXAMPLES::\n\n sage: s = ExtendedAffineWeylGroup([\'A\',2,1]).PW0().S0(); s\n t[Lambdacheck[1] + Lambdacheck[2]] * s1*s2*s1\n sage: s.to_translation_left()\n Lambdacheck[1] + Lambdacheck[2]\n '
return self.cartesian_projection(0).value
def to_classical_weyl(self):
'\n Return the image of ``self`` under the homomorphism that projects to the classical\n Weyl group factor after rewriting it in either style "PW0" or "W0P".\n\n EXAMPLES::\n\n sage: s = ExtendedAffineWeylGroup([\'A\',2,1]).PW0().S0(); s\n t[Lambdacheck[1] + Lambdacheck[2]] * s1*s2*s1\n sage: s.to_classical_weyl()\n s1*s2*s1\n '
return self.cartesian_projection(1)
class ExtendedAffineWeylGroupPW0(GroupSemidirectProduct, BindableClass):
"\n Extended affine Weyl group, realized as the semidirect product of the translation lattice\n by the finite Weyl group.\n\n INPUT:\n\n - ``E`` -- A parent with realization in :class:`ExtendedAffineWeylGroup_Class`\n\n EXAMPLES::\n\n sage: ExtendedAffineWeylGroup(['A',2,1]).PW0()\n Extended affine Weyl group of type ['A', 2, 1] realized by Semidirect product of\n Multiplicative form of Coweight lattice of the Root system of type ['A', 2]\n acted upon by Weyl Group of type ['A', 2]\n (as a matrix group acting on the coweight lattice)\n "
def __init__(self, E):
"\n Create the PW0 realization of the extended affine Weyl group.\n\n EXAMPLES::\n\n sage: PW0 = ExtendedAffineWeylGroup(['D',3,2]).PW0()\n sage: TestSuite(PW0).run()\n "
def twist(w, l):
return E.exp_lattice()(w.action(l.value))
GroupSemidirectProduct.__init__(self, E.exp_lattice(), E.classical_weyl(), twist=twist, act_to_right=False, prefix0=E._prefixt, print_tuple=E._print_tuple, category=E.Realizations())
self._style = 'PW0'
def _repr_(self):
'\n A string representing ``self``.\n\n EXAMPLES::\n\n sage: ExtendedAffineWeylGroup([\'A\',4,2]).PW0()._repr_()\n "Extended affine Weyl group of type [\'BC\', 2, 2] realized by Semidirect product of Multiplicative form of Weight lattice of the Root system of type [\'C\', 2] acted upon by Weyl Group of type [\'C\', 2] (as a matrix group acting on the weight lattice)"\n '
return ((self.realization_of()._repr_() + ' realized by ') + super()._repr_())
def from_translation(self, la):
'\n Map the translation lattice element ``la`` into ``self``.\n\n EXAMPLES::\n\n sage: E = ExtendedAffineWeylGroup([\'A\',2,1], translation="tau",\n ....: print_tuple=True)\n sage: la = E.lattice().an_element(); la\n 2*Lambdacheck[1] + 2*Lambdacheck[2]\n sage: E.PW0().from_translation(la)\n (tau[2*Lambdacheck[1] + 2*Lambdacheck[2]], 1)\n '
E = self.realization_of()
return self((E.exp_lattice()(la), self.cartesian_factors()[1].one()))
@cached_method
def S0(self):
"\n Return the affine simple reflection.\n\n EXAMPLES::\n\n sage: ExtendedAffineWeylGroup(['B',2]).PW0().S0()\n t[Lambdacheck[2]] * s2*s1*s2\n "
E = self.realization_of()
return self((E.exp_lattice()(E.lattice()(E._special_translation)), E._special_reflection))
@cached_method
def simple_reflection(self, i):
'\n Return the `i`-th simple reflection in ``self``.\n\n EXAMPLES::\n\n sage: E = ExtendedAffineWeylGroup("G2")\n sage: [(i, E.PW0().simple_reflection(i)) for i in E.cartan_type().index_set()]\n [(0, t[Lambdacheck[2]] * s2*s1*s2*s1*s2), (1, s1), (2, s2)]\n '
if (i == 0):
return self.S0()
else:
E = self.realization_of()
return self.from_classical_weyl(E.classical_weyl().simple_reflection(i))
@cached_method
def simple_reflections(self):
'\n Return a family for the simple reflections of ``self``.\n\n EXAMPLES::\n\n sage: ExtendedAffineWeylGroup("A3").PW0().simple_reflections()\n Finite family {0: t[Lambdacheck[1] + Lambdacheck[3]] * s1*s2*s3*s2*s1,\n 1: s1, 2: s2, 3: s3}\n '
return Family(self.realization_of().cartan_type().index_set(), self.simple_reflection)
def from_classical_weyl(self, w):
'\n Return the image of `w` under the homomorphism of the classical Weyl group into ``self``.\n\n EXAMPLES::\n\n sage: E = ExtendedAffineWeylGroup("A3",print_tuple=True)\n sage: E.PW0().from_classical_weyl(E.classical_weyl().from_reduced_word([1,2]))\n (t[0], s1*s2)\n '
return self((self.cartesian_factors()[0].one(), w))
class ExtendedAffineWeylGroupW0PElement(GroupSemidirectProduct.Element):
'\n The element class for the W0P realization.\n '
def has_descent(self, i, side='right', positive=False):
"\n Return whether ``self`` has `i` as a descent.\n\n INPUT:\n\n - ``i`` -- an index.\n\n OPTIONAL:\n\n - ``side`` -- ``'left'`` or ``'right'`` (default: ``'right'``)\n - ``positive`` -- ``True`` or ``False`` (default: ``False``)\n\n EXAMPLES::\n\n sage: W0P = ExtendedAffineWeylGroup(['A',4,2]).W0P()\n sage: w = W0P.from_reduced_word([0,1]); w\n s1*s2 * t[Lambda[1] - Lambda[2]]\n sage: w.has_descent(0, side='left')\n True\n "
E = self.parent().realization_of()
if (side == 'left'):
self = (~ self)
if positive:
return (not self.has_descent(i, side='right'))
w = self.cartesian_projection(0)
la = self.cartesian_projection(1).value
if (i == 0):
ip = (la.scalar(E._special_translation_covector) * E._a0check)
if (ip < (- 1)):
return True
if (ip > (- 1)):
return False
return E._special_root.weyl_action(w).is_positive_root()
ip = la.scalar(E._simpleR0[i])
if (ip > 0):
return True
if (ip < 0):
return False
return w.has_descent(i, side='right')
def to_classical_weyl(self):
"\n Project ``self`` into the classical Weyl group.\n\n EXAMPLES::\n\n sage: x = ExtendedAffineWeylGroup(['A',2,1]).W0P().simple_reflection(0); x\n s1*s2*s1 * t[-Lambdacheck[1] - Lambdacheck[2]]\n sage: x.to_classical_weyl()\n s1*s2*s1\n "
return self.cartesian_projection(0)
def to_translation_right(self):
'\n Project onto the right (translation) factor in the "W0P" style.\n\n EXAMPLES::\n\n sage: x = ExtendedAffineWeylGroup([\'A\',2,1]).W0P().simple_reflection(0); x\n s1*s2*s1 * t[-Lambdacheck[1] - Lambdacheck[2]]\n sage: x.to_translation_right()\n -Lambdacheck[1] - Lambdacheck[2]\n '
return self.cartesian_projection(1).value
class ExtendedAffineWeylGroupW0P(GroupSemidirectProduct, BindableClass):
"\n Extended affine Weyl group, realized as the semidirect product of the finite Weyl group\n by the translation lattice.\n\n INPUT:\n\n - ``E`` -- A parent with realization in :class:`ExtendedAffineWeylGroup_Class`\n\n EXAMPLES::\n\n sage: ExtendedAffineWeylGroup(['A',2,1]).W0P()\n Extended affine Weyl group of type ['A', 2, 1] realized by Semidirect product of\n Weyl Group of type ['A', 2] (as a matrix group acting on the coweight lattice)\n acting on Multiplicative form of Coweight lattice of the Root system of type ['A', 2]\n "
def __init__(self, E):
"\n EXAMPLES::\n\n sage: W0P = ExtendedAffineWeylGroup(['D',3,2]).W0P()\n sage: TestSuite(W0P).run()\n "
def twist(w, l):
return E.exp_lattice()(w.action(l.value))
GroupSemidirectProduct.__init__(self, E.classical_weyl(), E.exp_lattice(), twist=twist, act_to_right=True, prefix1=E._prefixt, print_tuple=E._print_tuple, category=E.Realizations())
self._style = 'W0P'
def _repr_(self):
'\n A string representing ``self``.\n\n EXAMPLES::\n\n sage: ExtendedAffineWeylGroup([\'A\',4,2]).W0P()._repr_()\n "Extended affine Weyl group of type [\'BC\', 2, 2] realized by Semidirect product of Weyl Group of type [\'C\', 2] (as a matrix group acting on the weight lattice) acting on Multiplicative form of Weight lattice of the Root system of type [\'C\', 2]"\n '
return ((self.realization_of()._repr_() + ' realized by ') + super()._repr_())
def S0(self):
'\n Return the zero-th simple reflection in style "W0P".\n\n EXAMPLES::\n\n sage: ExtendedAffineWeylGroup(["A",3,1]).W0P().S0()\n s1*s2*s3*s2*s1 * t[-Lambdacheck[1] - Lambdacheck[3]]\n '
E = self.realization_of()
return self((E._special_reflection, E.exp_lattice()(E.lattice()((- E._special_translation)))))
def simple_reflection(self, i):
"\n Return the `i`-th simple reflection in ``self``.\n\n EXAMPLES::\n\n sage: E = ExtendedAffineWeylGroup(['A',3,1]); W0P = E.W0P()\n sage: [(i, W0P.simple_reflection(i)) for i in E.cartan_type().index_set()]\n [(0, s1*s2*s3*s2*s1 * t[-Lambdacheck[1] - Lambdacheck[3]]),\n (1, s1), (2, s2), (3, s3)]\n "
if (i == 0):
return self.S0()
E = self.realization_of()
return self.from_classical_weyl(E.classical_weyl().simple_reflection(i))
@cached_method
def simple_reflections(self):
'\n Return the family of simple reflections.\n\n EXAMPLES::\n\n sage: ExtendedAffineWeylGroup(["A",3,1]).W0P().simple_reflections()\n Finite family {0: s1*s2*s3*s2*s1 * t[-Lambdacheck[1] - Lambdacheck[3]],\n 1: s1, 2: s2, 3: s3}\n '
return Family(self.realization_of().cartan_type().index_set(), self.simple_reflection)
def from_classical_weyl(self, w):
"\n Return the image of the classical Weyl group element `w` in ``self``.\n\n EXAMPLES::\n\n sage: E = ExtendedAffineWeylGroup(['A',2,1],print_tuple=True)\n sage: E.W0P().from_classical_weyl(E.classical_weyl().from_reduced_word([2,1]))\n (s2*s1, t[0])\n "
return self((w, self.cartesian_factors()[1].one()))
def from_translation(self, la):
"\n Return the image of the lattice element ``la`` in ``self``.\n\n EXAMPLES::\n\n sage: E = ExtendedAffineWeylGroup(['A',2,1],print_tuple=True)\n sage: E.W0P().from_translation(E.lattice().an_element())\n (1, t[2*Lambdacheck[1] + 2*Lambdacheck[2]])\n "
return self((self.cartesian_factors()[0].one(), self.realization_of().exp_lattice()(la)))
class ExtendedAffineWeylGroupWFElement(GroupSemidirectProduct.Element):
'\n Element class for the "WF" realization.\n '
def has_descent(self, i, side='right', positive=False):
"\n Return whether ``self`` has `i` as a descent.\n\n INPUT:\n\n - ``i`` -- an affine Dynkin index\n\n OPTIONAL:\n\n - ``side`` -- ``'left'`` or ``'right'`` (default: ``'right'``)\n - ``positive`` -- ``True`` or ``False`` (default: ``False``)\n\n EXAMPLES::\n\n sage: E = ExtendedAffineWeylGroup(['A',2,1])\n sage: x = E.WF().an_element(); x\n S0*S1*S2 * pi[2]\n sage: [(i, x.has_descent(i)) for i in E.cartan_type().index_set()]\n [(0, True), (1, False), (2, False)]\n "
if (side == 'right'):
self = (~ self)
if positive:
return (not self.has_descent(i, side='left'))
return self.cartesian_projection(0).has_descent(i, side='left')
def to_fundamental_group(self):
'\n Project ``self`` to the right (fundamental group) factor in the "WF" style.\n\n EXAMPLES::\n\n sage: E = ExtendedAffineWeylGroup([\'A\',2,1])\n sage: x = E.WF().from_translation(E.lattice_basis()[1]); x\n S0*S2 * pi[1]\n sage: x.to_fundamental_group()\n pi[1]\n '
return self.cartesian_projection(1)
def to_affine_weyl_left(self):
'\n Project ``self`` to the left (affine Weyl group) factor in the "WF" style.\n\n EXAMPLES::\n\n sage: E = ExtendedAffineWeylGroup([\'A\',2,1])\n sage: x = E.WF().from_translation(E.lattice_basis()[1]); x\n S0*S2 * pi[1]\n sage: x.to_affine_weyl_left()\n S0*S2\n '
return self.cartesian_projection(0)
def bruhat_le(self, x):
'\n Return whether ``self`` is less than or equal to `x` in the Bruhat order.\n\n EXAMPLES::\n\n sage: E = ExtendedAffineWeylGroup([\'A\',2,1], affine="s",\n ....: print_tuple=True); WF = E.WF()\n sage: r = E.affine_weyl().from_reduced_word\n sage: v = r([1,0])\n sage: w = r([1,2,0])\n sage: v.bruhat_le(w)\n True\n sage: vv = WF.from_affine_weyl(v); vv\n (s1*s0, pi[0])\n sage: ww = WF.from_affine_weyl(w); ww\n (s1*s2*s0, pi[0])\n sage: vv.bruhat_le(ww)\n True\n sage: f = E.fundamental_group()(2); f\n pi[2]\n sage: ff = WF.from_fundamental(f); ff\n (1, pi[2])\n sage: vv.bruhat_le(ww*ff)\n False\n sage: (vv*ff).bruhat_le(ww*ff)\n True\n '
if (self.cartesian_projection(1) != x.cartesian_projection(1)):
return False
return self.cartesian_projection(0).bruhat_le(x.cartesian_projection(0))
class ExtendedAffineWeylGroupWF(GroupSemidirectProduct, BindableClass):
"\n Extended affine Weyl group, realized as the semidirect product of the affine Weyl group\n by the fundamental group.\n\n INPUT:\n\n - ``E`` -- A parent with realization in :class:`ExtendedAffineWeylGroup_Class`\n\n EXAMPLES::\n\n sage: ExtendedAffineWeylGroup(['A',2,1]).WF()\n Extended affine Weyl group of type ['A', 2, 1] realized by Semidirect product of\n Weyl Group of type ['A', 2, 1] (as a matrix group acting on the root lattice)\n acted upon by Fundamental group of type ['A', 2, 1]\n "
def __init__(self, E):
"\n EXAMPLES::\n\n sage: WF = ExtendedAffineWeylGroup(['D',3,2]).WF()\n sage: TestSuite(WF).run()\n "
def twist(g, w):
return g.act_on_affine_weyl(w)
GroupSemidirectProduct.__init__(self, E.affine_weyl(), E.fundamental_group(), twist=twist, act_to_right=False, print_tuple=E._print_tuple, category=E.Realizations())
self._style = 'WF'
def _repr_(self):
'\n A string representing ``self``.\n\n EXAMPLES::\n\n sage: ExtendedAffineWeylGroup([\'A\',4,2]).WF()._repr_()\n "Extended affine Weyl group of type [\'BC\', 2, 2] realized by Semidirect product of Weyl Group of type [\'BC\', 2, 2] (as a matrix group acting on the root lattice) acted upon by Fundamental group of type [\'BC\', 2, 2]"\n '
return ((self.realization_of()._repr_() + ' realized by ') + super()._repr_())
def from_affine_weyl(self, w):
"\n Return the image of the affine Weyl group element `w` in ``self``.\n\n EXAMPLES::\n\n sage: E = ExtendedAffineWeylGroup(['C',2,1], print_tuple=True)\n sage: E.WF().from_affine_weyl(E.affine_weyl().from_reduced_word([1,2,1,0]))\n (S1*S2*S1*S0, pi[0])\n "
return self((w, self.cartesian_factors()[1].one()))
@cached_method
def simple_reflections(self):
'\n Return the family of simple reflections.\n\n EXAMPLES::\n\n sage: ExtendedAffineWeylGroup(["A",3,1], affine="r").WF().simple_reflections()\n Finite family {0: r0, 1: r1, 2: r2, 3: r3}\n '
E = self.realization_of()
W = E.affine_weyl()
return Family(E.cartan_type().index_set(), (lambda i: self.from_affine_weyl(W.simple_reflection(i))))
@cached_method
def from_fundamental(self, f):
'\n Return the image of `f` under the homomorphism from the fundamental group into\n the right (fundamental group) factor in "WF" style.\n\n EXAMPLES::\n\n sage: E = ExtendedAffineWeylGroup([\'E\',6,1], print_tuple=True); WF = E.WF()\n sage: F = E.fundamental_group()\n sage: [(x, WF.from_fundamental(x)) for x in F]\n [(pi[0], (1, pi[0])), (pi[1], (1, pi[1])), (pi[6], (1, pi[6]))]\n '
return self((self.cartesian_factors()[0].one(), f))
class ExtendedAffineWeylGroupFWElement(GroupSemidirectProduct.Element):
'\n The element class for the "FW" realization.\n '
def has_descent(self, i, side='right', positive=False):
"\n Return whether ``self`` has descent at `i`.\n\n INPUT:\n\n - `i` -- an affine Dynkin index.\n\n OPTIONAL:\n\n - ``side`` -- ``'left'`` or ``'right'`` (default: ``'right'``)\n - ``positive`` -- ``True`` or ``False`` (default: ``False``)\n\n EXAMPLES::\n\n sage: E = ExtendedAffineWeylGroup(['A',2,1])\n sage: x = E.FW().an_element(); x\n pi[2] * S0*S1*S2\n sage: [(i, x.has_descent(i)) for i in E.cartan_type().index_set()]\n [(0, False), (1, False), (2, True)]\n "
if (side == 'left'):
self = (~ self)
if positive:
return (not self.has_descent(i, side='right'))
return self.cartesian_projection(1).has_descent(i, side='right')
def to_fundamental_group(self):
'\n Return the projection of ``self`` to the fundamental group in the "FW" style.\n\n EXAMPLES::\n\n sage: E = ExtendedAffineWeylGroup([\'A\',2,1])\n sage: x = E.FW().from_translation(E.lattice_basis()[2]); x\n pi[2] * S1*S2\n sage: x.to_fundamental_group()\n pi[2]\n '
return self.cartesian_projection(0)
def to_affine_weyl_right(self):
'\n Project ``self`` to the right (affine Weyl group) factor in the "FW" style.\n\n EXAMPLES::\n\n sage: E = ExtendedAffineWeylGroup([\'A\',2,1])\n sage: x = E.FW().from_translation(E.lattice_basis()[1]); x\n pi[1] * S2*S1\n sage: x.to_affine_weyl_right()\n S2*S1\n '
return self.cartesian_projection(1)
def action_on_affine_roots(self, beta):
'\n Act by ``self`` on the affine root lattice element ``beta``.\n\n EXAMPLES::\n\n sage: E = ExtendedAffineWeylGroup([\'A\',2,1], affine="s")\n sage: x = E.FW().an_element(); x\n pi[2] * s0*s1*s2\n sage: v = RootSystem([\'A\',2,1]).root_lattice().an_element(); v\n 2*alpha[0] + 2*alpha[1] + 3*alpha[2]\n sage: x.action_on_affine_roots(v)\n alpha[0] + alpha[1]\n '
g = self.cartesian_projection(0)
w = self.cartesian_projection(1)
return g.act_on_affine_lattice(w.action(beta))
class ExtendedAffineWeylGroupFW(GroupSemidirectProduct, BindableClass):
"\n Extended affine Weyl group, realized as the semidirect product of the affine Weyl group\n by the fundamental group.\n\n INPUT:\n\n - ``E`` -- A parent with realization in :class:`ExtendedAffineWeylGroup_Class`\n\n EXAMPLES::\n\n sage: ExtendedAffineWeylGroup(['A',2,1]).FW()\n Extended affine Weyl group of type ['A', 2, 1] realized by Semidirect product of\n Fundamental group of type ['A', 2, 1] acting on Weyl Group of type ['A', 2, 1]\n (as a matrix group acting on the root lattice)\n "
def __init__(self, E):
"\n\n EXAMPLES::\n\n sage: FW = ExtendedAffineWeylGroup(['D',3,2]).FW()\n sage: TestSuite(FW).run()\n "
def twist(g, w):
return g.act_on_affine_weyl(w)
GroupSemidirectProduct.__init__(self, E.fundamental_group(), E.affine_weyl(), twist=twist, act_to_right=True, print_tuple=E._print_tuple, category=E.Realizations())
self._style = 'FW'
def _repr_(self):
'\n A string representing ``self``.\n\n EXAMPLES::\n\n sage: ExtendedAffineWeylGroup([\'A\',4,2]).FW()._repr_()\n "Extended affine Weyl group of type [\'BC\', 2, 2] realized by Semidirect product of Fundamental group of type [\'BC\', 2, 2] acting on Weyl Group of type [\'BC\', 2, 2] (as a matrix group acting on the root lattice)"\n '
return ((self.realization_of()._repr_() + ' realized by ') + super()._repr_())
@cached_method
def simple_reflections(self):
"\n Return the family of simple reflections of ``self``.\n\n EXAMPLES::\n\n sage: ExtendedAffineWeylGroup(['A',2,1],print_tuple=True).FW().simple_reflections()\n Finite family {0: (pi[0], S0), 1: (pi[0], S1), 2: (pi[0], S2)}\n "
E = self.realization_of()
W = E.affine_weyl()
return Family(E.cartan_type().index_set(), (lambda i: self.from_affine_weyl(W.simple_reflection(i))))
def from_affine_weyl(self, w):
'\n Return the image of `w` under the map of the affine Weyl group into the right\n (affine Weyl group) factor in the "FW" style.\n\n EXAMPLES::\n\n sage: E = ExtendedAffineWeylGroup([\'A\',2,1], print_tuple=True)\n sage: E.FW().from_affine_weyl(E.affine_weyl().from_reduced_word([0,2,1]))\n (pi[0], S0*S2*S1)\n '
return self((self.cartesian_factors()[0].one(), w))
@cached_method
def from_fundamental(self, f):
"\n Return the image of the fundamental group element `f` into ``self``.\n\n EXAMPLES::\n\n sage: E = ExtendedAffineWeylGroup(['A',2,1], print_tuple=True)\n sage: E.FW().from_fundamental(E.fundamental_group()(2))\n (pi[2], 1)\n "
return self((f, self.cartesian_factors()[1].one()))
class ExtendedAffineWeylGroupPvW0Element(GroupSemidirectProduct.Element):
'\n The element class for the "PvW0" realization.\n '
def has_descent(self, i, side='right', positive=False):
"\n Return whether ``self`` has `i` as a descent.\n\n INPUT:\n\n - ``i`` - an affine Dynkin index\n\n OPTIONAL:\n\n - ``side`` -- ``'left'`` or ``'right'`` (default: ``'right'``)\n - ``positive`` -- ``True`` or ``False`` (default: ``False``)\n\n EXAMPLES::\n\n sage: E = ExtendedAffineWeylGroup(['A',4,2])\n sage: w = E.PvW0().from_reduced_word([0,1]); w\n t[Lambda[1]] * s1*s2\n sage: [(i, w.has_descent(i, side='left')) for i in E.cartan_type().index_set()]\n [(0, True), (1, False), (2, False)]\n "
return self.parent().realization_of().PW0()(self).has_descent(i, side=side, positive=positive)
def dual_action(self, la):
"\n Return the action of ``self`` on an element ``la`` of the dual version of the translation lattice.\n\n EXAMPLES::\n\n sage: E = ExtendedAffineWeylGroup(['A',2,1])\n sage: x = E.PvW0().an_element(); x\n t[2*Lambda[1] + 2*Lambda[2]] * s1*s2\n sage: la = E.dual_lattice().an_element(); la\n 2*Lambda[1] + 2*Lambda[2]\n sage: x.dual_action(la)\n -2*Lambda[1] + 4*Lambda[2]\n "
w = self.cartesian_projection(1)
assert (la in w.parent().domain())
return (self.cartesian_projection(0).value + w.action(la))
def to_dual_translation_left(self):
'\n The image of ``self`` under the map that projects to the dual translation lattice\n factor after factoring it to the left as in style "PvW0".\n\n EXAMPLES::\n\n sage: s = ExtendedAffineWeylGroup([\'A\',2,1]).PvW0().simple_reflection(0); s\n t[Lambda[1] + Lambda[2]] * s1*s2*s1\n sage: s.to_dual_translation_left()\n Lambda[1] + Lambda[2]\n '
return self.cartesian_projection(0).value
def to_dual_classical_weyl(self):
'\n Return the image of ``self`` under the homomorphism that projects to the dual classical\n Weyl group factor after rewriting it in either style "PvW0" or "W0Pv".\n\n EXAMPLES::\n\n sage: s = ExtendedAffineWeylGroup([\'A\',2,1]).PvW0().simple_reflection(0); s\n t[Lambda[1] + Lambda[2]] * s1*s2*s1\n sage: s.to_dual_classical_weyl()\n s1*s2*s1\n '
return self.cartesian_projection(1)
def is_translation(self):
"\n Return whether ``self`` is a translation element or not.\n\n EXAMPLES::\n\n sage: PvW0 = ExtendedAffineWeylGroup(['A',2,1]).PvW0()\n sage: t = PvW0.from_reduced_word([1,2,1,0])\n sage: t.is_translation()\n True\n sage: PvW0.simple_reflection(0).is_translation()\n False\n "
w = self.to_dual_classical_weyl()
return (w == w.parent().one())
class ExtendedAffineWeylGroupPvW0(GroupSemidirectProduct, BindableClass):
"\n Extended affine Weyl group, realized as the semidirect product of the dual form of the translation lattice\n by the finite Weyl group.\n\n INPUT:\n\n - ``E`` -- A parent with realization in :class:`ExtendedAffineWeylGroup_Class`\n\n EXAMPLES::\n\n sage: ExtendedAffineWeylGroup(['A',2,1]).PvW0()\n Extended affine Weyl group of type ['A', 2, 1] realized by Semidirect product of\n Multiplicative form of Weight lattice of the Root system of type ['A', 2] acted\n upon by Weyl Group of type ['A', 2] (as a matrix group acting on the weight lattice)\n "
def __init__(self, E):
"\n\n EXAMPLES::\n\n sage: PvW0 = ExtendedAffineWeylGroup(['D',3,2]).PvW0()\n sage: TestSuite(PvW0).run()\n "
def twist(w, l):
return E.exp_dual_lattice()(w.action(l.value))
GroupSemidirectProduct.__init__(self, E.exp_dual_lattice(), E.dual_classical_weyl(), twist=twist, act_to_right=False, prefix0=E._prefixt, print_tuple=E._print_tuple, category=E.Realizations())
self._style = 'PvW0'
def _repr_(self):
'\n A string representing ``self``.\n\n EXAMPLES::\n\n sage: ExtendedAffineWeylGroup([\'A\',4,2]).PvW0()._repr_()\n "Extended affine Weyl group of type [\'BC\', 2, 2] realized by Semidirect product of Multiplicative form of Weight lattice of the Root system of type [\'C\', 2] acted upon by Weyl Group of type [\'C\', 2] (as a matrix group acting on the weight lattice)"\n '
return ((self.realization_of()._repr_() + ' realized by ') + super()._repr_())
def from_dual_translation(self, la):
'\n Map the dual translation lattice element ``la`` into ``self``.\n\n EXAMPLES::\n\n sage: E = ExtendedAffineWeylGroup([\'A\',2,1], translation="tau",\n ....: print_tuple=True)\n sage: la = E.dual_lattice().an_element(); la\n 2*Lambda[1] + 2*Lambda[2]\n sage: E.PvW0().from_dual_translation(la)\n (tau[2*Lambda[1] + 2*Lambda[2]], 1)\n '
E = self.realization_of()
return self((E.exp_dual_lattice()(la), self.cartesian_factors()[1].one()))
@cached_method
def simple_reflections(self):
"\n Return a family for the simple reflections of ``self``.\n\n EXAMPLES::\n\n sage: ExtendedAffineWeylGroup(['A',3,1]).PvW0().simple_reflections()\n Finite family {0: t[Lambda[1] + Lambda[3]] * s1*s2*s3*s2*s1,\n 1: s1, 2: s2, 3: s3}\n "
E = self.realization_of()
return Family(E.cartan_type().index_set(), (lambda i: self(E.PW0().simple_reflection(i))))
def from_dual_classical_weyl(self, w):
"\n Return the image of `w` under the homomorphism of the dual form of the classical Weyl group into ``self``.\n\n EXAMPLES::\n\n sage: E = ExtendedAffineWeylGroup(['A',3,1], print_tuple=True)\n sage: E.PvW0().from_dual_classical_weyl(\n ....: E.dual_classical_weyl().from_reduced_word([1,2]))\n (t[0], s1*s2)\n "
return self((self.cartesian_factors()[0].one(), w))
class ExtendedAffineWeylGroupW0PvElement(GroupSemidirectProduct.Element):
'\n The element class for the "W0Pv" realization.\n '
def dual_action(self, la):
"\n Return the action of ``self`` on an element ``la`` of the dual version of the translation lattice.\n\n EXAMPLES::\n\n sage: E = ExtendedAffineWeylGroup(['A',2,1])\n sage: x = E.W0Pv().an_element(); x\n s1*s2 * t[2*Lambda[1] + 2*Lambda[2]]\n sage: la = E.dual_lattice().an_element(); la\n 2*Lambda[1] + 2*Lambda[2]\n sage: x.dual_action(la)\n -8*Lambda[1] + 4*Lambda[2]\n "
w = self.cartesian_projection(0)
assert (la in w.parent().domain())
return w.action((self.cartesian_projection(1).value + la))
def has_descent(self, i, side='right', positive=False):
"\n Return whether ``self`` has `i` as a descent.\n\n INPUT:\n\n - `i` - an affine Dynkin index\n\n OPTIONAL:\n\n - ``side`` - 'left' or 'right' (default: 'right')\n - ``positive`` - True or False (default: False)\n\n EXAMPLES::\n\n sage: w = ExtendedAffineWeylGroup(['A',4,2]).W0Pv().from_reduced_word([0,1]); w\n s1*s2 * t[Lambda[1] - Lambda[2]]\n sage: w.has_descent(0, side='left')\n True\n "
return self.parent().realization_of().W0P()(self).has_descent(i, side=side, positive=positive)
def to_dual_translation_right(self):
'\n The image of ``self`` under the map that projects to the dual translation lattice\n factor after factoring it to the right as in style "W0Pv".\n\n EXAMPLES::\n\n sage: s = ExtendedAffineWeylGroup([\'A\',2,1]).W0Pv().simple_reflection(0); s\n s1*s2*s1 * t[-Lambda[1] - Lambda[2]]\n sage: s.to_dual_translation_right()\n -Lambda[1] - Lambda[2]\n '
return self.cartesian_projection(1).value
def to_dual_classical_weyl(self):
'\n Return the image of ``self`` under the homomorphism that projects to the dual classical\n Weyl group factor after rewriting it in either style "PvW0" or "W0Pv".\n\n EXAMPLES::\n\n sage: s = ExtendedAffineWeylGroup([\'A\',2,1]).W0Pv().simple_reflection(0); s\n s1*s2*s1 * t[-Lambda[1] - Lambda[2]]\n sage: s.to_dual_classical_weyl()\n s1*s2*s1\n '
return self.cartesian_projection(0)
def is_translation(self):
"\n Return whether ``self`` is a translation element or not.\n\n EXAMPLES::\n\n sage: ExtendedAffineWeylGroup(['A',2,1]).W0Pv().from_reduced_word([1,2,1,0]).is_translation()\n True\n "
w = self.to_dual_classical_weyl()
return (w == w.parent().one())
class ExtendedAffineWeylGroupW0Pv(GroupSemidirectProduct, BindableClass):
"\n Extended affine Weyl group, realized as the semidirect product of the finite Weyl group, acting on the\n dual form of the translation lattice.\n\n INPUT:\n\n - `E` -- A parent with realization in :class:`ExtendedAffineWeylGroup_Class`\n\n EXAMPLES::\n\n sage: ExtendedAffineWeylGroup(['A',2,1]).W0Pv()\n Extended affine Weyl group of type ['A', 2, 1] realized by Semidirect product of\n Weyl Group of type ['A', 2] (as a matrix group acting on the weight lattice)\n acting on Multiplicative form of Weight lattice of the Root system of type ['A', 2]\n "
def __init__(self, E):
"\n EXAMPLES::\n\n sage: W0Pv = ExtendedAffineWeylGroup(['D',3,2]).W0Pv()\n sage: TestSuite(W0Pv).run()\n "
def twist(w, l):
return E.exp_dual_lattice()(w.action(l.value))
GroupSemidirectProduct.__init__(self, E.dual_classical_weyl(), E.exp_dual_lattice(), twist=twist, act_to_right=True, prefix1=E._prefixt, print_tuple=E._print_tuple, category=E.Realizations())
self._style = 'W0Pv'
def _repr_(self):
'\n A string representing ``self``.\n\n EXAMPLES::\n\n sage: ExtendedAffineWeylGroup([\'A\',4,2]).W0Pv()._repr_()\n "Extended affine Weyl group of type [\'BC\', 2, 2] realized by Semidirect product of Weyl Group of type [\'C\', 2] (as a matrix group acting on the weight lattice) acting on Multiplicative form of Weight lattice of the Root system of type [\'C\', 2]"\n '
return ((self.realization_of()._repr_() + ' realized by ') + super()._repr_())
def from_dual_translation(self, la):
'\n Map the dual translation lattice element ``la`` into ``self``.\n\n EXAMPLES::\n\n sage: E = ExtendedAffineWeylGroup([\'A\',2,1], translation="tau",\n ....: print_tuple=True)\n sage: la = E.dual_lattice().an_element(); la\n 2*Lambda[1] + 2*Lambda[2]\n sage: E.W0Pv().from_dual_translation(la)\n (1, tau[2*Lambda[1] + 2*Lambda[2]])\n '
E = self.realization_of()
return self((self.cartesian_factors()[0].one(), E.exp_dual_lattice()(la)))
@cached_method
def simple_reflections(self):
"\n Return a family for the simple reflections of ``self``.\n\n EXAMPLES::\n\n sage: ExtendedAffineWeylGroup(['A',3,1]).W0Pv().simple_reflections()\n Finite family {0: s1*s2*s3*s2*s1 * t[-Lambda[1] - Lambda[3]],\n 1: s1, 2: s2, 3: s3}\n "
E = self.realization_of()
return Family(E.cartan_type().index_set(), (lambda i: self(E.PW0().simple_reflection(i))))
def from_dual_classical_weyl(self, w):
"\n Return the image of `w` under the homomorphism of the dual form of the classical Weyl group into ``self``.\n\n EXAMPLES::\n\n sage: E = ExtendedAffineWeylGroup(['A',3,1],print_tuple=True)\n sage: E.W0Pv().from_dual_classical_weyl(E.dual_classical_weyl().from_reduced_word([1,2]))\n (s1*s2, t[0])\n "
return self((w, self.cartesian_factors()[1].one()))
|
def FundamentalGroupOfExtendedAffineWeylGroup(cartan_type, prefix='pi', general_linear=None):
'\n Factory for the fundamental group of an extended affine Weyl group.\n\n INPUT:\n\n - ``cartan_type`` -- a Cartan type that is either affine or finite, with the latter being a\n shorthand for the untwisted affinization\n - ``prefix`` (default: \'pi\') -- string that labels the elements of the group\n - ``general_linear`` -- (default: None, meaning False) In untwisted type A, if True, use the\n universal central extension\n\n .. RUBRIC:: Fundamental group\n\n Associated to each affine Cartan type `\\tilde{X}` is an extended affine Weyl group `E`.\n Its subgroup of length-zero elements is called the fundamental group `F`.\n The group `F` can be identified with a subgroup of the group of automorphisms of the\n affine Dynkin diagram. As such, every element of `F` can be viewed as a permutation of the\n set `I` of affine Dynkin nodes.\n\n Let `0 \\in I` be the distinguished affine node; it is the one whose removal produces the\n associated finite Cartan type (call it `X`). A node `i \\in I` is called *special*\n if some automorphism of the affine Dynkin diagram, sends `0` to `i`.\n The node `0` is always special due to the identity automorphism.\n There is a bijection of the set of special nodes with the fundamental group. We denote the\n image of `i` by `\\pi_i`. The structure of `F` is determined as follows.\n\n - `\\tilde{X}` is untwisted -- `F` is isomorphic to `P^\\vee/Q^\\vee` where `P^\\vee` and `Q^\\vee` are the\n coweight and coroot lattices of type `X`. The group `P^\\vee/Q^\\vee` consists of the cosets `\\omega_i^\\vee + Q^\\vee`\n for special nodes `i`, where `\\omega_0^\\vee = 0` by convention. In this case the special nodes `i`\n are the *cominuscule* nodes, the ones such that `\\omega_i^\\vee(\\alpha_j)` is `0` or `1` for all `j\\in I_0 = I \\setminus \\{0\\}`.\n For `i` special, addition by `\\omega_i^\\vee+Q^\\vee` permutes `P^\\vee/Q^\\vee` and therefore permutes the set of special nodes.\n This permutation extends uniquely to an automorphism of the affine Dynkin diagram.\n - `\\tilde{X}` is dual untwisted -- (that is, the dual of `\\tilde{X}` is untwisted) `F` is isomorphic to `P/Q`\n where `P` and `Q` are the weight and root lattices of type `X`. The group `P/Q` consists of the cosets\n `\\omega_i + Q` for special nodes `i`, where `\\omega_0 = 0` by convention. In this case the special nodes `i`\n are the *minuscule* nodes, the ones such that `\\alpha_j^\\vee(\\omega_i)` is `0` or `1` for all `j \\in I_0`.\n For `i` special, addition by `\\omega_i+Q` permutes `P/Q` and therefore permutes the set of special nodes.\n This permutation extends uniquely to an automorphism of the affine Dynkin diagram.\n - `\\tilde{X}` is mixed -- (that is, not of the above two types) `F` is the trivial group.\n\n EXAMPLES::\n\n sage: from sage.combinat.root_system.fundamental_group import FundamentalGroupOfExtendedAffineWeylGroup\n sage: F = FundamentalGroupOfExtendedAffineWeylGroup([\'A\',3,1]); F\n Fundamental group of type [\'A\', 3, 1]\n sage: F.cartan_type().dynkin_diagram()\n 0\n O-------+\n | |\n | |\n O---O---O\n 1 2 3\n A3~\n sage: F.special_nodes()\n (0, 1, 2, 3)\n sage: F(1)^2\n pi[2]\n sage: F(1)*F(2)\n pi[3]\n sage: F(3)^(-1)\n pi[1]\n\n sage: F = FundamentalGroupOfExtendedAffineWeylGroup("B3"); F\n Fundamental group of type [\'B\', 3, 1]\n sage: F.cartan_type().dynkin_diagram()\n O 0\n |\n |\n O---O=>=O\n 1 2 3\n B3~\n sage: F.special_nodes()\n (0, 1)\n\n sage: F = FundamentalGroupOfExtendedAffineWeylGroup("C2"); F\n Fundamental group of type [\'C\', 2, 1]\n sage: F.cartan_type().dynkin_diagram()\n O=>=O=<=O\n 0 1 2\n C2~\n sage: F.special_nodes()\n (0, 2)\n\n sage: F = FundamentalGroupOfExtendedAffineWeylGroup("D4"); F\n Fundamental group of type [\'D\', 4, 1]\n sage: F.cartan_type().dynkin_diagram()\n O 4\n |\n |\n O---O---O\n 1 |2 3\n |\n O 0\n D4~\n sage: F.special_nodes()\n (0, 1, 3, 4)\n sage: (F(4), F(4)^2)\n (pi[4], pi[0])\n\n sage: F = FundamentalGroupOfExtendedAffineWeylGroup("D5"); F\n Fundamental group of type [\'D\', 5, 1]\n sage: F.cartan_type().dynkin_diagram()\n 0 O O 5\n | |\n | |\n O---O---O---O\n 1 2 3 4\n D5~\n sage: F.special_nodes()\n (0, 1, 4, 5)\n sage: (F(5), F(5)^2, F(5)^3, F(5)^4)\n (pi[5], pi[1], pi[4], pi[0])\n sage: F = FundamentalGroupOfExtendedAffineWeylGroup("E6"); F\n Fundamental group of type [\'E\', 6, 1]\n sage: F.cartan_type().dynkin_diagram()\n O 0\n |\n |\n O 2\n |\n |\n O---O---O---O---O\n 1 3 4 5 6\n E6~\n sage: F.special_nodes()\n (0, 1, 6)\n sage: F(1)^2\n pi[6]\n\n sage: F = FundamentalGroupOfExtendedAffineWeylGroup([\'D\',4,2]); F\n Fundamental group of type [\'C\', 3, 1]^*\n sage: F.cartan_type().dynkin_diagram()\n O=<=O---O=>=O\n 0 1 2 3\n C3~*\n sage: F.special_nodes()\n (0, 3)\n\n We also implement a fundamental group for `GL_n`. It is defined to be the group of integers, which is the\n covering group of the fundamental group Z/nZ for affine `SL_n`::\n\n sage: F = FundamentalGroupOfExtendedAffineWeylGroup([\'A\',2,1], general_linear=True); F\n Fundamental group of GL(3)\n sage: x = F.an_element(); x\n pi[5]\n sage: x*x\n pi[10]\n sage: x.inverse()\n pi[-5]\n sage: wt = F.cartan_type().classical().root_system().ambient_space().an_element(); wt\n (2, 2, 3)\n sage: x.act_on_classical_ambient(wt)\n (2, 3, 2)\n sage: w = WeylGroup(F.cartan_type(),prefix="s").an_element(); w\n s0*s1*s2\n sage: x.act_on_affine_weyl(w)\n s2*s0*s1\n '
cartan_type = CartanType(cartan_type)
if cartan_type.is_finite():
cartan_type = cartan_type.affine()
if (not cartan_type.is_affine()):
raise NotImplementedError('Cartan type is not affine')
if (general_linear is True):
if (cartan_type.is_untwisted_affine() and (cartan_type.type() == 'A')):
return FundamentalGroupGL(cartan_type, prefix)
else:
raise ValueError('General Linear Fundamental group is untwisted type A')
return FundamentalGroupOfExtendedAffineWeylGroup_Class(cartan_type, prefix, finite=True)
|
class FundamentalGroupElement(MultiplicativeGroupElement):
def __init__(self, parent, x):
'\n This should not be called directly\n\n EXAMPLES::\n\n sage: from sage.combinat.root_system.fundamental_group import FundamentalGroupOfExtendedAffineWeylGroup\n sage: x = FundamentalGroupOfExtendedAffineWeylGroup([\'A\',4,1], prefix="f").an_element()\n sage: TestSuite(x).run()\n '
if (x not in parent.special_nodes()):
raise ValueError(('%s is not a special node' % x))
self._value = x
MultiplicativeGroupElement.__init__(self, parent)
def value(self):
'\n Return the special node which indexes the special automorphism ``self``.\n\n EXAMPLES::\n\n sage: from sage.combinat.root_system.fundamental_group import FundamentalGroupOfExtendedAffineWeylGroup\n sage: F = FundamentalGroupOfExtendedAffineWeylGroup([\'A\',4,1], prefix="f")\n sage: F.special_nodes()\n (0, 1, 2, 3, 4)\n sage: x = F(4); x\n f[4]\n sage: x.value()\n 4\n '
return self._value
def _repr_(self):
'\n Return a string representing ``self``.\n\n EXAMPLES::\n\n sage: from sage.combinat.root_system.fundamental_group import FundamentalGroupOfExtendedAffineWeylGroup\n sage: F = FundamentalGroupOfExtendedAffineWeylGroup([\'A\',4,1], prefix="f")\n sage: F(2)^3 # indirect doctest\n f[1]\n '
return (((self.parent()._prefix + '[') + repr(self.value())) + ']')
def __invert__(self):
'\n Return the inverse element of ``self``.\n\n EXAMPLES::\n\n sage: from sage.combinat.root_system.fundamental_group import FundamentalGroupOfExtendedAffineWeylGroup\n sage: F = FundamentalGroupOfExtendedAffineWeylGroup([\'A\',3,1])\n sage: F(1).inverse() # indirect doctest\n pi[3]\n sage: F = FundamentalGroupOfExtendedAffineWeylGroup([\'E\',6,1], prefix="f")\n sage: F(1).inverse()\n f[6]\n '
par = self.parent()
return self.__class__(par, par.dual_node(self.value()))
def _richcmp_(self, x, op):
"\n Compare ``self`` with `x`.\n\n EXAMPLES::\n\n sage: from sage.combinat.root_system.fundamental_group import FundamentalGroupOfExtendedAffineWeylGroup\n sage: F = FundamentalGroupOfExtendedAffineWeylGroup(['A',3,1])\n sage: x = F(0); y = F(2)\n sage: y > x\n True\n sage: y == y\n True\n sage: y != y\n False\n sage: x <= y\n True\n "
return richcmp(self.value(), x.value(), op)
def act_on_affine_weyl(self, w):
'\n Act by ``self`` on the element `w` of the affine Weyl group.\n\n EXAMPLES::\n\n sage: from sage.combinat.root_system.fundamental_group import FundamentalGroupOfExtendedAffineWeylGroup\n sage: F = FundamentalGroupOfExtendedAffineWeylGroup([\'A\',3,1])\n sage: W = WeylGroup(F.cartan_type(),prefix="s")\n sage: w = W.from_reduced_word([2,3,0])\n sage: F(1).act_on_affine_weyl(w).reduced_word()\n [3, 0, 1]\n '
par = self.parent()
if (self == par.one()):
return w
action = par.action(self.value())
return w.parent().from_reduced_word([action(j) for j in w.reduced_word()])
def act_on_affine_lattice(self, wt):
"\n Act by ``self`` on the element ``wt`` of an affine root/weight lattice realization.\n\n EXAMPLES::\n\n sage: from sage.combinat.root_system.fundamental_group import FundamentalGroupOfExtendedAffineWeylGroup\n sage: F = FundamentalGroupOfExtendedAffineWeylGroup(['A',3,1])\n sage: wt = RootSystem(F.cartan_type()).weight_lattice().an_element(); wt\n 2*Lambda[0] + 2*Lambda[1] + 3*Lambda[2]\n sage: F(3).act_on_affine_lattice(wt)\n 2*Lambda[0] + 3*Lambda[1] + 2*Lambda[3]\n\n .. WARNING::\n\n Doesn't work on ambient spaces.\n "
return wt.map_support(self.parent().action(self.value()))
def __hash__(self):
"\n Return the hash of ``self``.\n\n TESTS:\n\n Check that :issue:`36121` is fixed::\n\n sage: W = ExtendedAffineWeylGroup('A4')\n sage: fun = W.fundamental_group().an_element()\n sage: hash(fun) == hash(fun.value())\n True\n "
return hash(self.value())
|
class FundamentalGroupOfExtendedAffineWeylGroup_Class(UniqueRepresentation, Parent):
'\n The group of length zero elements in the extended affine Weyl group.\n '
Element = FundamentalGroupElement
def __init__(self, cartan_type, prefix, finite=True):
"\n\n EXAMPLES::\n\n sage: from sage.combinat.root_system.fundamental_group import FundamentalGroupOfExtendedAffineWeylGroup\n sage: F = FundamentalGroupOfExtendedAffineWeylGroup(['A',3,1])\n sage: F in Groups().Commutative().Finite()\n True\n sage: TestSuite(F).run()\n "
def leading_support(beta):
'\n Given a dictionary with one key, return this key\n '
supp = beta.support()
assert (len(supp) == 1)
return supp[0]
self._cartan_type = cartan_type
self._prefix = prefix
special_node = cartan_type.special_node()
self._special_nodes = cartan_type.special_nodes()
inverse_dict = {}
inverse_dict[special_node] = special_node
auto_dict = {}
for i in cartan_type.index_set():
auto_dict[(special_node, i)] = i
reduced_words_dict = {}
reduced_words_dict[0] = tuple()
if cartan_type.dual().is_untwisted_affine():
cartan_type = cartan_type.dual()
if cartan_type.is_untwisted_affine():
cartan_type_classical = cartan_type.classical()
I = [i for i in cartan_type_classical.index_set()]
Q = RootSystem(cartan_type_classical).root_lattice()
alpha = Q.simple_roots()
omega = RootSystem(cartan_type_classical).weight_lattice().fundamental_weights()
W = Q.weyl_group(prefix='s')
for i in self._special_nodes:
if (i == special_node):
continue
(antidominant_weight, reduced_word) = omega[i].to_dominant_chamber(reduced_word=True, positive=False)
reduced_words_dict[i] = tuple(reduced_word)
w0i = W.from_reduced_word(reduced_word)
idual = leading_support((- antidominant_weight))
inverse_dict[i] = idual
auto_dict[(i, special_node)] = i
for j in I:
if (j == idual):
auto_dict[(i, j)] = special_node
else:
auto_dict[(i, j)] = leading_support(w0i.action(alpha[j]))
self._action = Family(self._special_nodes, (lambda i: Family(cartan_type.index_set(), (lambda j: auto_dict[(i, j)]))))
self._dual_node = Family(self._special_nodes, inverse_dict.__getitem__)
self._reduced_words = Family(self._special_nodes, reduced_words_dict.__getitem__)
if finite:
cat = Category.join((Groups().Commutative().Finite(), EnumeratedSets()))
else:
cat = Groups().Commutative().Infinite()
Parent.__init__(self, category=cat)
@cached_method
def one(self):
"\n Return the identity element of the fundamental group.\n\n EXAMPLES::\n\n sage: from sage.combinat.root_system.fundamental_group import FundamentalGroupOfExtendedAffineWeylGroup\n sage: F = FundamentalGroupOfExtendedAffineWeylGroup(['A',3,1])\n sage: F.one()\n pi[0]\n "
return self(self.cartan_type().special_node())
def product(self, x, y):
"\n Return the product of `x` and `y`.\n\n EXAMPLES::\n\n sage: from sage.combinat.root_system.fundamental_group import FundamentalGroupOfExtendedAffineWeylGroup\n sage: F = FundamentalGroupOfExtendedAffineWeylGroup(['A',3,1])\n sage: F.special_nodes()\n (0, 1, 2, 3)\n sage: F(2)*F(3)\n pi[1]\n sage: F(1)*F(3)^(-1)\n pi[2]\n "
return self(self.action(x.value())(y.value()))
def cartan_type(self):
"\n The Cartan type of ``self``.\n\n EXAMPLES::\n\n sage: from sage.combinat.root_system.fundamental_group import FundamentalGroupOfExtendedAffineWeylGroup\n sage: FundamentalGroupOfExtendedAffineWeylGroup(['A',3,1]).cartan_type()\n ['A', 3, 1]\n "
return self._cartan_type
def _repr_(self):
"\n A string representing ``self``.\n\n EXAMPLES::\n\n sage: from sage.combinat.root_system.fundamental_group import FundamentalGroupOfExtendedAffineWeylGroup\n sage: FundamentalGroupOfExtendedAffineWeylGroup(['A',3,1]) # indirect doctest\n Fundamental group of type ['A', 3, 1]\n "
return ('Fundamental group of type %s' % self.cartan_type())
def special_nodes(self):
"\n Return the special nodes of ``self``.\n\n See :meth:`sage.combinat.root_system.cartan_type.special_nodes()`.\n\n EXAMPLES::\n\n sage: from sage.combinat.root_system.fundamental_group import FundamentalGroupOfExtendedAffineWeylGroup\n sage: FundamentalGroupOfExtendedAffineWeylGroup(['D',4,1]).special_nodes()\n (0, 1, 3, 4)\n sage: FundamentalGroupOfExtendedAffineWeylGroup(['A',2,1]).special_nodes()\n (0, 1, 2)\n sage: FundamentalGroupOfExtendedAffineWeylGroup(['C',3,1]).special_nodes()\n (0, 3)\n sage: FundamentalGroupOfExtendedAffineWeylGroup(['D',4,2]).special_nodes()\n (0, 3)\n sage: FundamentalGroupOfExtendedAffineWeylGroup(['A',2,1], general_linear=True).special_nodes()\n Integer Ring\n\n "
return self._special_nodes
def group_generators(self):
'\n Return a tuple of generators of the fundamental group.\n\n .. WARNING::\n\n This returns the entire group, a necessary behavior because it\n is used in :meth:`__iter__`.\n\n EXAMPLES::\n\n sage: from sage.combinat.root_system.fundamental_group import FundamentalGroupOfExtendedAffineWeylGroup\n sage: FundamentalGroupOfExtendedAffineWeylGroup([\'E\',6,1],prefix="f").group_generators()\n Finite family {0: f[0], 1: f[1], 6: f[6]}\n '
return Family(self.special_nodes(), self)
def __iter__(self):
'\n Return the iterator for ``self``.\n\n EXAMPLES::\n\n sage: from sage.combinat.root_system.fundamental_group import FundamentalGroupOfExtendedAffineWeylGroup\n sage: F = FundamentalGroupOfExtendedAffineWeylGroup([\'E\',6,1],prefix="f")\n sage: [x for x in F] # indirect doctest\n [f[0], f[1], f[6]]\n '
return iter(self.group_generators())
@cached_method
def an_element(self):
'\n Return an element of ``self``.\n\n EXAMPLES::\n\n sage: from sage.combinat.root_system.fundamental_group import FundamentalGroupOfExtendedAffineWeylGroup\n sage: FundamentalGroupOfExtendedAffineWeylGroup([\'A\',4,1],prefix="f").an_element()\n f[4]\n '
return self.last()
@cached_method
def index_set(self):
"\n The node set of the affine Cartan type of ``self``.\n\n EXAMPLES::\n\n sage: from sage.combinat.root_system.fundamental_group import FundamentalGroupOfExtendedAffineWeylGroup\n sage: FundamentalGroupOfExtendedAffineWeylGroup(['A',2,1]).index_set()\n (0, 1, 2)\n\n "
return self.cartan_type().index_set()
def action(self, i):
"\n Return a function which permutes the affine Dynkin node set by the `i`-th special automorphism.\n\n EXAMPLES::\n\n sage: from sage.combinat.root_system.fundamental_group import FundamentalGroupOfExtendedAffineWeylGroup\n sage: F = FundamentalGroupOfExtendedAffineWeylGroup(['A',2,1])\n sage: [[(i, j, F.action(i)(j)) for j in F.index_set()] for i in F.special_nodes()]\n [[(0, 0, 0), (0, 1, 1), (0, 2, 2)], [(1, 0, 1), (1, 1, 2), (1, 2, 0)], [(2, 0, 2), (2, 1, 0), (2, 2, 1)]]\n sage: G = FundamentalGroupOfExtendedAffineWeylGroup(['D',4,1])\n sage: [[(i, j, G.action(i)(j)) for j in G.index_set()] for i in G.special_nodes()]\n [[(0, 0, 0), (0, 1, 1), (0, 2, 2), (0, 3, 3), (0, 4, 4)], [(1, 0, 1), (1, 1, 0), (1, 2, 2), (1, 3, 4), (1, 4, 3)], [(3, 0, 3), (3, 1, 4), (3, 2, 2), (3, 3, 0), (3, 4, 1)], [(4, 0, 4), (4, 1, 3), (4, 2, 2), (4, 3, 1), (4, 4, 0)]]\n "
return (lambda j: self._action[i][j])
def dual_node(self, i):
"\n Return the node that indexes the inverse of the `i`-th element.\n\n EXAMPLES::\n\n sage: from sage.combinat.root_system.fundamental_group import FundamentalGroupOfExtendedAffineWeylGroup\n sage: F = FundamentalGroupOfExtendedAffineWeylGroup(['A',4,1])\n sage: [(i, F.dual_node(i)) for i in F.special_nodes()]\n [(0, 0), (1, 4), (2, 3), (3, 2), (4, 1)]\n sage: G = FundamentalGroupOfExtendedAffineWeylGroup(['E',6,1])\n sage: [(i, G.dual_node(i)) for i in G.special_nodes()]\n [(0, 0), (1, 6), (6, 1)]\n sage: H = FundamentalGroupOfExtendedAffineWeylGroup(['D',5,1])\n sage: [(i, H.dual_node(i)) for i in H.special_nodes()]\n [(0, 0), (1, 1), (4, 5), (5, 4)]\n "
return self._dual_node[i]
def reduced_word(self, i):
"\n Return a reduced word for the finite Weyl group element associated with the `i`-th special automorphism.\n\n More precisely, for each special node `i`, ``self.reduced_word(i)`` is a reduced word for\n the element `v` in the finite Weyl group such that in the extended affine Weyl group,\n the `i`-th special automorphism is equal to `t v` where `t` is a translation element.\n\n EXAMPLES::\n\n sage: from sage.combinat.root_system.fundamental_group import FundamentalGroupOfExtendedAffineWeylGroup\n sage: F = FundamentalGroupOfExtendedAffineWeylGroup(['A',3,1])\n sage: [(i, F.reduced_word(i)) for i in F.special_nodes()]\n [(0, ()), (1, (1, 2, 3)), (2, (2, 1, 3, 2)), (3, (3, 2, 1))]\n "
return self._reduced_words[i]
|
class FundamentalGroupGLElement(FundamentalGroupElement):
def act_on_classical_ambient(self, wt):
"\n Act by ``self`` on the classical ambient weight vector ``wt``.\n\n EXAMPLES::\n\n sage: from sage.combinat.root_system.fundamental_group import FundamentalGroupOfExtendedAffineWeylGroup\n sage: F = FundamentalGroupOfExtendedAffineWeylGroup(['A',2,1], general_linear=True)\n sage: f = F.an_element(); f\n pi[5]\n sage: la = F.cartan_type().classical().root_system().ambient_space().an_element(); la\n (2, 2, 3)\n sage: f.act_on_classical_ambient(la)\n (2, 3, 2)\n "
return wt.map_support(self.parent().action(self.value()))
|
class FundamentalGroupGL(FundamentalGroupOfExtendedAffineWeylGroup_Class):
'\n Fundamental group of `GL_n`. It is just the integers with extra privileges.\n '
Element = FundamentalGroupGLElement
def __init__(self, cartan_type, prefix='pi'):
"\n\n EXAMPLES::\n\n sage: from sage.combinat.root_system.fundamental_group import FundamentalGroupOfExtendedAffineWeylGroup\n sage: F = FundamentalGroupOfExtendedAffineWeylGroup(['A',2,1], general_linear=True)\n sage: F in Groups().Commutative().Infinite()\n True\n sage: TestSuite(F).run()\n "
FundamentalGroupOfExtendedAffineWeylGroup_Class.__init__(self, cartan_type, prefix, finite=False)
self._special_nodes = ZZ
self._n = (cartan_type.n + 1)
@cached_method
def one(self):
"\n Return the identity element of the fundamental group.\n\n EXAMPLES::\n\n sage: from sage.combinat.root_system.fundamental_group import FundamentalGroupOfExtendedAffineWeylGroup\n sage: FundamentalGroupOfExtendedAffineWeylGroup(['A',2,1], general_linear=True).one()\n pi[0]\n "
return self(ZZ.zero())
def product(self, x, y):
"\n Return the product of `x` and `y`.\n\n EXAMPLES::\n\n sage: from sage.combinat.root_system.fundamental_group import FundamentalGroupOfExtendedAffineWeylGroup\n sage: F = FundamentalGroupOfExtendedAffineWeylGroup(['A',2,1], general_linear=True)\n sage: F.special_nodes()\n Integer Ring\n sage: F(2)*F(3)\n pi[5]\n sage: F(1)*F(3)^(-1)\n pi[-2]\n "
return self((x.value() + y.value()))
def _repr_(self):
"\n Return a string representing the fundamental group.\n\n EXAMPLES::\n\n sage: from sage.combinat.root_system.fundamental_group import FundamentalGroupOfExtendedAffineWeylGroup\n sage: FundamentalGroupOfExtendedAffineWeylGroup(['A',2,1], general_linear=True) # indirect doctest\n Fundamental group of GL(3)\n "
return ('Fundamental group of GL(%s)' % self._n)
def family(self):
"\n The family associated with the set of special nodes.\n\n EXAMPLES::\n\n sage: from sage.combinat.root_system.fundamental_group import FundamentalGroupOfExtendedAffineWeylGroup\n sage: fam = FundamentalGroupOfExtendedAffineWeylGroup(['A',2,1], general_linear=True).family() # indirect doctest\n sage: fam\n Lazy family (<lambda>(i))_{i in Integer Ring}\n sage: fam[-3]\n -3\n "
return LazyFamily(ZZ, (lambda i: i))
@cached_method
def an_element(self):
"\n An element of ``self``.\n\n EXAMPLES::\n\n sage: from sage.combinat.root_system.fundamental_group import FundamentalGroupOfExtendedAffineWeylGroup\n sage: FundamentalGroupOfExtendedAffineWeylGroup(['A',2,1], general_linear=True).an_element()\n pi[5]\n "
return self(ZZ(5))
def some_elements(self):
"\n Return some elements of ``self``.\n\n EXAMPLES::\n\n sage: from sage.combinat.root_system.fundamental_group import FundamentalGroupOfExtendedAffineWeylGroup\n sage: FundamentalGroupOfExtendedAffineWeylGroup(['A',2,1], general_linear=True).some_elements()\n [pi[-2], pi[2], pi[5]]\n "
return [self(ZZ(i)) for i in [(- 2), 2, 5]]
def group_generators(self):
"\n Return group generators for ``self``.\n\n EXAMPLES::\n\n sage: from sage.combinat.root_system.fundamental_group import FundamentalGroupOfExtendedAffineWeylGroup\n sage: FundamentalGroupOfExtendedAffineWeylGroup(['A',2,1], general_linear=True).group_generators()\n (pi[1],)\n "
return (self(ZZ.one()),)
def action(self, i):
"\n The action of the `i`-th automorphism on the affine Dynkin node set.\n\n EXAMPLES::\n\n sage: from sage.combinat.root_system.fundamental_group import FundamentalGroupOfExtendedAffineWeylGroup\n sage: F = FundamentalGroupOfExtendedAffineWeylGroup(['A',2,1], general_linear=True)\n sage: F.action(4)(2)\n 0\n sage: F.action(-4)(2)\n 1\n "
return (lambda j: ((i + j) % self._n))
def dual_node(self, i):
"\n The node whose special automorphism is inverse to that of `i`.\n\n EXAMPLES::\n\n sage: from sage.combinat.root_system.fundamental_group import FundamentalGroupOfExtendedAffineWeylGroup\n sage: F = FundamentalGroupOfExtendedAffineWeylGroup(['A',2,1], general_linear=True)\n sage: F.dual_node(2)\n -2\n "
return (- i)
@cached_method
def reduced_word(self, i):
"\n A reduced word for the finite permutation part of the\n special automorphism indexed by `i`.\n\n More precisely, return a reduced word for the finite Weyl group element `u`\n where `i`-th automorphism (expressed in the extended affine Weyl group)\n has the form `t u` where `t` is a translation element.\n\n EXAMPLES::\n\n sage: from sage.combinat.root_system.fundamental_group import FundamentalGroupOfExtendedAffineWeylGroup\n sage: F = FundamentalGroupOfExtendedAffineWeylGroup(['A',2,1], general_linear=True)\n sage: F.reduced_word(10)\n (1, 2)\n "
i = (i % self._n)
if (i == 0):
return tuple()
om = self.cartan_type().classical().root_system().weight_lattice().fundamental_weight(i)
return tuple((- om).reduced_word())
|
class HeckeAlgebraRepresentation(WithEqualityById, SageObject):
'\n A representation of an (affine) Hecke algebra given by the action of the `T` generators\n\n Let `F_i` be a family of operators implementing an action of the\n operators `(T_i)_{i\\in I}` of the Hecke algebra on some vector\n space ``domain``, given by their action on the basis of\n ``domain``. This constructs the family of operators `(F_w)_{w\\in\n W}` describing the action of all elements of the basis\n `(T_w)_{w\\in W}` of the Hecke algebra. This is achieved by\n linearity on the first argument, and applying recursively the\n `F_i` along a reduced word for `w=s_{i_1}\\cdots s_{i_k}`:\n\n .. MATH::\n\n F_w (x) = F_{i_k}\\circ\\cdots\\circ F_{i_1}(x) .\n\n INPUT:\n\n - ``domain`` -- a vector space\n - ``f`` -- a function ``f(l,i)`` taking a basis element `l` of ``domain`` and an index `i`, and returning `F_i`\n - ``cartan_type`` -- The Cartan type of the Hecke algebra\n - ``q1,q2`` -- The eigenvalues of the generators `T` of the Hecke algebra\n - ``side`` -- "left" or "right" (default: "right")\n whether this is a left or right representation\n\n EXAMPLES::\n\n sage: K = QQ[\'q1,q2\'].fraction_field()\n sage: q1, q2 = K.gens()\n sage: KW = WeylGroup(["A",3]).algebra(QQ)\n sage: H = KW.demazure_lusztig_operators(q1,q2); H\n A representation of the (q1, q2)-Hecke algebra of type [\'A\', 3, 1]\n on Algebra of Weyl Group of type [\'A\', 3]\n (as a matrix group acting on the ambient space)\n over Rational Field\n\n Among other things, it implements the `T_w` operators, their\n inverses and compositions thereof::\n\n sage: H.Tw((1,2))\n Generic endomorphism of Algebra of Weyl Group of type [\'A\', 3]\n (as a matrix group acting on the ambient space) over Rational Field\n\n and the Cherednik operators `Y^{\\lambda^\\vee}`::\n\n sage: H.Y()\n Lazy family (...)_{i in Coroot lattice of the Root system of type [\'A\', 3, 1]}\n\n TESTS::\n\n sage: from sage.combinat.root_system.hecke_algebra_representation import HeckeAlgebraRepresentation\n sage: W = SymmetricGroup(3)\n sage: domain = W.algebra(QQ)\n sage: action = lambda x,i: domain.monomial(x.apply_simple_reflection(i, side="right"))\n sage: r = HeckeAlgebraRepresentation(domain, action, CartanType(["A",2]), 1, -1)\n sage: hash(r) # random\n 3\n\n REFERENCES:\n\n - [HST2008]_\n '
def __init__(self, domain, on_basis, cartan_type, q1, q2, q=ZZ.one(), side='right'):
'\n TESTS::\n\n sage: from sage.combinat.root_system.hecke_algebra_representation import HeckeAlgebraRepresentation\n sage: W = SymmetricGroup(3)\n sage: domain = W.algebra(QQ)\n sage: action = lambda x,i: domain.monomial(x.apply_simple_reflection(i, side="right"))\n sage: HeckeAlgebraRepresentation(domain, action, CartanType(["A",2]), 1, -1)\n A representation of the (1, -1)-Hecke algebra of type [\'A\', 2] on Symmetric group algebra of order 3 over Rational Field\n '
self._domain = domain
self._Ti_on_basis = on_basis
self._q1 = q1
self._q2 = q2
self._q = q
self._cartan_type = cartan_type
self._side = side
def _repr_(self):
'\n EXAMPLES::\n\n sage: WeylGroup(["A",3]).algebra(QQ).demazure_lusztig_operators(-1,1)._repr_()\n "A representation of the (-1, 1)-Hecke algebra of type [\'A\', 3, 1]\n on Algebra of Weyl Group of type [\'A\', 3]\n (as a matrix group acting on the ambient space) over Rational Field"\n '
return ('A representation of the %s-Hecke algebra of type %s on %s' % ((self._q1, self._q2), self.cartan_type(), self.domain()))
@cached_method
def parameters(self, i):
'\n Return `q_1,q_2` such that `(T_i-q_1)(T_i-q_2) = 0`.\n\n EXAMPLES::\n\n sage: K = QQ[\'q1,q2\'].fraction_field()\n sage: q1, q2 = K.gens()\n sage: KW = WeylGroup(["A",3]).algebra(QQ)\n sage: H = KW.demazure_lusztig_operators(q1,q2)\n sage: H.parameters(1)\n (q1, q2)\n\n sage: H = KW.demazure_lusztig_operators(1,-1)\n sage: H.parameters(1)\n (1, -1)\n\n .. TODO::\n\n At this point, this method is constant. It\'s meant as a\n starting point for implementing parameters depending on\n the node `i` of the Dynkin diagram.\n '
return (self._q1, self._q2)
def cartan_type(self):
'\n Return the Cartan type of ``self``.\n\n EXAMPLES::\n\n sage: from sage.combinat.root_system.hecke_algebra_representation import HeckeAlgebraRepresentation\n sage: KW = SymmetricGroup(3).algebra(QQ)\n sage: action = lambda x,i: KW.monomial(x.apply_simple_reflection(i, side="right"))\n sage: H = HeckeAlgebraRepresentation(KW, action, CartanType(["A",2]), 1, -1)\n sage: H.cartan_type()\n [\'A\', 2]\n\n sage: H = WeylGroup(["A",3]).algebra(QQ).demazure_lusztig_operators(-1,1)\n sage: H.cartan_type()\n [\'A\', 3, 1]\n '
return self._cartan_type
def domain(self):
'\n Return the domain of ``self``.\n\n EXAMPLES::\n\n sage: H = WeylGroup(["A",3]).algebra(QQ).demazure_lusztig_operators(-1,1)\n sage: H.domain()\n Algebra of Weyl Group of type [\'A\', 3] (as a matrix group\n acting on the ambient space) over Rational Field\n '
return self._domain
def Ti_on_basis(self, x, i):
'\n The `T_i` operators, on basis elements.\n\n INPUT:\n\n - ``x`` -- the index of a basis element\n - ``i`` -- the index of a generator\n\n EXAMPLES::\n\n sage: W = WeylGroup("A3")\n sage: W.element_class._repr_=lambda x: "".join(str(i) for i in x.reduced_word())\n sage: K = QQ[\'q1,q2\'].fraction_field()\n sage: q1, q2 = K.gens()\n sage: KW = W.algebra(K)\n sage: rho = KW.demazure_lusztig_operators(q1,q2)\n sage: w = W.an_element()\n sage: rho.Ti_on_basis(w,1)\n q1*1231\n '
return self._Ti_on_basis(x, i)
def Ti_inverse_on_basis(self, x, i):
'\n The `T_i^{-1}` operators, on basis elements\n\n INPUT:\n\n - ``x`` -- the index of a basis element\n - ``i`` -- the index of a generator\n\n EXAMPLES::\n\n sage: W = WeylGroup("A3")\n sage: W.element_class._repr_=lambda x: "".join(str(i) for i in x.reduced_word())\n sage: K = QQ[\'q1,q2\'].fraction_field()\n sage: q1, q2 = K.gens()\n sage: KW = W.algebra(K)\n sage: rho = KW.demazure_lusztig_operators(q1,q2)\n sage: w = W.an_element()\n sage: rho.Ti_inverse_on_basis(w, 1)\n -1/q2*1231 + ((q1+q2)/(q1*q2))*123\n '
q1 = self._q1
q2 = self._q2
return ((self._domain.term(x, (q1 + q2)) - self.Ti_on_basis(x, i)) / (q1 * q2))
@cached_method
def on_basis(self, x, word, signs=None, scalar=None):
'\n Action of product of `T_i` and `T_i^{-1}` on ``x``.\n\n INPUT:\n\n - ``x`` -- the index of a basis element\n - ``word`` -- word of indices of generators\n - ``signs`` -- (default: None) sequence of signs of same length as ``word``; determines\n which operators are supposed to be taken as inverses.\n - ``scalar`` -- (default: None) scalar to multiply the answer by\n\n EXAMPLES::\n\n sage: from sage.combinat.root_system.hecke_algebra_representation import HeckeAlgebraRepresentation\n sage: W = SymmetricGroup(3)\n sage: domain = W.algebra(QQ)\n sage: action = lambda x,i: domain.monomial(x.apply_simple_reflection(i, side="right"))\n sage: rho = HeckeAlgebraRepresentation(domain, action, CartanType(["A",2]), 1, -1)\n\n sage: rho.on_basis(W.one(), (1,2,1))\n (1,3)\n\n sage: word = (1,2)\n sage: u = W.from_reduced_word(word)\n sage: for w in W: assert rho.on_basis(w, word) == domain.monomial(w*u)\n\n The next example tests the signs::\n\n sage: W = WeylGroup("A3")\n sage: W.element_class._repr_=lambda x: "".join(str(i) for i in x.reduced_word())\n sage: K = QQ[\'q1,q2\'].fraction_field()\n sage: q1, q2 = K.gens()\n sage: KW = W.algebra(K)\n sage: rho = KW.demazure_lusztig_operators(q1,q2)\n sage: w = W.an_element(); w\n 123\n sage: rho.on_basis(w, (1,), signs=(-1,))\n -1/q2*1231 + ((q1+q2)/(q1*q2))*123\n sage: rho.on_basis(w, (1,), signs=( 1,))\n q1*1231\n sage: rho.on_basis(w, (1,1), signs=(1,-1))\n 123\n sage: rho.on_basis(w, (1,1), signs=(-1,1))\n 123\n '
l = len(word)
if (l == 0):
return self._domain.monomial(x)
rec = self.on_basis(x, word[:(- 1)], signs)
i = word[(l - 1)]
if ((signs is not None) and (signs[(l - 1)] == (- 1))):
operator = self.Ti_inverse_on_basis
else:
operator = self.Ti_on_basis
result = self._domain.linear_combination(((operator(l, i), c) for (l, c) in rec))
if (scalar is None):
return result
else:
return (scalar * result)
def straighten_word(self, word):
'\n Return a tuple of indices of generators after some straightening.\n\n INPUT:\n\n - ``word`` -- a list/tuple of indices of generators, the index\n of a generator, or an object with a reduced word method\n\n OUTPUT: a tuple of indices of generators\n\n EXAMPLES::\n\n sage: W = WeylGroup(["A",3])\n sage: H = W.algebra(QQ).demazure_lusztig_operators(-1,1)\n sage: H.straighten_word(1)\n (1,)\n sage: H.straighten_word((2,1))\n (2, 1)\n sage: H.straighten_word([2,1])\n (2, 1)\n sage: H.straighten_word(W.an_element())\n (1, 2, 3)\n '
if hasattr(word, 'reduced_word'):
word = word.reduced_word()
if isinstance(word, list):
word = tuple(word)
elif (not isinstance(word, tuple)):
word = (word,)
return word
def Tw(self, word, signs=None, scalar=None):
'\n Return `T_w`.\n\n INPUT:\n\n - ``word`` -- a word `i_1,\\dots,i_k` for some element `w` of the Weyl group.\n See :meth:`straighten_word` for how this word can be specified.\n\n - ``signs`` -- a list `\\epsilon_1,\\dots,\\epsilon_k` of the\n same length as ``word`` with `\\epsilon_i =\\pm 1` or\n ``None`` for `1,\\dots,1` (default: ``None``)\n\n - ``scalar`` -- an element `c` of the base ring or ``None``\n for `1` (default: ``None``)\n\n OUTPUT:\n\n a module morphism implementing\n\n .. MATH::\n\n T_w = T_{i_k} \\circ \\cdots \\circ T_{i_1}\n\n in left action notation; that is `T_{i_1}` is applied first,\n then `T_{i_2}`, etc.\n\n More generally, if ``scalar`` or ``signs`` is specified, the\n morphism implements\n\n .. MATH::\n\n c T_{i_k}^{\\epsilon_k} \\circ \\cdots \\circ T_{i_1}^{\\epsilon_k}.\n\n EXAMPLES::\n\n sage: W = WeylGroup("A3")\n sage: W.element_class._repr_=lambda x: (\'e\' if not x.reduced_word()\n ....: else "".join(str(i) for i in x.reduced_word()))\n sage: K = QQ[\'q1,q2\'].fraction_field()\n sage: q1, q2 = K.gens()\n sage: KW = W.algebra(K)\n sage: x = KW.an_element(); x\n 123 + 3*2312 + 2*31 + e\n\n sage: T = KW.demazure_lusztig_operators(q1,q2)\n sage: T12 = T.Tw( (1,2) )\n sage: T12(KW.one())\n q1^2*12\n\n This is `T_2 \\circ T_1`::\n\n sage: T[2](T[1](KW.one()))\n q1^2*12\n sage: T[1](T[2](KW.one()))\n q1^2*21\n sage: T12(x) == T[2](T[1](x))\n True\n\n Now with signs and scalar coefficient we construct `3 T_2 \\circ T_1^{-1}`::\n\n sage: phi = T.Tw((1,2), (-1,1), 3)\n sage: phi(KW.one())\n ((-3*q1)/q2)*12 + ((3*q1+3*q2)/q2)*2\n sage: phi(T[1](x)) == 3*T[2](x)\n True\n\n For debugging purposes, one can recover the input data::\n\n sage: phi.word\n (1, 2)\n sage: phi.signs\n (-1, 1)\n sage: phi.scalar\n 3\n '
word = self.straighten_word(word)
result = self._domain.module_morphism(functools.partial(self.on_basis, word=word, signs=signs, scalar=scalar), codomain=self._domain)
result.word = word
result.signs = signs
result.scalar = scalar
return result
def Tw_inverse(self, word):
'\n Return `T_w^{-1}`.\n\n This is essentially a shorthand for :meth:`Tw` with all minus signs.\n\n .. TODO:: Add an example where `T_i\\ne T_i^{-1}`\n\n EXAMPLES::\n\n sage: W = WeylGroup(["A",3])\n sage: W.element_class._repr_ = lambda x: "".join(str(i) for i in x.reduced_word())\n sage: KW = W.algebra(QQ)\n sage: rho = KW.demazure_lusztig_operators(1, -1)\n sage: x = KW.monomial(W.an_element()); x\n 123\n sage: word = [1,2]\n sage: rho.Tw(word)(x)\n 12312\n sage: rho.Tw_inverse(word)(x)\n 12321\n\n sage: K = QQ[\'q1,q2\'].fraction_field()\n sage: q1, q2 = K.gens()\n sage: KW = W.algebra(K)\n sage: rho = KW.demazure_lusztig_operators(q1, q2)\n sage: x = KW.monomial(W.an_element()); x\n 123\n sage: rho.Tw_inverse(word)(x)\n 1/q2^2*12321 + ((-q1-q2)/(q1*q2^2))*1231 + ((-q1-q2)/(q1*q2^2))*1232\n + ((q1^2+2*q1*q2+q2^2)/(q1^2*q2^2))*123\n sage: rho.Tw(word)(_)\n 123\n '
word = tuple(reversed(self.straighten_word(word)))
signs = (((- 1),) * len(word))
return self.Tw(word, signs)
__getitem__ = Tw
def _test_relations(self, **options):
'\n Test that this family of operators satisfies the Iwahori Hecke relations\n\n EXAMPLES::\n\n sage: L = RootSystem(["A",3]).ambient_space()\n sage: K = QQ[\'q1,q2\'].fraction_field()\n sage: q1, q2 = K.gens()\n sage: KL = L.algebra(K)\n sage: T = KL.demazure_lusztig_operators(q1,q2)\n sage: T._test_relations()\n '
tester = self._tester(**options)
cartan_type = self.cartan_type()
elements = options.get('elements', self.domain().some_elements())
q1 = self._q1
q2 = self._q2
T = self
def Ti(x, i, c):
return (T[i](x) + (c * x))
try:
for i in cartan_type.index_set():
for x in elements:
tester.assertTrue(Ti(Ti(x, i, (- q2)), i, (- q1)).is_zero())
G = cartan_type.coxeter_diagram()
for (i, j) in Subsets(cartan_type.index_set(), 2):
if G.has_edge(i, j):
o = G.edge_label(i, j)
else:
o = 2
if (o == infinity):
continue
for x in elements:
y = x
for k in range(o):
x = T[i](x)
y = T[j](y)
(y, x) = (x, y)
tester.assertEqual(x, y)
except ImportError:
pass
def _test_inverse(self, **options):
'\n Test the `T_w^{-1}` operators.\n\n EXAMPLES::\n\n sage: L = RootSystem(["A",3]).ambient_space()\n sage: K = QQ[\'q1,q2\'].fraction_field()\n sage: q1, q2 = K.gens()\n sage: KL = L.algebra(K)\n sage: T = KL.demazure_lusztig_operators(q1,q2)\n sage: T._test_inverse()\n '
tester = self._tester(**options)
elements = self.domain().some_elements()
q1 = self._q1
q2 = self._q2
try:
if (q1.is_unit() and q2.is_unit()):
I = self.cartan_type().index_set()
for w in ([[i] for i in I] + [tuple(I)]):
Tw = self.Tw(w)
Tw_inverse = self.Tw_inverse(w)
for x in elements:
tester.assertEqual(Tw_inverse(Tw(x)), x)
tester.assertEqual(Tw(Tw_inverse(x)), x)
except ImportError:
pass
def Y_lambdacheck(self, lambdacheck):
'\n Return the Cherednik operators `Y^{\\lambda^\\vee}` for this representation of an affine Hecke algebra.\n\n INPUT:\n\n - ``lambdacheck`` -- an element of the coroot lattice for this\n Cartan type\n\n EXAMPLES::\n\n sage: W = WeylGroup(["B",2])\n sage: W.element_class._repr_=lambda x: "".join(str(i) for i in x.reduced_word())\n sage: K = QQ[\'q1,q2\'].fraction_field()\n sage: q1, q2 = K.gens()\n sage: KW = W.algebra(K)\n\n We take `q_2` and `q_1` as eigenvalues to match with the notations of [HST2008]_ ::\n\n sage: rho = KW.demazure_lusztig_operators(q2, q1)\n sage: L = rho.Y().keys()\n sage: alpha = L.simple_roots()\n sage: Y0 = rho.Y_lambdacheck(alpha[0])\n sage: Y1 = rho.Y_lambdacheck(alpha[1])\n sage: Y2 = rho.Y_lambdacheck(alpha[2])\n\n sage: x = KW.monomial(W.an_element()); x\n 12\n sage: Y1(x)\n ((-q1^2-2*q1*q2-q2^2)/(-q2^2))*2121\n + ((q1^3+q1^2*q2+q1*q2^2+q2^3)/(-q1*q2^2))*121\n + ((q1^2+q1*q2)/(-q2^2))*212 + ((-q1^2)/(-q2^2))*12\n sage: Y2(x)\n ((-q1^4-q1^3*q2-q1*q2^3-q2^4)/(-q1^3*q2))*2121\n + ((q1^3+q1^2*q2+q1*q2^2+q2^3)/(-q1^2*q2))*121 + (q2^3/(-q1^3))*12\n sage: Y1(Y2(x))\n ((q1*q2+q2^2)/q1^2)*212 + ((-q2)/q1)*12\n sage: Y2(Y1(x))\n ((q1*q2+q2^2)/q1^2)*212 + ((-q2)/q1)*12\n\n The `Y` operators commute::\n\n sage: Y0(Y1(x)) - Y1(Y0(x))\n 0\n sage: Y2(Y1(x)) - Y1(Y2(x))\n 0\n\n In the classical root lattice, `\\alpha_0 + \\alpha_1 + \\alpha_2 = 0`::\n\n sage: Y0(Y1(Y2(x)))\n 12\n\n Lemma 7.2 of [HST2008]_::\n\n sage: w0 = KW.monomial(W.long_element())\n sage: rho.Tw(0)(w0)\n q2\n sage: rho.Tw_inverse(1)(w0)\n 1/q2*212\n sage: rho.Tw_inverse(2)(w0)\n 1/q2*121\n\n Lemma 7.5 of [HST2008]_::\n\n sage: Y0(w0)\n q1^2/q2^2*2121\n sage: Y1(w0)\n (q2/(-q1))*2121\n sage: Y2(w0)\n (q2/(-q1))*2121\n\n .. TODO::\n\n Add more tests\n\n Add tests in type BC affine where the null coroot\n `\\delta^\\vee` can have non trivial coefficient in term of\n `\\alpha_0`\n\n .. SEEALSO::\n\n - [HST2008]_ for the formula in terms of `q_1, q_2`\n '
Q_check = lambdacheck.parent()
P_check = Q_check.root_system.weight_space()
assert P_check.has_coerce_map_from(Q_check)
alphacheck = P_check.simple_roots()
c = Q_check.cartan_type().translation_factors()
t = P_check.linear_combination(((alphacheck[i], (c[i] * coeff)) for (i, coeff) in lambdacheck))
word = P_check.reduced_word_of_translation(t)
signs = tuple(P_check.signs_of_alcovewalk(word))
if (self._side == 'left'):
word = tuple([x for x in reversed(word)])
signs = tuple([x for x in reversed(signs)])
special_node = Q_check.cartan_type().special_node()
scalar = ((((- self._q1) * self._q2) ** ((- sum(signs)) / 2)) * (self._q ** (- lambdacheck[special_node])))
return self.Tw(word, signs, scalar)
def Y(self, base_ring=ZZ):
'\n Return the Cherednik operators `Y` for this representation of an affine Hecke algebra.\n\n INPUT:\n\n - ``self`` -- a representation of an affine Hecke algebra\n - ``base_ring`` -- the base ring of the coroot lattice\n\n This is a family of operators indexed by the coroot lattice\n for this Cartan type. In practice this is currently indexed\n instead by the affine coroot lattice, even if this indexing is\n not one to one, in order to allow for `Y[\\alpha^\\vee_0]`.\n\n EXAMPLES::\n\n sage: W = WeylGroup(["A",3])\n sage: K = QQ[\'q1,q2\'].fraction_field()\n sage: q1, q2 = K.gens()\n sage: KW = W.algebra(K)\n sage: rho = KW.demazure_lusztig_operators(q2, q1)\n sage: Y = rho.Y(); Y\n Lazy family (...(i))_{i in Coroot lattice of the Root system of type [\'A\', 3, 1]}\n '
if (not self.cartan_type().is_affine()):
raise ValueError('The Cherednik operators are only defined for representations of affine Hecke algebra')
L = self.cartan_type().root_system().coroot_space(base_ring)
return Family(L, self.Y_lambdacheck)
def _test_Y(self, **options):
'\n Test the `T_w^{-1}` operators\n\n EXAMPLES::\n\n sage: W = WeylGroup(["B",3])\n sage: W.element_class._repr_=lambda x: "".join(str(i) for i in x.reduced_word())\n sage: K = QQ[\'q1,q2\'].fraction_field()\n sage: q1, q2 = K.gens()\n sage: KW = W.algebra(K)\n sage: rho = KW.demazure_lusztig_operators(q1, q2, affine=True)\n sage: rho._test_Y() # long time (4s)\n '
tester = self._tester(**options)
if self.cartan_type().is_affine():
elements = self.domain().some_elements()
Y = self.Y()
L = Y.keys()
I = L.index_set()
alpha = L.simple_roots()
Yi = Family(I, (lambda i: Y[alpha[i]]))
for (Y1, Y2) in Subsets(Yi, 2):
for x in elements:
tester.assertEqual(Y1(Y2(x)), Y2(Y1(x)))
def Y_eigenvectors(self):
'\n Return the family of eigenvectors for the Cherednik operators `Y` of this representation of an affine Hecke algebra.\n\n INPUT:\n\n - ``self`` -- a representation of an affine Hecke algebra\n - ``base_ring`` -- the base ring of the coroot lattice\n\n EXAMPLES::\n\n sage: W = WeylGroup(["B",2])\n sage: W.element_class._repr_=lambda x: "".join(str(i) for i in x.reduced_word())\n sage: K = QQ[\'q1,q2\'].fraction_field()\n sage: q1, q2 = K.gens()\n sage: KW = W.algebra(K)\n sage: rho = KW.demazure_lusztig_operators(q1, q2, affine=True)\n sage: E = rho.Y_eigenvectors()\n sage: E.keys()\n Weyl Group of type [\'B\', 2] (as a matrix group acting on the ambient space)\n sage: w0 = W.long_element()\n\n To set the recurrence up properly, one often needs to customize\n the :meth:`CherednikOperatorsEigenvectors.affine_lift`\n and :meth:`CherednikOperatorsEigenvectors.affine_retract`\n methods. This would usually be done by subclassing\n :class:`CherednikOperatorsEigenvectors`; here we just override\n the methods directly.\n\n In this particular case, we multiply by `w_0` to take into\n account that `w_0` is the seed for the recursion::\n\n sage: E.affine_lift = w0._mul_\n sage: E.affine_retract = w0._mul_\n\n sage: E[w0]\n 2121\n sage: E.eigenvalues(E[w0])\n [q2^2/q1^2, q1/(-q2), q1/(-q2)]\n\n This step is taken care of automatically if one instead calls\n the specialization\n :meth:`sage.coxeter_groups.CoxeterGroups.Algebras.demazure_lusztig_eigenvectors`.\n\n Now we can compute all eigenvectors::\n\n sage: [E[w] for w in W]\n [2121 - 121 - 212 + 12 + 21 - 1 - 2 + ,\n -2121 + 212,\n (q2/(q1-q2))*2121 + (q2/(-q1+q2))*121\n + (q2/(-q1+q2))*212 - 12 + ((-q2)/(-q1+q2))*21 + 2,\n ((-q2^2)/(-q1^2+q1*q2-q2^2))*2121 - 121 + (q2^2/(-q1^2+q1*q2-q2^2))*212 + 21,\n ((-q1^2-q2^2)/(q1^2-q1*q2+q2^2))*2121 + ((-q1^2-q2^2)/(-q1^2+q1*q2-q2^2))*121\n + ((-q2^2)/(-q1^2+q1*q2-q2^2))*212 + (q2^2/(-q1^2+q1*q2-q2^2))*12 - 21 + 1,\n 2121,\n (q2/(-q1+q2))*2121 + ((-q2)/(-q1+q2))*121 - 212 + 12,\n -2121 + 121]\n '
if (not self.cartan_type().is_affine()):
raise ValueError('The Cherednik operators are only defined for representations of affine Hecke algebra')
return CherednikOperatorsEigenvectors(self)
|
class CherednikOperatorsEigenvectors(UniqueRepresentation, SageObject):
'\n A class for the family of eigenvectors of the `Y` Cherednik\n operators for a module over a (Double) Affine Hecke algebra\n\n INPUT:\n\n - ``T`` -- a family `(T_i)_{i\\in I}` implementing the action of\n the generators of an affine Hecke algebra on ``self``.\n The intertwiner operators are built from these.\n\n - ``T_Y`` -- a family `(T^Y_i)_{i\\in I}` implementing the action\n of the generators of an affine Hecke algebra on ``self``. By\n default, this is ``T``. But this can be used to get the action\n of the full Double Affine Hecke Algebra. The `Y` operators are\n built from the ``T_Y``.\n\n This returns a function `\\mu\\mapsto E_\\mu` which uses intertwining\n operators to calculate recursively eigenvectors `E_\\mu` for the\n action of the torus of the affine Hecke algebra with eigenvalue\n given by `f`. Namely:\n\n .. MATH::\n\n E_\\mu.Y^{\\lambda^\\vee} = f(\\lambda^\\vee, \\mu) E_\\mu\n\n Assumptions:\n\n - ``seed(mu)`` initializes the recurrence by returning an\n appropriate eigenvector `E_\\mu` for `\\mu` trivial enough. For\n example, for nonsymmetric Macdonald polynomials ``seed(mu)``\n returns the monomial `X^\\mu` for a minuscule weight `\\mu`.\n\n - `f` is almost equivariant. Namely, `f(\\lambda^\\vee,\\mu) =\n f(\\lambda^\\vee s_i, twist(\\mu,i))` whenever `i` is a descent of\n `\\mu`.\n\n - `twist(\\mu, i)` maps `\\mu` closer to the dominant\n chamber whenever `i` is a descent of `\\mu`.\n\n .. TODO::\n\n Add tests for the above assumptions, and also that the\n classical operators `T_1, \\ldots, T_n` from `T` and `T_Y` coincide.\n '
def __init__(self, T, T_Y=None, normalized=True):
'\n INPUT:\n\n - ``T`` -- a family `(T_i)_{i\\in I}` implementing the action of\n the generators of an affine Hecke algebra on ``self``.\n\n - ``T_Y`` -- a family `(T^Y_i)_{i\\in I}` implementing the action\n of the generators of an affine Hecke algebra on ``self``. By\n default, this is ``T``.\n\n - ``normalized`` -- boolean (default: True) whether the\n eigenvector `E_\\mu` is normalized so that `\\mu` has\n coefficient `1`.\n\n TESTS::\n\n sage: from sage.combinat.root_system.hecke_algebra_representation import CherednikOperatorsEigenvectors\n sage: W = WeylGroup(["B",3])\n sage: K = QQ[\'q1,q2\'].fraction_field()\n sage: q1, q2 = K.gens()\n sage: KW = W.algebra(K)\n sage: rho = KW.demazure_lusztig_operators(q1, q2, affine=True)\n sage: E = CherednikOperatorsEigenvectors(rho); E\n <sage.combinat.root_system.hecke_algebra_representation.CherednikOperatorsEigenvectors object at ...>\n sage: E.keys()\n Weyl Group of type [\'B\', 3] (as a matrix group acting on the ambient space)\n sage: E.domain()\n Algebra of Weyl Group of type [\'B\', 3] (as a matrix group acting on the ambient space)\n over Fraction Field of Multivariate Polynomial Ring in q1, q2 over Rational Field\n sage: E._T == E._T_Y\n True\n '
self._T = T
if (T_Y is None):
T_Y = T
self._T_Y = T_Y
self._normalized = normalized
@cached_method
def cartan_type(self):
'\n Return Cartan type of ``self``.\n\n EXAMPLES::\n\n sage: W = WeylGroup(["B",3])\n sage: K = QQ[\'q1,q2\']\n sage: q1, q2 = K.gens()\n sage: KW = W.algebra(K)\n sage: E = KW.demazure_lusztig_eigenvectors(q1, q2)\n sage: E.cartan_type()\n [\'B\', 3, 1]\n\n sage: NonSymmetricMacdonaldPolynomials(["B", 2, 1]).cartan_type() # needs sage.graphs\n [\'B\', 2, 1]\n '
return self._T_Y.cartan_type()
def domain(self):
'\n The module on which the affine Hecke algebra acts.\n\n EXAMPLES::\n\n sage: W = WeylGroup(["B",3])\n sage: K = QQ[\'q1,q2\']\n sage: q1, q2 = K.gens()\n sage: KW = W.algebra(K)\n sage: E = KW.demazure_lusztig_eigenvectors(q1, q2)\n sage: E.domain()\n Algebra of Weyl Group of type [\'B\', 3]\n (as a matrix group acting on the ambient space)\n over Multivariate Polynomial Ring in q1, q2 over Rational Field\n '
return self._T.domain()
def keys(self):
'\n The index set for the eigenvectors.\n\n By default, this assumes that the eigenvectors span the full\n affine Hecke algebra module and that the eigenvectors have\n the same indexing as the basis of this module.\n\n EXAMPLES::\n\n sage: W = WeylGroup(["A",3])\n sage: K = QQ[\'q1,q2\']\n sage: q1, q2 = K.gens()\n sage: KW = W.algebra(K)\n sage: E = KW.demazure_lusztig_eigenvectors(q1, q2)\n sage: E.keys()\n Weyl Group of type [\'A\', 3] (as a matrix group acting on the ambient space)\n '
return self._T.domain().basis().keys()
def seed(self, mu):
'\n Return the eigenvector for `\\mu` minuscule.\n\n INPUT:\n\n - ``mu`` -- an element `\\mu` of the indexing set\n\n OUTPUT: an element of ``T.domain()``\n\n This default implementation returns the monomial indexed by `\\mu`.\n\n EXAMPLES::\n\n sage: W = WeylGroup(["A",3])\n sage: W.element_class._repr_=lambda x: "".join(str(i) for i in x.reduced_word())\n sage: K = QQ[\'q1,q2\']\n sage: q1, q2 = K.gens()\n sage: KW = W.algebra(K)\n sage: E = KW.demazure_lusztig_eigenvectors(q1, q2)\n sage: E.seed(W.long_element())\n 123121\n '
return self.domain().monomial(mu)
@abstract_method
def affine_lift(self, mu):
'\n Lift the index ``\\mu`` to a space admitting an action of the affine Weyl group.\n\n INPUT:\n\n - ``mu`` -- an element `\\mu` of the indexing set\n\n In this space, one should have ``first_descent`` and\n ``apply_simple_reflection`` act properly.\n\n EXAMPLES::\n\n sage: W = WeylGroup(["A",3])\n sage: W.element_class._repr_=lambda x: "".join(str(i) for i in x.reduced_word())\n sage: K = QQ[\'q1,q2\']\n sage: q1, q2 = K.gens()\n sage: KW = W.algebra(K)\n sage: E = KW.demazure_lusztig_eigenvectors(q1, q2)\n sage: w = W.an_element(); w\n 123\n sage: E.affine_lift(w)\n 121\n '
@abstract_method
def affine_retract(self, mu):
'\n Retract `\\mu` from a space admitting an action of the affine Weyl group.\n\n EXAMPLES::\n\n sage: W = WeylGroup(["A",3])\n sage: W.element_class._repr_=lambda x: "".join(str(i) for i in x.reduced_word())\n sage: K = QQ[\'q1,q2\']\n sage: q1, q2 = K.gens()\n sage: KW = W.algebra(K)\n sage: E = KW.demazure_lusztig_eigenvectors(q1, q2)\n sage: w = W.an_element(); w\n 123\n sage: E.affine_retract(E.affine_lift(w)) == w\n True\n '
def Y(self):
'\n Return the Cherednik operators.\n\n EXAMPLES::\n\n sage: W = WeylGroup(["B",2])\n sage: K = QQ[\'q1,q2\'].fraction_field()\n sage: q1, q2 = K.gens()\n sage: KW = W.algebra(K)\n sage: E = KW.demazure_lusztig_eigenvectors(q1, q2)\n sage: E.Y()\n Lazy family (...)_{i in Coroot lattice of the Root system of type [\'B\', 2, 1]}\n '
return self._T_Y.Y()
def eigenvalues(self, mu):
'\n Return the eigenvalues of `Y_{\\alpha_0},\\dots,Y_{\\alpha_n}` on `E_\\mu`.\n\n INPUT:\n\n - ``mu`` -- the index `\\mu` of an eigenvector or a tentative eigenvector\n\n EXAMPLES::\n\n sage: W = WeylGroup(["B",2])\n sage: K = QQ[\'q1,q2\'].fraction_field()\n sage: q1, q2 = K.gens()\n sage: KW = W.algebra(K)\n sage: E = KW.demazure_lusztig_eigenvectors(q1, q2)\n sage: w0 = W.long_element()\n sage: E.eigenvalues(w0)\n [q2^2/q1^2, q1/(-q2), q1/(-q2)]\n sage: w = W.an_element()\n sage: E.eigenvalues(w)\n [(-q2)/q1, (-q2^2)/(-q1^2), q1^3/(-q2^3)]\n '
alphacheck = self.Y().keys().simple_roots()
return [self.eigenvalue(mu, alphacheck[i]) for i in self.cartan_type().index_set()]
@cached_method
def eigenvalue(self, mu, l):
'\n Return the eigenvalue of `Y_{\\lambda^\\vee}` on `E_\\mu` computed by applying `Y_{\\lambda^\\vee}` on `E_\\mu`.\n\n INPUT:\n\n - ``mu`` -- the index `\\mu` of an eigenvector, or a tentative eigenvector\n - ``l`` -- the index `\\lambda^\\vee` of a Cherednik operator in ``self.Y_index_set()``\n\n This default implementation applies explicitly `Y_\\mu` to `E_\\lambda`.\n\n EXAMPLES::\n\n sage: W = WeylGroup(["B",2])\n sage: K = QQ[\'q1,q2\'].fraction_field()\n sage: q1, q2 = K.gens()\n sage: KW = W.algebra(K)\n sage: E = KW.demazure_lusztig_eigenvectors(q1, q2)\n sage: w0 = W.long_element()\n sage: Y = E.Y()\n sage: alphacheck = Y.keys().simple_roots()\n sage: E.eigenvalue(w0, alphacheck[1])\n q1/(-q2)\n sage: E.eigenvalue(w0, alphacheck[2])\n q1/(-q2)\n sage: E.eigenvalue(w0, alphacheck[0])\n q2^2/q1^2\n\n The following checks that all `E_w` are eigenvectors, with\n eigenvalue given by Lemma 7.5 of [HST2008]_ (checked for\n `A_2`, `A_3`)::\n\n sage: Pcheck = Y.keys()\n sage: Wcheck = Pcheck.weyl_group()\n sage: P0check = Pcheck.classical()\n sage: def height(root):\n ....: return sum(P0check(root).coefficients())\n sage: def eigenvalue(w, mu):\n ....: return (-q2/q1)^height(Wcheck.from_reduced_word(w.reduced_word()).action(mu))\n sage: all(E.eigenvalue(w, a) == eigenvalue(w, a) for w in E.keys() for a in Y.keys().simple_roots()) # long time (2.5s)\n True\n '
Y = self.Y()
assert Y.keys().is_parent_of(l)
if self.keys().is_parent_of(mu):
Emu = self[mu]
elif self.domain().is_parent_of(mu):
Emu = mu
else:
raise TypeError('input should be a (tentative) eigenvector or an index thereof')
res = Y[l](Emu)
if (not res):
return self.domain().base_ring().zero()
t = res.leading_support()
assert (t == Emu.leading_support())
c = (res[t] / Emu[t])
assert (res == (Emu * c)), 'not an eigenvector!!!'
return c
def twist(self, mu, i):
'\n Act by `s_i` on `\\mu`.\n\n By default, this calls the method ``apply_simple_reflection``.\n\n EXAMPLES::\n\n sage: W = WeylGroup(["B",3])\n sage: W.element_class._repr_=lambda x: "".join(str(i) for i in x.reduced_word())\n sage: K = QQ[\'q1,q2\']\n sage: q1, q2 = K.gens()\n sage: KW = W.algebra(K)\n sage: T = KW.demazure_lusztig_operators(q1, q2, affine=True)\n sage: E = T.Y_eigenvectors()\n sage: w = W.an_element(); w\n 123\n sage: E.twist(w,1)\n 1231\n '
return mu.apply_simple_reflection(i)
@cached_method
def hecke_parameters(self, i):
'\n Return the Hecke parameters for index ``i``.\n\n EXAMPLES::\n\n sage: W = WeylGroup(["B",3])\n sage: K = QQ[\'q1,q2\']\n sage: q1, q2 = K.gens()\n sage: KW = W.algebra(K)\n sage: T = KW.demazure_lusztig_operators(q1, q2, affine=True)\n sage: E = T.Y_eigenvectors()\n sage: E.hecke_parameters(1)\n (q1, q2)\n sage: E.hecke_parameters(2)\n (q1, q2)\n sage: E.hecke_parameters(0)\n (q1, q2)\n '
return self._T.parameters(i)
@cached_method
def __getitem__(self, mu):
'\n Return the eigenvector `E_\\mu`.\n\n INPUT:\n\n - ``mu`` -- the index `\\mu` of an eigenvector\n\n EXAMPLES::\n\n sage: W = WeylGroup(["A",3])\n sage: W.element_class._repr_=lambda x: "".join(str(i) for i in x.reduced_word())\n sage: K = QQ[\'q1,q2\'].fraction_field()\n sage: q1, q2 = K.gens()\n sage: KW = W.algebra(K)\n sage: E = KW.demazure_lusztig_eigenvectors(q1, q2)\n sage: w0 = W.long_element()\n sage: E[w0]\n 123121\n '
L0 = self.keys()
assert L0.is_parent_of(mu)
alphacheck = self.Y().keys().simple_roots()
muaff = self.affine_lift(mu)
i = muaff.first_descent()
if (i is None):
return self.seed(mu)
muaffi = self.twist(muaff, i)
mui = self.affine_retract(muaffi)
E_mui = self[mui]
(q1, q2) = self.hecke_parameters(i)
coroot = alphacheck[i]
ct = self.cartan_type()
special_node = ct.special_node()
if (i == special_node):
a = ct.a()[special_node]
else:
a = 1
Yi = self.eigenvalue(mui, (- coroot))
result = (self._T.Tw(i)(E_mui) - ((((q1 + q2) * (Yi ** (a - 1))) / (1 - (Yi ** a))) * E_mui))
if self._normalized:
coeff = result.coefficient(mu)
result /= coeff
return result
def recursion(self, mu):
'\n Return the indices used in the recursion.\n\n INPUT:\n\n - ``mu`` -- the index `\\mu` of an eigenvector\n\n EXAMPLES::\n\n sage: W = WeylGroup(["A",3])\n sage: W.element_class._repr_=lambda x: "".join(str(i) for i in x.reduced_word())\n sage: K = QQ[\'q1,q2\'].fraction_field()\n sage: q1, q2 = K.gens()\n sage: KW = W.algebra(K)\n sage: E = KW.demazure_lusztig_eigenvectors(q1, q2)\n sage: w0 = W.long_element()\n sage: E.recursion(w0)\n []\n sage: w = W.an_element(); w\n 123\n sage: E.recursion(w)\n [1, 2, 1]\n '
muaff = self.affine_lift(mu)
return muaff.reduced_word()
|
class IntegrableRepresentation(UniqueRepresentation, CategoryObject):
'\n An irreducible integrable highest weight representation of\n an affine Lie algebra.\n\n INPUT:\n\n - ``Lam`` -- a dominant weight in an extended weight lattice\n of affine type\n\n REFERENCES:\n\n - [Ka1990]_\n\n .. [KMPS] Kass, Moody, Patera and Slansky, *Affine Lie algebras,\n weight multiplicities, and branching rules*. Vols. 1, 2. University\n of California Press, Berkeley, CA, 1990.\n\n .. [KacPeterson] Kac and Peterson. *Infinite-dimensional Lie algebras,\n theta functions and modular forms*. Adv. in Math. 53 (1984),\n no. 2, 125-264.\n\n .. [Carter] Carter, *Lie algebras of finite and affine type*. Cambridge\n University Press, 2005\n\n If `\\Lambda` is a dominant integral weight for an affine root system,\n there exists a unique integrable representation `V=V_\\Lambda` of highest\n weight `\\Lambda`. If `\\mu` is another weight, let `m(\\mu)` denote the\n multiplicity of the weight `\\mu` in this representation. The set\n `\\operatorname{supp}(V)` of `\\mu` such that `m(\\mu) > 0` is contained in the\n paraboloid\n\n .. MATH::\n\n (\\Lambda+\\rho | \\Lambda+\\rho) - (\\mu+\\rho | \\mu+\\rho) \\geq 0\n\n where `(\\, | \\,)` is the invariant inner product on the weight\n lattice and `\\rho` is the Weyl vector. Moreover if `m(\\mu)>0`\n then `\\mu\\in\\operatorname{supp}(V)` differs from `\\Lambda` by an element\n of the root lattice ([Ka1990]_, Propositions 11.3 and 11.4).\n\n Let `\\delta` be the nullroot, which is the lowest positive imaginary\n root. Then by [Ka1990]_, Proposition 11.3 or Corollary 11.9, for fixed `\\mu`\n the function `m(\\mu - k\\delta)` is a monotone increasing function of\n `k`. It is useful to take `\\mu` to be such that this function is nonzero\n if and only if `k \\geq 0`. Therefore we make the following definition. If\n `\\mu` is such that `m(\\mu) \\neq 0` but `m(\\mu + \\delta) = 0` then `\\mu` is\n called *maximal*.\n\n Since `\\delta` is fixed under the action of the affine Weyl group,\n and since the weight multiplicities are Weyl group invariant, the\n function `k \\mapsto m(\\mu - k \\delta)` is unchanged if `\\mu` is replaced\n by an equivalent weight. Therefore in tabulating these functions, we may\n assume that `\\mu` is dominant. There are only a finite number of dominant\n maximal weights.\n\n Since every nonzero weight multiplicity appears in the string\n `\\mu - k\\delta` for one of the finite number of dominant maximal\n weights `\\mu`, it is important to be able to compute these. We may\n do this as follows.\n\n EXAMPLES::\n\n sage: Lambda = RootSystem([\'A\',3,1]).weight_lattice(extended=true).fundamental_weights()\n sage: IntegrableRepresentation(Lambda[1]+Lambda[2]+Lambda[3]).print_strings()\n 2*Lambda[0] + Lambda[2]: 4 31 161 665 2380 7658 22721 63120 166085 417295 1007601 2349655\n Lambda[0] + 2*Lambda[1]: 2 18 99 430 1593 5274 16005 45324 121200 308829 754884 1779570\n Lambda[0] + 2*Lambda[3]: 2 18 99 430 1593 5274 16005 45324 121200 308829 754884 1779570\n Lambda[1] + Lambda[2] + Lambda[3]: 1 10 60 274 1056 3601 11199 32354 88009 227555 563390 1343178\n 3*Lambda[2] - delta: 3 21 107 450 1638 5367 16194 45687 121876 310056 757056 1783324\n sage: Lambda = RootSystem([\'D\',4,1]).weight_lattice(extended=true).fundamental_weights()\n sage: IntegrableRepresentation(Lambda[0]+Lambda[1]).print_strings() # long time\n Lambda[0] + Lambda[1]: 1 10 62 293 1165 4097 13120 38997 109036 289575 735870 1799620\n Lambda[3] + Lambda[4] - delta: 3 25 136 590 2205 7391 22780 65613 178660 463842 1155717 2777795\n\n In this example, we construct the extended weight lattice of Cartan\n type `A_3^{(1)}`, then define ``Lambda`` to be the fundamental\n weights `(\\Lambda_i)_{i \\in I}`. We find there are 5 maximal\n dominant weights in irreducible representation of highest weight\n `\\Lambda_1 + \\Lambda_2 + \\Lambda_3`, and we determine their strings.\n\n It was shown in [KacPeterson]_ that each string is the set of Fourier\n coefficients of a modular form.\n\n Every weight `\\mu` such that the weight multiplicity `m(\\mu)` is\n nonzero has the form\n\n .. MATH::\n\n \\Lambda - n_0 \\alpha_0 - n_1 \\alpha_1 - \\cdots,\n\n where the `n_i` are nonnegative integers. This is represented internally\n as a tuple `(n_0, n_1, n_2, \\ldots)`. If you want an individual\n multiplicity you use the method :meth:`m` and supply it with this tuple::\n\n sage: Lambda = RootSystem([\'C\',2,1]).weight_lattice(extended=true).fundamental_weights()\n sage: V = IntegrableRepresentation(2*Lambda[0]); V\n Integrable representation of [\'C\', 2, 1] with highest weight 2*Lambda[0]\n sage: V.m((3,5,3))\n 18\n\n The :class:`IntegrableRepresentation` class has methods :meth:`to_weight`\n and :meth:`from_weight` to convert between this internal representation\n and the weight lattice::\n\n sage: delta = V.weight_lattice().null_root()\n sage: V.to_weight((4,3,2))\n -3*Lambda[0] + 6*Lambda[1] - Lambda[2] - 4*delta\n sage: V.from_weight(-3*Lambda[0] + 6*Lambda[1] - Lambda[2] - 4*delta)\n (4, 3, 2)\n\n To get more values, use the depth parameter::\n\n sage: L0 = RootSystem(["A",1,1]).weight_lattice(extended=true).fundamental_weight(0); L0\n Lambda[0]\n sage: IntegrableRepresentation(4*L0).print_strings(depth=20)\n 4*Lambda[0]: 1 1 3 6 13 23 44 75 131 215 354 561 889 1368 2097 3153 4712 6936 10151 14677\n 2*Lambda[0] + 2*Lambda[1] - delta: 1 2 5 10 20 36 66 112 190 310 501 788 1230 1880 2850 4256 6303 9222 13396 19262\n 4*Lambda[1] - 2*delta: 1 2 6 11 23 41 75 126 215 347 561 878 1368 2082 3153 4690 6936 10121 14677 21055\n\n An example in type `C_2^{(1)}`::\n\n sage: Lambda = RootSystem([\'C\',2,1]).weight_lattice(extended=true).fundamental_weights()\n sage: V = IntegrableRepresentation(2*Lambda[0])\n sage: V.print_strings() # long time\n 2*Lambda[0]: 1 2 9 26 77 194 477 1084 2387 5010 10227 20198\n Lambda[0] + Lambda[2] - delta: 1 5 18 55 149 372 872 1941 4141 8523 17005 33019\n 2*Lambda[1] - delta: 1 4 15 44 122 304 721 1612 3469 7176 14414 28124\n 2*Lambda[2] - 2*delta: 2 7 26 72 194 467 1084 2367 5010 10191 20198 38907\n\n Examples for twisted affine types::\n\n sage: Lambda = RootSystem(["A",2,2]).weight_lattice(extended=True).fundamental_weights()\n sage: IntegrableRepresentation(Lambda[0]).strings()\n {Lambda[0]: [1, 1, 2, 3, 5, 7, 11, 15, 22, 30, 42, 56]}\n sage: Lambda = RootSystem([\'G\',2,1]).dual.weight_lattice(extended=true).fundamental_weights()\n sage: V = IntegrableRepresentation(Lambda[0]+Lambda[1]+Lambda[2])\n sage: V.print_strings() # long time\n 6*Lambdacheck[0]: 4 28 100 320 944 2460 6064 14300 31968 69020 144676 293916\n 3*Lambdacheck[0] + Lambdacheck[1]: 2 16 58 192 588 1568 3952 9520 21644 47456 100906 207536\n 4*Lambdacheck[0] + Lambdacheck[2]: 4 22 84 276 800 2124 5288 12470 28116 61056 128304 261972\n 2*Lambdacheck[1] - deltacheck: 2 8 32 120 354 980 2576 6244 14498 32480 69776 145528\n Lambdacheck[0] + Lambdacheck[1] + Lambdacheck[2]: 1 6 26 94 294 832 2184 5388 12634 28390 61488 128976\n 2*Lambdacheck[0] + 2*Lambdacheck[2]: 2 12 48 164 492 1344 3428 8256 18960 41844 89208 184512\n 3*Lambdacheck[2] - deltacheck: 4 16 60 208 592 1584 4032 9552 21728 47776 101068 207888\n sage: Lambda = RootSystem([\'A\',6,2]).weight_lattice(extended=true).fundamental_weights()\n sage: V = IntegrableRepresentation(Lambda[0]+2*Lambda[1])\n sage: V.print_strings() # long time\n 5*Lambda[0]: 3 42 378 2508 13707 64650 272211 1045470 3721815 12425064 39254163 118191378\n 3*Lambda[0] + Lambda[2]: 1 23 234 1690 9689 47313 204247 800029 2893198 9786257 31262198 95035357\n Lambda[0] + 2*Lambda[1]: 1 14 154 1160 6920 34756 153523 612354 2248318 7702198 24875351 76341630\n Lambda[0] + Lambda[1] + Lambda[3] - 2*delta: 6 87 751 4779 25060 113971 464842 1736620 6034717 19723537 61152367 181068152\n Lambda[0] + 2*Lambda[2] - 2*delta: 3 54 499 3349 18166 84836 353092 1341250 4725259 15625727 48938396 146190544\n Lambda[0] + 2*Lambda[3] - 4*delta: 15 195 1539 9186 45804 200073 789201 2866560 9723582 31120281 94724550 275919741\n '
def __init__(self, Lam):
"\n Initialize ``self``.\n\n EXAMPLES::\n\n sage: Lambda = RootSystem(['A',3,1]).weight_lattice(extended=true).fundamental_weights()\n sage: V = IntegrableRepresentation(Lambda[1]+Lambda[2]+Lambda[3])\n\n Some methods required by the category are not implemented::\n\n sage: TestSuite(V).run() # known bug (#21387)\n "
CategoryObject.__init__(self, base=ZZ, category=Modules(ZZ))
self._Lam = Lam
self._P = Lam.parent()
self._Q = self._P.root_system.root_lattice()
self._Lam_rho = (self._Lam + self._P.rho())
self._cartan_matrix = self._P.root_system.cartan_matrix()
self._cartan_type = self._P.root_system.cartan_type()
self._classical_rank = self._cartan_type.classical().rank()
self._index_set = self._P.index_set()
self._index_set_classical = self._cartan_type.classical().index_set()
self._cminv = self._cartan_type.classical().cartan_matrix().inverse()
self._ddict = {}
self._mdict = {tuple((0 for i in self._index_set)): 1}
from_cl_root = (lambda h: self._Q._from_dict(h._monomial_coefficients))
self._classical_roots = [from_cl_root(al) for al in self._Q.classical().roots()]
self._classical_positive_roots = [from_cl_root(al) for al in self._Q.classical().positive_roots()]
self._a = self._cartan_type.a()
self._ac = self._cartan_type.dual().a()
self._eps = {i: (self._a[i] / self._ac[i]) for i in self._index_set}
E = Matrix.diagonal([self._eps[i] for i in self._index_set_classical])
self._ip = (self._cartan_type.classical().cartan_matrix() * E).inverse()
if (not self._cartan_type.is_untwisted_affine()):
self._classical_short_roots = frozenset((al for al in self._classical_roots if (self._inner_qq(al, al) == 2)))
def highest_weight(self):
"\n Returns the highest weight of ``self``.\n\n EXAMPLES::\n\n sage: Lambda = RootSystem(['D',4,1]).weight_lattice(extended=true).fundamental_weights()\n sage: IntegrableRepresentation(Lambda[0]+2*Lambda[2]).highest_weight()\n Lambda[0] + 2*Lambda[2]\n "
return self._Lam
def weight_lattice(self):
"\n Return the weight lattice associated to ``self``.\n\n EXAMPLES::\n\n sage: V=IntegrableRepresentation(RootSystem(['E',6,1]).weight_lattice(extended=true).fundamental_weight(0))\n sage: V.weight_lattice()\n Extended weight lattice of the Root system of type ['E', 6, 1]\n "
return self._P
def root_lattice(self):
"\n Return the root lattice associated to ``self``.\n\n EXAMPLES::\n\n sage: V=IntegrableRepresentation(RootSystem(['F',4,1]).weight_lattice(extended=true).fundamental_weight(0))\n sage: V.root_lattice()\n Root lattice of the Root system of type ['F', 4, 1]\n "
return self._Q
@cached_method
def level(self):
"\n Return the level of ``self``.\n\n The level of a highest weight representation `V_{\\Lambda}` is\n defined as `(\\Lambda | \\delta)` See [Ka1990]_ section 12.4.\n\n EXAMPLES::\n\n sage: Lambda = RootSystem(['G',2,1]).weight_lattice(extended=true).fundamental_weights()\n sage: [IntegrableRepresentation(Lambda[i]).level() for i in [0,1,2]]\n [1, 1, 2]\n "
return ZZ(self._inner_pq(self._Lam, self._Q.null_root()))
@cached_method
def coxeter_number(self):
"\n Return the Coxeter number of the Cartan type of ``self``.\n\n The Coxeter number is defined in [Ka1990]_ Chapter 6, and commonly\n denoted `h`.\n\n EXAMPLES::\n\n sage: Lambda = RootSystem(['F',4,1]).weight_lattice(extended=true).fundamental_weights()\n sage: V = IntegrableRepresentation(Lambda[0])\n sage: V.coxeter_number()\n 12\n "
return sum(self._a)
@cached_method
def dual_coxeter_number(self):
"\n Return the dual Coxeter number of the Cartan type of ``self``.\n\n The dual Coxeter number is defined in [Ka1990]_ Chapter 6, and commonly\n denoted `h^{\\vee}`.\n\n EXAMPLES::\n\n sage: Lambda = RootSystem(['F',4,1]).weight_lattice(extended=true).fundamental_weights()\n sage: V = IntegrableRepresentation(Lambda[0])\n sage: V.dual_coxeter_number()\n 9\n "
return sum(self._ac)
def _repr_(self):
"\n Return a string representation of ``self``.\n\n EXAMPLES::\n\n sage: Lambda = RootSystem(['F',4,1]).weight_lattice(extended=true).fundamental_weights()\n sage: IntegrableRepresentation(Lambda[0])\n Integrable representation of ['F', 4, 1] with highest weight Lambda[0]\n "
return ('Integrable representation of %s with highest weight %s' % (self._cartan_type, self._Lam))
def _latex_(self):
"\n Return a latex representation of ``self``.\n\n EXAMPLES::\n\n sage: Lambda = RootSystem(['C',3,1]).weight_lattice(extended=true).fundamental_weights()\n sage: V = IntegrableRepresentation(Lambda[0]+2*Lambda[3])\n sage: latex(V)\n V_{\\Lambda_{0} + 2 \\Lambda_{3}}\n "
return 'V_{{{}}}'.format(self._Lam._latex_())
def cartan_type(self):
"\n Return the Cartan type of ``self``.\n\n EXAMPLES::\n\n sage: Lambda = RootSystem(['F',4,1]).weight_lattice(extended=true).fundamental_weights()\n sage: V = IntegrableRepresentation(Lambda[0])\n sage: V.cartan_type()\n ['F', 4, 1]\n "
return self._cartan_type
def _inner_qq(self, qelt1, qelt2):
"\n Symmetric form between two elements of the root lattice\n associated to ``self``.\n\n EXAMPLES::\n\n sage: P = RootSystem(['F',4,1]).weight_lattice(extended=true)\n sage: Lambda = P.fundamental_weights()\n sage: V = IntegrableRepresentation(Lambda[0])\n sage: alpha = V.root_lattice().simple_roots()\n sage: Matrix([[V._inner_qq(alpha[i], alpha[j]) for j in V._index_set] for i in V._index_set])\n [ 2 -1 0 0 0]\n [ -1 2 -1 0 0]\n [ 0 -1 2 -1 0]\n [ 0 0 -1 1 -1/2]\n [ 0 0 0 -1/2 1]\n\n .. WARNING::\n\n If ``qelt1`` or ``qelt1`` accidentally gets coerced into\n the extended weight lattice, this will return an answer,\n and it will be wrong. To make this code robust, parents\n should be checked. This is not done since in the application\n the parents are known, so checking would unnecessarily slow\n us down.\n "
mc1 = qelt1.monomial_coefficients()
mc2 = qelt2.monomial_coefficients()
zero = ZZ.zero()
return sum(((((mc1.get(i, zero) * mc2.get(j, zero)) * self._cartan_matrix[(i, j)]) / self._eps[i]) for i in self._index_set for j in self._index_set))
def _inner_pq(self, pelt, qelt):
"\n Symmetric form between an element of the weight and root lattices\n associated to ``self``.\n\n .. WARNING::\n\n If ``qelt`` accidentally gets coerced into the extended weight\n lattice, this will return an answer, and it will be wrong. To make\n this code robust, parents should be checked. This is not done\n since in the application the parents are known, so checking would\n unnecessarily slow us down.\n\n EXAMPLES::\n\n sage: P = RootSystem(['F',4,1]).weight_lattice(extended=true)\n sage: Lambda = P.fundamental_weights()\n sage: V = IntegrableRepresentation(Lambda[0])\n sage: alpha = V.root_lattice().simple_roots()\n sage: Matrix([[V._inner_pq(P(alpha[i]), alpha[j]) for j in V._index_set] for i in V._index_set])\n [ 2 -1 0 0 0]\n [ -1 2 -1 0 0]\n [ 0 -1 2 -1 0]\n [ 0 0 -1 1 -1/2]\n [ 0 0 0 -1/2 1]\n sage: P = RootSystem(['G',2,1]).weight_lattice(extended=true)\n sage: P = RootSystem(['G',2,1]).weight_lattice(extended=true)\n sage: Lambda = P.fundamental_weights()\n sage: V = IntegrableRepresentation(Lambda[0])\n sage: alpha = V.root_lattice().simple_roots()\n sage: Matrix([[V._inner_pq(Lambda[i],alpha[j]) for j in V._index_set] for i in V._index_set])\n [ 1 0 0]\n [ 0 1/3 0]\n [ 0 0 1]\n "
mcp = pelt.monomial_coefficients()
mcq = qelt.monomial_coefficients()
zero = ZZ.zero()
return sum((((mcp.get(i, zero) * mcq[i]) / self._eps[i]) for i in mcq))
def _inner_pp(self, pelt1, pelt2):
"\n Symmetric form between two elements of the weight lattice\n associated to ``self``.\n\n EXAMPLES::\n\n sage: P = RootSystem(['G',2,1]).weight_lattice(extended=true)\n sage: Lambda = P.fundamental_weights()\n sage: V = IntegrableRepresentation(Lambda[0])\n sage: alpha = V.root_lattice().simple_roots()\n sage: Matrix([[V._inner_pp(Lambda[i],P(alpha[j])) for j in V._index_set] for i in V._index_set])\n [ 1 0 0]\n [ 0 1/3 0]\n [ 0 0 1]\n sage: Matrix([[V._inner_pp(Lambda[i],Lambda[j]) for j in V._index_set] for i in V._index_set])\n [ 0 0 0]\n [ 0 2/3 1]\n [ 0 1 2]\n "
mc1 = pelt1.monomial_coefficients()
mc2 = pelt2.monomial_coefficients()
zero = ZZ.zero()
mc1d = mc1.get('delta', zero)
mc2d = mc2.get('delta', zero)
return (sum(((((mc1.get(i, zero) * self._ac[i]) * mc2d) + ((mc2.get(i, zero) * self._ac[i]) * mc1d)) for i in self._index_set)) + sum((((mc1.get(i, zero) * mc2.get(j, zero)) * self._ip[(ii, ij)]) for (ii, i) in enumerate(self._index_set_classical) for (ij, j) in enumerate(self._index_set_classical))))
def to_weight(self, n):
"\n Return the weight associated to the tuple ``n`` in ``self``.\n\n If ``n`` is the tuple `(n_1, n_2, \\ldots)`, then the associated\n weight is `\\Lambda - \\sum_i n_i \\alpha_i`, where `\\Lambda`\n is the weight of the representation.\n\n INPUT:\n\n - ``n`` -- a tuple representing a weight\n\n EXAMPLES::\n\n sage: Lambda = RootSystem(['A',2,1]).weight_lattice(extended=true).fundamental_weights()\n sage: V = IntegrableRepresentation(2*Lambda[2])\n sage: V.to_weight((1,0,0))\n -2*Lambda[0] + Lambda[1] + 3*Lambda[2] - delta\n "
alpha = self._P.simple_roots()
I = self._index_set
return (self._Lam - self._P.sum(((val * alpha[I[i]]) for (i, val) in enumerate(n))))
def _from_weight_helper(self, mu, check=False):
"\n Return the coefficients of a tuple of the weight ``mu`` expressed\n in terms of the simple roots in ``self``.\n\n The tuple ``n`` is defined as the tuple `(n_0, n_1, \\ldots)`\n such that `\\mu = \\sum_{i \\in I} n_i \\alpha_i`.\n\n INPUT:\n\n - ``mu`` -- an element in the root lattice\n\n .. TODO::\n\n Implement this as a section map of the inverse of the\n coercion from `Q \\to P`.\n\n EXAMPLES::\n\n sage: Lambda = RootSystem(['A',2,1]).weight_lattice(extended=true).fundamental_weights()\n sage: V = IntegrableRepresentation(2*Lambda[2])\n sage: V.to_weight((1,0,0))\n -2*Lambda[0] + Lambda[1] + 3*Lambda[2] - delta\n sage: delta = V.weight_lattice().null_root()\n sage: V._from_weight_helper(2*Lambda[0] - Lambda[1] - 1*Lambda[2] + delta)\n (1, 0, 0)\n "
mu = self._P(mu)
zero = ZZ.zero()
n0 = mu.monomial_coefficients().get('delta', zero)
mu0 = (mu - (n0 * self._P.simple_root(self._cartan_type.special_node())))
ret = [n0]
mc_mu0 = mu0.monomial_coefficients()
for (ii, i) in enumerate(self._index_set_classical):
ret.append(sum(((self._cminv[(ii, ij)] * mc_mu0.get(j, zero)) for (ij, j) in enumerate(self._index_set_classical))))
if check:
return all(((x in ZZ) for x in ret))
else:
return tuple((ZZ(x) for x in ret))
def from_weight(self, mu):
"\n Return the tuple `(n_0, n_1, ...)`` such that ``mu`` equals\n `\\Lambda - \\sum_{i \\in I} n_i \\alpha_i` in ``self``, where `\\Lambda`\n is the highest weight of ``self``.\n\n EXAMPLES::\n\n sage: Lambda = RootSystem(['A',2,1]).weight_lattice(extended=true).fundamental_weights()\n sage: V = IntegrableRepresentation(2*Lambda[2])\n sage: V.to_weight((1,0,0))\n -2*Lambda[0] + Lambda[1] + 3*Lambda[2] - delta\n sage: delta = V.weight_lattice().null_root()\n sage: V.from_weight(-2*Lambda[0] + Lambda[1] + 3*Lambda[2] - delta)\n (1, 0, 0)\n "
return self._from_weight_helper((self._Lam - mu))
def s(self, n, i):
"\n Return the action of the ``i``-th simple reflection on the\n internal representation of weights by tuples ``n`` in ``self``.\n\n EXAMPLES::\n\n sage: V = IntegrableRepresentation(RootSystem(['A',2,1]).weight_lattice(extended=true).fundamental_weight(0))\n sage: [V.s((0,0,0),i) for i in V._index_set]\n [(1, 0, 0), (0, 0, 0), (0, 0, 0)]\n "
ret = list(n)
ret[i] += self._Lam._monomial_coefficients.get(i, ZZ.zero())
ret[i] -= sum(((val * self._cartan_matrix[(i, j)]) for (j, val) in enumerate(n)))
return tuple(ret)
def to_dominant(self, n):
"\n Return the dominant weight in ``self`` equivalent to ``n``\n under the affine Weyl group.\n\n EXAMPLES::\n\n sage: Lambda = RootSystem(['A',2,1]).weight_lattice(extended=true).fundamental_weights()\n sage: V = IntegrableRepresentation(3*Lambda[0])\n sage: n = V.to_dominant((13,11,7)); n\n (4, 3, 3)\n sage: V.to_weight(n)\n Lambda[0] + Lambda[1] + Lambda[2] - 4*delta\n "
if (n in self._ddict):
return self._ddict[n]
path = [n]
alpha = self._P.simple_roots()
next = True
cur_wt = self.to_weight(n)
while next:
if (path[(- 1)] in self._ddict):
path.append(self._ddict[path[(- 1)]])
break
next = False
mc = cur_wt.monomial_coefficients()
for i in self._index_set:
if (mc.get(i, 0) < 0):
m = self.s(path[(- 1)], i)
if (m in self._ddict):
path.append(self._ddict[m])
else:
cur_wt -= ((m[i] - path[(- 1)][i]) * alpha[i])
path.append(m)
next = True
break
v = path.pop()
for m in path:
self._ddict[m] = v
return v
def _freudenthal_roots_imaginary(self, nu):
"\n Iterate over the set of imaginary roots `\\alpha \\in \\Delta^+`\n in ``self`` such that `\\nu - \\alpha \\in Q^+`.\n\n INPUT:\n\n - ``nu`` -- an element in `Q`\n\n EXAMPLES::\n\n sage: Lambda = RootSystem(['B',3,1]).weight_lattice(extended=true).fundamental_weights()\n sage: V = IntegrableRepresentation(Lambda[0]+Lambda[1]+Lambda[3])\n sage: [list(V._freudenthal_roots_imaginary(V.highest_weight() - mw))\n ....: for mw in V.dominant_maximal_weights()]\n [[], [], [], [], []]\n "
l = self._from_weight_helper(nu)
kp = min(((l[i] // self._a[i]) for i in self._index_set))
delta = self._Q.null_root()
for u in range(1, (kp + 1)):
(yield (u * delta))
def _freudenthal_roots_real(self, nu):
"\n Iterate over the set of real positive roots `\\alpha \\in \\Delta^+`\n in ``self`` such that `\\nu - \\alpha \\in Q^+`.\n\n See [Ka1990]_ Proposition 6.3 for the way to compute the set of real\n roots for twisted affine case.\n\n INPUT:\n\n - ``nu`` -- an element in `Q`\n\n EXAMPLES::\n\n sage: Lambda = RootSystem(['B',3,1]).weight_lattice(extended=true).fundamental_weights()\n sage: V = IntegrableRepresentation(Lambda[0]+Lambda[1]+Lambda[3])\n sage: mw = V.dominant_maximal_weights()[0]\n sage: sorted(V._freudenthal_roots_real(V.highest_weight() - mw), key=str)\n [alpha[1],\n alpha[1] + alpha[2],\n alpha[1] + alpha[2] + alpha[3],\n alpha[2],\n alpha[2] + alpha[3],\n alpha[3]]\n "
for al in self._classical_positive_roots:
if (min(self._from_weight_helper((nu - al))) >= 0):
(yield al)
if self._cartan_type.is_untwisted_affine():
for al in self._classical_roots:
for ir in self._freudenthal_roots_imaginary((nu - al)):
(yield (al + ir))
elif (self._cartan_type.type() == 'BC'):
ret = set(self._classical_positive_roots)
for al in self._classical_roots:
if (al in self._classical_short_roots):
for ir in self._freudenthal_roots_imaginary((nu - al)):
ret.add((al + ir))
(yield (al + ir))
else:
fri = list(self._freudenthal_roots_imaginary((nu - al)))
friset = set(fri)
for ir in fri:
if ((2 * ir) in friset):
ret.add((al + (2 * ir)))
(yield (al + (2 * ir)))
alpha = self._Q.simple_roots()
fri = list(self._freudenthal_roots_imaginary(((2 * nu) - al)))
for ir in fri[::2]:
rt = sum((((val // 2) * alpha[i]) for (i, val) in enumerate(self._from_weight_helper((al + ir)))))
if (rt not in ret):
ret.add(rt)
(yield rt)
elif (self._cartan_type.dual().type() == 'G'):
for al in self._classical_roots:
if (al in self._classical_short_roots):
for ir in self._freudenthal_roots_imaginary((nu - al)):
(yield (al + ir))
else:
fri = list(self._freudenthal_roots_imaginary((nu - al)))
friset = set(fri)
for ir in fri:
if ((3 * ir) in friset):
(yield (al + (3 * ir)))
elif (self._cartan_type.dual().type() in ['B', 'C', 'F']):
for al in self._classical_roots:
if (al in self._classical_short_roots):
for ir in self._freudenthal_roots_imaginary((nu - al)):
(yield (al + ir))
else:
fri = list(self._freudenthal_roots_imaginary((nu - al)))
friset = set(fri)
for ir in fri:
if ((2 * ir) in friset):
(yield (al + (2 * ir)))
def _freudenthal_accum(self, nu, al):
"\n Helper method for computing the Freudenthal formula in ``self``.\n\n EXAMPLES::\n\n sage: Lambda = RootSystem(['B',3,1]).weight_lattice(extended=true).fundamental_weights()\n sage: V = IntegrableRepresentation(Lambda[0]+Lambda[1]+Lambda[3])\n sage: mw = V.dominant_maximal_weights()[0]\n sage: F = V._freudenthal_roots_real(V.highest_weight() - mw)\n sage: sorted([V._freudenthal_accum(mw, al) for al in F])\n [3, 3, 3, 4, 4, 4]\n "
ret = 0
n = list(self._from_weight_helper((self._Lam - nu)))
ip = self._inner_pq(nu, al)
n_shift = self._from_weight_helper(al)
ip_shift = self._inner_qq(al, al)
while (min(n) >= 0):
ip += ip_shift
for (i, val) in enumerate(n_shift):
n[i] -= val
ret += ((2 * self.m(tuple(n))) * ip)
return ret
def _m_freudenthal(self, n):
"\n Compute the weight multiplicity using the Freudenthal\n multiplicity formula in ``self``.\n\n The multiplicities of the imaginary roots for the twisted\n affine case are different than those for the untwisted case.\n See [Carter]_ Corollary 18.10 for general type and Corollary\n 18.15 for `A^2_{2l}`\n\n EXAMPLES::\n\n sage: Lambda = RootSystem(['B',3,1]).weight_lattice(extended=true).fundamental_weights()\n sage: V = IntegrableRepresentation(Lambda[0]+Lambda[1]+Lambda[3])\n sage: D = list(V.dominant_maximal_weights())\n sage: D.remove(V.highest_weight())\n sage: [V._m_freudenthal(V.from_weight(mw)) for mw in D]\n [3, 7, 3, 3]\n "
if (min(n) < 0):
return 0
mu = self.to_weight(n)
I = self._index_set
al = self._Q._from_dict({I[i]: val for (i, val) in enumerate(n) if val}, remove_zeros=False)
cr = self._classical_rank
num = sum((self._freudenthal_accum(mu, alr) for alr in self._freudenthal_roots_real((self._Lam - mu))))
if self._cartan_type.is_untwisted_affine():
num += sum(((cr * self._freudenthal_accum(mu, alr)) for alr in self._freudenthal_roots_imaginary((self._Lam - mu))))
elif (self._cartan_type.dual().type() == 'B'):
val = 1
for rt in self._freudenthal_roots_imaginary((self._Lam - mu)):
num += ((cr - val) * self._freudenthal_accum(mu, rt))
val = (1 - val)
elif (self._cartan_type.type() == 'BC'):
num += sum(((cr * self._freudenthal_accum(mu, alr)) for alr in self._freudenthal_roots_imaginary((self._Lam - mu))))
elif (self._cartan_type.dual() == 'C'):
val = 1
for rt in self._freudenthal_roots_imaginary((self._Lam - mu)):
num += ((cr - ((cr - 1) * val)) * self._freudenthal_accum(mu, rt))
val = (1 - val)
elif (self._cartan_type.dual().type() == 'F'):
val = 1
for rt in self._freudenthal_roots_imaginary((self._Lam - mu)):
num += ((4 - (2 * val)) * self._freudenthal_accum(mu, rt))
val = (1 - val)
elif (self._cartan_type.dual().type() == 'G'):
for (k, rt) in enumerate(self._freudenthal_roots_imaginary((self._Lam - mu))):
if (((k + 1) % 3) == 0):
num += (2 * self._freudenthal_accum(mu, rt))
else:
num += self._freudenthal_accum(mu, rt)
den = ((2 * self._inner_pq(self._Lam_rho, al)) - self._inner_qq(al, al))
try:
return ZZ((num / den))
except TypeError:
return None
def m(self, n):
"\n Return the multiplicity of the weight `\\mu` in ``self``, where\n `\\mu = \\Lambda - \\sum_i n_i \\alpha_i`.\n\n INPUT:\n\n - ``n`` -- a tuple representing a weight `\\mu`.\n\n EXAMPLES::\n\n sage: Lambda = RootSystem(['E',6,1]).weight_lattice(extended=true).fundamental_weights()\n sage: V = IntegrableRepresentation(Lambda[0])\n sage: u = V.highest_weight() - V.weight_lattice().null_root()\n sage: V.from_weight(u)\n (1, 1, 2, 2, 3, 2, 1)\n sage: V.m(V.from_weight(u))\n 6\n "
if (n in self._mdict):
return self._mdict[n]
elif (n in self._ddict):
self._mdict[n] = self.m(self._ddict[n])
m = self.to_dominant(n)
if (m in self._mdict):
return self._mdict[m]
ret = self._m_freudenthal(m)
assert (ret is not None), 'm: error - failed to compute m{}'.format(n)
self._mdict[n] = ret
return ret
def mult(self, mu):
'\n Return the weight multiplicity of ``mu``.\n\n INPUT:\n\n - ``mu`` -- an element of the weight lattice\n\n EXAMPLES::\n\n sage: # needs sage.libs.gap\n sage: L = RootSystem("B3~").weight_lattice(extended=True)\n sage: Lambda = L.fundamental_weights()\n sage: delta = L.null_root()\n sage: W = L.weyl_group(prefix="s")\n sage: [s0,s1,s2,s3] = W.simple_reflections()\n sage: V = IntegrableRepresentation(Lambda[0])\n sage: V.mult(Lambda[2] - 2*delta)\n 3\n sage: V.mult(Lambda[2] - Lambda[1])\n 0\n sage: weights = [w.action(Lambda[1] - 4*delta) for w in [s1,s2,s0*s1*s2*s3]]\n sage: weights\n [-Lambda[1] + Lambda[2] - 4*delta,\n Lambda[1] - 4*delta,\n -Lambda[1] + Lambda[2] - 4*delta]\n sage: [V.mult(mu) for mu in weights]\n [35, 35, 35]\n\n TESTS::\n\n sage: L = RootSystem("B3~").weight_lattice(extended=True)\n sage: La = L.fundamental_weights()\n sage: V = IntegrableRepresentation(La[0])\n sage: Q = RootSystem("B3~").root_space()\n sage: al = Q.simple_roots()\n sage: V.mult(1/2*al[1])\n 0\n '
try:
n = self.from_weight(mu)
except TypeError:
return ZZ.zero()
return self.m(n)
@cached_method
def dominant_maximal_weights(self):
"\n Return the dominant maximal weights of ``self``.\n\n A weight `\\mu` is *maximal* if it has nonzero multiplicity but\n `\\mu + \\delta`` has multiplicity zero. There are a finite number\n of dominant maximal weights. Indeed, [Ka1990]_ Proposition 12.6\n shows that the dominant maximal weights are in bijection with\n the classical weights in `k \\cdot F` where `F` is the fundamental\n alcove and `k` is the level. The construction used in this\n method is based on that Proposition.\n\n EXAMPLES::\n\n sage: Lambda = RootSystem(['C',3,1]).weight_lattice(extended=true).fundamental_weights()\n sage: IntegrableRepresentation(2*Lambda[0]).dominant_maximal_weights()\n (2*Lambda[0],\n Lambda[0] + Lambda[2] - delta,\n 2*Lambda[1] - delta,\n Lambda[1] + Lambda[3] - 2*delta,\n 2*Lambda[2] - 2*delta,\n 2*Lambda[3] - 3*delta)\n "
k = self.level()
Lambda = self._P.fundamental_weights()
def next_level(wt):
return [(wt + Lambda[i]) for i in self._index_set_classical if ((wt + Lambda[i]).level() <= k)]
R = RecursivelyEnumeratedSet([self._P.zero()], next_level)
candidates = [(x + ((k - x.level()) * Lambda[0])) for x in list(R)]
ret = []
delta = self._Q.null_root()
for x in candidates:
if self._from_weight_helper((self._Lam - x), check=True):
t = 0
while (self.m(self.from_weight((x - (t * delta)))) == 0):
t += 1
ret.append((x - (t * delta)))
return tuple(ret)
def string(self, max_weight, depth=12):
"\n Return the list of multiplicities `m(\\Lambda - k \\delta)` in\n ``self``, where `\\Lambda` is ``max_weight`` and `k` runs from `0`\n to ``depth``.\n\n INPUT:\n\n - ``max_weight`` -- a dominant maximal weight\n - ``depth`` -- (default: 12) the maximum value of `k`\n\n EXAMPLES::\n\n sage: Lambda = RootSystem(['A',2,1]).weight_lattice(extended=true).fundamental_weights()\n sage: V = IntegrableRepresentation(2*Lambda[0])\n sage: V.string(2*Lambda[0])\n [1, 2, 8, 20, 52, 116, 256, 522, 1045, 1996, 3736, 6780]\n sage: V.string(Lambda[1] + Lambda[2])\n [0, 1, 4, 12, 32, 77, 172, 365, 740, 1445, 2736, 5041]\n "
ret = []
delta = self._Q.null_root()
cur_weight = max_weight
for k in range(depth):
ret.append(self.m(self.from_weight(cur_weight)))
cur_weight -= delta
return ret
def strings(self, depth=12):
'\n Return the set of dominant maximal weights of ``self``, together\n with the string coefficients for each.\n\n OPTIONAL:\n\n - ``depth`` -- (default: 12) a parameter indicating how far\n to push computations\n\n EXAMPLES::\n\n sage: Lambda = RootSystem([\'A\',1,1]).weight_lattice(extended=true).fundamental_weights()\n sage: V = IntegrableRepresentation(2*Lambda[0])\n sage: S = V.strings(depth=25)\n sage: for k in S:\n ....: print("{}: {}".format(k, \' \'.join(str(x) for x in S[k])))\n 2*Lambda[0]: 1 1 3 5 10 16 28 43 70 105 161 236 350 501 722 1016 1431 1981 2741 3740 5096 6868 9233 12306 16357\n 2*Lambda[1] - delta: 1 2 4 7 13 21 35 55 86 130 196 287 420 602 858 1206 1687 2331 3206 4368 5922 7967 10670 14193 18803\n '
return {max_weight: self.string(max_weight, depth) for max_weight in self.dominant_maximal_weights()}
def print_strings(self, depth=12):
"\n Print the strings of ``self``.\n\n .. SEEALSO::\n\n :meth:`strings`\n\n EXAMPLES::\n\n sage: Lambda = RootSystem(['A',1,1]).weight_lattice(extended=true).fundamental_weights()\n sage: V = IntegrableRepresentation(2*Lambda[0])\n sage: V.print_strings(depth=25)\n 2*Lambda[0]: 1 1 3 5 10 16 28 43 70 105 161 236 350 501 722 1016 1431 1981 2741 3740 5096 6868 9233 12306 16357\n 2*Lambda[1] - delta: 1 2 4 7 13 21 35 55 86 130 196 287 420 602 858 1206 1687 2331 3206 4368 5922 7967 10670 14193 18803\n "
S = self.strings(depth=depth)
for mw in self.dominant_maximal_weights():
print('{}: {}'.format(mw, ' '.join((str(x) for x in S[mw]))))
def modular_characteristic(self, mu=None):
"\n Return the modular characteristic of ``self``.\n\n The modular characteristic is a rational number introduced\n by Kac and Peterson [KacPeterson]_, required to interpret the\n string functions as Fourier coefficients of modular forms. See\n [Ka1990]_ Section 12.7. Let `k` be the level, and let `h^\\vee`\n be the dual Coxeter number. Then\n\n .. MATH::\n\n m_\\Lambda = \\frac{|\\Lambda+\\rho|^2}{2(k+h^\\vee)}\n - \\frac{|\\rho|^2}{2h^\\vee}\n\n If `\\mu` is a weight, then\n\n .. MATH::\n\n m_{\\Lambda,\\mu} = m_\\Lambda - \\frac{|\\mu|^2}{2k}.\n\n OPTIONAL:\n\n - ``mu`` -- a weight; or alternatively:\n - ``n`` -- a tuple representing a weight `\\mu`.\n\n If no optional parameter is specified, this returns `m_\\Lambda`.\n If ``mu`` is specified, it returns `m_{\\Lambda,\\mu}`. You may\n use the tuple ``n`` to specify `\\mu`. If you do this, `\\mu` is\n `\\Lambda - \\sum_i n_i \\alpha_i`.\n\n EXAMPLES::\n\n sage: Lambda = RootSystem(['A',1,1]).weight_lattice(extended=true).fundamental_weights()\n sage: V = IntegrableRepresentation(3*Lambda[0]+2*Lambda[1])\n sage: [V.modular_characteristic(x) for x in V.dominant_maximal_weights()]\n [11/56, -1/280, 111/280]\n "
if (type(mu) is tuple):
n = mu
else:
n = self.from_weight(mu)
k = self.level()
hd = self.dual_coxeter_number()
rho = self._P.rho()
m_Lambda = ((self._inner_pp(self._Lam_rho, self._Lam_rho) / (2 * (k + hd))) - (self._inner_pp(rho, rho) / (2 * hd)))
if (n is None):
return m_Lambda
mu = self.to_weight(n)
return (m_Lambda - (self._inner_pp(mu, mu) / (2 * k)))
def branch(self, i=None, weyl_character_ring=None, sequence=None, depth=5):
'\n Return the branching rule on ``self``.\n\n Removing any node from the extended Dynkin diagram of the affine\n Lie algebra results in the Dynkin diagram of a classical Lie\n algebra, which is therefore a Lie subalgebra. For example\n removing the `0` node from the Dynkin diagram of type ``[X, r, 1]``\n produces the classical Dynkin diagram of ``[X, r]``.\n\n Thus for each `i` in the index set, we may restrict ``self`` to\n the corresponding classical subalgebra. Of course ``self`` is\n an infinite dimensional representation, but each weight `\\mu`\n is assigned a grading by the number of times the simple root\n `\\alpha_i` appears in `\\Lambda-\\mu`. Thus the branched\n representation is graded and we get sequence of finite-dimensional\n representations which this method is able to compute.\n\n OPTIONAL:\n\n - ``i`` -- (default: 0) an element of the index set\n - ``weyl_character_ring`` -- a WeylCharacterRing\n - ``sequence`` -- a dictionary\n - ``depth`` -- (default: 5) an upper bound for `k` determining\n how many terms to give\n\n In the default case where `i = 0`, you do not need to specify\n anything else, though you may want to increase the depth if\n you need more terms.\n\n EXAMPLES::\n\n sage: Lambda = RootSystem([\'A\',2,1]).weight_lattice(extended=true).fundamental_weights()\n sage: V = IntegrableRepresentation(2*Lambda[0])\n sage: b = V.branch(); b # needs sage.libs.gap\n [A2(0,0),\n A2(1,1),\n A2(0,0) + 2*A2(1,1) + A2(2,2),\n 2*A2(0,0) + 2*A2(0,3) + 4*A2(1,1) + 2*A2(3,0) + 2*A2(2,2),\n 4*A2(0,0) + 3*A2(0,3) + 10*A2(1,1) + 3*A2(3,0) + A2(1,4) + 6*A2(2,2) + A2(4,1),\n 6*A2(0,0) + 9*A2(0,3) + 20*A2(1,1) + 9*A2(3,0) + 3*A2(1,4) + 12*A2(2,2) + 3*A2(4,1) + A2(3,3)]\n\n If the parameter ``weyl_character_ring`` is omitted, the ring may be recovered\n as the parent of one of the branched coefficients::\n\n sage: A2 = b[0].parent(); A2 # needs sage.libs.gap\n The Weyl Character Ring of Type A2 with Integer Ring coefficients\n\n If `i` is not zero then you should specify the :class:`WeylCharacterRing` that you\n are branching to. This is determined by the Dynkin diagram::\n\n sage: Lambda = RootSystem([\'B\',3,1]).weight_lattice(extended=true).fundamental_weights()\n sage: V = IntegrableRepresentation(Lambda[0])\n sage: V.cartan_type().dynkin_diagram()\n O 0\n |\n |\n O---O=>=O\n 1 2 3\n B3~\n\n In this example, we observe that removing the `i=2` node from the\n Dynkin diagram produces a reducible diagram of type ``A1xA1xA1``.\n Thus we have a branching to\n `\\mathfrak{sl}(2) \\times \\mathfrak{sl}(2) \\times \\mathfrak{sl}(2)`::\n\n sage: A1xA1xA1 = WeylCharacterRing("A1xA1xA1",style="coroots") # needs sage.libs.gap\n sage: V.branch(i=2,weyl_character_ring=A1xA1xA1) # needs sage.libs.gap\n [A1xA1xA1(1,0,0),\n A1xA1xA1(0,1,2),\n A1xA1xA1(1,0,0) + A1xA1xA1(1,2,0) + A1xA1xA1(1,0,2),\n A1xA1xA1(2,1,2) + A1xA1xA1(0,1,0) + 2*A1xA1xA1(0,1,2),\n 3*A1xA1xA1(1,0,0) + 2*A1xA1xA1(1,2,0) + A1xA1xA1(1,2,2) + 2*A1xA1xA1(1,0,2) + A1xA1xA1(1,0,4) + A1xA1xA1(3,0,0),\n A1xA1xA1(2,1,0) + 3*A1xA1xA1(2,1,2) + 2*A1xA1xA1(0,1,0) + 5*A1xA1xA1(0,1,2) + A1xA1xA1(0,1,4) + A1xA1xA1(0,3,2)]\n\n If the nodes of the two Dynkin diagrams are not in the same order, you\n must specify an additional parameter, ``sequence`` which gives a dictionary\n to the affine Dynkin diagram to the classical one.\n\n EXAMPLES::\n\n sage: Lambda = RootSystem([\'F\',4,1]).weight_lattice(extended=true).fundamental_weights()\n sage: V = IntegrableRepresentation(Lambda[0])\n sage: V.cartan_type().dynkin_diagram()\n O---O---O=>=O---O\n 0 1 2 3 4\n F4~\n sage: A1xC3=WeylCharacterRing("A1xC3",style="coroots")\n sage: A1xC3.dynkin_diagram()\n O\n 1\n O---O=<=O\n 2 3 4\n A1xC3\n\n Observe that removing the `i=1` node from the ``F4~`` Dynkin diagram\n gives the ``A1xC3`` diagram, but the roots are in a different order.\n The nodes `0, 2, 3, 4` of ``F4~`` correspond to ``1, 4, 3, 2``\n of ``A1xC3`` and so we encode this in a dictionary::\n\n sage: V.branch(i=1, weyl_character_ring=A1xC3, sequence={0:1,2:4,3:3,4:2}) # long time\n [A1xC3(1,0,0,0),\n A1xC3(0,0,0,1),\n A1xC3(1,0,0,0) + A1xC3(1,2,0,0),\n A1xC3(2,0,0,1) + A1xC3(0,0,0,1) + A1xC3(0,1,1,0),\n 2*A1xC3(1,0,0,0) + A1xC3(1,0,1,0) + 2*A1xC3(1,2,0,0) + A1xC3(1,0,2,0) + A1xC3(3,0,0,0),\n 2*A1xC3(2,0,0,1) + A1xC3(2,1,1,0) + A1xC3(0,1,0,0) + 3*A1xC3(0,0,0,1) + 2*A1xC3(0,1,1,0) + A1xC3(0,2,0,1)]\n\n The branch method gives a way of computing the graded dimension of the integrable representation::\n\n sage: Lambda = RootSystem("A1~").weight_lattice(extended=true).fundamental_weights()\n sage: V=IntegrableRepresentation(Lambda[0])\n sage: r = [x.degree() for x in V.branch(depth=15)]; r\n [1, 3, 4, 7, 13, 19, 29, 43, 62, 90, 126, 174, 239, 325, 435, 580]\n sage: oeis(r) # optional -- internet\n 0: A029552: Expansion of phi(x) / f(-x) in powers of x where phi(), f() are Ramanujan theta functions.\n\n '
if (i is None):
i = self._cartan_type.special_node()
if ((i == self._cartan_type.special_node()) or (self._cartan_type.type() == 'A')):
if (weyl_character_ring is None):
weyl_character_ring = WeylCharacterRing(self._cartan_type.classical(), style='coroots')
if (weyl_character_ring.cartan_type() != self._cartan_type.classical()):
raise ValueError(('Cartan type of WeylCharacterRing must be %s' % self.cartan_type().classical()))
elif (weyl_character_ring is None):
raise ValueError('the argument weyl_character_ring cannot be omitted if i != 0')
if (sequence is None):
sequence = {}
for j in self._index_set:
if (j < i):
sequence[j] = (j + 1)
elif (j > i):
sequence[j] = j
def next_level(x):
ret = []
for j in self._index_set:
t = list(x[0])
t[j] += 1
t = tuple(t)
m = self.m(t)
if ((m > 0) and (t[i] <= depth)):
ret.append((t, m))
return ret
hwv = (tuple([0 for j in self._index_set]), 1)
terms = RecursivelyEnumeratedSet([hwv], next_level)
fw = weyl_character_ring.fundamental_weights()
P = self.weight_lattice()
ret = []
for l in range((depth + 1)):
lterms = [x for x in terms if (x[0][i] == l)]
ldict = {}
for x in lterms:
mc = P(self.to_weight(x[0])).monomial_coefficients()
contr = sum(((fw[sequence[j]] * mc.get(j, 0)) for j in self._index_set if (j != i))).coerce_to_sl()
if (contr in ldict):
ldict[contr] += x[1]
else:
ldict[contr] = x[1]
ret.append(weyl_character_ring.char_from_weights(ldict))
return ret
|
class NonSymmetricMacdonaldPolynomials(CherednikOperatorsEigenvectors):
'\n Nonsymmetric Macdonald polynomials\n\n INPUT:\n\n - ``KL`` -- an affine Cartan type or the group algebra of a\n realization of the affine weight lattice\n - ``q``, ``q1``, ``q2`` -- parameters in the base ring of the group algebra (default: ``q``, ``q1``, ``q2``)\n - ``normalized`` -- a boolean (default: ``True``)\n whether to normalize the result to have leading coefficient 1\n\n This implementation covers all reduced affine root systems.\n The polynomials are constructed recursively by the application\n of intertwining operators.\n\n .. TODO::\n\n - Non-reduced case (Koornwinder polynomials).\n - Non-equal parameters for the affine Hecke algebra.\n - Choice of convention (dominant/anti-dominant, ...).\n - More uniform implementation of the `T_0^\\vee` operator.\n - Optimizations, in particular in the calculation of the\n eigenvalues for the recursion.\n\n EXAMPLES:\n\n We construct the family of nonsymmetric Macdonald polynomials in\n three variables in type `A`::\n\n sage: E = NonSymmetricMacdonaldPolynomials(["A",2,1])\n\n They are constructed as elements of the group algebra of the\n classical weight lattice `L_0` (or one of its realizations, such as\n the ambient space, which is used here) and indexed by elements of `L_0`::\n\n sage: L0 = E.keys(); L0\n Ambient space of the Root system of type [\'A\', 2]\n\n Here is the nonsymmetric Macdonald polynomial with leading term\n `[2,0,1]`::\n\n sage: E[L0([2,0,1])] # needs sage.libs.gap\n ((-q*q1-q*q2)/(-q*q1-q2))*B[(1, 1, 1)]\n + ((-q1-q2)/(-q*q1-q2))*B[(2, 1, 0)] + B[(2, 0, 1)]\n\n It can be seen as a polynomial (or in general a Laurent\n polynomial) by interpreting each term as an exponent vector. The\n parameter `q` is the exponential of the null (co)root, whereas\n `q_1` and `q_2` are the two eigenvalues of each generator\n `T_i` of the affine Hecke algebra (see the background section for\n details).\n\n By setting `q_1=t`, `q_2=-1` and using the\n :meth:`.root_lattice_realization_algebras.Algebras.ElementMethods.expand`\n method, we recover the nonsymmetric Macdonald polynomial as\n computed by [HHL06]_\'s combinatorial formula::\n\n sage: K = QQ[\'q,t\'].fraction_field()\n sage: q,t = K.gens()\n sage: E = NonSymmetricMacdonaldPolynomials(["A",2,1], q=q, q1=t, q2=-1)\n sage: vars = K[\'x0,x1,x2\'].gens()\n sage: E[L0([2,0,1])].expand(vars) # needs sage.libs.gap\n (t - 1)/(q*t - 1)*x0^2*x1 + x0^2*x2 + (q*t - q)/(q*t - 1)*x0*x1*x2\n\n sage: from sage.combinat.sf.ns_macdonald import E # needs sage.combinat\n sage: E([2,0,1]) # needs sage.combinat sage.groups\n (t - 1)/(q*t - 1)*x0^2*x1 + x0^2*x2 + (q*t - q)/(q*t - 1)*x0*x1*x2\n\n Here is a type `G_2^{(1)}` nonsymmetric Macdonald polynomial::\n\n sage: E = NonSymmetricMacdonaldPolynomials(["G",2,1])\n sage: L0 = E.keys()\n sage: omega = L0.fundamental_weights()\n sage: E[omega[2] - omega[1]]\n ((-q*q1^3*q2-q*q1^2*q2^2)/(q*q1^4-q2^4))*B[(0, 0, 0)]\n + B[(1, -1, 0)] + ((-q1*q2^3-q2^4)/(q*q1^4-q2^4))*B[(1, 0, -1)]\n\n Many more examples are given after the background section.\n\n .. SEEALSO::\n\n - :func:`sage.combinat.sf.ns_macdonald.E`\n - :meth:`SymmetricFunctions.macdonald`\n\n .. RUBRIC:: Background\n\n .. RUBRIC:: The polynomial module\n\n The nonsymmetric Macdonald polynomials are a distinguished basis of the "polynomial" module\n of the affine Hecke algebra. Given::\n\n - a ground ring `K`, which contains the input parameters `q, q_1, q_2`\n - an affine root system, specified by a Cartan type `C`\n - a realization `L` of the weight lattice of type `C`\n\n the polynomial module is the group algebra `K[L_0]` of the classical\n weight lattice `L_0` with coefficients in `K`. It is isomorphic to the\n Laurent polynomial ring over `K` generated by the formal exponentials\n of any basis of `L_0`.\n\n In our running example `L` is the ambient space of type `C_2^{(1)}`::\n\n sage: K = QQ[\'q,q1,q2\'].fraction_field()\n sage: q, q1, q2 = K.gens()\n sage: C = CartanType(["C",2,1])\n sage: L = RootSystem(C).ambient_space(); L\n Ambient space of the Root system of type [\'C\', 2, 1]\n\n sage: L.simple_roots()\n Finite family {0: -2*e[0] + e[\'delta\'], 1: e[0] - e[1], 2: 2*e[1]}\n sage: omega = L.fundamental_weights(); omega\n Finite family {0: e[\'deltacheck\'],\n 1: e[0] + e[\'deltacheck\'],\n 2: e[0] + e[1] + e[\'deltacheck\']}\n\n sage: L0 = L.classical(); L0\n Ambient space of the Root system of type [\'C\', 2]\n sage: KL0 = L0.algebra(K); KL0\n Algebra of the Ambient space of the Root system of type [\'C\', 2]\n over Fraction Field of Multivariate Polynomial Ring in q, q1, q2 over Rational Field\n\n .. RUBRIC:: Affine Hecke algebra\n\n The affine Hecke algebra is generated by elements `T_i` for ``i`` in the\n set of affine Dynkin nodes. They satisfy the same braid relations\n as the simple reflections `s_i` of the affine Weyl group.\n The `T_i` satisfy the quadratic relation\n\n .. MATH::\n\n (T_i-q_1)\\circ(T_i-q_2) = 0,\n\n where `q_1` and `q_2` are the input parameters. Some of the\n representation theory requires that `q_1` and `q_2` satisfy\n additional relations; typically one uses the specializations\n `q_1=u` and `q_2=-1/u` or `q_1=t` and `q_2=-1`). This can be\n achieved by constructing an appropriate field and passing `q_1`\n and `q_2` appropriately; see the examples. In principle, the\n parameter(s) could further depend on ``i``; this is not yet\n implemented but the code has been designed in such a way that this\n feature is easy to add.\n\n .. RUBRIC:: Demazure-Lusztig operators\n\n The ``i``-th Demazure-Lusztig operator is an operator on `K[L]`\n which interpolates between the reflection `s_i` and the Demazure operator `\\pi_i`\n (see :meth:`.root_lattice_realization.RootLatticeRealization.Algebras.ParentMethods.demazure_lusztig_operators`).::\n\n sage: KL = L.algebra(K); KL\n Algebra of the Ambient space of the Root system of type [\'C\', 2, 1]\n over Fraction Field of Multivariate Polynomial Ring in q, q1, q2 over Rational Field\n sage: T = KL.demazure_lusztig_operators(q1, q2)\n sage: x = KL.monomial(omega[1]); x\n B[e[0] + e[\'deltacheck\']]\n sage: T[2](x)\n q1*B[e[0] + e[\'deltacheck\']]\n sage: T[1](x)\n (q1+q2)*B[e[0] + e[\'deltacheck\']] + q1*B[e[1] + e[\'deltacheck\']]\n sage: T[0](x)\n q1*B[e[0] + e[\'deltacheck\']]\n\n The affine Hecke algebra acts on `K[L]` by letting the generators `T_i` act by\n the Demazure-Lusztig operators. The class\n :class:`sage.combinat.root_system.hecke_algebra_representation.HeckeAlgebraRepresentation`\n implements some simple generic features for representations of affine Hecke algebras\n defined by the action of their `T`-generators.::\n\n sage: T\n A representation of the (q1, q2)-Hecke algebra of type [\'C\', 2, 1] on\n Algebra of the Ambient space of the Root system of type [\'C\', 2, 1] over\n Fraction Field of Multivariate Polynomial Ring in q, q1, q2 over Rational Field\n sage: type(T)\n <class \'sage.combinat.root_system.hecke_algebra_representation.HeckeAlgebraRepresentation\'>\n sage: T._test_relations() # long time (1.3s)\n\n Here we construct the operator `q_1 T_2^{-1}\\circ T_1^{-1}T_0`\n from a signed reduced word::\n\n sage: T.Tw([0,1,2],[1,-1,-1], q1^2)\n Generic endomorphism of Algebra of the Ambient space of the Root system of type [\'C\', 2, 1]\n over Fraction Field of Multivariate Polynomial Ring in q, q1, q2 over Rational Field\n\n (note the reversal of the word). Inverses are computed using the\n quadratic relation.\n\n .. RUBRIC:: Cherednik operators\n\n The affine Hecke algebra contains elements `Y_\\lambda` indexed by\n the coroot lattice. Their action on `K[L]` is implemented in Sage::\n\n sage: Y = T.Y(); Y\n Lazy family (...)_{i in Coroot lattice of the Root system of type [\'C\', 2, 1]}\n sage: alphacheck = Y.keys().simple_roots()\n sage: Y1 = Y[alphacheck[1]]\n sage: Y1(x)\n ((q1^2+2*q1*q2+q2^2)/(-q1*q2))*B[e[0] + e[\'deltacheck\']]\n + ((-q1^2-2*q1*q2-q2^2)/(-q2^2))*B[-e[1] + e[\'deltacheck\']]\n + ((-q1^2-q1*q2)/(-q2^2))*B[2*e[0] - e[1] - e[\'delta\']\n + e[\'deltacheck\']] + ((q1^3+q1^2*q2)/(-q2^3))*B[e[0] - e[\'delta\']\n + e[\'deltacheck\']] + ((q1^3+q1^2*q2)/(-q2^3))*B[e[0] - 2*e[1] - e[\'delta\']\n + e[\'deltacheck\']] + ((q1+q2)/(-q2))*B[e[1] + e[\'deltacheck\']]\n + ((q1^3+2*q1^2*q2+q1*q2^2)/(-q2^3))*B[-e[1] - e[\'delta\'] + e[\'deltacheck\']]\n + ((q1^3+q1^2*q2)/(-q2^3))*B[2*e[0] - e[1] - 2*e[\'delta\'] + e[\'deltacheck\']]\n + ((q1^3+2*q1^2*q2+q1*q2^2)/(-q2^3))*B[-e[0] - e[\'delta\'] + e[\'deltacheck\']]\n + ((q1^3+2*q1^2*q2+q1*q2^2)/(-q2^3))*B[e[0] - 2*e[\'delta\'] + e[\'deltacheck\']]\n + ((q1^3+q1^2*q2)/(-q2^3))*B[3*e[0] - 3*e[\'delta\'] + e[\'deltacheck\']]\n + ((q1^3+q1^2*q2)/(-q2^3))*B[-e[0] - 2*e[1] - e[\'delta\'] + e[\'deltacheck\']]\n + ((q1^3+q1^2*q2)/(-q2^3))*B[e[0] - 2*e[1] - 2*e[\'delta\'] + e[\'deltacheck\']]\n + (q1^3/(-q2^3))*B[3*e[0] - 2*e[1] - 3*e[\'delta\'] + e[\'deltacheck\']]\n\n The Cherednik operators span a Laurent polynomial ring inside the\n affine Hecke algebra; namely `\\lambda\\mapsto Y_\\lambda` is a group\n isomorphism from the classical root lattice (viewed additively) to\n the affine Hecke algebra (viewed multiplicatively). In practice,\n `Y_\\lambda` is constructed by computing combinatorially its signed\n reduced word (and an overall scalar factor) using the periodic\n orientation of the alcove model in the coweight lattice (see\n :meth:`.hecke_algebra_representation.HeckeAlgebraRepresentation.Y_lambdacheck`)::\n\n sage: Lcheck = L.root_system.coweight_lattice()\n sage: w = Lcheck.reduced_word_of_translation(Lcheck(alphacheck[1])); w\n [0, 2, 1, 0, 2, 1]\n sage: Lcheck.signs_of_alcovewalk(w)\n [1, -1, 1, -1, 1, 1]\n\n .. RUBRIC:: Level zero representation of the affine Hecke algebra\n\n The action of the affine Hecke algebra on `K[L]` induces\n an action on `K[L_0]`: the action of `T_i` on `X^\\lambda` for `\\lambda` a\n classical weight in `L_0` is obtained by embedding the weight at\n level zero in the affine weight lattice (see\n :meth:`.weight_lattice_realizations.WeightLatticeRealizations.ParentMethods.embed_at_level`)\n applying the Demazure-Lusztig operator there, and projecting from `K[L]\\to K[L_0]`\n mapping the exponential of `\\delta` to `q` (see\n :meth:`.root_lattice_realization_algebras.Algebras.ParentMethods.q_project`). This is implemented in\n :meth:`.root_lattice_realization_algebras.Algebras.ParentMethods.demazure_lusztig_operators_on_classical`::\n\n sage: T = KL.demazure_lusztig_operators_on_classical(q, q1,q2)\n sage: omega = L0.fundamental_weights()\n sage: x = KL0.monomial(omega[1])\n sage: T[0](x)\n (-q*q2)*B[(-1, 0)]\n\n For classical nodes these are the usual Demazure-Lusztig operators::\n\n sage: T[1](x)\n (q1+q2)*B[(1, 0)] + q1*B[(0, 1)]\n\n .. RUBRIC:: Nonsymmetric Macdonald polynomials\n\n We can now finally define the nonsymmetric Macdonald polynomials.\n Because the Cherednik operators commute (and there is no radical),\n they can be simultaneously diagonalized; namely, `K[L_0]` admits a\n `K`-basis of joint eigenvectors for the `Y_\\lambda`. For `\\mu \\in\n L_0`, the nonsymmetric Macdonald polynomial `E_\\mu` is the unique\n eigenvector of the family of Cherednik operators `Y_\\lambda`\n having `\\mu` as leading term::\n\n sage: E = NonSymmetricMacdonaldPolynomials(KL, q, q1, q2); E\n The family of the Macdonald polynomials of type [\'C\', 2, 1]\n with parameters q, q1, q2\n\n Or for short::\n\n sage: E = NonSymmetricMacdonaldPolynomials(C)\n\n .. RUBRIC:: Recursive construction of the nonsymmetric Macdonald polynomials\n\n The generators `T_i` of the affine Hecke algebra almost skew\n commute with the Cherednik operators. More precisely, one\n can deform them into the so-called intertwining operators:\n\n .. MATH:: \\tau_i = T_i - (q_1+q_2) \\frac{Y_i^{a-1}}{1-Y_i^a}\\,.\n\n (where `a=1` except for `i=0` in type `BC` where `a=a_0=2`) which\n satisfy the following skew commutation relations:\n\n .. MATH:: \\tau_i Y_\\lambda = \\tau_i Y_{s_i\\lambda} \\,.\n\n If `s_i \\mu \\ne \\mu`, applying `\\tau_i` on an eigenvector `E_\\mu`\n produces a new eigenvector (essentially `E_{s_i\\mu}`) with a\n distinct eigenvalue. It follows that the eigenvectors indexed by\n an affine Weyl orbit of weights, may be recursively computed from\n a single weight in the orbit.\n\n In the case at hand, there is a little complication: namely, the\n simple reflections `s_i` acting at level 0 do not act transitively\n on classical weights; in fact the orbits for the classical Weyl\n group and for the affine Weyl group are the same. Thus, one can\n construct the nonsymmetric Macdonald polynomials for all weights\n from those for the classical dominant weights, but one is lacking\n a creation operator to construct the nonsymmetric Macdonald\n polynomials for dominant weights.\n\n .. RUBRIC:: Twisted Demazure-Lusztig operators\n\n To compensate for this, one needs to consider another affinization\n of the action of the classical Demazure-Lusztig operators\n `T_1,\\dots,T_n`, which gives rise to the double affine Hecke algebra.\n Following Cherednik, one adds another operator `T_0^\\vee` implemented in:\n :meth:`.root_lattice_realization_algebras.Algebras.ParentMethods.T0_check_on_basis`.\n See also:\n :meth:`.root_lattice_realization_algebras.Algebras.ParentMethods.twisted_demazure_lusztig_operators`.\n\n Depending on the type (untwisted or not), this is a representation\n of the affine Hecke algebra for another affinization of the\n classical Cartan type. The corresponding action of the affine Weyl\n group -- which is used to compute the recursion on `\\mu` -- occurs\n in the corresponding weight lattice realization::\n\n sage: E.L()\n Ambient space of the Root system of type [\'C\', 2, 1]\n sage: E.L_prime()\n Coambient space of the Root system of type [\'B\', 2, 1]\n sage: E.L_prime().classical()\n Ambient space of the Root system of type [\'C\', 2]\n\n See :meth:`L_prime` and\n :meth:`.cartan_type.CartanType_affine.other_affinization`.\n\n REFERENCES:\n\n .. [HaimanICM] \\M. Haiman, Cherednik algebras, Macdonald polynomials and combinatorics,\n Proceedings of the International Congress of Mathematicians,\n Madrid 2006, Vol. III, 843-872.\n\n .. [HHL06] \\J. Haglund, M. Haiman and N. Loehr,\n A combinatorial formula for nonsymmetric Macdonald polynomials,\n Amer. J. Math. 130, No. 2 (2008), 359-383.\n\n .. [LNSSS12] \\C. Lenart, S. Naito, D. Sagaki, A. Schilling, M. Shimozono,\n A uniform model for Kirillov-Reshetikhin crystals I: Lifting\n the parabolic quantum Bruhat graph, preprint :arxiv:`1211.2042`\n [math.QA]\n\n .. RUBRIC:: More examples\n\n We show how to create the nonsymmetric Macdonald polynomials in\n two different ways and check that they are the same::\n\n sage: K = QQ[\'q,u\'].fraction_field()\n sage: q, u = K.gens()\n sage: E = NonSymmetricMacdonaldPolynomials([\'D\',3,1], q, u, -1/u)\n sage: omega = E.keys().fundamental_weights()\n sage: E[omega[1]+omega[3]]\n ((-q*u^2+q)/(-q*u^4+1))*B[(1/2, -1/2, 1/2)]\n + ((-q*u^2+q)/(-q*u^4+1))*B[(1/2, 1/2, -1/2)] + B[(3/2, 1/2, 1/2)]\n\n sage: KL = RootSystem(["D",3,1]).ambient_space().algebra(K)\n sage: P = NonSymmetricMacdonaldPolynomials(KL, q, u, -1/u)\n sage: E[omega[1]+omega[3]] == P[omega[1]+omega[3]]\n True\n sage: E[E.keys()((0,1,-1))]\n ((-q*u^2+q)/(-q*u^2+1))*B[(0, 0, 0)] + ((-u^2+1)/(-q*u^2+1))*B[(1, 1, 0)]\n + ((-u^2+1)/(-q*u^2+1))*B[(1, 0, -1)] + B[(0, 1, -1)]\n\n In type `A`, there is also a combinatorial implementation of the\n nonsymmetric Macdonald polynomials in terms of augmented diagram\n fillings as in [HHL06]_. See\n :func:`sage.combinat.sf.ns_macdonald.E`. First we check that\n these polynomials are indeed eigenvectors of the Cherednik\n operators::\n\n sage: K = QQ[\'q,t\'].fraction_field()\n sage: q,t = K.gens()\n sage: q1 = t; q2 = -1\n sage: KL = RootSystem(["A",2,1]).ambient_space().algebra(K)\n sage: KL0 = KL.classical()\n sage: E = NonSymmetricMacdonaldPolynomials(KL,q, q1, q2)\n sage: omega = E.keys().fundamental_weights()\n sage: w = omega[1]\n\n sage: # needs sage.combinat sage.groups\n sage: import sage.combinat.sf.ns_macdonald as NS\n sage: p = NS.E([1,0,0]); p\n x0\n sage: pp = KL0.from_polynomial(p)\n sage: E.eigenvalues(KL0.from_polynomial(p))\n [t, (-1)/(-q*t^2), t]\n\n sage: def eig(l): return E.eigenvalues(KL0.from_polynomial(NS.E(l)))\n\n sage: # needs sage.combinat sage.groups\n sage: eig([1,0,0])\n [t, (-1)/(-q*t^2), t]\n sage: eig([2,0,0])\n [q*t, (-1)/(-q^2*t^2), t]\n sage: eig([3,0,0])\n [q^2*t, (-1)/(-q^3*t^2), t]\n sage: eig([2,0,4])\n [(-1)/(-q^3*t), 1/(q^2*t), q^4*t^2]\n\n Next we check explicitly that they agree with the current implementation::\n\n sage: K = QQ[\'q\',\'t\'].fraction_field()\n sage: q,t = K.gens()\n sage: KL = RootSystem(["A",1,1]).ambient_lattice().algebra(K)\n sage: E = NonSymmetricMacdonaldPolynomials(KL,q, t, -1)\n sage: L0 = E.keys()\n sage: KL0 = KL.classical()\n sage: P = K[\'x0,x1\']\n sage: def EE(weight): return E[L0(weight)].expand(P.gens())\n\n sage: # needs sage.combinat\n sage: import sage.combinat.sf.ns_macdonald as NS\n sage: EE([0,0])\n 1\n sage: NS.E([0,0]) # needs sage.groups\n 1\n sage: EE([1,0])\n x0\n sage: NS.E([1,0]) # needs sage.groups\n x0\n sage: EE([0,1])\n (t - 1)/(q*t - 1)*x0 + x1\n sage: NS.E([0,1]) # needs sage.groups\n (t - 1)/(q*t - 1)*x0 + x1\n sage: EE([2,0])\n x0^2 + (q*t - q)/(q*t - 1)*x0*x1\n sage: NS.E([2,0]) # needs sage.groups\n x0^2 + (q*t - q)/(q*t - 1)*x0*x1\n\n The same, directly in the ambient lattice with several shifts::\n\n sage: E[L0([2,0])] # needs sage.combinat\n ((-q*t+q)/(-q*t+1))*B[(1, 1)] + B[(2, 0)]\n sage: E[L0([1,-1])] # needs sage.combinat\n ((-q*t+q)/(-q*t+1))*B[(0, 0)] + B[(1, -1)]\n sage: E[L0([0,-2])] # needs sage.combinat\n ((-q*t+q)/(-q*t+1))*B[(-1, -1)] + B[(0, -2)]\n\n Systematic checks with Sage\'s implementation of [HHL06]_::\n\n sage: assert all(EE([x,y]) == NS.E([x,y]) # needs sage.combinat\n ....: for d in range(5) for x,y in IntegerVectors(d,2))\n\n With the current implementation, we can compute nonsymmetric\n Macdonald polynomials for any type, for example for type `E_6^{(1)}`::\n\n sage: K = QQ[\'q,u\'].fraction_field()\n sage: q, u = K.gens()\n sage: KL = RootSystem(["E",6,1]).weight_space(extended=True).algebra(K)\n sage: E = NonSymmetricMacdonaldPolynomials(KL,q,u,-1/u)\n sage: L0 = E.keys()\n\n sage: E[L0.fundamental_weight(1).weyl_action([2,4,3,2,1])]\n ((-u^2+1)/(-q*u^16+1))*B[-Lambda[1] + Lambda[3]]\n + ((-u^2+1)/(-q*u^16+1))*B[Lambda[1]]\n + B[-Lambda[2] + Lambda[5]]\n + ((-u^2+1)/(-q*u^16+1))*B[Lambda[2] - Lambda[4] + Lambda[5]]\n + ((-u^2+1)/(-q*u^16+1))*B[-Lambda[3] + Lambda[4]]\n\n sage: E[L0.fundamental_weight(2).weyl_action([2,5,3,4,2])] # long time (6s)\n ((-q^2*u^20+q^2*u^18+q*u^2-q)/(-q^2*u^32+2*q*u^16-1))*B[0]\n + B[Lambda[1] - Lambda[3] + Lambda[4] - Lambda[5] + Lambda[6]]\n + ((-u^2+1)/(-q*u^16+1))*B[Lambda[1] - Lambda[3] + Lambda[5]]\n + ((-q*u^20+q*u^18+u^2-1)/(-q^2*u^32+2*q*u^16-1))*B[-Lambda[2] + Lambda[4]]\n + ((-q*u^20+q*u^18+u^2-1)/(-q^2*u^32+2*q*u^16-1))*B[Lambda[2]]\n + ((u^4-2*u^2+1)/(q^2*u^32-2*q*u^16+1))*B[Lambda[3] - Lambda[4] + Lambda[5]]\n + ((-u^2+1)/(-q*u^16+1))*B[Lambda[3] - Lambda[5] + Lambda[6]]\n sage: E[L0.fundamental_weight(1)+L0.fundamental_weight(6)] # long time (13s)\n ((q^2*u^10-q^2*u^8-q^2*u^2+q^2)/(q^2*u^26-q*u^16-q*u^10+1))*B[0]\n + ((-q*u^2+q)/(-q*u^10+1))*B[Lambda[1] - Lambda[2] + Lambda[6]]\n + ((-q*u^2+q)/(-q*u^10+1))*B[Lambda[1] + Lambda[2] - Lambda[4] + Lambda[6]]\n + ((-q*u^2+q)/(-q*u^10+1))*B[Lambda[1] - Lambda[3] + Lambda[4] - Lambda[5] + Lambda[6]]\n + ((-q*u^2+q)/(-q*u^10+1))*B[Lambda[1] - Lambda[3] + Lambda[5]]\n + B[Lambda[1] + Lambda[6]]\n + ((-q*u^2+q)/(-q*u^10+1))*B[-Lambda[2] + Lambda[4]]\n + ((-q*u^2+q)/(-q*u^10+1))*B[Lambda[2]]\n + ((-q*u^2+q)/(-q*u^10+1))*B[Lambda[3] - Lambda[4] + Lambda[5]]\n + ((-q*u^2+q)/(-q*u^10+1))*B[Lambda[3] - Lambda[5] + Lambda[6]]\n\n We test various other types::\n\n sage: K = QQ[\'q,u\'].fraction_field()\n sage: q, u = K.gens()\n sage: KL = RootSystem(["A",5,2]).ambient_space().algebra(K)\n sage: E = NonSymmetricMacdonaldPolynomials(KL, q, u, -1/u)\n sage: L0 = E.keys()\n sage: E[L0.fundamental_weight(2)]\n ((-q*u^2+q)/(-q*u^8+1))*B[(0, 0, 0)] + B[(1, 1, 0)]\n sage: E[L0((0,-1,1))] # long time (1.5s)\n ((-q^2*u^10+q^2*u^8-q*u^6+q*u^4+q*u^2+u^2-q-1)/(-q^3*u^12+q^2*u^8+q*u^4-1))*B[(0, 0, 0)]\n + ((-u^2+1)/(-q*u^4+1))*B[(1, -1, 0)]\n + ((u^6-u^4-u^2+1)/(q^3*u^12-q^2*u^8-q*u^4+1))*B[(1, 1, 0)]\n + ((u^4-2*u^2+1)/(q^3*u^12-q^2*u^8-q*u^4+1))*B[(1, 0, -1)]\n + ((q^2*u^12-q^2*u^10-u^2+1)/(q^3*u^12-q^2*u^8-q*u^4+1))*B[(1, 0, 1)]\n + B[(0, -1, 1)]\n + ((-u^2+1)/(-q^2*u^8+1))*B[(0, 1, -1)] + ((-u^2+1)/(-q^2*u^8+1))*B[(0, 1, 1)]\n sage: K = QQ[\'q,u\'].fraction_field()\n sage: q, u = K.gens()\n sage: KL = RootSystem(["E",6,2]).ambient_space().algebra(K)\n sage: E = NonSymmetricMacdonaldPolynomials(KL,q,u,-1/u)\n sage: L0 = E.keys()\n sage: E[L0.fundamental_weight(4)] # long time (5s)\n ((-q^3*u^20+q^3*u^18+q^2*u^2-q^2)/(-q^3*u^28+q^2*u^22+q*u^6-1))*B[(0, 0, 0, 0)]\n + ((-q*u^2+q)/(-q*u^6+1))*B[(1/2, 1/2, -1/2, -1/2)]\n + ((-q*u^2+q)/(-q*u^6+1))*B[(1/2, 1/2, -1/2, 1/2)]\n + ((-q*u^2+q)/(-q*u^6+1))*B[(1/2, 1/2, 1/2, -1/2)]\n + ((-q*u^2+q)/(-q*u^6+1))*B[(1/2, 1/2, 1/2, 1/2)]\n + ((q*u^2-q)/(q*u^6-1))*B[(1, 0, 0, 0)]\n + B[(1, 1, 0, 0)]\n + ((-q*u^2+q)/(-q*u^6+1))*B[(0, 1, 0, 0)]\n sage: E[L0((1,-1,0,0))] # long time (23s)\n ((q^3*u^18-q^3*u^16+q*u^4-q^2*u^2-2*q*u^2+q^2+q)/(q^3*u^18-q^2*u^12-q*u^6+1))*B[(0, 0, 0, 0)]\n + ((-q^3*u^18+q^3*u^16+q*u^2-q)/(-q^3*u^18+q^2*u^12+q*u^6-1))*B[(1/2, -1/2, -1/2, -1/2)]\n + ((-q^3*u^18+q^3*u^16+q*u^2-q)/(-q^3*u^18+q^2*u^12+q*u^6-1))*B[(1/2, -1/2, -1/2, 1/2)]\n + ((q^3*u^18-q^3*u^16-q*u^2+q)/(q^3*u^18-q^2*u^12-q*u^6+1))*B[(1/2, -1/2, 1/2, -1/2)]\n + ((q^3*u^18-q^3*u^16-q*u^2+q)/(q^3*u^18-q^2*u^12-q*u^6+1))*B[(1/2, -1/2, 1/2, 1/2)]\n + ((q*u^8-q*u^6-q*u^2+q)/(q^3*u^18-q^2*u^12-q*u^6+1))*B[(1/2, 1/2, -1/2, -1/2)]\n + ((q*u^8-q*u^6-q*u^2+q)/(q^3*u^18-q^2*u^12-q*u^6+1))*B[(1/2, 1/2, -1/2, 1/2)]\n + ((-q*u^8+q*u^6+q*u^2-q)/(-q^3*u^18+q^2*u^12+q*u^6-1))*B[(1/2, 1/2, 1/2, -1/2)]\n + ((-q*u^8+q*u^6+q*u^2-q)/(-q^3*u^18+q^2*u^12+q*u^6-1))*B[(1/2, 1/2, 1/2, 1/2)]\n + ((-q^2*u^18+q^2*u^16-q*u^8+q*u^6+q*u^2+u^2-q-1)/(-q^3*u^18+q^2*u^12+q*u^6-1))*B[(1, 0, 0, 0)]\n + B[(1, -1, 0, 0)] + ((-u^2+1)/(-q^2*u^12+1))*B[(1, 1, 0, 0)]\n + ((-u^2+1)/(-q^2*u^12+1))*B[(1, 0, -1, 0)]\n + ((u^2-1)/(q^2*u^12-1))*B[(1, 0, 1, 0)]\n + ((-u^2+1)/(-q^2*u^12+1))*B[(1, 0, 0, -1)]\n + ((-u^2+1)/(-q^2*u^12+1))*B[(1, 0, 0, 1)]\n + ((-q*u^2+q)/(-q*u^6+1))*B[(0, -1, 0, 0)]\n + ((-q*u^4+2*q*u^2-q)/(-q^3*u^18+q^2*u^12+q*u^6-1))*B[(0, 1, 0, 0)]\n + ((-q*u^4+2*q*u^2-q)/(-q^3*u^18+q^2*u^12+q*u^6-1))*B[(0, 0, -1, 0)]\n + ((-q*u^4+2*q*u^2-q)/(-q^3*u^18+q^2*u^12+q*u^6-1))*B[(0, 0, 1, 0)]\n + ((-q*u^4+2*q*u^2-q)/(-q^3*u^18+q^2*u^12+q*u^6-1))*B[(0, 0, 0, -1)]\n + ((-q*u^4+2*q*u^2-q)/(-q^3*u^18+q^2*u^12+q*u^6-1))*B[(0, 0, 0, 1)]\n\n Next we test a twisted type (checked against Maple computation by\n Bogdan Ion for `q_1=t^2` and `q_2=-1`)::\n\n sage: E = NonSymmetricMacdonaldPolynomials(["A",5,2])\n sage: omega = E.keys()\n\n sage: E[omega[1]]\n B[(1, 0, 0)]\n\n sage: E[-omega[1]]\n B[(-1, 0, 0)]\n + ((q*q1^6+q*q1^5*q2+q1*q2^5+q2^6)/(q^3*q1^6+q^2*q1^5*q2+q*q1*q2^5+q2^6))*B[(1, 0, 0)]\n + ((q1+q2)/(q*q1+q2))*B[(0, -1, 0)] + ((q1+q2)/(q*q1+q2))*B[(0, 1, 0)]\n + ((q1+q2)/(q*q1+q2))*B[(0, 0, -1)] + ((q1+q2)/(q*q1+q2))*B[(0, 0, 1)]\n\n sage: E[omega[2]]\n ((-q1*q2^3-q2^4)/(q*q1^4-q2^4))*B[(1, 0, 0)] + B[(0, 1, 0)]\n\n sage: E[-omega[2]]\n ((q^2*q1^7+q^2*q1^6*q2-q1*q2^6-q2^7)/(q^3*q1^7-q^2*q1^5*q2^2+q*q1^2*q2^5-q2^7))*B[(1, 0, 0)]\n + B[(0, -1, 0)]\n + ((q*q1^5*q2^2+q*q1^4*q2^3-q1*q2^6-q2^7)/(q^3*q1^7-q^2*q1^5*q2^2+q*q1^2*q2^5-q2^7))*B[(0, 1, 0)]\n + ((-q1*q2-q2^2)/(q*q1^2-q2^2))*B[(0, 0, -1)]\n + ((q1*q2+q2^2)/(-q*q1^2+q2^2))*B[(0, 0, 1)]\n\n sage: E[-omega[1]-omega[2]]\n ((q^3*q1^6+q^3*q1^5*q2+2*q^2*q1^6+3*q^2*q1^5*q2-q^2*q1^4*q2^2-2*q^2*q1^3*q2^3-q*q1^5*q2-2*q*q1^4*q2^2+q*q1^3*q2^3+2*q*q1^2*q2^4-q*q1*q2^5-q*q2^6+q1^3*q2^3+q1^2*q2^4-2*q1*q2^5-2*q2^6)/(q^4*q1^6+q^3*q1^5*q2-q^3*q1^4*q2^2+q*q1^2*q2^4-q*q1*q2^5-q2^6))*B[(0, 0, 0)]\n + B[(-1, -1, 0)]\n + ((q*q1^4+q*q1^3*q2+q1*q2^3+q2^4)/(q^3*q1^4+q^2*q1^3*q2+q*q1*q2^3+q2^4))*B[(-1, 1, 0)]\n + ((q1+q2)/(q*q1+q2))*B[(-1, 0, -1)]\n + ((-q1-q2)/(-q*q1-q2))*B[(-1, 0, 1)]\n + ((q*q1^4+q*q1^3*q2+q1*q2^3+q2^4)/(q^3*q1^4+q^2*q1^3*q2+q*q1*q2^3+q2^4))*B[(1, -1, 0)]\n + ((q^2*q1^6+q^2*q1^5*q2+q*q1^5*q2-q*q1^3*q2^3-q1^5*q2-q1^4*q2^2+q1^3*q2^3+q1^2*q2^4-q1*q2^5-q2^6)/(q^4*q1^6+q^3*q1^5*q2-q^3*q1^4*q2^2+q*q1^2*q2^4-q*q1*q2^5-q2^6))*B[(1, 1, 0)]\n + ((q*q1^4+2*q*q1^3*q2+q*q1^2*q2^2-q1^3*q2-q1^2*q2^2+q1*q2^3+q2^4)/(q^3*q1^4+q^2*q1^3*q2+q*q1*q2^3+q2^4))*B[(1, 0, -1)]\n + ((q*q1^4+2*q*q1^3*q2+q*q1^2*q2^2-q1^3*q2-q1^2*q2^2+q1*q2^3+q2^4)/(q^3*q1^4+q^2*q1^3*q2+q*q1*q2^3+q2^4))*B[(1, 0, 1)]\n + ((q1+q2)/(q*q1+q2))*B[(0, -1, -1)]\n + ((q1+q2)/(q*q1+q2))*B[(0, -1, 1)]\n + ((q*q1^4+2*q*q1^3*q2+q*q1^2*q2^2-q1^3*q2-q1^2*q2^2+q1*q2^3+q2^4)/(q^3*q1^4+q^2*q1^3*q2+q*q1*q2^3+q2^4))*B[(0, 1, -1)]\n + ((q*q1^4+2*q*q1^3*q2+q*q1^2*q2^2-q1^3*q2-q1^2*q2^2+q1*q2^3+q2^4)/(q^3*q1^4+q^2*q1^3*q2+q*q1*q2^3+q2^4))*B[(0, 1, 1)]\n\n sage: E[omega[1]-omega[2]]\n ((q^3*q1^7+q^3*q1^6*q2-q*q1*q2^6-q*q2^7)/(q^3*q1^7-q^2*q1^5*q2^2+q*q1^2*q2^5-q2^7))*B[(0, 0, 0)]\n + B[(1, -1, 0)]\n + ((q*q1^5*q2^2+q*q1^4*q2^3-q1*q2^6-q2^7)/(q^3*q1^7-q^2*q1^5*q2^2+q*q1^2*q2^5-q2^7))*B[(1, 1, 0)]\n + ((-q1*q2-q2^2)/(q*q1^2-q2^2))*B[(1, 0, -1)]\n + ((q1*q2+q2^2)/(-q*q1^2+q2^2))*B[(1, 0, 1)]\n\n sage: E[omega[3]]\n ((-q1*q2^2-q2^3)/(-q*q1^3-q2^3))*B[(1, 0, 0)]\n + ((-q1*q2^2-q2^3)/(-q*q1^3-q2^3))*B[(0, 1, 0)] + B[(0, 0, 1)]\n\n sage: E[-omega[3]]\n ((q*q1^4*q2+q*q1^3*q2^2-q1*q2^4-q2^5)/(-q^2*q1^5-q2^5))*B[(1, 0, 0)]\n + ((q*q1^4*q2+q*q1^3*q2^2-q1*q2^4-q2^5)/(-q^2*q1^5-q2^5))*B[(0, 1, 0)]\n + B[(0, 0, -1)] + ((-q1*q2^4-q2^5)/(-q^2*q1^5-q2^5))*B[(0, 0, 1)]\n\n .. RUBRIC:: Comparison with the energy function of crystals\n\n Next we test that the nonsymmetric Macdonald polynomials at `t=0`\n match with the one-dimensional configuration sums involving\n Kirillov-Reshetikhin crystals for various types. See\n [LNSSS12]_::\n\n sage: K = QQ[\'q,t\'].fraction_field()\n sage: q,t = K.gens()\n sage: KL = RootSystem(["A",5,2]).ambient_space().algebra(K)\n sage: E = NonSymmetricMacdonaldPolynomials(KL, q, t, -1)\n sage: omega = E.keys().fundamental_weights()\n sage: E[-omega[1]].map_coefficients(lambda x: x.subs(t=0))\n B[(-1, 0, 0)] + B[(1, 0, 0)] + B[(0, -1, 0)] + B[(0, 1, 0)]\n + B[(0, 0, -1)] + B[(0, 0, 1)]\n sage: E[-omega[2]].map_coefficients(lambda x: x.subs(t=0)) # long time (3s)\n (q+2)*B[(0, 0, 0)] + B[(-1, -1, 0)] + B[(-1, 1, 0)] + B[(-1, 0, -1)]\n + B[(-1, 0, 1)] + B[(1, -1, 0)] + B[(1, 1, 0)] + B[(1, 0, -1)] + B[(1, 0, 1)]\n + B[(0, -1, -1)] + B[(0, -1, 1)] + B[(0, 1, -1)] + B[(0, 1, 1)]\n\n ::\n\n sage: KL = RootSystem(["C",3,1]).ambient_space().algebra(K)\n sage: E = NonSymmetricMacdonaldPolynomials(KL, q, t, -1)\n sage: omega = E.keys().fundamental_weights()\n sage: E[-omega[2]].map_coefficients(lambda x: x.subs(t=0)) # long time (5s)\n 2*B[(0, 0, 0)] + B[(-1, -1, 0)] + B[(-1, 1, 0)] + B[(-1, 0, -1)]\n + B[(-1, 0, 1)] + B[(1, -1, 0)] + B[(1, 1, 0)] + B[(1, 0, -1)] + B[(1, 0, 1)]\n + B[(0, -1, -1)] + B[(0, -1, 1)] + B[(0, 1, -1)] + B[(0, 1, 1)]\n\n ::\n\n sage: R = RootSystem([\'C\',3,1])\n sage: KL = R.weight_lattice(extended=True).algebra(K)\n sage: E = NonSymmetricMacdonaldPolynomials(KL, q, t, -1)\n sage: omega = E.keys().fundamental_weights()\n sage: La = R.weight_space().basis()\n sage: LS = crystals.ProjectedLevelZeroLSPaths(2*La[1])\n sage: (E[-2*omega[1]].map_coefficients(lambda x: x.subs(t=0)) # long time (15s)\n ....: == LS.one_dimensional_configuration_sum(q))\n True\n sage: LS = crystals.ProjectedLevelZeroLSPaths(La[1] + La[2])\n sage: (E[-omega[1] - omega[2]].map_coefficients(lambda x: x.subs(t=0)) # long time (45s)\n ....: == LS.one_dimensional_configuration_sum(q))\n True\n\n ::\n\n sage: R = RootSystem([\'C\',2,1])\n sage: KL = R.weight_lattice(extended=True).algebra(K)\n sage: E = NonSymmetricMacdonaldPolynomials(KL, q, t, -1)\n sage: omega = E.keys().fundamental_weights()\n sage: La = R.weight_space().basis()\n sage: for d in range(1,3): # long time (45s)\n ....: for x,y in IntegerVectors(d,2):\n ....: weight = x*La[1]+y*La[2]\n ....: weight0 = -x*omega[1]-y*omega[2]\n ....: LS = crystals.ProjectedLevelZeroLSPaths(weight)\n ....: assert (E[weight0].map_coefficients(lambda x:x.subs(t=0))\n ....: == LS.one_dimensional_configuration_sum(q))\n\n ::\n\n sage: R = RootSystem([\'B\',3,1])\n sage: KL = R.weight_lattice(extended=True).algebra(K)\n sage: E = NonSymmetricMacdonaldPolynomials(KL, q, t, -1)\n sage: omega = E.keys().fundamental_weights()\n sage: La = R.weight_space().basis()\n\n sage: # needs sage.combinat\n sage: LS = crystals.ProjectedLevelZeroLSPaths(2*La[1])\n sage: (E[-2*omega[1]].map_coefficients(lambda x: x.subs(t=0)) # long time (23s)\n ....: == LS.one_dimensional_configuration_sum(q))\n True\n sage: B = crystals.KirillovReshetikhin([\'B\',3,1],1,1)\n sage: T = crystals.TensorProduct(B,B)\n sage: (T.one_dimensional_configuration_sum(q) # long time (2s)\n ....: == LS.one_dimensional_configuration_sum(q))\n True\n\n ::\n\n sage: R = RootSystem([\'BC\',3,2])\n sage: KL = R.weight_lattice(extended=True).algebra(K)\n sage: E = NonSymmetricMacdonaldPolynomials(KL, q, t, -1)\n sage: omega = E.keys().fundamental_weights()\n sage: La = R.weight_space().basis()\n sage: LS = crystals.ProjectedLevelZeroLSPaths(2*La[1]) # needs sage.combinat\n sage: (E[-2*omega[1]].map_coefficients(lambda x: x.subs(t=0)) # long time (21s), needs sage.combinat\n ....: == LS.one_dimensional_configuration_sum(q))\n True\n\n ::\n\n sage: R = RootSystem(CartanType([\'BC\',3,2]).dual())\n sage: KL = R.weight_space(extended=True).algebra(K)\n sage: E = NonSymmetricMacdonaldPolynomials(KL, q, t, -1)\n sage: omega = E.keys().fundamental_weights()\n sage: La = R.weight_space().basis()\n\n sage: # long time, needs sage.combinat\n sage: LS = crystals.ProjectedLevelZeroLSPaths(2*La[1])\n sage: g = E[-2*omega[1]].map_coefficients(lambda x: x.subs(t=0)) # 30s\n sage: f = LS.one_dimensional_configuration_sum(q) # 1.5s\n sage: P = g.support()[0].parent()\n sage: B = P.algebra(q.parent())\n sage: sum(p[1]*B(P(p[0])) for p in f) == g\n True\n\n ::\n\n sage: C = CartanType([\'G\',2,1])\n sage: R = RootSystem(C.dual())\n sage: K = QQ[\'q,t\'].fraction_field()\n sage: q,t = K.gens()\n sage: KL = R.weight_lattice(extended=True).algebra(K)\n sage: E = NonSymmetricMacdonaldPolynomials(KL, q, t, -1)\n sage: omega = E.keys().fundamental_weights()\n sage: La = R.weight_space().basis()\n\n sage: # needs sage.combinat\n sage: LS = crystals.ProjectedLevelZeroLSPaths(2*La[1])\n sage: (E[-2*omega[1]].map_coefficients(lambda x: x.subs(t=0)) # long time (20s), not tested\n ....: == LS.one_dimensional_configuration_sum(q)\n True\n sage: LS = crystals.ProjectedLevelZeroLSPaths(La[1] + La[2])\n sage: (E[-omega[1]-omega[2]].map_coefficients(lambda x: x.subs(t=0)) # long time (23s), not tested\n ....: == LS.one_dimensional_configuration_sum(q))\n True\n\n The next test breaks if the energy is not scaled by the\n translation factor for dual type `G_2^{(1)}`::\n\n sage: LS = crystals.ProjectedLevelZeroLSPaths(2*La[1]+La[2]) # needs sage.combinat\n sage: (E[-2*omega[1]-omega[2]].map_coefficients(lambda x: x.subs(t=0)) # long time (100s), not tested, needs sage.combinat\n ....: == LS.one_dimensional_configuration_sum(q)\n True\n\n sage: R = RootSystem([\'D\',4,1])\n sage: KL = R.weight_lattice(extended=True).algebra(K)\n sage: E = NonSymmetricMacdonaldPolynomials(KL, q, t, -1)\n sage: omega = E.keys().fundamental_weights()\n sage: La = R.weight_space().basis()\n sage: for d in range(1,2): # long time (41s)\n ....: for a,b,c,d in IntegerVectors(d,4):\n ....: weight = a*La[1] + b*La[2] + c*La[3] + d*La[4]\n ....: weight0 = -a*omega[1] - b*omega[2] - c*omega[3] - d*omega[4]\n ....: LS = crystals.ProjectedLevelZeroLSPaths(weight)\n ....: assert (E[weight0].map_coefficients(lambda x: x.subs(t=0))\n ....: == LS.one_dimensional_configuration_sum(q))\n\n TESTS:\n\n Calculations checked with Bogdan Ion 2013/04/18::\n\n sage: K = QQ[\'q,t\'].fraction_field()\n sage: q,t = K.gens()\n sage: E = NonSymmetricMacdonaldPolynomials(["B",2,1], q=q,q1=t,q2=-1/t)\n sage: L0 = E.keys()\n sage: omega = L0.fundamental_weights()\n\n sage: E[omega[1]]\n ((-q*t^4+q*t^2)/(-q*t^6+1))*B[(0, 0)] + B[(1, 0)]\n sage: E[omega[2]]\n B[(1/2, 1/2)]\n sage: E[-omega[1]]\n ((-q^2*t^8+q^2*t^6-q*t^6+2*q*t^4-q*t^2+t^2-1)/(-q^3*t^8+q^2*t^6+q*t^2-1))*B[(0, 0)]\n + B[(-1, 0)] + ((-q*t^8+q*t^6+t^2-1)/(-q^3*t^8+q^2*t^6+q*t^2-1))*B[(1, 0)]\n + ((-t^2+1)/(-q*t^2+1))*B[(0, -1)] + ((t^2-1)/(q*t^2-1))*B[(0, 1)]\n sage: E[L0([0,1])]\n ((-q*t^4+q*t^2)/(-q*t^4+1))*B[(0, 0)] + ((-t^2+1)/(-q*t^4+1))*B[(1, 0)] + B[(0, 1)]\n sage: E[L0([1,1])]\n ((q*t^2-q)/(q*t^2-1))*B[(0, 0)] + ((-q*t^2+q)/(-q*t^2+1))*B[(1, 0)]\n + B[(1, 1)] + ((-q*t^2+q)/(-q*t^2+1))*B[(0, 1)]\n\n sage: E = NonSymmetricMacdonaldPolynomials(["A",2,1], q=q,q1=t,q2=-1/t)\n sage: L0 = E.keys()\n sage: factor(E[L0([-1,0,1])][L0.zero()])\n (t - 1) * (t + 1) * (q*t^2 - 1)^-3 * (q*t^2 + 1)^-1\n * (q^3*t^6 + 2*q^2*t^6 - 3*q^2*t^4 - 2*q*t^2 - t^2 + q + 2)\n\n Checking step by step calculations in type `BC` with Bogdan Ion 2013/04/18::\n\n sage: K = QQ[\'q,t\'].fraction_field()\n sage: q,t=K.gens()\n sage: E = NonSymmetricMacdonaldPolynomials(["BC",1,2], q=q,q1=t,q2=-1/t)\n sage: KL0 = E.domain()\n sage: L0 = E.keys()\n sage: omega = L0.fundamental_weights()\n sage: e = L0.basis()\n sage: E._T_Y[1] ( KL0.monomial(e[0]) )\n 1/t*B[(-1)]\n sage: E._T_Y[0] ( KL0.monomial(L0.zero()) )\n t*B[(0)]\n sage: E._T_Y[0] ( KL0.monomial(-e[0]))\n ((-t^2+1)/(q*t))*B[(0)] + 1/(q^2*t)*B[(1)]\n\n sage: Y = E.Y()\n sage: alphacheck = Y.keys().simple_roots()\n sage: Y0 = Y[alphacheck[0]]\n sage: Y1 = Y[alphacheck[1]]\n sage: Y0\n Generic endomorphism of Algebra of the Ambient space of the Root system of type [\'C\', 1]\n over Fraction Field of Multivariate Polynomial Ring in q, t over Rational Field\n sage: Y0.word, Y0.signs, Y0.scalar\n ((0, 1), (-1, -1), 1/q)\n sage: Y1.word, Y1.signs, Y1.scalar\n ((1, 0), (1, 1), 1)\n\n sage: T0_check = E._T[0]\n\n Comparing with Bogdan Ion\'s hand calculations for type `BC`, 2013/05/13:\n\n .. TODO:: add his notes in latex\n\n ::\n\n sage: K = QQ[\'q,q1,q2\'].fraction_field()\n sage: q,q1,q2=K.gens()\n sage: L = RootSystem(["A",4,2]).ambient_space()\n sage: L.cartan_type()\n [\'BC\', 2, 2]\n sage: L.null_root()\n 2*e[\'delta\']\n sage: L.simple_roots()\n Finite family {0: -e[0] + e[\'delta\'], 1: e[0] - e[1], 2: 2*e[1]}\n sage: KL = L.algebra(K)\n sage: KL0 = KL.classical()\n sage: L0 = L.classical()\n sage: L0.cartan_type()\n [\'C\', 2]\n\n sage: E = NonSymmetricMacdonaldPolynomials(KL, q=q,q1=q1,q2=q2)\n sage: E.keys()\n Ambient space of the Root system of type [\'C\', 2]\n sage: E.keys().simple_roots()\n Finite family {1: (1, -1), 2: (0, 2)}\n sage: omega = E.keys().fundamental_weights()\n\n sage: E[0*omega[1]]\n B[(0, 0)]\n sage: E[omega[1]]\n ((-q*q1*q2^3-q*q2^4)/(q^2*q1^4-q2^4))*B[(0, 0)] + B[(1, 0)]\n\n sage: E[2*omega[2]] # not checked against Bogdan\'s notes, but a good self-consistency test # long time\n ((-q^12*q1^6-q^12*q1^5*q2+2*q^10*q1^5*q2+5*q^10*q1^4*q2^2+3*q^10*q1^3*q2^3+2*q^8*q1^5*q2+4*q^8*q1^4*q2^2+q^8*q1^3*q2^3-q^8*q1^2*q2^4+q^8*q1*q2^5+q^8*q2^6-q^6*q1^3*q2^3+q^6*q1^2*q2^4+4*q^6*q1*q2^5+2*q^6*q2^6+q^4*q1^3*q2^3+3*q^4*q1^2*q2^4+4*q^4*q1*q2^5+2*q^4*q2^6)/(-q^12*q1^6-q^10*q1^5*q2-q^8*q1^3*q2^3+q^6*q1^4*q2^2-q^6*q1^2*q2^4+q^4*q1^3*q2^3+q^2*q1*q2^5+q2^6))*B[(0, 0)]\n + ((q^7*q1^2*q2+2*q^7*q1*q2^2+q^7*q2^3+q^5*q1^2*q2+2*q^5*q1*q2^2+q^5*q2^3)/(-q^8*q1^3-q^6*q1^2*q2+q^2*q1*q2^2+q2^3))*B[(-1, 0)]\n + ((-q^6*q1*q2-q^6*q2^2)/(q^6*q1^2-q2^2))*B[(-1, -1)]\n + ((q^6*q1^2*q2+2*q^6*q1*q2^2+q^6*q2^3+q^4*q1^2*q2+2*q^4*q1*q2^2+q^4*q2^3)/(-q^8*q1^3-q^6*q1^2*q2+q^2*q1*q2^2+q2^3))*B[(-1, 1)]\n + ((-q^3*q1*q2-q^3*q2^2)/(q^6*q1^2-q2^2))*B[(-1, 2)]\n + ((q^7*q1^3+q^7*q1^2*q2-q^7*q1*q2^2-q^7*q2^3-2*q^5*q1^2*q2-4*q^5*q1*q2^2-2*q^5*q2^3-2*q^3*q1^2*q2-4*q^3*q1*q2^2-2*q^3*q2^3)/(q^8*q1^3+q^6*q1^2*q2-q^2*q1*q2^2-q2^3))*B[(1, 0)] + ((q^6*q1^2*q2+2*q^6*q1*q2^2+q^6*q2^3+q^4*q1^2*q2+2*q^4*q1*q2^2+q^4*q2^3)/(-q^8*q1^3-q^6*q1^2*q2+q^2*q1*q2^2+q2^3))*B[(1, -1)]\n + ((q^8*q1^3+q^8*q1^2*q2+q^6*q1^3+q^6*q1^2*q2-q^6*q1*q2^2-q^6*q2^3-2*q^4*q1^2*q2-4*q^4*q1*q2^2-2*q^4*q2^3-q^2*q1^2*q2-3*q^2*q1*q2^2-2*q^2*q2^3)/(q^8*q1^3+q^6*q1^2*q2-q^2*q1*q2^2-q2^3))*B[(1, 1)]\n + ((q^5*q1^2+q^5*q1*q2-q^3*q1*q2-q^3*q2^2-q*q1*q2-q*q2^2)/(q^6*q1^2-q2^2))*B[(1, 2)]\n + ((-q^6*q1^2-q^6*q1*q2+q^4*q1*q2+q^4*q2^2+q^2*q1*q2+q^2*q2^2)/(-q^6*q1^2+q2^2))*B[(2, 0)]\n + ((-q^3*q1*q2-q^3*q2^2)/(q^6*q1^2-q2^2))*B[(2, -1)]\n + ((-q^5*q1^2-q^5*q1*q2+q^3*q1*q2+q^3*q2^2+q*q1*q2+q*q2^2)/(-q^6*q1^2+q2^2))*B[(2, 1)]\n + B[(2, 2)]\n + ((q^7*q1^2*q2+2*q^7*q1*q2^2+q^7*q2^3+q^5*q1^2*q2+2*q^5*q1*q2^2+q^5*q2^3)/(-q^8*q1^3-q^6*q1^2*q2+q^2*q1*q2^2+q2^3))*B[(0, -1)]\n + ((q^7*q1^3+q^7*q1^2*q2-q^7*q1*q2^2-q^7*q2^3-2*q^5*q1^2*q2-4*q^5*q1*q2^2-2*q^5*q2^3-2*q^3*q1^2*q2-4*q^3*q1*q2^2-2*q^3*q2^3)/(q^8*q1^3+q^6*q1^2*q2-q^2*q1*q2^2-q2^3))*B[(0, 1)]\n + ((q^6*q1^2+q^6*q1*q2-q^4*q1*q2-q^4*q2^2-q^2*q1*q2-q^2*q2^2)/(q^6*q1^2-q2^2))*B[(0, 2)]\n sage: E.recursion(2*omega[2])\n [0, 1, 0, 2, 1, 0, 2, 1, 0]\n\n Some tests that the `T` s are implemented properly by hand\n defining the `Y` s in terms of them::\n\n sage: T = E._T_Y\n sage: Ye1 = T.Tw((1,2,1,0), scalar=(-1/(q1*q2))^2)\n sage: Ye2 = T.Tw((2,1,0,1), signs=(1,1,1,-1), scalar=(-1/(q1*q2)))\n sage: Yalpha0 = T.Tw((0,1,2,1), signs=(-1,-1,-1,-1), scalar=q^-1*(-q1*q2)^2)\n sage: Yalpha1 = T.Tw((1,2,0,1,2,0), signs=(1,1,-1,1,-1,1), scalar=-1/(q1*q2))\n sage: Yalpha2 = T.Tw((2,1,0,1,2,1,0,1), signs=(1,1,1,-1,1,1,1,-1),\n ....: scalar=(1/(q1*q2))^2)\n\n sage: Ye1(KL0.one())\n q1^2/q2^2*B[(0, 0)]\n sage: Ye2(KL0.one())\n ((-q1)/q2)*B[(0, 0)]\n sage: Yalpha0(KL0.one())\n q2^2/(q*q1^2)*B[(0, 0)]\n sage: Yalpha1(KL0.one())\n ((-q1)/q2)*B[(0, 0)]\n sage: Yalpha2(KL0.one())\n q1^2/q2^2*B[(0, 0)]\n\n Testing the `Y` s directly::\n\n sage: Y = E.Y()\n sage: Y.keys()\n Coroot lattice of the Root system of type [\'BC\', 2, 2]\n sage: alpha = Y.keys().simple_roots()\n sage: L(alpha[0])\n -2*e[0] + e[\'deltacheck\']\n sage: L(alpha[1])\n e[0] - e[1]\n sage: L(alpha[2])\n e[1]\n sage: Y[alpha[0]].word\n (0, 1, 2, 1)\n sage: Y[alpha[0]].signs\n (-1, -1, -1, -1)\n sage: Y[alpha[0]].scalar # mind that Sage\'s q is the usual q^{1/2}\n q1^2*q2^2/q\n sage: Y[alpha[0]](KL0.one())\n q2^2/(q*q1^2)*B[(0, 0)]\n\n sage: Y[alpha[1]].word\n (1, 2, 0, 1, 2, 0)\n sage: Y[alpha[1]].signs\n (1, 1, -1, 1, -1, 1)\n sage: Y[alpha[1]].scalar\n 1/(-q1*q2)\n\n sage: Y[alpha[2]].word # Bogdan says it should be the square of that; do we need to take translation factors into account or not?\n (2, 1, 0, 1)\n sage: Y[alpha[2]].signs\n (1, 1, 1, -1)\n sage: Y[alpha[2]].scalar\n 1/(-q1*q2)\n\n Checking the provided nonsymmetric Macdonald polynomial::\n\n sage: E10 = KL0.monomial(L0((1,0))) + KL0( q*(1-(-q1/q2)) / (1-q^2*(-q1/q2)^4) )\n sage: E10 == E[omega[1]]\n True\n sage: E.eigenvalues(E10) # not checked\n [q*q1^2/q2^2, q2^3/(-q^2*q1^3), q1/(-q2)]\n\n Checking T0check::\n\n sage: T0check_on_basis = KL.T0_check_on_basis(q1,q2, convention="dominant")\n sage: T0check_on_basis.phi # note: this is in fact a0 phi\n (2, 0)\n sage: T0check_on_basis.v # what to match it with?\n (1,)\n sage: T0check_on_basis.j # what to match it with?\n 2\n sage: T0check_on_basis(KL0.basis().keys().zero())\n ((-q1^2)/q2)*B[(1, 0)]\n\n sage: T0check = E._T[0]\n sage: T0check(KL0.one())\n ((-q1^2)/q2)*B[(1, 0)]\n\n\n Systematic tests of nonsymmetric Macdonald polynomials in type\n `A_1^{(1)}`, in the weight lattice. Each time, we specify the\n eigenvalues for the action of `Y_{\\alpha_0}`, and `Y_{\\alpha_1}`::\n\n sage: K = QQ[\'q\',\'t\'].fraction_field()\n sage: q,t = K.gens()\n sage: KL = RootSystem(["A",1,1]).weight_lattice(extended=True).algebra(K)\n sage: E = NonSymmetricMacdonaldPolynomials(KL,q, t, -1)\n sage: omega = E.keys().fundamental_weights()\n\n sage: x = E[0*omega[1]]; x\n B[0]\n sage: E.eigenvalues(x)\n [1/(q*t), t]\n sage: x.is_one()\n True\n sage: x.parent()\n Algebra of the Weight lattice of the Root system of type [\'A\', 1]\n over Fraction Field of Multivariate Polynomial Ring in q, t over Rational Field\n sage: E[omega[1]]\n B[Lambda[1]]\n sage: E.eigenvalues(_)\n [t, 1/(q*t)]\n sage: E[2*omega[1]]\n ((-q*t+q)/(-q*t+1))*B[0] + B[2*Lambda[1]]\n sage: E.eigenvalues(_)\n [q*t, 1/(q^2*t)]\n sage: E[3*omega[1]]\n ((-q^2*t+q^2)/(-q^2*t+1))*B[-Lambda[1]]\n + ((-q^2*t+q^2-q*t+q)/(-q^2*t+1))*B[Lambda[1]] + B[3*Lambda[1]]\n sage: E.eigenvalues(_)\n [q^2*t, 1/(q^3*t)]\n sage: E[4*omega[1]]\n ((q^5*t^2-q^5*t+q^4*t^2-2*q^4*t+q^3*t^2+q^4-2*q^3*t+q^3-q^2*t+q^2)/(q^5*t^2-q^3*t-q^2*t+1))*B[0]\n + ((-q^3*t+q^3)/(-q^3*t+1))*B[-2*Lambda[1]]\n + ((-q^3*t+q^3-q^2*t+q^2-q*t+q)/(-q^3*t+1))*B[2*Lambda[1]]\n + B[4*Lambda[1]]\n sage: E.eigenvalues(_)\n [q^3*t, 1/(q^4*t)]\n sage: E[6*omega[1]]\n ((-q^12*t^3+q^12*t^2-q^11*t^3+2*q^11*t^2-2*q^10*t^3-q^11*t+4*q^10*t^2-2*q^9*t^3-2*q^10*t+5*q^9*t^2-2*q^8*t^3-4*q^9*t+6*q^8*t^2-q^7*t^3+q^9-5*q^8*t+5*q^7*t^2-q^6*t^3+q^8-6*q^7*t+4*q^6*t^2+2*q^7-5*q^6*t+2*q^5*t^2+2*q^6-4*q^5*t+q^4*t^2+2*q^5-2*q^4*t+q^4-q^3*t+q^3)/(-q^12*t^3+q^9*t^2+q^8*t^2+q^7*t^2-q^5*t-q^4*t-q^3*t+1))*B[0]\n + ((-q^5*t+q^5)/(-q^5*t+1))*B[-4*Lambda[1]]\n + ((q^9*t^2-q^9*t+q^8*t^2-2*q^8*t+q^7*t^2+q^8-2*q^7*t+q^6*t^2+q^7-2*q^6*t+q^5*t^2+q^6-2*q^5*t+q^5-q^4*t+q^4)/(q^9*t^2-q^5*t-q^4*t+1))*B[-2*Lambda[1]]\n + ((q^9*t^2-q^9*t+q^8*t^2-2*q^8*t+2*q^7*t^2+q^8-3*q^7*t+2*q^6*t^2+q^7-4*q^6*t+2*q^5*t^2+2*q^6-4*q^5*t+q^4*t^2+2*q^5-3*q^4*t+q^3*t^2+2*q^4-2*q^3*t+q^3-q^2*t+q^2)/(q^9*t^2-q^5*t-q^4*t+1))*B[2*Lambda[1]]\n + ((q^5*t-q^5+q^4*t-q^4+q^3*t-q^3+q^2*t-q^2+q*t-q)/(q^5*t-1))*B[4*Lambda[1]]\n + B[6*Lambda[1]]\n sage: E.eigenvalues(_)\n [q^5*t, 1/(q^6*t)]\n sage: E[-omega[1]]\n B[-Lambda[1]] + ((-t+1)/(-q*t+1))*B[Lambda[1]]\n sage: E.eigenvalues(_)\n [(-1)/(-q^2*t), q*t]\n\n As expected, `e^{-\\omega}` is not an eigenvector::\n\n sage: E.eigenvalues(KL.classical().monomial(-omega[1]))\n Traceback (most recent call last):\n ...\n AssertionError\n\n We proceed by comparing against the examples from the appendix of\n [HHL06]_ in type `A_2^{(1)}`::\n\n sage: K = QQ[\'q\',\'t\'].fraction_field()\n sage: q,t = K.gens()\n sage: KL = RootSystem(["A",2,1]).ambient_space().algebra(K)\n sage: E = NonSymmetricMacdonaldPolynomials(KL,q, t, -1)\n sage: L0 = E.keys()\n sage: omega = L0.fundamental_weights()\n sage: P = K[\'x0,x1,x2\']\n sage: def EE(weight): return E[L0(weight)].expand(P.gens())\n\n sage: EE([0,0,0])\n 1\n sage: EE([1,0,0])\n x0\n sage: EE([0,1,0])\n (t - 1)/(q*t^2 - 1)*x0 + x1\n sage: EE([0,0,1])\n (t - 1)/(q*t - 1)*x0 + (t - 1)/(q*t - 1)*x1 + x2\n sage: EE([1,1,0])\n x0*x1\n sage: EE([1,0,1])\n (t - 1)/(q*t^2 - 1)*x0*x1 + x0*x2\n sage: EE([0,1,1])\n (t - 1)/(q*t - 1)*x0*x1 + (t - 1)/(q*t - 1)*x0*x2 + x1*x2\n sage: EE([2,0,0])\n x0^2 + (q*t - q)/(q*t - 1)*x0*x1 + (q*t - q)/(q*t - 1)*x0*x2\n\n sage: EE([0,2,0])\n (t - 1)/(q^2*t^2 - 1)*x0^2\n + (q^2*t^3 - q^2*t^2 + q*t^2 - 2*q*t + q - t + 1)/(q^3*t^3 - q^2*t^2 - q*t + 1)*x0*x1\n + x1^2\n + (q*t^2 - 2*q*t + q)/(q^3*t^3 - q^2*t^2 - q*t + 1)*x0*x2\n + (q*t - q)/(q*t - 1)*x1*x2\n\n Systematic checks with Sage\'s implementation of [HHL06]_::\n\n sage: import sage.combinat.sf.ns_macdonald as NS # needs sage.combinat\n sage: assert all(EE([x,y,z]) == NS.E([x,y,z]) for d in range(5) # long time (9s), needs sage.combinat\n ....: for x,y,z in IntegerVectors(d,3))\n\n We check that we get eigenvectors for generic `q_1`, `q_2`::\n\n sage: K = QQ[\'q,q1,q2\'].fraction_field()\n sage: q,q1,q2 = K.gens()\n sage: KL = RootSystem(["A",2,1]).ambient_space().algebra(K)\n sage: E = NonSymmetricMacdonaldPolynomials(KL, q, q1, q2)\n sage: L0 = E.keys()\n sage: omega = L0.fundamental_weights()\n sage: E[2*omega[2]]\n ((-q*q1-q*q2)/(-q*q1-q2))*B[(1, 2, 1)] + ((-q*q1-q*q2)/(-q*q1-q2))*B[(2, 1, 1)] + B[(2, 2, 0)]\n sage: for d in range(4): # long time (9s)\n ....: for weight in IntegerVectors(d,3).map(list).map(L0):\n ....: eigenvalues = E.eigenvalues(E[L0(weight)])\n\n Some type `C` calculations::\n\n sage: K = QQ[\'q\',\'t\'].fraction_field()\n sage: q, t = K.gens()\n sage: KL = RootSystem(["C",2,1]).ambient_space().algebra(K)\n sage: E = NonSymmetricMacdonaldPolynomials(KL,q, t, -1)\n sage: L0 = E.keys()\n sage: omega = L0.fundamental_weights()\n sage: E[0*omega[1]]\n B[(0, 0)]\n sage: E.eigenvalues(_) # checked for i=0 with previous calculation\n [1/(q*t^3), t, t]\n sage: E[omega[1]]\n B[(1, 0)]\n sage: E.eigenvalues(_) # not checked\n [t, 1/(q*t^3), t]\n\n sage: E[-omega[1]] # consistent with before refactoring\n B[(-1, 0)] + ((-t+1)/(-q*t+1))*B[(1, 0)]\n + ((-t+1)/(-q*t+1))*B[(0, -1)] + ((t-1)/(q*t-1))*B[(0, 1)]\n sage: E.eigenvalues(_) # not checked\n [(-1)/(-q^2*t^3), q*t, t]\n sage: E[-omega[1]+omega[2]] # consistent with before refactoring\n ((-t+1)/(-q*t^3+1))*B[(1, 0)] + B[(0, 1)]\n sage: E.eigenvalues(_) # not checked\n [t, q*t^3, (-1)/(-q*t^2)]\n sage: E[omega[1]-omega[2]] # consistent with before refactoring\n ((-t+1)/(-q*t^2+1))*B[(1, 0)] + B[(0, -1)] + ((-t+1)/(-q*t^2+1))*B[(0, 1)]\n sage: E.eigenvalues(_) # not checked\n [1/(q^2*t^3), 1/(q*t), q*t^2]\n\n sage: E[-omega[2]]\n ((-q^2*t^4+q^2*t^3-q*t^3+2*q*t^2-q*t+t-1)/(-q^3*t^4+q^2*t^3+q*t-1))*B[(0, 0)]\n + B[(-1, -1)] + ((-t+1)/(-q*t+1))*B[(-1, 1)] + ((t-1)/(q*t-1))*B[(1, -1)]\n + ((-q*t^4+q*t^3+t-1)/(-q^3*t^4+q^2*t^3+q*t-1))*B[(1, 1)]\n sage: E.eigenvalues(_) # not checked # long time (1s)\n [1/(q^3*t^3), t, q*t]\n sage: E[-omega[2]].map_coefficients(lambda c: c.subs(t=0)) # checking against crystals\n B[(0, 0)] + B[(-1, -1)] + B[(-1, 1)] + B[(1, -1)] + B[(1, 1)]\n\n sage: E[2*omega[2]]\n ((-q^6*t^7+q^6*t^6-q^5*t^6+2*q^5*t^5-q^4*t^5-q^5*t^3+3*q^4*t^4-3*q^4*t^3+q^3*t^4+q^4*t^2-2*q^3*t^2+q^3*t-q^2*t+q^2)/(-q^6*t^7+q^5*t^6+q^4*t^4+q^3*t^4-q^3*t^3-q^2*t^3-q*t+1))*B[(0, 0)]\n + ((-q^3*t^2+q^3*t)/(-q^3*t^3+1))*B[(-1, -1)]\n + ((-q^3*t^3+2*q^3*t^2-q^3*t)/(-q^4*t^4+q^3*t^3+q*t-1))*B[(-1, 1)]\n + ((-q^3*t^3+2*q^3*t^2-q^3*t)/(-q^4*t^4+q^3*t^3+q*t-1))*B[(1, -1)]\n + ((-q^4*t^4+q^4*t^3-q^3*t^3+2*q^3*t^2-q^2*t^3-q^3*t+2*q^2*t^2-q^2*t+q*t-q)/(-q^4*t^4+q^3*t^3+q*t-1))*B[(1, 1)]\n + ((q*t-q)/(q*t-1))*B[(2, 0)] + B[(2, 2)] + ((-q*t+q)/(-q*t+1))*B[(0, 2)]\n sage: E.eigenvalues(_) # not checked\n [q^3*t^3, t, (-1)/(-q^2*t^2)]\n\n The following computations were calculated by hand::\n\n sage: KL0 = KL.classical()\n sage: E11 = KL0.sum_of_terms([[L0([1,1]), 1], [L0([0,0]), (-q*t^2 + q*t)/(1-q*t^3)]])\n sage: E11 == E[omega[2]]\n True\n sage: E.eigenvalues(E11)\n [q*t^3, t, (-1)/(-q*t^2)]\n\n sage: E1m1 = KL0.sum_of_terms([[L0([1,-1]), 1], [L0([1,1]), (1-t)/(1-q*t^2)],\n ....: [L0([0,0]), q*t*(1-t)/(1-q*t^2)]])\n sage: E1m1 == E[2*omega[1]-omega[2]]\n True\n sage: E.eigenvalues(E1m1)\n [1/(q*t), 1/(q^2*t^3), q*t^2]\n\n Now we present an example for a twisted affine root system. The\n results are eigenvectors::\n\n sage: K = QQ[\'q\',\'t\'].fraction_field()\n sage: q, t = K.gens()\n sage: KL = RootSystem("C2~*").ambient_space().algebra(K)\n sage: E = NonSymmetricMacdonaldPolynomials(KL,q, t, -1)\n sage: omega = E.keys().fundamental_weights()\n sage: E[0*omega[1]]\n B[(0, 0)]\n sage: E.eigenvalues(_)\n [1/(q*t^2), t, t]\n sage: E[omega[1]]\n ((-q*t+q)/(-q*t^2+1))*B[(0, 0)] + B[(1, 0)]\n sage: E.eigenvalues(_)\n [q*t^2, 1/(q^2*t^3), t]\n\n sage: E[-omega[1]]\n ((-q*t+q-t+1)/(-q^2*t+1))*B[(0, 0)] + B[(-1, 0)] + ((-t+1)/(-q^2*t+1))*B[(1, 0)]\n + ((-t+1)/(-q^2*t+1))*B[(0, -1)] + ((t-1)/(q^2*t-1))*B[(0, 1)]\n sage: E.eigenvalues(_)\n [(-1)/(-q^3*t^2), q^2*t, t]\n sage: E[-omega[1]+omega[2]]\n B[(-1/2, 1/2)] + ((-t+1)/(-q^2*t^3+1))*B[(1/2, -1/2)]\n + ((-q*t^3+q*t^2-t+1)/(-q^2*t^3+1))*B[(1/2, 1/2)]\n sage: E.eigenvalues(_)\n [(-1)/(-q^2*t^2), q^2*t^3, (-1)/(-q*t)]\n sage: E[omega[1]-omega[2]]\n B[(1/2, -1/2)] + ((-t+1)/(-q*t^2+1))*B[(1/2, 1/2)]\n sage: E.eigenvalues(_)\n [t, 1/(q^2*t^3), q*t^2]\n\n Type BC, comparison with calculations with Maple by Bogdan Ion::\n\n sage: K = QQ[\'q\',\'t\'].fraction_field()\n sage: q,t = K.gens()\n sage: def to_SR(x):\n ....: dim = x.parent().basis().keys().dimension()\n ....: x_expanded = x.expand([SR.var(\'x%s\'%i) for i in range(1, dim + 1)])\n ....: return x_expanded.subs(q=SR.var(\'q\'), t=SR.var(\'t\'))\n sage: var(\'x1,x2,x3\') # needs sage.symbolic\n (x1, x2, x3)\n\n sage: E = NonSymmetricMacdonaldPolynomials(["BC",2,2], q=q, q1=t^2, q2=-1)\n sage: omega = E.keys().fundamental_weights()\n sage: expected = (t-1)*(t+1)*(2+q^4+2*q^2-2*t^2-2*q^2*t^2-t^4*q^2-q^4*t^4+t^4-3*q^6*t^6-2*q^4*t^6+2*q^6*t^8+2*q^4*t^8+t^10*q^8)*q^4/((q^2*t^3-1)*(q^2*t^3+1)*(t*q-1)*(t*q+1)*(t^2*q^3+1)*(t^2*q^3-1))+(t-1)^2*(t+1)^2*(2*q^2+q^4+2+q^4*t^2)*q^3*x1/((t^2*q^3+1)*(t^2*q^3-1)*(t*q-1)*(t*q+1))+(t-1)^2*(t+1)^2*(q^2+1)*q^5/((t^2*q^3+1)*(t^2*q^3-1)*(t*q-1)*(t*q+1)*x1)+(t-1)^2*(t+1)^2*(q^2+1)*q^4*x2/((t^2*q^3+1)*(t^2*q^3-1)*(t*q-1)*(t*q+1)*x1)+(t-1)^2*(t+1)^2*(2*q^2+q^4+2+q^4*t^2)*q^3*x2/((t^2*q^3+1)*(t^2*q^3-1)*(t*q-1)*(t*q+1))+(t-1)^2*(t+1)^2*(q^2+1)*q^5/((t^2*q^3+1)*(t^2*q^3-1)*(t*q-1)*(t*q+1)*x2)+x1^2*x2^2+(t-1)*(t+1)*(-2*q^2-q^4-2+2*q^2*t^2+t^2+q^6*t^4+q^4*t^4)*q^2*x2*x1/((t^2*q^3+1)*(t^2*q^3-1)*(t*q-1)*(t*q+1))+(t-1)*(t+1)*(q^2+1+q^4*t^2)*q*x2^2*x1/((t^2*q^3-1)*(t^2*q^3+1))+(t-1)*(t+1)*q^3*x1^2/((t^2*q^3-1)*(t^2*q^3+1)*x2)+(t-1)*(t+1)*(q^2+1+q^4*t^2)*q*x2*x1^2/((t^2*q^3-1)*(t^2*q^3+1))+(t-1)*(t+1)*q^6/((t^2*q^3+1)*(t^2*q^3-1)*x1*x2)+(t-1)*(t+1)*(q^2+1+q^4*t^2)*q^2*x1^2/((t^2*q^3-1)*(t^2*q^3+1))+(t-1)*(t+1)*(q^2+1+q^4*t^2)*q^2*x2^2/((t^2*q^3-1)*(t^2*q^3+1))+(t-1)*(t+1)*q^3*x2^2/((t^2*q^3-1)*(t^2*q^3+1)*x1)+(t-1)^2*(t+1)^2*(q^2+1)*q^4*x1/((t^2*q^3+1)*(t^2*q^3-1)*(t*q-1)*(t*q+1)*x2) # needs sage.symbolic\n sage: to_SR(E[2*omega[2]]) - expected # long time (3.5s) # needs sage.symbolic\n 0\n\n sage: E = NonSymmetricMacdonaldPolynomials(["BC",3,2], q=q, q1=t^2, q2=-1)\n sage: omega=E.keys().fundamental_weights()\n sage: mu = -3*omega[1] + 3*omega[2] - omega[3]; mu\n (-1, 2, -1)\n sage: expected = (t-1)^2*(t+1)^2*(3*q^2+q^4+1+t^2*q^4+q^2*t^2-3*t^4*q^2-5*t^6*q^4+2*t^8*q^4-4*t^8*q^6-q^8*t^10+2*t^10*q^6-2*q^8*t^12+t^14*q^8-t^14*q^10+q^10*t^16+q^8*t^16+q^10*t^18+t^18*q^12)*x2*x1/((q^3*t^5+1)*(q^3*t^5-1)*(t*q-1)*(t*q+1)*(t^3*q^2+1)*(t^3*q^2-1)*(t^2*q-1)*(t^2*q+1))+(t-1)^2*(t+1)^2*(q^2*t^6+2*t^6*q^4-q^4*t^4+t^4*q^2-q^2*t^2+t^2-2-q^2)*q^2*x1/((t^3*q^2-1)*(t^3*q^2+1)*(t*q+1)*(t*q-1)*(q^3*t^5-1)*(q^3*t^5+1)*x2)+(t-1)^2*(t+1)^2*(-q^2-1+t^4*q^2-q^4*t^4+2*t^6*q^4)*x1^2/((t^3*q^2-1)*(t^3*q^2+1)*(t*q+1)*(t*q-1)*(q^3*t^5-1)*(q^3*t^5+1))+(t+1)*(t-1)*x2^2*x3/((t*q-1)*(t*q+1)*x1)+(t-1)^2*(t+1)^2*(3*q^2+q^4+2+t^2*q^4+2*q^2*t^2-4*t^4*q^2+q^4*t^4-6*t^6*q^4+t^8*q^4-4*t^8*q^6-q^8*t^10+t^10*q^6-3*q^8*t^12-2*t^14*q^10+2*t^14*q^8+2*q^10*t^16+q^8*t^16+t^18*q^12+2*q^10*t^18)*q*x2/((q^3*t^5+1)*(q^3*t^5-1)*(t*q-1)*(t*q+1)*(t^3*q^2+1)*(t^3*q^2-1)*(t^2*q-1)*(t^2*q+1))+(t-1)^2*(t+1)^2*(1+q^4+2*q^2+t^2*q^4-3*t^4*q^2+q^2*t^6-5*t^6*q^4+3*t^8*q^4-4*t^8*q^6+2*t^10*q^6-q^8*t^12-t^14*q^10+t^14*q^8+q^10*t^16+t^18*q^12)*x3*x1/((q^3*t^5+1)*(q^3*t^5-1)*(t*q-1)*(t*q+1)*(t^3*q^2+1)*(t^3*q^2-1)*(t^2*q-1)*(t^2*q+1))+(t-1)^2*(t+1)^2*(2*q^2+1+q^4+t^2*q^4-t^2+q^2*t^2-4*t^4*q^2+q^4*t^4+q^2*t^6-5*t^6*q^4+3*t^8*q^4-4*t^8*q^6+2*t^10*q^6+q^6*t^12-2*q^8*t^12-2*t^14*q^10+2*t^14*q^8+q^10*t^16+t^18*q^12)*q*x3/((q^3*t^5+1)*(q^3*t^5-1)*(t*q-1)*(t*q+1)*(t^3*q^2+1)*(t^3*q^2-1)*(t^2*q-1)*(t^2*q+1))+(t-1)^2*(t+1)^2*(1+t^2+t^4*q^2)*q*x3*x2^2/((t*q-1)*(t*q+1)*(t^3*q^2+1)*(t^3*q^2-1))+(t-1)^2*(t+1)^2*(-q^2-2-q^2*t^2+t^4-q^4*t^4-t^4*q^2+3*q^2*t^6-t^6*q^4-t^8*q^6+t^8*q^4+t^10*q^4+2*q^6*t^12-q^8*t^12+t^14*q^8)*q*x3*x2*x1/((t^3*q^2-1)*(t^3*q^2+1)*(t*q+1)*(t*q-1)*(q^3*t^5-1)*(q^3*t^5+1))+(t-1)*(t+1)*x1^2/((q^3*t^5-1)*(q^3*t^5+1)*x3*x2)+(t-1)*(t+1)*(-q^2-1+t^4*q^2-q^4*t^4+2*t^6*q^4)*x2^2/((t*q-1)*(t*q+1)*(t^3*q^2+1)*(t^3*q^2-1))+(t-1)*(t+1)*(t^3*q-1)*(t^3*q+1)*x3*x2^2*x1/((t*q-1)*(t*q+1)*(t^3*q^2+1)*(t^3*q^2-1))+(t-1)^2*(t+1)^2*(q^2+1)*q*x1/((t*q+1)*(t*q-1)*(q^3*t^5+1)*(q^3*t^5-1)*x3*x2)+(t-1)^2*(t+1)^2*(t^3*q-1)*(t^3*q+1)*x3*x2*x1^2/((t^3*q^2-1)*(t^3*q^2+1)*(t*q+1)*(t*q-1)*(q^3*t^5-1)*(q^3*t^5+1))+(t-1)^2*(t+1)^2*q^3*x3/((t*q+1)*(t*q-1)*(q^3*t^5-1)*(q^3*t^5+1)*x1*x2)+(t-1)*(t+1)*(-1-q^2+q^2*t^2+t^10*q^6)*q*x2/((t*q+1)*(t*q-1)*(q^3*t^5+1)*(q^3*t^5-1)*x3*x1)+x2^2/(x1*x3)+(t-1)*(t+1)*q*x2^2/((t*q-1)*(t*q+1)*x3)+(t-1)^3*(t+1)^3*(1+t^2+t^4*q^2)*q*x2*x1^2/((t^3*q^2-1)*(t^3*q^2+1)*(t*q+1)*(t*q-1)*(q^3*t^5-1)*(q^3*t^5+1))+(t-1)^2*(t+1)^2*q*x1^2/((t*q+1)*(t*q-1)*(q^3*t^5-1)*(q^3*t^5+1)*x3)+(t-1)^2*(t+1)^2*(q^2*t^6+2*t^6*q^4-q^4*t^4+t^4*q^2-q^2*t^2+t^2-2-q^2)*q^3/((t^3*q^2-1)*(t^3*q^2+1)*(t*q+1)*(t*q-1)*(q^3*t^5-1)*(q^3*t^5+1)*x2)+(t-1)*(t+1)*(q^2+2-t^2+q^4*t^4-t^4*q^2-3*t^6*q^4+t^8*q^4-2*t^10*q^6-q^8*t^12+q^6*t^12+q^8*t^16+q^10*t^16)*q^2*x2/((t^3*q^2-1)*(t^3*q^2+1)*(t*q+1)*(t*q-1)*(q^3*t^5-1)*(q^3*t^5+1)*x1)+(t-1)^2*(t+1)^2*(q^2+1)*q^2/((t*q+1)*(t*q-1)*(q^3*t^5-1)*(q^3*t^5+1)*x3*x2)+(t-1)*(t+1)*(1+q^4+2*q^2-2*q^2*t^2+t^4*q^6-q^4*t^4-3*q^6*t^6-t^6*q^4+2*t^8*q^6-t^10*q^6-q^8*t^10-t^14*q^10+t^14*q^8+2*q^10*t^16)*x2/((t^3*q^2-1)*(t^3*q^2+1)*(t*q+1)*(t*q-1)*(q^3*t^5-1)*(q^3*t^5+1)*x3)+(t-1)^2*(t+1)^2*(-q^2-2-q^2*t^2-q^4*t^4+2*t^6*q^4+t^10*q^6+q^8*t^12+t^14*q^8)*q^3/((t^3*q^2-1)*(t^3*q^2+1)*(t*q+1)*(t*q-1)*(q^3*t^5-1)*(q^3*t^5+1)*x1)+(t-1)^2*(t+1)^2*(-1-q^2-q^2*t^2+t^2+t^4*q^2-q^4*t^4+2*t^6*q^4)*q^2*x3/((t^3*q^2-1)*(t^3*q^2+1)*(t*q+1)*(t*q-1)*(q^3*t^5-1)*(q^3*t^5+1)*x2)+(t-1)*(t+1)*q*x2^2/((t*q-1)*(t*q+1)*x1)+(t-1)^2*(t+1)^2*(1+t^2+t^4*q^2)*q*x2^2*x1/((t*q-1)*(t*q+1)*(t^3*q^2+1)*(t^3*q^2-1))+(t-1)^2*(t+1)^2*q*x1^2/((t*q+1)*(t*q-1)*(q^3*t^5-1)*(q^3*t^5+1)*x2)+(t-1)^2*(t+1)^2*(-1-q^4-2*q^2-t^2*q^4-q^2*t^2+t^4*q^2-t^4*q^6-2*q^4*t^4+3*t^6*q^4-q^6*t^6-t^8*q^8+t^8*q^6+2*t^10*q^6-q^10*t^12+3*q^8*t^12+2*t^14*q^10)*x3*x2/((t^3*q^2-1)*(t^3*q^2+1)*(t*q+1)*(t*q-1)*(q^3*t^5-1)*(q^3*t^5+1))+(t-1)*(t+1)*(q^2+1-t^2+q^4*t^4-t^4*q^2+q^2*t^6-3*t^6*q^4+t^8*q^4-t^10*q^6+q^6*t^12-q^8*t^12+q^10*t^16)*q^2*x3/((t^3*q^2-1)*(t^3*q^2+1)*(t*q+1)*(t*q-1)*(q^3*t^5-1)*(q^3*t^5+1)*x1)+(t-1)*(t+1)*(-1-q^2+q^2*t^2+t^10*q^6)*q^2/((t*q-1)*(t*q+1)*(q^3*t^5+1)*(q^3*t^5-1)*x1*x3)+(t-1)*(t+1)*(1+q^4+2*q^2-3*q^2*t^2+t^4*q^6-q^4*t^4-3*q^6*t^6-t^6*q^4+t^8*q^4+2*t^8*q^6-t^10*q^6+t^14*q^8-t^14*q^10+q^10*t^16)*x1/((t^3*q^2-1)*(t^3*q^2+1)*(t*q+1)*(t*q-1)*(q^3*t^5-1)*(q^3*t^5+1)*x3)+(t-1)^2*(t+1)^2*(3*q^2+q^4+2+q^2*t^2-t^2+t^2*q^4-6*t^4*q^2+q^4*t^4-7*t^6*q^4+q^2*t^6+3*t^8*q^4-4*t^8*q^6+t^10*q^4+3*t^10*q^6-q^8*t^12-t^14*q^10+t^14*q^8+q^8*t^16+q^10*t^18)*q*x1/((q^3*t^5+1)*(q^3*t^5-1)*(t*q-1)*(t*q+1)*(t^3*q^2+1)*(t^3*q^2-1)*(t^2*q-1)*(t^2*q+1))+(t-1)^2*(t+1)^2*(-q^2-2-q^2*t^2-q^4*t^4+2*t^6*q^4+t^10*q^6+q^6*t^12+t^14*q^8)*q*x2*x1/((t^3*q^2-1)*(t^3*q^2+1)*(t*q+1)*(t*q-1)*(q^3*t^5-1)*(q^3*t^5+1)*x3)+(t+1)*(t-1)*x2^2*x1/((t*q-1)*(t*q+1)*x3)+(t-1)^3*(t+1)^3*(1+t^2+t^4*q^2)*q*x3*x1^2/((t^3*q^2-1)*(t^3*q^2+1)*(t*q+1)*(t*q-1)*(q^3*t^5-1)*(q^3*t^5+1))+(t-1)*(t+1)*q^3/((q^3*t^5+1)*(q^3*t^5-1)*x1*x2*x3)+(t-1)^2*(t+1)^2*(3+3*q^2+q^4+2*q^2*t^2-t^2+t^2*q^4-6*t^4*q^2+q^4*t^4-8*t^6*q^4+q^2*t^6+2*t^8*q^4-4*t^8*q^6+t^10*q^4+2*t^10*q^6-2*q^8*t^12-t^14*q^10+t^14*q^8+q^8*t^16+q^10*t^16+2*q^10*t^18)*q^2/((q^3*t^5+1)*(q^3*t^5-1)*(t*q-1)*(t*q+1)*(t^3*q^2+1)*(t^3*q^2-1)*(t^2*q-1)*(t^2*q+1))+(t-1)^2*(t+1)^2*(-q^4-2*q^2-1-t^2*q^4-t^4*q^6+2*q^6*t^6+t^6*q^4+t^10*q^6+q^8*t^12+t^14*q^10)*q/((t^3*q^2-1)*(t^3*q^2+1)*(t*q+1)*(t*q-1)*(q^3*t^5-1)*(q^3*t^5+1)*x3)+(t-1)^2*(t+1)^2*(-1-q^2-q^2*t^2+t^2+t^4*q^2-q^4*t^4+2*t^6*q^4)*q*x3*x1/((t^3*q^2-1)*(t^3*q^2+1)*(t*q+1)*(t*q-1)*(q^3*t^5-1)*(q^3*t^5+1)*x2)+(t-1)^2*(t+1)^2*x2*x1^2/((t*q+1)*(t*q-1)*(q^3*t^5-1)*(q^3*t^5+1)*x3)+(t-1)^2*(t+1)^2*x3*x1^2/((t*q+1)*(t*q-1)*(q^3*t^5-1)*(q^3*t^5+1)*x2)+(t-1)^2*(t+1)^2*q^4/((t*q+1)*(t*q-1)*(q^3*t^5+1)*(q^3*t^5-1)*x1*x2)+(t-1)^2*(t+1)^2*(-q^2-1-q^2*t^2-q^4*t^4+t^6*q^4+t^10*q^6+q^8*t^12+t^14*q^10)*q*x3*x2/((t^3*q^2-1)*(t^3*q^2+1)*(t*q+1)*(t*q-1)*(q^3*t^5-1)*(q^3*t^5+1)*x1) # needs sage.symbolic\n sage: to_SR(E[mu]) - expected # long time (20s) # needs sage.symbolic\n 0\n\n sage: E = NonSymmetricMacdonaldPolynomials(["BC",1,2], q=q, q1=t^2, q2=-1)\n sage: omega = E.keys().fundamental_weights()\n sage: mu = -4*omega[1]; mu\n (-4)\n sage: expected = (t-1)*(t+1)*(-1+q^2*t^2-q^2-3*q^10-7*q^26*t^8+5*t^2*q^6-q^16-3*q^4+4*t^10*q^30-4*t^6*q^22-10*q^20*t^6+2*q^32*t^10-3*q^6-4*q^8+q^34*t^10-4*t^8*q^24-2*q^12-q^14+2*q^22*t^10+4*q^26*t^10+4*q^28*t^10+t^6*q^30-2*q^32*t^8-2*t^8*q^22+2*q^24*t^10-q^20*t^2-2*t^6*q^12+t^8*q^14+2*t^4*q^24-4*t^8*q^30+2*t^8*q^20-9*t^6*q^16+3*q^26*t^6+q^28*t^6+3*t^2*q^4+2*q^18*t^8-6*t^6*q^14+4*t^4*q^22-2*q^24*t^6+3*t^2*q^12+7*t^4*q^20-t^2*q^16+11*q^18*t^4-2*t^2*q^18+9*q^16*t^4-t^4*q^6+6*q^8*t^2+5*q^10*t^2-6*q^28*t^8+q^12*t^4+8*t^4*q^14-10*t^6*q^18-q^4*t^4+q^16*t^8-2*t^4*q^8)/((t*q^4-1)*(t*q^4+1)*(q^7*t^2-1)*(q^7*t^2+1)*(t*q^3-1)*(t*q^3+1)*(q^5*t^2+1)*(q^5*t^2-1))+(q^2+1)*(q^4+1)*(t-1)*(t+1)*(-1+q^2*t^2-q^2+t^2*q^6-q^4+t^6*q^22+3*q^10*t^4+t^2-q^8-2*t^8*q^24+q^22*t^10+q^26*t^10-2*t^8*q^22+q^24*t^10-4*t^6*q^12-2*t^8*q^20-3*t^6*q^16+2*t^2*q^4-t^6*q^10-2*t^6*q^14+t^8*q^12-t^2*q^12+2*q^16*t^4+q^8*t^2-q^10*t^2+3*q^12*t^4+2*t^4*q^14+t^6*q^18-2*q^4*t^4+q^16*t^8+q^20*t^10)*q*x1/((t*q^4-1)*(t*q^4+1)*(q^7*t^2-1)*(q^7*t^2+1)*(t*q^3-1)*(t*q^3+1)*(q^5*t^2+1)*(q^5*t^2-1))+(q^2+1)*(q^4+1)*(t-1)*(t+1)*(1+q^8+q^4+q^2-q^8*t^2-2*t^2*q^4-t^2*q^6+t^2*q^12-t^2+t^4*q^6-2*q^16*t^4-t^4*q^14-2*q^12*t^4+t^6*q^12+t^6*q^16+t^6*q^18+t^6*q^14)*q/((t*q^4-1)*(t*q^4+1)*(q^7*t^2-1)*(q^7*t^2+1)*(t*q^3-1)*(t*q^3+1)*x1)+(t-1)*(t+1)*(-1-q^2-q^6-q^4-q^8+t^2*q^4-t^2*q^14+t^2*q^6-q^10*t^2+q^8*t^2-t^2*q^12+q^12*t^4+q^10*t^4+q^16*t^4+2*t^4*q^14)*(q^4+1)/((q^7*t^2+1)*(q^7*t^2-1)*(t*q^4-1)*(t*q^4+1)*x1^2)+(t-1)*(t+1)*(q^4+1)*(q^2+1)*q/((t*q^4-1)*(t*q^4+1)*x1^3)+(q^4+1)*(t-1)*(t+1)*(1+q^6+q^8+q^2+q^4-q^2*t^2-3*t^2*q^4+q^10*t^2+t^2*q^12-2*t^2*q^6-q^8*t^2-2*q^16*t^4+q^4*t^4+t^4*q^6-q^10*t^4-2*q^12*t^4-2*t^4*q^14+t^6*q^12+t^6*q^18+2*t^6*q^16+t^6*q^14)*x1^2/((t*q^4-1)*(t*q^4+1)*(q^7*t^2-1)*(q^7*t^2+1)*(t*q^3-1)*(t*q^3+1))+(t-1)*(t+1)*(-1-t^2*q^6+t^2+t^4*q^8)*(q^4+1)*(q^2+1)*q*x1^3/((q^7*t^2+1)*(q^7*t^2-1)*(t*q^4-1)*(t*q^4+1))+1/x1^4+(t-1)*(t+1)*x1^4/((t*q^4-1)*(t*q^4+1)) # needs sage.symbolic\n sage: to_SR(E[mu]) - expected # needs sage.symbolic\n 0\n\n Type `BC` dual, comparison with hand calculations by Bogdan Ion::\n\n sage: K = QQ[\'q,q1,q2\'].fraction_field()\n sage: q,q1,q2 = K.gens()\n sage: ct = CartanType(["BC",2,2]).dual()\n sage: E = NonSymmetricMacdonaldPolynomials(ct, q=q, q1=q1, q2=q2)\n sage: KL = E.domain(); KL\n Algebra of the Ambient space of the Root system of type [\'B\', 2]\n over Fraction Field of Multivariate Polynomial Ring in q, q1, q2 over Rational Field\n sage: alpha = E.keys().simple_roots(); alpha\n Finite family {1: (1, -1), 2: (0, 1)}\n sage: omega=E.keys().fundamental_weights(); omega\n Finite family {1: (1, 0), 2: (1/2, 1/2)}\n sage: epsilon = E.keys().basis(); epsilon\n Finite family {0: (1, 0), 1: (0, 1)}\n\n Note: Sage\'s `q` is the usual `q^2`::\n\n sage: E.L().null_root()\n e[\'delta\']\n sage: E.L().null_coroot()\n 2*e[\'deltacheck\']\n\n Some eigenvectors::\n\n sage: E[0*omega[1]]\n B[(0, 0)]\n sage: E[omega[1]]\n ((-q^2*q1^3*q2-q^2*q1^2*q2^2)/(q^2*q1^4-q2^4))*B[(0, 0)] + B[(1, 0)]\n sage: Eomega1 = (KL.one() * (q^2*(-q1/q2)^2*(1-(-q1/q2))) / (1-q^2*(-q1/q2)^4)\n ....: + KL.monomial(omega[1]))\n sage: E[omega[1]] == Eomega1\n True\n\n Checking the `Y` s::\n\n sage: Y = E.Y()\n sage: alphacheck = Y.keys().simple_roots()\n sage: Y0 = Y[alphacheck[0]]\n sage: Y1 = Y[alphacheck[1]]\n sage: Y2 = Y[alphacheck[2]]\n\n sage: Y0.word, Y0.signs, Y0.scalar\n ((0, 1, 2, 1, 0, 1, 2, 1), (-1, -1, -1, -1, -1, -1, -1, -1), q1^4*q2^4/q^2)\n sage: Y1.word, Y1.signs, Y1.scalar\n ((1, 2, 0, 1, 2, 0), (1, 1, -1, 1, -1, 1), 1/(-q1*q2))\n sage: Y2.word, Y2.signs, Y2.scalar\n ((2, 1, 0, 1), (1, 1, 1, -1), 1/(-q1*q2))\n\n sage: E.eigenvalues(0*omega[1])\n [q2^4/(q^2*q1^4), q1/(-q2), q1/(-q2)]\n\n Checking the `T` and `T^{-1}` s::\n\n sage: T = E._T_Y\n sage: Tinv0 = T.Tw_inverse([0])\n sage: Tinv1 = T.Tw_inverse([1])\n sage: Tinv2 = T.Tw_inverse([2])\n\n sage: for x in [0*epsilon[0], -epsilon[0], -epsilon[1], epsilon[0], epsilon[1]]:\n ....: x = KL.monomial(x)\n ....: assert Tinv0(T[0](x)) == x and T[0](Tinv0(x)) == x\n ....: assert Tinv1(T[1](x)) == x and T[1](Tinv1(x)) == x\n ....: assert Tinv2(T[2](x)) == x and T[2](Tinv2(x)) == x\n\n sage: start = E[omega[1]]; start\n ((-q^2*q1^3*q2-q^2*q1^2*q2^2)/(q^2*q1^4-q2^4))*B[(0, 0)] + B[(1, 0)]\n sage: Tinv1(Tinv2(Tinv1(Tinv0(Tinv1(Tinv2(Tinv1(Tinv0(start)))))))) * (q1*q2)^4/q^2 == Y0(start)\n True\n sage: Y0(start) == q^2*q1^4/q2^4 * start\n True\n\n Checking the relation between the `Y` s::\n\n sage: q^2 * Y0(Y1(Y1(Y2(Y2(start))))) == start\n True\n sage: for x in [0*epsilon[0], -epsilon[0], -epsilon[1], epsilon[0], epsilon[1]]:\n ....: x = KL.monomial(x)\n ....: assert q^2 * Y0(Y1(Y1(Y2(Y2(start))))) == start\n\n '
@staticmethod
def __classcall__(cls, KL, q='q', q1='q1', q2='q2', normalized=True):
'\n EXAMPLES::\n\n sage: NonSymmetricMacdonaldPolynomials(["B", 2, 1])\n The family of the Macdonald polynomials of type [\'B\', 2, 1] with parameters q, q1, q2\n '
from sage.combinat.root_system.cartan_type import CartanType
K = None
if isinstance(KL, CombinatorialFreeModule):
K = KL.base_ring()
else:
if (q == 'q'):
from sage.rings.rational_field import QQ
K = QQ[('q', 'q1', 'q2')].fraction_field()
else:
K = q.parent()
KL = CartanType(KL).root_system().ambient_space().algebra(K)
q = K(q)
q1 = K(q1)
q2 = K(q2)
return super().__classcall__(cls, KL, q, q1, q2, normalized)
def __init__(self, KL, q, q1, q2, normalized):
'\n Initializes the nonsymmetric Macdonald polynomial class.\n\n INPUT:\n\n - ``KL`` -- algebra over weight space\n - ``q``, ``q1``, ``q2`` -- parameters\n - ``normalized`` -- a boolean (default: True)\n whether to normalize the result to have leading coefficient 1\n\n EXAMPLES::\n\n sage: K = QQ[\'q,q1,q2\'].fraction_field()\n sage: q, q1, q2 = K.gens()\n sage: KL = RootSystem(["A",1,1]).weight_space(extended = True).algebra(K)\n sage: NonSymmetricMacdonaldPolynomials(KL,q, q1, q2)\n The family of the Macdonald polynomials of type [\'A\', 1, 1] with parameters q, q1, q2\n\n sage: KL = RootSystem(["A",1,1]).ambient_space().algebra(K)\n sage: NonSymmetricMacdonaldPolynomials(KL,q, q1, q2)\n The family of the Macdonald polynomials of type [\'A\', 1, 1] with parameters q, q1, q2\n\n sage: KL = RootSystem(["A",1,1]).weight_space().algebra(K)\n sage: NonSymmetricMacdonaldPolynomials(KL,q, q1, q2)\n Traceback (most recent call last):\n ...\n AssertionError: The weight lattice needs to be extended!\n '
self._KL = KL
self._L = KL.basis().keys()
assert self._L.is_extended(), 'The weight lattice needs to be extended!'
self._q = q
self._q1 = q1
self._q2 = q2
assert (self.L_prime().classical() is self.L().classical())
T = KL.twisted_demazure_lusztig_operators(q1, q2, convention='dominant')
T_Y = KL.demazure_lusztig_operators_on_classical(q, q1, q2, convention='dominant')
CherednikOperatorsEigenvectors.__init__(self, T, T_Y, normalized=normalized)
def _repr_(self):
'\n EXAMPLES::\n\n sage: NonSymmetricMacdonaldPolynomials(["B", 2, 1])\n The family of the Macdonald polynomials of type [\'B\', 2, 1] with parameters q, q1, q2\n '
return ('The family of the Macdonald polynomials of type %s with parameters %s, %s, %s' % (self.cartan_type(), self._q, self._q1, self._q2))
@cached_method
def cartan_type(self):
'\n Return Cartan type of ``self``.\n\n EXAMPLES::\n\n sage: NonSymmetricMacdonaldPolynomials(["B", 2, 1]).cartan_type()\n [\'B\', 2, 1]\n '
return self._L.cartan_type()
def L(self):
'\n Return the affinization of the classical weight space.\n\n EXAMPLES::\n\n sage: NonSymmetricMacdonaldPolynomials(["B", 2, 1]).L()\n Ambient space of the Root system of type [\'B\', 2, 1]\n '
return self._L
@cached_method
def L_check(self):
'\n Return the other affinization of the classical weight space.\n\n .. TODO:: should this just return `L` in the simply laced case?\n\n EXAMPLES::\n\n sage: NonSymmetricMacdonaldPolynomials(["B", 2, 1]).L_check()\n Coambient space of the Root system of type [\'C\', 2, 1]\n sage: NonSymmetricMacdonaldPolynomials(["B", 2, 1]).L_check().classical()\n Ambient space of the Root system of type [\'B\', 2]\n '
from sage.combinat.root_system.weight_space import WeightSpace
from sage.combinat.root_system.type_affine import AmbientSpace
L = self.L()
other_affine_root_system = self.cartan_type().classical().dual().affine().root_system()
if isinstance(L, WeightSpace):
return other_affine_root_system.coweight_space(L.base_ring(), extended=True)
else:
assert isinstance(L, AmbientSpace)
return other_affine_root_system.coambient_space(L.base_ring())
@cached_method
def L_prime(self):
'\n The affine space where classical weights are lifted for the recursion.\n\n Also the parent of `\\rho\'`.\n\n EXAMPLES:\n\n In the twisted case, this is the affinization of the classical\n ambient space::\n\n sage: NonSymmetricMacdonaldPolynomials("B2~*").L()\n Ambient space of the Root system of type [\'B\', 2, 1]^*\n sage: NonSymmetricMacdonaldPolynomials("B2~*").L().classical()\n Ambient space of the Root system of type [\'C\', 2]\n\n sage: NonSymmetricMacdonaldPolynomials("B2~*").L_prime()\n Ambient space of the Root system of type [\'B\', 2, 1]^*\n sage: NonSymmetricMacdonaldPolynomials("B2~*").L_prime().classical()\n Ambient space of the Root system of type [\'C\', 2]\n\n In the untwisted case, this is the other affinization of the\n classical ambient space::\n\n sage: NonSymmetricMacdonaldPolynomials("B2~").L()\n Ambient space of the Root system of type [\'B\', 2, 1]\n sage: NonSymmetricMacdonaldPolynomials("B2~").L().classical()\n Ambient space of the Root system of type [\'B\', 2]\n\n sage: NonSymmetricMacdonaldPolynomials("B2~").L_prime()\n Coambient space of the Root system of type [\'C\', 2, 1]\n sage: NonSymmetricMacdonaldPolynomials("B2~").L_prime().classical()\n Ambient space of the Root system of type [\'B\', 2]\n\n For simply laced, the two affinizations coincide::\n\n sage: NonSymmetricMacdonaldPolynomials("A2~").L()\n Ambient space of the Root system of type [\'A\', 2, 1]\n sage: NonSymmetricMacdonaldPolynomials("A2~").L().classical()\n Ambient space of the Root system of type [\'A\', 2]\n\n sage: NonSymmetricMacdonaldPolynomials("A2~").L_prime()\n Coambient space of the Root system of type [\'A\', 2, 1]\n sage: NonSymmetricMacdonaldPolynomials("A2~").L_prime().classical()\n Ambient space of the Root system of type [\'A\', 2]\n\n .. NOTE:: do we want the coambient space of type `A_2^{(1)}` instead?\n\n For type BC::\n\n sage: NonSymmetricMacdonaldPolynomials(["BC",3,2]).L_prime()\n Ambient space of the Root system of type [\'BC\', 3, 2]\n '
ct = self.cartan_type()
if ct.is_untwisted_affine():
return self.L_check()
else:
return self.L()
@cached_method
def L0(self):
'\n Return the space indexing the monomials of the nonsymmetric Macdonald polynomials.\n\n EXAMPLES::\n\n sage: NonSymmetricMacdonaldPolynomials("B2~").L0()\n Ambient space of the Root system of type [\'B\', 2]\n sage: NonSymmetricMacdonaldPolynomials("B2~*").L0()\n Ambient space of the Root system of type [\'C\', 2]\n '
return self.L().classical()
@cached_method
def KL0(self):
'\n Return the group algebra where the nonsymmetric Macdonald polynomials live.\n\n EXAMPLES::\n\n sage: NonSymmetricMacdonaldPolynomials("B2~").KL0()\n Algebra of the Ambient space of the Root system of type [\'B\', 2]\n over Fraction Field of Multivariate Polynomial Ring in q, q1, q2 over Rational Field\n sage: NonSymmetricMacdonaldPolynomials("B2~*").KL0()\n Algebra of the Ambient space of the Root system of type [\'C\', 2]\n over Fraction Field of Multivariate Polynomial Ring in q, q1, q2 over Rational Field\n\n '
return self._KL.classical()
@lazy_attribute
def Q_to_Qcheck(self):
'\n The reindexing of the index set of the Y\'s by the coroot lattice.\n\n EXAMPLES::\n\n sage: E = NonSymmetricMacdonaldPolynomials("C2~")\n sage: alphacheck = E.Y().keys().simple_roots()\n sage: E.Q_to_Qcheck(alphacheck[0])\n alphacheck[0] - alphacheck[2]\n sage: E.Q_to_Qcheck(alphacheck[1])\n alphacheck[1]\n sage: E.Q_to_Qcheck(alphacheck[2])\n alphacheck[2]\n\n sage: x = alphacheck[1] + 2*alphacheck[2]\n sage: x.parent()\n Root lattice of the Root system of type [\'B\', 2, 1]\n sage: E.Q_to_Qcheck(x)\n alphacheck[1] + 2*alphacheck[2]\n sage: _.parent()\n Coroot lattice of the Root system of type [\'C\', 2, 1]\n\n '
Qcheck = self._T_Y.Y().keys()
Q = Qcheck.cartan_type().other_affinization().root_system().root_lattice()
assert (Q.classical() is Qcheck.classical())
return Q.module_morphism(Qcheck.simple_roots_tilde().__getitem__, codomain=Qcheck)
def Y(self):
'\n Return the family of `Y` operators whose eigenvectors are the nonsymmetric Macdonald polynomials.\n\n EXAMPLES::\n\n sage: NonSymmetricMacdonaldPolynomials("C2~").Y()\n Lazy family (<lambda>(i))_{i in Root lattice of the Root system of type [\'B\', 2, 1]}\n sage: _.keys().classical()\n Root lattice of the Root system of type [\'B\', 2]\n sage: NonSymmetricMacdonaldPolynomials("C2~*").Y()\n Lazy family (<...Y_lambdacheck...>(i))_{i in Coroot lattice of the Root system of type [\'C\', 2, 1]^*}\n sage: _.keys().classical()\n Root lattice of the Root system of type [\'C\', 2]\n sage: NonSymmetricMacdonaldPolynomials(["BC", 3, 2]).Y()\n Lazy family (<...Y_lambdacheck...>(i))_{i in Coroot lattice of the Root system of type [\'BC\', 3, 2]}\n sage: _.keys().classical()\n Root lattice of the Root system of type [\'B\', 3]\n '
from sage.sets.family import Family
Y = self._T_Y.Y()
ct = self.cartan_type()
if (ct.dual().is_untwisted_affine() or (ct.type() == 'BC')):
return Y
Q = self.Q_to_Qcheck.domain()
return Family(Q, (lambda lambdacheck: Y[self.Q_to_Qcheck(lambdacheck)]))
def affine_lift(self, mu):
'\n Return the affinization of `\\mu` in `L\'`.\n\n INPUT:\n\n - ``mu`` -- a classical weight `\\mu`\n\n .. SEEALSO::\n\n - :meth:`.hecke_algebra_representation.CherednikOperatorsEigenvectors.affine_lift`\n - :meth:`affine_retract`\n - :meth:`L_prime`\n\n EXAMPLES:\n\n In the untwisted case, this is the other affinization at level 1::\n\n sage: E = NonSymmetricMacdonaldPolynomials("B2~")\n sage: L0 = E.keys(); L0\n Ambient space of the Root system of type [\'B\', 2]\n sage: omega = L0.fundamental_weights()\n sage: E.affine_lift(omega[1])\n e[0] + e[\'deltacheck\']\n sage: E.affine_lift(omega[1]).parent()\n Coambient space of the Root system of type [\'C\', 2, 1]\n\n In the twisted case, this is the usual affinization at level 1::\n\n sage: E = NonSymmetricMacdonaldPolynomials("B2~*")\n sage: L0 = E.keys(); L0\n Ambient space of the Root system of type [\'C\', 2]\n sage: omega = L0.fundamental_weights()\n sage: E.affine_lift(omega[1])\n e[0] + e[\'deltacheck\']\n sage: E.affine_lift(omega[1]).parent()\n Ambient space of the Root system of type [\'B\', 2, 1]^*\n '
return self.L_prime().embed_at_level(mu, 1)
def twist(self, mu, i):
'\n Act by `s_i` on the affine weight `\\mu`.\n\n This calls ``simple_reflection``; which is semantically the\n same as the default implementation.\n\n EXAMPLES::\n\n sage: # needs sage.libs.gap\n sage: W = WeylGroup(["B",3])\n sage: W.element_class._repr_ = lambda x: "".join(str(i)\n ....: for i in x.reduced_word())\n sage: K = QQ[\'q1,q2\']\n sage: q1, q2 = K.gens()\n sage: KW = W.algebra(K)\n sage: T = KW.demazure_lusztig_operators(q1, q2, affine=True)\n sage: E = T.Y_eigenvectors()\n sage: w = W.an_element(); w\n 123\n sage: E.twist(w,1)\n 1231\n '
return mu.simple_reflection(i)
def affine_retract(self, mu):
'\n Retract the affine weight `\\mu` into a classical weight.\n\n INPUT:\n\n - ``mu`` -- an affine weight `\\mu` in `L\'`\n\n .. SEEALSO::\n\n - :meth:`.hecke_algebra_representation.HeckeAlgebraRepresentation.affine_retract`\n - :meth:`affine_lift`\n - :meth:`L_prime`\n\n EXAMPLES::\n\n sage: E = NonSymmetricMacdonaldPolynomials("B2~")\n sage: L0 = E.keys(); L0\n Ambient space of the Root system of type [\'B\', 2]\n sage: omega = L0.fundamental_weights()\n sage: E.affine_lift(omega[1])\n e[0] + e[\'deltacheck\']\n sage: E.affine_retract(E.affine_lift(omega[1]))\n (1, 0)\n '
assert (mu in self.L_prime())
return self.L0()(mu)
def __getitem__(self, mu):
'\n Return the nonsymmetric Macdonald polynomial `E_\\mu`.\n\n INPUT:\n\n - ``mu`` -- a weight `\\mu` that lifts to a level 0 element of the affine weight lattice\n\n This methods simply checks the weight and calls\n :meth:`.hecke_algebra_representation.CherednikOperatorsEigenvectors.__getitem__`.\n\n .. NOTE::\n\n Any element of the finite weight lattice lifts to a level\n 0 element of the affine weight lattice.\n Exception: `\\omega_n` in type `BC_n` dual.\n\n EXAMPLES::\n\n sage: ct = CartanType(["BC",2,2]).dual()\n sage: E = NonSymmetricMacdonaldPolynomials(ct)\n sage: omega = E.keys().fundamental_weights()\n sage: omega[2]\n (1/2, 1/2)\n sage: E[omega[2]]\n Traceback (most recent call last):\n ...\n ValueError: 1/2*e[0] + 1/2*e[1] does not lift to a level 0 element\n of the affine weight lattice\n sage: E[2*omega[2]] # needs sage.libs.gap\n ((q^2*q1^2+q^2*q1*q2)/(q^2*q1^2-q2^2))*B[(0, 0)]\n + ((-q^2*q1^2-q^2*q1*q2)/(-q^2*q1^2+q2^2))*B[(1, 0)] + B[(1, 1)]\n + ((-q^2*q1^2-q^2*q1*q2)/(-q^2*q1^2+q2^2))*B[(0, 1)]\n '
muaff = self._L.embed_at_level(mu, 0)
if (not all(((muaff.scalar(coroot) in ZZ) for coroot in self._L.simple_coroots()))):
raise ValueError(('%s does not lift to a level 0 element of the affine weight lattice' % muaff))
return super().__getitem__(mu)
@cached_method
def rho_prime(self):
'\n Return the level 0 sum of the classical fundamental weights in `L\'`.\n\n .. SEEALSO:: :meth:`L_prime`\n\n EXAMPLES:\n\n Untwisted case::\n\n sage: NonSymmetricMacdonaldPolynomials("B2~").rho_prime() # CHECKME\n 3/2*e[0] + 1/2*e[1]\n sage: NonSymmetricMacdonaldPolynomials("B2~").rho_prime().parent()\n Coambient space of the Root system of type [\'C\', 2, 1]\n\n Twisted case::\n\n sage: NonSymmetricMacdonaldPolynomials("B2~*").rho_prime() # CHECKME\n 2*e[0] + e[1]\n sage: NonSymmetricMacdonaldPolynomials("B2~*").rho_prime().parent()\n Ambient space of the Root system of type [\'B\', 2, 1]^*\n '
return self.L_prime().rho_classical()
def eigenvalue_experimental(self, mu, l):
'\n Return the eigenvalue of `Y^{\\lambda^\\vee}` acting on the macdonald polynomial `E_\\mu`.\n\n INPUT:\n\n - ``mu`` -- the index `\\mu` of an eigenvector\n - `l` -- an index `\\lambda^\\vee` of some `Y`\n\n .. NOTE::\n\n - This method is currently not used; most tests below even\n test the naive method. They are left here as a basis for\n a future implementation.\n\n - This is actually equivariant, as long as `s_i` does not\n fix `\\lambda`.\n\n - This method is only really needed for\n `\\lambda^\\vee=\\alpha^\\vee_i` with `i=0,...,n`.\n\n See Corollary 6.11 of [Haiman06]_.\n\n EXAMPLES::\n\n sage: K = QQ[\'q,t\'].fraction_field()\n sage: q,t = K.gens()\n sage: q1 = t\n sage: q2 = -1\n sage: KL = RootSystem(["A",1,1]).ambient_space().algebra(K)\n sage: E = NonSymmetricMacdonaldPolynomials(KL,q, q1, q2)\n sage: L0 = E.keys()\n sage: E.eigenvalues(L0([0,0])) # Checked by hand by Mark and Arun # needs sage.libs.gap\n [1/(q*t), t]\n sage: alpha = E.Y().keys().simple_roots()\n sage: E.eigenvalue_experimental(L0([0,0]), alpha[0]) # todo: not implemented\n 1/(q*t)\n sage: E.eigenvalue_experimental(L0([0,0]), alpha[1])\n t\n\n Some examples of eigenvalues (not mathematically checked!!!)::\n\n sage: # needs sage.libs.gap\n sage: E.eigenvalues(L0([1,0]))\n [t, 1/(q*t)]\n sage: E.eigenvalues(L0([0,1]))\n [1/(q^2*t), q*t]\n sage: E.eigenvalues(L0([1,1]))\n [1/(q*t), t]\n sage: E.eigenvalues(L0([2,1]))\n [t, 1/(q*t)]\n sage: E.eigenvalues(L0([-1,1]))\n [(-1)/(-q^3*t), q^2*t]\n sage: E.eigenvalues(L0([-2,1]))\n [(-1)/(-q^4*t), q^3*t]\n sage: E.eigenvalues(L0([-2,0]))\n [(-1)/(-q^3*t), q^2*t]\n\n Some type `B` examples::\n\n sage: K = QQ[\'q,t\'].fraction_field()\n sage: q,t = K.gens()\n sage: q1 = t\n sage: q2 = -1\n sage: L = RootSystem(["B",2,1]).ambient_space()\n sage: KL = L.algebra(K)\n sage: E = NonSymmetricMacdonaldPolynomials(KL,q, q1, q2)\n sage: L0 = E.keys()\n sage: alpha = L.simple_coroots()\n\n sage: # not tested\n sage: E.eigenvalue(L0((0,0)), alpha[0]) # not checked\n q/t\n sage: E.eigenvalue(L0((1,0)), alpha[1]) # What Mark got by hand\n q\n sage: E.eigenvalue(L0((1,0)), alpha[2]) # not checked\n t\n sage: E.eigenvalue(L0((1,0)), alpha[0]) # not checked\n 1\n\n sage: L = RootSystem("B2~*").ambient_space()\n sage: KL = L.algebra(K)\n sage: E = NonSymmetricMacdonaldPolynomials(KL,q, q1, q2)\n sage: L0 = E.keys()\n sage: alpha = L.simple_coroots()\n sage: E.eigenvalue(L0((0,0)), alpha[0]) # assuming Mark\'s calculation is correct, one should get # not tested\n 1/(q*t^2)\n\n The expected value can more or less be read off from equation\n (37), Corollary 6.15 of [Haiman06]_\n\n .. TODO::\n\n - Use proposition 6.9 of [Haiman06]_ to check the action\n of the `Y` s on monomials.\n\n - Generalize to any `q_1`, `q_2`.\n\n - Check claim by Mark: all scalar products should occur in\n the finite weight lattice, with alpha 0 being the\n appropriate projection of the affine alpha 0. Question:\n can this be emulated by being at level 0?\n '
assert self.Y().keys().is_parent_of(l)
L_prime = self.L_prime()
L0 = L_prime.classical()
I0 = L0.index_set()
assert L0.is_parent_of(mu)
muaff = self.affine_lift(mu)
w = reversed(mu.reduced_word(I0, positive=False))
x = self.rho_prime()
l = self.L_prime().coroot_lattice()(l)
for i in w:
x = x.simple_reflection(i)
(q1, q2) = self.hecke_parameters(1)
t = ((- q2) / q1)
return ((self._q ** (- muaff.scalar(l))) * (t ** (- x.scalar(l))))
def seed(self, mu):
'\n Return `E_\\mu` for `\\mu` minuscule, i.e. in the fundamental alcove.\n\n INPUT:\n\n - ``mu`` -- the index `\\mu` of an eigenvector\n\n EXAMPLES::\n\n sage: E = NonSymmetricMacdonaldPolynomials(["A",2,1])\n sage: omega = E.keys().fundamental_weights()\n sage: E.seed(omega[1])\n B[(1, 0, 0)]\n '
return self.KL0().monomial(mu)
def symmetric_macdonald_polynomial(self, mu):
"\n Return the symmetric Macdonald polynomial indexed by `\\mu`.\n\n INPUT:\n\n - ``mu`` -- a dominant weight `\\mu`\n\n .. WARNING::\n\n The result is Weyl-symmetric only for Hecke parameters of\n the form `q_1=v` and `q_2=-1/v`. In general the value of\n `v` below, should be the square root of `-q_1/q_2`, but the\n use of `q_1=t` and `q_2=-1` results in nonintegral powers of `t`.\n\n EXAMPLES::\n\n sage: K = QQ['q,v,t'].fraction_field()\n sage: q,v,t = K.gens()\n sage: E = NonSymmetricMacdonaldPolynomials(['A',2,1], q, v, -1/v)\n sage: om = E.L0().fundamental_weights()\n sage: E.symmetric_macdonald_polynomial(om[2]) # needs sage.libs.gap\n B[(1, 1, 0)] + B[(1, 0, 1)] + B[(0, 1, 1)]\n sage: E.symmetric_macdonald_polynomial(2*om[1]) # needs sage.libs.gap\n ((q*v^2+v^2-q-1)/(q*v^2-1))*B[(1, 1, 0)]\n + ((q*v^2+v^2-q-1)/(q*v^2-1))*B[(1, 0, 1)] + B[(2, 0, 0)]\n + ((q*v^2+v^2-q-1)/(q*v^2-1))*B[(0, 1, 1)] + B[(0, 2, 0)] + B[(0, 0, 2)]\n sage: f = E.symmetric_macdonald_polynomial(E.L0()((2,1,0))); f # needs sage.libs.gap\n ((2*q*v^4+v^4-q*v^2+v^2-q-2)/(q*v^4-1))*B[(1, 1, 1)] + B[(1, 2, 0)]\n + B[(1, 0, 2)] + B[(2, 1, 0)] + B[(2, 0, 1)] + B[(0, 1, 2)] + B[(0, 2, 1)]\n\n We compare with the type `A` Macdonald polynomials\n coming from symmetric functions::\n\n sage: # needs sage.combinat\n sage: P = SymmetricFunctions(K).macdonald().P()\n sage: g = P[2,1].expand(3); g\n x0^2*x1 + x0*x1^2 + x0^2*x2\n + (2*q*t^2 - q*t - q + t^2 + t - 2)/(q*t^2 - 1)*x0*x1*x2\n + x1^2*x2 + x0*x2^2 + x1*x2^2\n sage: fe = f.expand(g.parent().gens()); fe # needs sage.libs.gap\n x0^2*x1 + x0*x1^2 + x0^2*x2\n + (2*q*v^4 - q*v^2 - q + v^4 + v^2 - 2)/(q*v^4 - 1)*x0*x1*x2\n + x1^2*x2 + x0*x2^2 + x1*x2^2\n sage: g.map_coefficients(lambda x: x.subs(t=v*v)) == fe # needs sage.libs.gap\n True\n\n sage: E = NonSymmetricMacdonaldPolynomials(['C',3,1], q, v, -1/v)\n sage: om = E.L0().fundamental_weights()\n sage: E.symmetric_macdonald_polynomial(om[1]+om[2])\n B[(-2, -1, 0)] + B[(-2, 1, 0)] + B[(-2, 0, -1)] + B[(-2, 0, 1)] + ((4*q^3*v^14+2*q^2*v^14-2*q^3*v^12+2*q^2*v^12-2*q^3*v^10+q*v^12-5*q^2*v^10-5*q*v^4+q^2*v^2-2*v^4+2*q*v^2-2*v^2+2*q+4)/(q^3*v^14-q^2*v^10-q*v^4+1))*B[(-1, 0, 0)] + B[(-1, -2, 0)] + ((2*q*v^4+v^4-q*v^2+v^2-q-2)/(q*v^4-1))*B[(-1, -1, -1)] + ((2*q*v^4+v^4-q*v^2+v^2-q-2)/(q*v^4-1))*B[(-1, -1, 1)] + ((2*q*v^4+v^4-q*v^2+v^2-q-2)/(q*v^4-1))*B[(-1, 1, -1)] + ((2*q*v^4+v^4-q*v^2+v^2-q-2)/(q*v^4-1))*B[(-1, 1, 1)] + B[(-1, 2, 0)] + B[(-1, 0, -2)] + B[(-1, 0, 2)] + ((4*q^3*v^14+2*q^2*v^14-2*q^3*v^12+2*q^2*v^12-2*q^3*v^10+q*v^12-5*q^2*v^10-5*q*v^4+q^2*v^2-2*v^4+2*q*v^2-2*v^2+2*q+4)/(q^3*v^14-q^2*v^10-q*v^4+1))*B[(1, 0, 0)] + B[(1, -2, 0)] + ((2*q*v^4+v^4-q*v^2+v^2-q-2)/(q*v^4-1))*B[(1, -1, -1)] + ((2*q*v^4+v^4-q*v^2+v^2-q-2)/(q*v^4-1))*B[(1, -1, 1)] + ((2*q*v^4+v^4-q*v^2+v^2-q-2)/(q*v^4-1))*B[(1, 1, -1)] + ((2*q*v^4+v^4-q*v^2+v^2-q-2)/(q*v^4-1))*B[(1, 1, 1)] + B[(1, 2, 0)] + B[(1, 0, -2)] + B[(1, 0, 2)] + B[(2, -1, 0)] + B[(2, 1, 0)] + B[(2, 0, -1)] + B[(2, 0, 1)] + B[(0, -2, -1)] + B[(0, -2, 1)] + ((-4*q^3*v^14-2*q^2*v^14+2*q^3*v^12-2*q^2*v^12+2*q^3*v^10-q*v^12+5*q^2*v^10+5*q*v^4-q^2*v^2+2*v^4-2*q*v^2+2*v^2-2*q-4)/(-q^3*v^14+q^2*v^10+q*v^4-1))*B[(0, -1, 0)] + B[(0, -1, -2)] + B[(0, -1, 2)] + ((-4*q^3*v^14-2*q^2*v^14+2*q^3*v^12-2*q^2*v^12+2*q^3*v^10-q*v^12+5*q^2*v^10+5*q*v^4-q^2*v^2+2*v^4-2*q*v^2+2*v^2-2*q-4)/(-q^3*v^14+q^2*v^10+q*v^4-1))*B[(0, 1, 0)] + B[(0, 1, -2)] + B[(0, 1, 2)] + B[(0, 2, -1)] + B[(0, 2, 1)] + ((4*q^3*v^14+2*q^2*v^14-2*q^3*v^12+2*q^2*v^12-2*q^3*v^10+q*v^12-5*q^2*v^10-5*q*v^4+q^2*v^2-2*v^4+2*q*v^2-2*v^2+2*q+4)/(q^3*v^14-q^2*v^10-q*v^4+1))*B[(0, 0, -1)] + ((4*q^3*v^14+2*q^2*v^14-2*q^3*v^12+2*q^2*v^12-2*q^3*v^10+q*v^12-5*q^2*v^10-5*q*v^4+q^2*v^2-2*v^4+2*q*v^2-2*v^2+2*q+4)/(q^3*v^14-q^2*v^10-q*v^4+1))*B[(0, 0, 1)]\n\n An example for type `G`::\n\n sage: E = NonSymmetricMacdonaldPolynomials(['G',2,1], q, v, -1/v)\n sage: om = E.L0().fundamental_weights()\n sage: E.symmetric_macdonald_polynomial(2*om[1])\n ((3*q^6*v^22+3*q^5*v^22-3*q^6*v^20+q^4*v^22-4*q^5*v^20+q^4*v^18-q^5*v^16+q^3*v^18-2*q^4*v^16+q^5*v^14-q^3*v^16+q^4*v^14-4*q^4*v^12+q^2*v^14+q^5*v^10-8*q^3*v^12+4*q^4*v^10-4*q^2*v^12+8*q^3*v^10-q*v^12-q^4*v^8+4*q^2*v^10-q^2*v^8+q^3*v^6-q*v^8+2*q^2*v^6-q^3*v^4+q*v^6-q^2*v^4+4*q*v^2-q^2+3*v^2-3*q-3)/(q^6*v^22-q^5*v^20-q^4*v^12-q^3*v^12+q^3*v^10+q^2*v^10+q*v^2-1))*B[(0, 0, 0)] + ((q*v^2+v^2-q-1)/(q*v^2-1))*B[(-2, 1, 1)] + B[(-2, 2, 0)] + B[(-2, 0, 2)] + ((-q*v^2-v^2+q+1)/(-q*v^2+1))*B[(-1, -1, 2)] + ((2*q^4*v^12+2*q^3*v^12-2*q^4*v^10-2*q^3*v^10+q^2*v^8-q^3*v^6+q*v^8-2*q^2*v^6+q^3*v^4-q*v^6+q^2*v^4-2*q*v^2-2*v^2+2*q+2)/(q^4*v^12-q^3*v^10-q*v^2+1))*B[(-1, 1, 0)] + ((-q*v^2-v^2+q+1)/(-q*v^2+1))*B[(-1, 2, -1)] + ((2*q^4*v^12+2*q^3*v^12-2*q^4*v^10-2*q^3*v^10+q^2*v^8-q^3*v^6+q*v^8-2*q^2*v^6+q^3*v^4-q*v^6+q^2*v^4-2*q*v^2-2*v^2+2*q+2)/(q^4*v^12-q^3*v^10-q*v^2+1))*B[(-1, 0, 1)] + ((-q*v^2-v^2+q+1)/(-q*v^2+1))*B[(1, -2, 1)] + ((-2*q^4*v^12-2*q^3*v^12+2*q^4*v^10+2*q^3*v^10-q^2*v^8+q^3*v^6-q*v^8+2*q^2*v^6-q^3*v^4+q*v^6-q^2*v^4+2*q*v^2+2*v^2-2*q-2)/(-q^4*v^12+q^3*v^10+q*v^2-1))*B[(1, -1, 0)] + ((-q*v^2-v^2+q+1)/(-q*v^2+1))*B[(1, 1, -2)] + ((-2*q^4*v^12-2*q^3*v^12+2*q^4*v^10+2*q^3*v^10-q^2*v^8+q^3*v^6-q*v^8+2*q^2*v^6-q^3*v^4+q*v^6-q^2*v^4+2*q*v^2+2*v^2-2*q-2)/(-q^4*v^12+q^3*v^10+q*v^2-1))*B[(1, 0, -1)] + B[(2, -2, 0)] + ((q*v^2+v^2-q-1)/(q*v^2-1))*B[(2, -1, -1)] + B[(2, 0, -2)] + B[(0, -2, 2)] + ((-2*q^4*v^12-2*q^3*v^12+2*q^4*v^10+2*q^3*v^10-q^2*v^8+q^3*v^6-q*v^8+2*q^2*v^6-q^3*v^4+q*v^6-q^2*v^4+2*q*v^2+2*v^2-2*q-2)/(-q^4*v^12+q^3*v^10+q*v^2-1))*B[(0, -1, 1)] + ((2*q^4*v^12+2*q^3*v^12-2*q^4*v^10-2*q^3*v^10+q^2*v^8-q^3*v^6+q*v^8-2*q^2*v^6+q^3*v^4-q*v^6+q^2*v^4-2*q*v^2-2*v^2+2*q+2)/(q^4*v^12-q^3*v^10-q*v^2+1))*B[(0, 1, -1)] + B[(0, 2, -2)]\n\n "
if ((self.cartan_type().classical() != mu.parent().cartan_type()) or (not mu.is_dominant())):
raise ValueError(('%s must be a dominant weight for the classical subrootsystem of %s' % (mu, self.cartan_type())))
v = self._q1
KL0 = self.KL0()
s = KL0.zero()
Torbit = {}
for c in mu._orbit_iter():
i = c.first_descent()
if (i is None):
Torbit[c] = self[mu]
else:
Torbit[c] = (v * self._T.Tw([i])(Torbit[c.simple_reflection(i)]))
s = (s + Torbit[c])
return s
|
class PieriFactors(UniqueRepresentation, Parent):
"\n An abstract class for sets of Pieri factors, used for constructing\n Stanley symmetric functions. The set of Pieri factors for a given\n type can be realized as an order ideal of the Bruhat order poset\n generated by a certain set of maximal elements.\n\n .. SEEALSO::\n\n - :meth:`WeylGroups.ParentMethods.pieri_factors`\n - :meth:`WeylGroups.ElementMethods.stanley_symmetric_function`\n\n EXAMPLES::\n\n sage: W = WeylGroup(['A',4])\n sage: PF = W.pieri_factors()\n sage: PF.an_element().reduced_word()\n [4, 3, 2, 1]\n sage: Waff = WeylGroup(['A',4,1])\n sage: PFaff = Waff.pieri_factors()\n sage: Waff.from_reduced_word(PF.an_element().reduced_word()) in PFaff\n True\n\n sage: W = WeylGroup(['B',3,1])\n sage: PF = W.pieri_factors()\n sage: W.from_reduced_word([2,3,2]) in PF.elements()\n True\n sage: PF.cardinality()\n 47\n\n sage: W = WeylGroup(['C',3,1])\n sage: PF = W.pieri_factors()\n sage: PF.generating_series()\n 6*z^6 + 14*z^5 + 18*z^4 + 15*z^3 + 9*z^2 + 4*z + 1\n sage: sorted(w.reduced_word() for w in PF if w.length() == 2)\n [[0, 1], [1, 0], [1, 2], [2, 0], [2, 1],\n [2, 3], [3, 0], [3, 1], [3, 2]]\n\n REFERENCES:\n\n - [FoSta1994]_\n - [BH1994]_\n - [Lam1996]_\n - [Lam2008]_\n - [LSS2009]_\n - [Pon2010]_\n "
def _repr_(self):
'\n String representation.\n\n EXAMPLES::\n\n sage: WeylGroup(["A", 2, 1]).pieri_factors() # indirect doctest\n Pieri factors for Weyl Group of type [\'A\', 2, 1] (as a matrix group acting on the root space)\n '
return ('Pieri factors for %s' % self.W)
def __contains__(self, w):
"\n Test for containment.\n\n EXAMPLES::\n\n sage: W = WeylGroup(['C',3,1])\n sage: w = W.from_reduced_word([3,2,1,0])\n sage: PF = W.pieri_factors()\n sage: w in PF\n True\n sage: w = W.from_reduced_word([1,0,1])\n sage: w in PF\n True\n sage: w = W.from_reduced_word([1,0,1,0])\n sage: w in PF\n False\n sage: w = W.from_reduced_word([0,1,2,3,2,1,0])\n sage: w in PF\n False\n sage: w = W.from_reduced_word([2,0,3,2,1])\n sage: w in PF\n True\n\n sage: W = WeylGroup(['B',4,1])\n sage: PF = W.pieri_factors()\n sage: w = W.from_reduced_word([1,2,4,3,1])\n sage: w in PF\n True\n sage: w = W.from_reduced_word([1,2,4,3,1,0])\n sage: w in PF\n False\n sage: w = W.from_reduced_word([2,3,4,3,2,1,0])\n sage: w in PF\n True\n\n sage: W = WeylGroup(['A',4])\n sage: PF = W.pieri_factors()\n sage: W.from_reduced_word([4,3,1]) in PF\n True\n sage: W.from_reduced_word([1,2]) in PF\n False\n "
if (w not in self.W):
return False
return any((w.bruhat_le(m) for m in self.maximal_elements()))
@cached_method
def elements(self):
"\n Return the elements of ``self``.\n\n Those are constructed as the elements below the maximal\n elements of ``self`` in Bruhat order.\n\n OUTPUT: a :class:`RecursivelyEnumeratedSet_generic` object\n\n EXAMPLES::\n\n sage: PF = WeylGroup(['A',3]).pieri_factors()\n sage: sorted(w.reduced_word() for w in PF.elements())\n [[], [1], [2], [2, 1], [3], [3, 1], [3, 2], [3, 2, 1]]\n\n .. SEEALSO:: :meth:`maximal_elements`\n\n .. TODO::\n\n Possibly remove this method and instead have this class\n inherit from :class:`RecursivelyEnumeratedSet_generic`.\n "
return RecursivelyEnumeratedSet(self.maximal_elements(), attrcall('bruhat_lower_covers'), structure=None, enumeration='naive')
def __iter__(self):
"\n Return an iterator over the elements of ``self``.\n\n EXAMPLES::\n\n sage: PF = WeylGroup(['A',3,1]).pieri_factors()\n sage: f = PF.__iter__()\n sage: [next(f).reduced_word() for i in range(5)]\n [[], [0], [1], [2], [3]]\n "
return iter(self.elements())
def generating_series(self, weight=None):
"\n Return a length generating series for the elements of ``self``.\n\n EXAMPLES::\n\n sage: PF = WeylGroup(['C',3,1]).pieri_factors()\n sage: PF.generating_series()\n 6*z^6 + 14*z^5 + 18*z^4 + 15*z^3 + 9*z^2 + 4*z + 1\n\n sage: PF = WeylGroup(['B',4]).pieri_factors()\n sage: PF.generating_series()\n z^7 + 6*z^6 + 14*z^5 + 18*z^4 + 15*z^3 + 9*z^2 + 4*z + 1\n "
if (weight is None):
weight = self.default_weight()
return sum((weight(w.length()) for w in self))
@cached_method
def default_weight(self):
'\n Return the function `i\\mapsto z^i`, where `z` is the\n generator of ``QQ[\'z\']``.\n\n EXAMPLES::\n\n sage: W = WeylGroup(["A", 3, 1])\n sage: weight = W.pieri_factors().default_weight()\n sage: weight(1)\n z\n sage: weight(5)\n z^5\n\n TESTS::\n\n sage: weight(4) in QQ[\'z\']\n True\n sage: weight(0) in QQ[\'z\']\n True\n sage: weight(0).parent() == QQ[\'z\'] # todo: not implemented\n True\n '
R = QQ['z']
z = R.gen()
return (lambda i: (z ** i))
def _test_maximal_elements(self, **options):
"\n Check that the conjectural type-free definition of Pieri\n factors matches with the proven type-specific definition.\n\n .. SEEALSO:: :class:`TestSuite`.\n\n EXAMPLES::\n\n sage: W = WeylGroup(['A',4,1])\n sage: PF = W.pieri_factors()\n sage: PF._test_maximal_elements()\n sage: WeylGroup(['B',5]).pieri_factors()._test_maximal_elements()\n\n TESTS::\n\n sage: W = WeylGroup(['C',4,1])\n sage: PF = W.pieri_factors()\n sage: PF._test_maximal_elements()\n sage: WeylGroup(['D',5,1]).pieri_factors()._test_maximal_elements()\n sage: WeylGroup(['A',5,1]).pieri_factors()._test_maximal_elements()\n sage: WeylGroup(['B',5,1]).pieri_factors()._test_maximal_elements()\n "
tester = self._tester(**options)
tester.assertEqual(set(self.maximal_elements()), set(self.maximal_elements_combinatorial()))
@cached_method
def max_length(self):
"\n Return the maximal length of a Pieri factor.\n\n EXAMPLES:\n\n In type A and A affine, this is `n`::\n\n sage: WeylGroup(['A',5]).pieri_factors().max_length()\n 5\n sage: WeylGroup(['A',5,1]).pieri_factors().max_length()\n 5\n\n In type B and B affine, this is `2n-1`::\n\n sage: WeylGroup(['B',5,1]).pieri_factors().max_length()\n 9\n sage: WeylGroup(['B',5]).pieri_factors().max_length()\n 9\n\n In type C affine this is `2n`::\n\n sage: WeylGroup(['C',5,1]).pieri_factors().max_length()\n 10\n\n In type D affine this is `2n-2`::\n\n sage: WeylGroup(['D',5,1]).pieri_factors().max_length()\n 8\n "
return self.maximal_elements()[0].length()
|
class PieriFactors_finite_type(PieriFactors):
'\n The Pieri factors of finite type A are the restriction of the\n Pieri factors of affine type A to finite permutations (under the\n canonical embedding of finite type A into the affine Weyl group),\n and the Pieri factors of finite type B are the restriction of the\n Pieri factors of affine type C. The finite type D Pieri factors\n are (weakly) conjectured to be the restriction of the Pieri\n factors of affine type D.\n '
def maximal_elements(self):
"\n The current algorithm uses the fact that the maximal Pieri factors\n of affine type A,B,C, or D either contain a finite Weyl group\n element, or contain an affine Weyl group element whose reflection\n by `s_0` gets a finite Weyl group element, and that either of\n these finite group elements will serve as a maximal element for\n finite Pieri factors. A better algorithm is desirable.\n\n EXAMPLES::\n\n sage: PF = WeylGroup(['A',5]).pieri_factors()\n sage: [v.reduced_word() for v in PF.maximal_elements()]\n [[5, 4, 3, 2, 1]]\n\n sage: WeylGroup(['B',4]).pieri_factors().maximal_elements()\n [\n [-1 0 0 0]\n [ 0 1 0 0]\n [ 0 0 1 0]\n [ 0 0 0 1]\n ]\n "
ct = self.W.cartan_type()
if ((ct.type() != 'A') and (ct.type() != 'B')):
raise NotImplementedError('currently only implemented for finite types A and B')
ct_aff = ct.dual().affine()
max_elts_affine = WeylGroup(ct_aff).pieri_factors().maximal_elements()
for w in max_elts_affine:
if (0 not in w.reduced_word()):
return [self.W.from_reduced_word(w.reduced_word())]
for w in max_elts_affine:
if (0 not in w.apply_simple_reflection(0).reduced_word()):
return [self.W.from_reduced_word(w.apply_simple_reflection(0).reduced_word())]
|
class PieriFactors_affine_type(PieriFactors):
def maximal_elements(self):
'\n Return the maximal elements of ``self`` with respect to Bruhat order.\n\n The current implementation is via a conjectural type-free\n formula. Use :meth:`maximal_elements_combinatorial` for proven\n type-specific implementations. To compare type-free and\n type-specific (combinatorial) implementations, use method\n :meth:`_test_maximal_elements`.\n\n EXAMPLES::\n\n sage: W = WeylGroup([\'A\',4,1])\n sage: PF = W.pieri_factors()\n sage: sorted([w.reduced_word() for w in PF.maximal_elements()], key=str)\n [[0, 4, 3, 2], [1, 0, 4, 3], [2, 1, 0, 4], [3, 2, 1, 0], [4, 3, 2, 1]]\n\n sage: W = WeylGroup(RootSystem(["C",3,1]).weight_space())\n sage: PF = W.pieri_factors()\n sage: sorted([w.reduced_word() for w in PF.maximal_elements()], key=str)\n [[0, 1, 2, 3, 2, 1], [1, 0, 1, 2, 3, 2], [1, 2, 3, 2, 1, 0],\n [2, 1, 0, 1, 2, 3], [2, 3, 2, 1, 0, 1], [3, 2, 1, 0, 1, 2]]\n\n sage: W = WeylGroup(RootSystem(["B",3,1]).weight_space())\n sage: PF = W.pieri_factors()\n sage: sorted([w.reduced_word() for w in PF.maximal_elements()], key=str)\n [[0, 2, 3, 2, 0], [1, 0, 2, 3, 2], [1, 2, 3, 2, 1],\n [2, 1, 0, 2, 3], [2, 3, 2, 1, 0], [3, 2, 1, 0, 2]]\n\n sage: W = WeylGroup([\'D\',4,1])\n sage: PF = W.pieri_factors()\n sage: sorted([w.reduced_word() for w in PF.maximal_elements()], key=str)\n [[0, 2, 4, 3, 2, 0], [1, 0, 2, 4, 3, 2], [1, 2, 4, 3, 2, 1],\n [2, 1, 0, 2, 4, 3], [2, 4, 3, 2, 1, 0], [3, 2, 1, 0, 2, 3],\n [4, 2, 1, 0, 2, 4], [4, 3, 2, 1, 0, 2]]\n '
ct = self.W.cartan_type()
s = ct.translation_factors()[1]
R = RootSystem(ct).weight_space()
Lambda = R.fundamental_weights()
orbit = [R.reduced_word_of_translation(x) for x in (s * (Lambda[1] - (Lambda[1].level() * Lambda[0])))._orbit_iter()]
return [self.W.from_reduced_word(x) for x in orbit]
|
class PieriFactors_type_A(PieriFactors_finite_type):
'\n The set of Pieri factors for finite type A.\n\n This is the set of elements of the Weyl group that have a reduced\n word that is strictly decreasing. This may also be viewed as the\n restriction of affine type A Pieri factors to finite Weyl group\n elements.\n '
def __init__(self, W):
"\n EXAMPLES::\n\n sage: PF = WeylGroup(['A',5]).pieri_factors()\n sage: PF\n Pieri factors for Weyl Group of type ['A', 5] (as a matrix group acting on the ambient space)\n\n TESTS::\n\n sage: PF = WeylGroup(['A',3]).pieri_factors()\n sage: PF.__class__\n <class 'sage.combinat.root_system.pieri_factors.PieriFactors_type_A_with_category'>\n sage: TestSuite(PF).run()\n "
Parent.__init__(self, category=FiniteEnumeratedSets())
self.W = W
def maximal_elements_combinatorial(self):
"\n Return the maximal Pieri factors, using the type A\n combinatorial description.\n\n EXAMPLES::\n\n sage: W = WeylGroup(['A',4])\n sage: PF = W.pieri_factors()\n sage: PF.maximal_elements_combinatorial()[0].reduced_word()\n [4, 3, 2, 1]\n "
return [self.W.from_reduced_word(range(self.W.cartan_type().n, 0, (- 1)))]
def stanley_symm_poly_weight(self, w):
"\n EXAMPLES::\n\n sage: W = WeylGroup(['A',4])\n sage: PF = W.pieri_factors()\n sage: PF.stanley_symm_poly_weight(W.from_reduced_word([3,1]))\n 0\n "
return 0
|
class PieriFactors_type_B(PieriFactors_finite_type):
'\n The type B finite Pieri factors are realized as the set of\n elements that have a reduced word that is a subword of\n `12...(n-1)n(n-1)...21`. They are the restriction of the type C\n affine Pieri factors to the set of finite Weyl group elements\n under the usual embedding.\n '
def __init__(self, W):
"\n EXAMPLES::\n\n sage: WeylGroup(['B',5]).pieri_factors()\n Pieri factors for Weyl Group of type ['B', 5] (as a matrix group acting on the ambient space)\n\n TESTS::\n\n sage: PF = WeylGroup(['B',3]).pieri_factors()\n sage: PF.__class__\n <class 'sage.combinat.root_system.pieri_factors.PieriFactors_type_B_with_category'>\n sage: TestSuite(PF).run()\n "
Parent.__init__(self, category=FiniteEnumeratedSets())
self.W = W
def maximal_elements_combinatorial(self):
"\n Return the maximal Pieri factors, using the type B\n combinatorial description.\n\n EXAMPLES::\n\n sage: PF = WeylGroup(['B',4]).pieri_factors()\n sage: PF.maximal_elements_combinatorial()[0].reduced_word()\n [1, 2, 3, 4, 3, 2, 1]\n "
N = self.W.cartan_type().n
li = (list(range(1, N)) + list(range(N, 0, (- 1))))
return [self.W.from_reduced_word(li)]
def stanley_symm_poly_weight(self, w):
"\n Weight used in computing Stanley symmetric polynomials of type `B`.\n\n The weight for finite type B is the number of components\n of the support of an element minus the number of occurrences\n of `n` in a reduced word.\n\n EXAMPLES::\n\n sage: W = WeylGroup(['B',5])\n sage: PF = W.pieri_factors()\n sage: PF.stanley_symm_poly_weight(W.from_reduced_word([3,1,5]))\n 2\n sage: PF.stanley_symm_poly_weight(W.from_reduced_word([3,4,5]))\n 0\n sage: PF.stanley_symm_poly_weight(W.from_reduced_word([1,2,3,4,5,4]))\n 0\n "
r = w.reduced_word().count(self.W.n)
return (WeylGroup(self.W.cartan_type().dual().affine()).pieri_factors().stanley_symm_poly_weight(w) - r)
|
class PieriFactors_type_A_affine(PieriFactors_affine_type):
'\n The set of Pieri factors for type A affine, that is the set of\n elements of the Weyl Group which are cyclically decreasing.\n\n Those are used for constructing (affine) Stanley symmetric functions.\n\n The Pieri factors are in bijection with the proper subsets of the\n ``index_set``. The bijection is given by the support. Namely, let `f`\n be a Pieri factor, and `red` a reduced word for `f`. No simple\n reflection appears twice in red, and the support `S` of `red`\n (that is the `i` such that `s_i` appears in `red`) does not depend\n on the reduced word).\n '
@staticmethod
def __classcall__(cls, W, min_length=0, max_length=infinity, min_support=frozenset([]), max_support=None):
"\n TESTS::\n\n sage: W = WeylGroup(['A',5,1])\n sage: PF1 = sage.combinat.root_system.pieri_factors.PieriFactors_type_A_affine(W)\n sage: PF2 = W.pieri_factors()\n sage: PF3 = W.pieri_factors(min_support = [])\n sage: PF4 = W.pieri_factors(max_support = [0,1,2,3,4,5])\n sage: PF5 = W.pieri_factors(max_length = 10)\n sage: PF6 = W.pieri_factors(min_length = 0)\n sage: PF2 is PF1, PF3 is PF1, PF4 is PF1, PF5 is PF1, PF6 is PF1\n (True, True, True, True, True)\n "
assert (W.cartan_type().is_affine() and (W.cartan_type().letter == 'A'))
min_support = frozenset(min_support)
if (max_support is None):
max_support = frozenset(W.index_set())
else:
max_support = frozenset(max_support)
min_length = max(min_length, len(min_support))
max_length = min(len(max_support), max_length, (len(W.index_set()) - 1))
return super().__classcall__(cls, W, min_length, max_length, min_support, max_support)
def __init__(self, W, min_length, max_length, min_support, max_support):
'\n INPUT:\n\n - ``W`` -- a Weyl group of affine type `A`\n - ``min_length``, ``max_length`` -- non negative integers\n - ``min_support``, ``max_support`` -- subsets of the index set of `W`\n\n EXAMPLES::\n\n sage: PF = WeylGroup(["A", 3, 1]).pieri_factors(); PF\n Pieri factors for Weyl Group of type [\'A\', 3, 1] (as a matrix group acting on the root space)\n\n TESTS::\n\n sage: PF = WeylGroup([\'A\',3,1]).pieri_factors()\n sage: PF.__class__\n <class \'sage.combinat.root_system.pieri_factors.PieriFactors_type_A_affine_with_category\'>\n sage: TestSuite(PF).run()\n\n sage: PF = WeylGroup([\'A\',3,1]).pieri_factors(min_length = 3)\n sage: [w.reduced_word() for w in PF]\n [[2, 1, 0], [1, 0, 3], [0, 3, 2], [3, 2, 1]]\n\n sage: PF = WeylGroup([\'A\',4,1]).pieri_factors(min_support = [0,2])\n sage: [w.reduced_word() for w in PF]\n [[2, 0], [2, 1, 0], [3, 2, 0], [0, 4, 2], [3, 2, 1, 0], [2, 1, 0, 4], [0, 4, 3, 2]]\n\n sage: PF = WeylGroup([\'A\',5,1]).pieri_factors(min_support = [0,1,2], max_support = [0,1,2,3])\n sage: [w.reduced_word() for w in PF]\n [[2, 1, 0], [3, 2, 1, 0]]\n\n sage: PF = WeylGroup([\'A\',5,1]).pieri_factors(min_length = 2, max_length = 5)\n sage: PF.generating_series()\n 6*z^5 + 15*z^4 + 20*z^3 + 15*z^2\n '
Parent.__init__(self, category=FiniteEnumeratedSets())
self.W = W
self._min_support = frozenset(min_support)
self._max_support = frozenset(max_support)
if (not self._min_support.issubset(self._max_support)):
raise ValueError('the min support must be a subset of the max support')
self._extra_support = self._max_support.difference(self._min_support)
self._min_length = min_length
self._max_length = max_length
def subset(self, length):
'\n Return the subset of the elements of ``self`` of length ``length``.\n\n INPUT:\n\n - ``length`` -- a non-negative integer\n\n EXAMPLES::\n\n sage: PF = WeylGroup(["A", 3, 1]).pieri_factors(); PF\n Pieri factors for Weyl Group of type [\'A\', 3, 1] (as a matrix group acting on the root space)\n sage: PF3 = PF.subset(length = 2)\n sage: PF3.cardinality()\n 6\n\n TESTS:\n\n We check that there is no reference effect (there was at some point!)::\n\n sage: PF.cardinality()\n 15\n '
return self.__class__(self.W, min_support=self._min_support, max_support=self._max_support, min_length=length, max_length=length)
def maximal_elements_combinatorial(self):
"\n Return the maximal Pieri factors, using the affine type A\n combinatorial description.\n\n EXAMPLES::\n\n sage: W = WeylGroup(['A',4,1])\n sage: PF = W.pieri_factors()\n sage: [w.reduced_word() for w in PF.maximal_elements_combinatorial()]\n [[3, 2, 1, 0], [2, 1, 0, 4], [1, 0, 4, 3], [0, 4, 3, 2], [4, 3, 2, 1]]\n "
return self.subset(self._max_length)
def _test_maximal_elements(self, **options):
"\n Same as :meth:`PieriFactors._test_maximal_elements`, but skips\n the tests if ``self`` is not the full set of Pieri factors.\n\n EXAMPLES::\n\n sage: W = WeylGroup(['A',4,1])\n sage: W.pieri_factors()._test_maximal_elements(verbose = True)\n sage: W.pieri_factors(min_length = 1)._test_maximal_elements(verbose = True)\n Strict subset of the Pieri factors; skipping test\n\n "
tester = self._tester(**options)
index_set = self.W.index_set()
if ((self._min_length > 0) or (self._max_length < (len(self.W.index_set()) - 1)) or (self._max_support != frozenset(index_set))):
tester.info('\n Strict subset of the Pieri factors; skipping test')
return
return super()._test_maximal_elements(**options)
def __contains__(self, w):
"\n Return whether ``w`` is in ``self``.\n\n EXAMPLES::\n\n sage: W = WeylGroup(['A',6,1])\n sage: PF = W.pieri_factors()\n sage: w=W.from_reduced_word([4,3,1,0,6])\n sage: w in PF\n True\n sage: w=W.from_reduced_word([4,3,1,0,2])\n sage: w in PF\n False\n sage: w=W.from_reduced_word([4,3,1,0,6,0])\n sage: w in PF\n False\n sage: w=W.from_reduced_word([])\n sage: w in PF\n True\n sage: w=W.from_reduced_word([3,2,1,0])\n sage: w in PF\n True\n\n sage: W=WeylGroup(['A',3,1])\n sage: PF = W.pieri_factors()\n sage: w=W.from_reduced_word([3,2,1,0])\n sage: w in PF\n False\n "
if (w not in self.W):
raise ValueError('{} is not an element of the Weyl group'.format(w))
n = (len(self.W.index_set()) - 1)
red = w.reduced_word()
support = set(red)
if (len(support) < len(red)):
return False
if (not ((self._min_length <= len(support)) and (len(support) <= self._max_length) and self._min_support.issubset(support) and support.issubset(self._max_support))):
return False
[rank, unrank] = sage.combinat.ranker.from_list(red)
for i in red:
j = ((i + 1) % (n + 1))
if (j in support):
if (rank(i) < rank(j)):
return False
return True
def __getitem__(self, support):
'\n Return the cyclically decreasing element associated with ``support``.\n\n INPUT:\n\n - ``support`` -- a proper subset of the index_set, as a list or set\n\n EXAMPLES::\n\n sage: W = WeylGroup(["A", 5, 1])\n sage: W.pieri_factors()[[0,1,2,3,5]].reduced_word()\n [3, 2, 1, 0, 5]\n sage: W.pieri_factors()[[0,1,3,4,5]].reduced_word()\n [1, 0, 5, 4, 3]\n sage: W.pieri_factors()[[0,1,2,3,4]].reduced_word()\n [4, 3, 2, 1, 0]\n\n '
index_set = sorted(self.W.index_set())
support = sorted(support)
if ((not set(support).issubset(set(index_set))) or (support == index_set)):
raise ValueError('the support must be a proper subset of the index set')
if (not support):
return self.W.one()
s = self.W.simple_reflections()
i = 0
while ((i < len(support)) and (support[i] == index_set[i])):
i += 1
return prod((s[j] for j in (list(reversed(support[0:i])) + list(reversed(support[i:])))), self.W.one())
def cardinality(self):
'\n Return the cardinality of ``self``.\n\n EXAMPLES::\n\n sage: WeylGroup(["A", 3, 1]).pieri_factors().cardinality()\n 15\n '
if ((self._min_length == len(self._min_support)) and (self._max_length == (len(self._max_support) - 1))):
return Integer(((2 ** len(self._extra_support)) - 1))
else:
return self.generating_series(weight=ConstantFunction(1))
def generating_series(self, weight=None):
'\n Return a length generating series for the elements of ``self``.\n\n EXAMPLES::\n\n sage: W = WeylGroup(["A", 3, 1])\n sage: W.pieri_factors().cardinality()\n 15\n sage: W.pieri_factors().generating_series()\n 4*z^3 + 6*z^2 + 4*z + 1\n '
if (weight is None):
weight = self.default_weight()
l_min = len(self._min_support)
l_max = len(self._max_support)
return sum(((binomial((l_max - l_min), (l - l_min)) * weight(l)) for l in range(self._min_length, (self._max_length + 1))))
def __iter__(self):
"\n Return an iterator over the elements of ``self``.\n\n EXAMPLES::\n\n sage: W = WeylGroup(['A',4,1])\n sage: PF = W.pieri_factors()\n sage: f = PF.__iter__()\n sage: next(f)\n [1 0 0 0 0]\n [0 1 0 0 0]\n [0 0 1 0 0]\n [0 0 0 1 0]\n [0 0 0 0 1]\n sage: [next(f).reduced_word() for i in range(6)]\n [[0], [1], [2], [3], [4], [1, 0]]\n "
from sage.combinat.subset import Subsets
for l in range(self._min_length, (self._max_length + 1)):
for extra in Subsets(self._extra_support, (l - len(self._min_support))):
(yield self[self._min_support.union(extra)])
def stanley_symm_poly_weight(self, w):
"\n Weight used in computing (affine) Stanley symmetric polynomials\n for affine type A.\n\n EXAMPLES::\n\n sage: W = WeylGroup(['A',5,1])\n sage: PF = W.pieri_factors()\n sage: PF.stanley_symm_poly_weight(W.one())\n 0\n sage: PF.stanley_symm_poly_weight(W.from_reduced_word([5,4,2,1,0]))\n 0\n "
return 0
|
class PieriFactors_type_C_affine(PieriFactors_affine_type):
"\n The type C affine Pieri factors are realized as the order ideal (in Bruhat\n order) generated by cyclic rotations of the element with unique reduced word\n `123...(n-1)n(n-1)...3210`.\n\n EXAMPLES::\n\n sage: W = WeylGroup(['C',3,1])\n sage: PF = W.pieri_factors()\n sage: sorted([u.reduced_word() for u in PF.maximal_elements()], key=str)\n [[0, 1, 2, 3, 2, 1], [1, 0, 1, 2, 3, 2], [1, 2, 3, 2, 1, 0],\n [2, 1, 0, 1, 2, 3], [2, 3, 2, 1, 0, 1], [3, 2, 1, 0, 1, 2]]\n "
def __init__(self, W):
"\n TESTS::\n\n sage: PF = WeylGroup(['C',3,1]).pieri_factors()\n sage: PF.__class__\n <class 'sage.combinat.root_system.pieri_factors.PieriFactors_type_C_affine_with_category'>\n sage: TestSuite(PF).run() # long time (4s on sage.math, 2011)\n "
Parent.__init__(self, category=FiniteEnumeratedSets())
self.W = W
@cached_method
def maximal_elements_combinatorial(self):
"\n Return the maximal Pieri factors, using the affine type C\n combinatorial description.\n\n EXAMPLES::\n\n sage: PF = WeylGroup(['C',3,1]).pieri_factors()\n sage: [w.reduced_word() for w in PF.maximal_elements_combinatorial()]\n [[0, 1, 2, 3, 2, 1], [1, 0, 1, 2, 3, 2], [2, 1, 0, 1, 2, 3], [3, 2, 1, 0, 1, 2], [2, 3, 2, 1, 0, 1], [1, 2, 3, 2, 1, 0]]\n "
n = self.W.n
rho = (self.W.from_reduced_word(range(1, (n - 1))) * self.W.from_reduced_word(range((n - 1), (- 1), (- 1))))
rotations = []
for i in range((2 * (n - 1))):
rho = rho.apply_simple_reflections(rho.descents()).apply_simple_reflections(rho.descents(), side='left')
rotations.append(rho)
return rotations
def stanley_symm_poly_weight(self, w):
"\n Return the weight of a Pieri factor to be used in the definition of\n Stanley symmetric functions.\n\n For type C, this weight is the number of connected components\n of the support (the indices appearing in a reduced word) of an\n element.\n\n EXAMPLES::\n\n sage: W = WeylGroup(['C',5,1])\n sage: PF = W.pieri_factors()\n sage: PF.stanley_symm_poly_weight(W.from_reduced_word([1,3]))\n 2\n sage: PF.stanley_symm_poly_weight(W.from_reduced_word([1,3,2,0]))\n 1\n sage: PF.stanley_symm_poly_weight(W.from_reduced_word([5,3,0]))\n 3\n sage: PF.stanley_symm_poly_weight(W.one())\n 0\n "
return DiGraph(DynkinDiagram(w.parent().cartan_type())).subgraph(set(w.reduced_word()), algorithm='delete').connected_components_number()
|
class PieriFactors_type_B_affine(PieriFactors_affine_type):
"\n The type B affine Pieri factors are realized as the order ideal (in Bruhat\n order) generated by the following elements:\n\n - cyclic rotations of the element with reduced word\n `234...(n-1)n(n-1)...3210`,\n except for `123...n...320` and `023...n...321`.\n - `123...(n-1)n(n-1)...321`\n - `023...(n-1)n(n-1)...320`\n\n EXAMPLES::\n\n sage: W = WeylGroup(['B',4,1])\n sage: PF = W.pieri_factors()\n sage: W.from_reduced_word([2,3,4,3,2,1,0]) in PF.maximal_elements()\n True\n sage: W.from_reduced_word([0,2,3,4,3,2,1]) in PF.maximal_elements()\n False\n sage: W.from_reduced_word([1,0,2,3,4,3,2]) in PF.maximal_elements()\n True\n sage: W.from_reduced_word([0,2,3,4,3,2,0]) in PF.maximal_elements()\n True\n sage: W.from_reduced_word([0,2,0]) in PF\n True\n "
def __init__(self, W):
'\n\n TESTS::\n\n sage: PF = WeylGroup(["B",3,1]).pieri_factors()\n sage: PF.__class__\n <class \'sage.combinat.root_system.pieri_factors.PieriFactors_type_B_affine_with_category\'>\n sage: TestSuite(PF).run()\n '
Parent.__init__(self, category=FiniteEnumeratedSets())
self.W = W
@cached_method
def maximal_elements_combinatorial(self):
"\n Return the maximal Pieri factors, using the affine type B\n combinatorial description.\n\n EXAMPLES::\n\n sage: W = WeylGroup(['B',4,1])\n sage: [u.reduced_word() for u in W.pieri_factors().maximal_elements_combinatorial()]\n [[1, 0, 2, 3, 4, 3, 2], [2, 1, 0, 2, 3, 4, 3], [3, 2, 1, 0, 2, 3, 4], [4, 3, 2, 1, 0, 2, 3], [3, 4, 3, 2, 1, 0, 2], [2, 3, 4, 3, 2, 1, 0], [1, 2, 3, 4, 3, 2, 1], [0, 2, 3, 4, 3, 2, 0]]\n "
n = self.W.n
rho = (self.W.from_reduced_word(range(2, (n - 1))) * self.W.from_reduced_word(range((n - 1), (- 1), (- 1))))
rotations = []
for i in range((2 * (n - 2))):
rho = rho.apply_simple_reflections(rho.descents()).apply_simple_reflections(rho.descents(), side='left')
rotations.append(rho)
rotations.append((self.W.from_reduced_word(range(1, (n - 1))) * self.W.from_reduced_word(range((n - 1), 0, (- 1)))))
rotations.append((((self.W.from_reduced_word([0]) * self.W.from_reduced_word(range(2, (n - 1)))) * self.W.from_reduced_word(range((n - 1), 1, (- 1)))) * self.W.from_reduced_word([0])))
return rotations
def stanley_symm_poly_weight(self, w):
"\n Return the weight of a Pieri factor to be used in the definition of\n Stanley symmetric functions.\n\n For type B, this weight involves the number of components of\n the complement of the support of an element, where we consider\n 0 and 1 to be one node -- if 1 is in the support, then we\n pretend 0 in the support, and vice versa. We also consider 0\n and 1 to be one node for the purpose of counting components of\n the complement (as if the Dynkin diagram were that of type C).\n Let n be the rank of the affine Weyl group in question (if\n type ``['B',k,1]`` then we have n = k+1). Let ``chi(v.length() < n-1)``\n be the indicator function that is 1 if the length of v is\n smaller than n-1, and 0 if the length of v is greater than or\n equal to n-1. If we call ``c'(v)`` the number of components of\n the complement of the support of v, then the type B weight is\n given by ``weight = c'(v) - chi(v.length() < n-1)``.\n\n EXAMPLES::\n\n sage: W = WeylGroup(['B',5,1])\n sage: PF = W.pieri_factors()\n sage: PF.stanley_symm_poly_weight(W.from_reduced_word([0,3]))\n 1\n sage: PF.stanley_symm_poly_weight(W.from_reduced_word([0,1,3]))\n 1\n sage: PF.stanley_symm_poly_weight(W.from_reduced_word([2,3]))\n 1\n sage: PF.stanley_symm_poly_weight(W.from_reduced_word([2,3,4,5]))\n 0\n sage: PF.stanley_symm_poly_weight(W.from_reduced_word([0,5]))\n 0\n sage: PF.stanley_symm_poly_weight(W.from_reduced_word([2,4,5,4,3,0]))\n -1\n sage: PF.stanley_symm_poly_weight(W.from_reduced_word([4,5,4,3,0]))\n 0\n "
ct = w.parent().cartan_type()
support = set(w.reduced_word())
if ((1 in support) or (0 in support)):
support_complement = set(ct.index_set()).difference(support).difference(set([0, 1]))
else:
support_complement = set(ct.index_set()).difference(support).difference(set([0]))
return (DiGraph(DynkinDiagram(ct)).subgraph(support_complement, algorithm='delete').connected_components_number() - 1)
|
class PieriFactors_type_D_affine(PieriFactors_affine_type):
"\n The type D affine Pieri factors are realized as the order ideal\n (in Bruhat order) generated by the following elements:\n\n * cyclic rotations of the element with reduced word\n `234...(n-2)n(n-1)(n-2)...3210`\n such that 1 and 0 are always adjacent and (n-1) and n are always adjacent.\n * `123...(n-2)n(n-1)(n-2)...321`\n * `023...(n-2)n(n-1)(n-2)...320`\n * `n(n-2)...2102...(n-2)n`\n * `(n-1)(n-2)...2102...(n-2)(n-1)`\n\n EXAMPLES::\n\n sage: W = WeylGroup(['D',5,1])\n sage: PF = W.pieri_factors()\n sage: W.from_reduced_word([3,2,1,0]) in PF\n True\n sage: W.from_reduced_word([0,3,2,1]) in PF\n False\n sage: W.from_reduced_word([0,1,3,2]) in PF\n True\n sage: W.from_reduced_word([2,0,1,3]) in PF\n True\n sage: sorted([u.reduced_word() for u in PF.maximal_elements()], key=str)\n [[0, 2, 3, 5, 4, 3, 2, 0], [1, 0, 2, 3, 5, 4, 3, 2], [1, 2, 3, 5, 4, 3, 2, 1],\n [2, 1, 0, 2, 3, 5, 4, 3], [2, 3, 5, 4, 3, 2, 1, 0], [3, 2, 1, 0, 2, 3, 5, 4],\n [3, 5, 4, 3, 2, 1, 0, 2], [4, 3, 2, 1, 0, 2, 3, 4], [5, 3, 2, 1, 0, 2, 3, 5],\n [5, 4, 3, 2, 1, 0, 2, 3]]\n "
def __init__(self, W):
'\n TESTS::\n\n sage: PF = WeylGroup(["D",4,1]).pieri_factors()\n sage: PF.__class__\n <class \'sage.combinat.root_system.pieri_factors.PieriFactors_type_D_affine_with_category\'>\n sage: TestSuite(PF).run() # long time\n '
Parent.__init__(self, category=FiniteEnumeratedSets())
self.W = W
@cached_method
def maximal_elements_combinatorial(self):
"\n Return the maximal Pieri factors, using the affine type D\n combinatorial description.\n\n EXAMPLES::\n\n sage: W = WeylGroup(['D',5,1])\n sage: PF = W.pieri_factors()\n sage: set(PF.maximal_elements_combinatorial()) == set(PF.maximal_elements())\n True\n "
n = self.W.n
rho = (self.W.from_reduced_word(range(2, n)) * self.W.from_reduced_word(range((n - 3), (- 1), (- 1))))
rotations = []
for i in range((2 * (n - 3))):
rho = rho.apply_simple_reflections(rho.descents()).apply_simple_reflections(rho.descents(), side='left')
rotations.append(rho)
rotations.append((self.W.from_reduced_word(range(1, n)) * self.W.from_reduced_word(range((n - 3), 0, (- 1)))))
rotations.append((((self.W.from_reduced_word([0]) * self.W.from_reduced_word(range(2, n))) * self.W.from_reduced_word(range((n - 3), 1, (- 1)))) * self.W.from_reduced_word([0])))
rotations.append((self.W.from_reduced_word(range((n - 2), (- 1), (- 1))) * self.W.from_reduced_word(range(2, (n - 1)))))
rotations.append((((self.W.from_reduced_word([(n - 1)]) * self.W.from_reduced_word(range((n - 3), (- 1), (- 1)))) * self.W.from_reduced_word(range(2, (n - 2)))) * self.W.from_reduced_word([(n - 1)])))
return rotations
def stanley_symm_poly_weight(self, w):
"\n Return the weight of `w`, to be used in the definition of\n Stanley symmetric functions.\n\n INPUT:\n\n - ``w`` -- a Pieri factor for this type\n\n For type `D`, this weight involves\n the number of components of the complement of the support of\n an element, where we consider `0` and `1` to be one node -- if `1`\n is in the support, then we pretend `0` in the support, and vice\n versa. Similarly with `n-1` and `n`. We also consider `0` and\n `1`, `n-1` and `n` to be one node for the purpose of counting\n components of the complement (as if the Dynkin diagram were\n that of type `C`).\n\n Type D Stanley symmetric polynomial weights are still\n conjectural. The given weight comes from conditions on\n elements of the affine Fomin-Stanley subalgebra, but work is\n needed to show this weight is correct for affine Stanley\n symmetric functions -- see [LSS2009, Pon2010]_ for details.\n\n EXAMPLES::\n\n sage: W = WeylGroup(['D', 5, 1])\n sage: PF = W.pieri_factors()\n sage: PF.stanley_symm_poly_weight(W.from_reduced_word([5,2,1]))\n 0\n sage: PF.stanley_symm_poly_weight(W.from_reduced_word([5,2,1,0]))\n 0\n sage: PF.stanley_symm_poly_weight(W.from_reduced_word([5,2]))\n 1\n sage: PF.stanley_symm_poly_weight(W.from_reduced_word([]))\n 0\n\n sage: W = WeylGroup(['D',7,1])\n sage: PF = W.pieri_factors()\n sage: PF.stanley_symm_poly_weight(W.from_reduced_word([2,4,6]))\n 2\n "
ct = w.parent().cartan_type()
support = set(w.reduced_word())
n = w.parent().n
if ((1 in support) or (0 in support)):
support = support.union(set([1])).difference(set([0]))
if ((n in support) or ((n - 1) in support)):
support = support.union(set([(n - 2)])).difference(set([(n - 1)]))
support_complement = set(range(1, (n - 1))).difference(support)
return (DiGraph(DynkinDiagram(ct)).subgraph(support_complement).connected_components_number() - 1)
|
class PlotOptions():
'\n A class for plotting options for root lattice realizations.\n\n .. SEEALSO::\n\n - :meth:`RootLatticeRealizations.ParentMethods.plot()\n <sage.combinat.root_system.root_lattice_realizations.RootLatticeRealizations.ParentMethods.plot>`\n for a description of the plotting options\n - :ref:`sage.combinat.root_system.plot` for a tutorial on root\n system plotting\n '
def __init__(self, space, projection=True, bounding_box=3, color=CartanType.color, labels=True, level=None, affine=None, arrowsize=5):
"\n TESTS::\n\n sage: L = RootSystem(['B',2,1]).weight_space()\n sage: options = L.plot_parse_options()\n sage: options.dimension\n 2\n sage: options._projections\n [Weight space over the Rational Field of the Root system of type ['B', 2],\n <bound method RootLatticeRealizations.ParentMethods._plot_projection\n of Weight space over the Rational Field of the Root system of type ['B', 2]>]\n\n sage: L = RootSystem(['B',2,1]).ambient_space()\n sage: options = L.plot_parse_options()\n sage: options.dimension\n 2\n sage: options._projections\n [Ambient space of the Root system of type ['B', 2],\n <bound method RootLatticeRealizations.ParentMethods._plot_projection\n of Ambient space of the Root system of type ['B', 2]>]\n\n sage: options = L.plot_parse_options(affine=True)\n sage: options.dimension\n 2\n sage: options._projections\n [Ambient space of the Root system of type ['B', 2],\n <bound method RootLatticeRealizations.ParentMethods._plot_projection\n of Ambient space of the Root system of type ['B', 2]>]\n\n sage: options = L.plot_parse_options(affine=False)\n sage: options._projections\n [<bound method AmbientSpace._plot_projection\n of Ambient space of the Root system of type ['B', 2, 1]>]\n sage: options.dimension\n 3\n\n sage: options = L.plot_parse_options(affine=False,\n ....: projection='barycentric')\n sage: options._projections\n [<bound method RootLatticeRealizations.ParentMethods._plot_projection_barycentric\n of Ambient space of the Root system of type ['B', 2, 1]>]\n sage: options.dimension\n 3\n "
self.space = space
self._color = color
self._arrowsize = arrowsize
self.labels = labels
if (affine is None):
affine = space.cartan_type().is_affine()
if affine:
if (level is None):
level = 1
if (not space.cartan_type().is_affine()):
raise ValueError('affine option only valid for affine types')
projections = [space.classical()]
projection_space = space.classical()
else:
projections = []
projection_space = space
self.affine = affine
self.level = level
if (projection is True):
projections.append(projection_space._plot_projection)
elif (projection == 'barycentric'):
projections.append(projection_space._plot_projection_barycentric)
elif (projection is not False):
projections.append(projection)
self._projections = projections
self.origin_projected = self.projection(space.zero())
self.dimension = len(self.origin_projected)
from sage.rings.real_mpfr import RR
from sage.geometry.polyhedron.constructor import Polyhedron
from itertools import product
if (bounding_box in RR):
bounding_box = ([[(- bounding_box), bounding_box]] * self.dimension)
elif (not (len(bounding_box) == self.dimension)):
raise TypeError("bounding_box argument doesn't match with the plot dimension")
elif (not all(((len(b) == 2) for b in bounding_box))):
raise TypeError(('Invalid bounding box %s' % bounding_box))
self.bounding_box = Polyhedron(vertices=product(*bounding_box))
@cached_method
def in_bounding_box(self, x):
'\n Return whether ``x`` is in the bounding box.\n\n INPUT:\n\n - ``x`` -- an element of the root lattice realization\n\n This method is currently one of the bottlenecks, and therefore\n cached.\n\n EXAMPLES::\n\n sage: L = RootSystem(["A",2,1]).ambient_space()\n sage: options = L.plot_parse_options()\n sage: alpha = L.simple_roots()\n sage: options.in_bounding_box(alpha[1])\n True\n sage: options.in_bounding_box(3*alpha[1])\n False\n '
return self.bounding_box.contains(self.projection(x))
def text(self, label, position, rgbcolor=(0, 0, 0)):
'\n Return text widget with label ``label`` at position ``position``\n\n INPUT:\n\n - ``label`` -- a string, or a Sage object upon which latex will\n be called\n\n - ``position`` -- a position\n\n - ``rgbcolor`` -- the color as an RGB tuple\n\n EXAMPLES::\n\n sage: L = RootSystem(["A",2]).root_lattice()\n sage: options = L.plot_parse_options()\n sage: list(options.text("coucou", [0,1]))\n [Text \'coucou\' at the point (0.0,1.0)]\n sage: list(options.text(L.simple_root(1), [0,1]))\n [Text \'$\\alpha_{1}$\' at the point (0.0,1.0)]\n sage: list(options.text(L.simple_root(2), [1,0], rgbcolor=(1,0.5,0)))\n [Text \'$\\alpha_{2}$\' at the point (1.0,0.0)]\n\n sage: options = L.plot_parse_options(labels=False)\n sage: options.text("coucou", [0,1])\n 0\n\n sage: options = RootSystem(["B",3]).root_lattice().plot_parse_options()\n sage: print(options.text("coucou", [0,1,2]).x3d_str())\n <Transform translation=\'0 1 2\'>\n <Shape><Text string=\'coucou\' solid=\'true\'/><Appearance><Material diffuseColor=\'0.0 0.0 0.0\' shininess=\'1.0\' specularColor=\'0.0 0.0 0.0\'/></Appearance></Shape>\n <BLANKLINE>\n </Transform>\n '
if self.labels:
if (self.dimension <= 2):
if (not isinstance(label, str)):
label = (('$' + str(latex(label))) + '$')
from sage.plot.text import text
return text(label, position, fontsize=15, rgbcolor=rgbcolor)
elif (self.dimension == 3):
if isinstance(label, str):
label = label.replace('{', '').replace('}', '').replace('$', '').replace('_', '')
else:
label = str(label)
from sage.plot.plot3d.shapes2 import text3d
return text3d(label, position, rgbcolor=rgbcolor)
else:
raise NotImplementedError('Plots in dimension > 3')
else:
return self.empty()
def index_of_object(self, i):
'\n Try to return the node of the Dynkin diagram indexing the object `i`.\n\n OUTPUT: a node of the Dynkin diagram or ``None``\n\n EXAMPLES::\n\n sage: L = RootSystem(["A",3]).root_lattice()\n sage: alpha = L.simple_roots()\n sage: omega = RootSystem(["A",3]).weight_lattice().fundamental_weights()\n sage: options = L.plot_parse_options(labels=False)\n sage: options.index_of_object(3)\n 3\n sage: options.index_of_object(alpha[1])\n 1\n sage: options.index_of_object(omega[2])\n 2\n sage: options.index_of_object(omega[2]+omega[3])\n sage: options.index_of_object(30)\n sage: options.index_of_object("bla")\n '
if ((parent(i) in RootLatticeRealizations) and (len(i) == 1) and i.leading_coefficient().is_one()):
i = i.leading_support()
if (i in self.space.cartan_type().index_set()):
return i
return None
def thickness(self, i):
'\n Return the thickness to be used for lines indexed by `i`.\n\n INPUT:\n\n - ``i`` -- an index\n\n .. SEEALSO:: :meth:`index_of_object`\n\n EXAMPLES::\n\n sage: L = RootSystem(["A",2,1]).root_lattice()\n sage: options = L.plot_parse_options(labels=False)\n sage: alpha = L.simple_roots()\n sage: options.thickness(0)\n 2\n sage: options.thickness(1)\n 1\n sage: options.thickness(2)\n 1\n sage: for alpha in L.simple_roots():\n ....: print("{} {}".format(alpha, options.thickness(alpha)))\n alpha[0] 2\n alpha[1] 1\n alpha[2] 1\n '
ct = self.space.cartan_type()
if (ct.is_affine() and (ct.special_node() == self.index_of_object(i))):
return 2
else:
return 1
def color(self, i):
'\n Return the color to be used for objects indexed by `i`.\n\n INPUT:\n\n - ``i`` -- an index\n\n .. SEEALSO:: :meth:`index_of_object`\n\n EXAMPLES::\n\n sage: L = RootSystem(["A",2]).root_lattice()\n sage: options = L.plot_parse_options(labels=False)\n sage: alpha = L.simple_roots()\n sage: options.color(1)\n \'blue\'\n sage: options.color(2)\n \'red\'\n sage: for alpha in L.roots():\n ....: print("{} {}".format(alpha, options.color(alpha)))\n alpha[1] blue\n alpha[2] red\n alpha[1] + alpha[2] black\n -alpha[1] black\n -alpha[2] black\n -alpha[1] - alpha[2] black\n '
return self._color(self.index_of_object(i))
def projection(self, v):
'\n Return the projection of ``v``.\n\n INPUT:\n\n - ``x`` -- an element of the root lattice realization\n\n OUTPUT:\n\n An immutable vector with integer or rational coefficients.\n\n EXAMPLES::\n\n sage: L = RootSystem(["A",2,1]).ambient_space()\n sage: options = L.plot_parse_options()\n sage: options.projection(L.rho())\n (0, 989/571)\n\n sage: options = L.plot_parse_options(projection=False)\n sage: options.projection(L.rho())\n (2, 1, 0)\n '
for projection in self._projections:
v = projection(v)
v = vector(v)
v.set_immutable()
return v
def intersection_at_level_1(self, x):
'\n Return ``x`` scaled at the appropriate level, if level is set;\n otherwise return ``x``.\n\n INPUT:\n\n - ``x`` -- an element of the root lattice realization\n\n EXAMPLES::\n\n sage: L = RootSystem(["A",2,1]).weight_space()\n sage: options = L.plot_parse_options()\n sage: options.intersection_at_level_1(L.rho())\n 1/3*Lambda[0] + 1/3*Lambda[1] + 1/3*Lambda[2]\n\n sage: options = L.plot_parse_options(affine=False, level=2)\n sage: options.intersection_at_level_1(L.rho())\n 2/3*Lambda[0] + 2/3*Lambda[1] + 2/3*Lambda[2]\n\n When ``level`` is not set, ``x`` is returned::\n\n sage: options = L.plot_parse_options(affine=False)\n sage: options.intersection_at_level_1(L.rho())\n Lambda[0] + Lambda[1] + Lambda[2]\n\n '
if (self.level is not None):
return ((x * self.level) / x.level())
else:
return x
def empty(self, *args):
'\n Return an empty plot.\n\n EXAMPLES::\n\n sage: L = RootSystem(["A",2]).root_lattice()\n sage: options = L.plot_parse_options(labels=True)\n\n This currently returns ``int(0)``::\n\n sage: options.empty()\n 0\n\n This is not a plot, so may cause some corner cases. On the\n other hand, `0` behaves as a fast neutral element, which is\n important given the typical idioms used in the plotting code::\n\n sage: p = point([0,0])\n sage: p + options.empty() is p\n True\n '
return 0
def finalize(self, G):
'\n Finalize a root system plot.\n\n INPUT:\n\n - ``G`` -- a root system plot or ``0``\n\n This sets the aspect ratio to 1 and remove the axes. This\n should be called by all the user-level plotting methods of\n root systems. This will become mostly obsolete when\n customization options won\'t be lost anymore upon addition of\n graphics objects and there will be a proper empty object for\n 2D and 3D plots.\n\n EXAMPLES::\n\n sage: L = RootSystem(["B",2,1]).ambient_space()\n sage: options = L.plot_parse_options()\n sage: p = L.plot_roots(plot_options=options)\n sage: p += L.plot_coroots(plot_options=options)\n sage: p.axes()\n True\n sage: p = options.finalize(p)\n sage: p.axes()\n False\n sage: p.aspect_ratio()\n 1.0\n\n sage: options = L.plot_parse_options(affine=False)\n sage: p = L.plot_roots(plot_options=options)\n sage: p += point([[1,1,0]])\n sage: p = options.finalize(p)\n sage: p.aspect_ratio()\n [1.0, 1.0, 1.0]\n\n If the input is ``0``, this returns an empty graphics object::\n\n sage: type(options.finalize(0))\n <class \'sage.plot.plot3d.base.Graphics3dGroup\'>\n\n sage: options = L.plot_parse_options()\n sage: type(options.finalize(0))\n <class \'sage.plot.graphics.Graphics\'>\n sage: list(options.finalize(0))\n []\n '
from sage.plot.graphics import Graphics
if (self.dimension == 2):
if (G == 0):
G = Graphics()
G.set_aspect_ratio(1)
G.axes(False)
elif (self.dimension == 3):
if (G == 0):
from sage.plot.plot3d.base import Graphics3dGroup
G = Graphics3dGroup()
G.aspect_ratio(1)
return G
def family_of_vectors(self, vectors):
'\n Return a plot of a family of vectors.\n\n INPUT:\n\n - ``vectors`` -- family or vectors in ``self``\n\n The vectors are labelled by their index.\n\n EXAMPLES::\n\n sage: L = RootSystem(["A",2]).root_lattice()\n sage: options = L.plot_parse_options()\n sage: alpha = L.simple_roots()\n sage: p = options.family_of_vectors(alpha); p\n Graphics object consisting of 4 graphics primitives\n sage: list(p)\n [Arrow from (0.0,0.0) to (1.0,0.0),\n Text \'$1$\' at the point (1.05,0.0),\n Arrow from (0.0,0.0) to (0.0,1.0),\n Text \'$2$\' at the point (0.0,1.05)]\n\n Handling of colors and labels::\n\n sage: def color(i):\n ....: return "purple" if i==1 else None\n sage: options = L.plot_parse_options(labels=False, color=color)\n sage: p = options.family_of_vectors(alpha)\n sage: list(p)\n [Arrow from (0.0,0.0) to (1.0,0.0)]\n sage: p[0].options()[\'rgbcolor\']\n \'purple\'\n\n Matplotlib emits a warning for arrows of length 0 and draws\n nothing anyway. So we do not draw them at all::\n\n sage: L = RootSystem(["A",2,1]).ambient_space()\n sage: options = L.plot_parse_options()\n sage: Lambda = L.fundamental_weights()\n sage: p = options.family_of_vectors(Lambda); p\n Graphics object consisting of 5 graphics primitives\n sage: list(p)\n [Text \'$0$\' at the point (0.0,0.0),\n Arrow from (0.0,0.0) to (0.5,0.86602451838...),\n Text \'$1$\' at the point (0.525,0.909325744308...),\n Arrow from (0.0,0.0) to (-0.5,0.86602451838...),\n Text \'$2$\' at the point (-0.525,0.909325744308...)]\n '
from sage.plot.arrow import arrow
tail = self.origin_projected
G = self.empty()
for i in vectors.keys():
if (self.color(i) is None):
continue
head = self.projection(vectors[i])
if (head != tail):
G += arrow(tail, head, rgbcolor=self.color(i), arrowsize=self._arrowsize)
G += self.text(i, (1.05 * head))
return self.finalize(G)
def cone(self, rays=[], lines=[], color='black', thickness=1, alpha=1, wireframe=False, label=None, draw_degenerate=True, as_polyhedron=False):
'\n Return the cone generated by the given rays and lines.\n\n INPUT:\n\n - ``rays``, ``lines`` -- lists of elements of the root lattice\n realization (default: ``[]``)\n\n - ``color`` -- a color (default: ``"black"``)\n\n - ``alpha`` -- a number in the interval `[0, 1]` (default: `1`)\n the desired transparency\n\n - ``label`` -- an object to be used as the label for this cone.\n The label itself will be constructed by calling\n :func:`~sage.misc.latex.latex` or :func:`repr` on the\n object depending on the graphics backend.\n\n - ``draw_degenerate`` -- a boolean (default: ``True``)\n whether to draw cones with a degenerate intersection with\n the bounding box\n\n - ``as_polyhedron`` -- a boolean (default: ``False``)\n whether to return the result as a polyhedron, without\n clipping it to the bounding box, and without making a plot\n out of it (for testing purposes)\n\n OUTPUT:\n\n A graphic object, a polyhedron, or ``0``.\n\n EXAMPLES::\n\n sage: L = RootSystem(["A",2]).root_lattice()\n sage: options = L.plot_parse_options()\n sage: alpha = L.simple_roots()\n sage: p = options.cone(rays=[alpha[1]], lines=[alpha[2]],\n ....: color=\'green\', label=2); p\n Graphics object consisting of 2 graphics primitives\n sage: list(p)\n [Polygon defined by 4 points,\n Text \'$2$\' at the point (3.15...,3.15...)]\n sage: options.cone(rays=[alpha[1]], lines=[alpha[2]],\n ....: color=\'green\', label=2, as_polyhedron=True)\n A 2-dimensional polyhedron in ZZ^2 defined as the convex hull of 1 vertex, 1 ray, 1 line\n\n An empty result, being outside of the bounding box::\n\n sage: options = L.plot_parse_options(labels=True,\n ....: bounding_box=[[-10,-9]]*2)\n sage: options.cone(rays=[alpha[1]], lines=[alpha[2]],\n ....: color=\'green\', label=2)\n 0\n\n Test that the options are properly passed down::\n\n sage: L = RootSystem(["A",2]).root_lattice()\n sage: options = L.plot_parse_options()\n sage: p = options.cone(rays=[alpha[1] + alpha[2]],\n ....: color=\'green\', label=2, thickness=4, alpha=.5)\n sage: list(p)\n [Line defined by 2 points, Text \'$2$\' at the point (3.15...,3.15...)]\n sage: sorted(p[0].options().items())\n [(\'alpha\', 0.500000000000000), (\'legend_color\', None),\n (\'legend_label\', None), (\'rgbcolor\', \'green\'), (\'thickness\', 4),\n (\'zorder\', 1)]\n\n This method is tested indirectly but extensively by the\n various plot methods of root lattice realizations.\n '
if (color is None):
return self.empty()
from sage.geometry.polyhedron.constructor import Polyhedron
rays = ((list(rays) + [ray for ray in lines]) + [(- ray) for ray in lines])
if self.level:
old_rays = rays
vertices = [self.intersection_at_level_1(ray) for ray in old_rays if (ray.level() > 0)]
rays = [ray for ray in old_rays if (ray.level() == 0)]
rays += [(vertex - self.intersection_at_level_1(ray)) for ray in old_rays if (ray.level() < 0) for vertex in vertices]
else:
vertices = []
vertices = [self.projection(vertex) for vertex in vertices]
rays = [(self.projection(ray) - self.projection(self.space.zero())) for ray in rays]
rays = [ray for ray in rays if ray]
p = Polyhedron(vertices=vertices, rays=rays)
if as_polyhedron:
return p
q = (p & self.bounding_box)
if ((q.dim() >= 0) and (p.dim() >= 0) and (draw_degenerate or (p.dim() == q.dim()))):
if wireframe:
options = dict(point=False, line=dict(width=10), polygon=False)
center = q.center()
q = q.translation((- center)).dilation((ZZ(95) / ZZ(100))).translation(center)
else:
options = dict(wireframe=False, line={'thickness': thickness})
result = q.plot(color=color, alpha=alpha, **options)
if (label is not None):
vertices = sorted([vector(v) for v in q.vertices()], key=(lambda x: list(reversed(x))))
result += self.text(label, (1.05 * vector(vertices[(- 1)])))
return result
else:
return self.empty()
def reflection_hyperplane(self, coroot, as_polyhedron=False):
'\n Return a plot of the reflection hyperplane indexed by this coroot.\n\n - ``coroot`` -- a coroot\n\n EXAMPLES::\n\n sage: L = RootSystem(["B",2]).weight_space()\n sage: alphacheck = L.simple_coroots()\n sage: options = L.plot_parse_options()\n sage: H = options.reflection_hyperplane(alphacheck[1]); H\n Graphics object consisting of 2 graphics primitives\n\n TESTS::\n\n sage: print(H.description())\n Text \'$H_{\\alpha^\\vee_{1}}$\' at the point (0.0,3.15...)\n Line defined by 2 points: [(0.0, 3.0), (0.0, -3.0)]\n\n ::\n\n sage: L = RootSystem(["A",3,1]).ambient_space()\n sage: alphacheck = L.simple_coroots()\n sage: options = L.plot_parse_options()\n sage: H = options.reflection_hyperplane(alphacheck[1],\n ....: as_polyhedron=True); H\n A 2-dimensional polyhedron in QQ^3 defined as the convex hull of 1 vertex and 2 lines\n sage: H.lines()\n (A line in the direction (0, 0, 1), A line in the direction (0, 1, 0))\n sage: H.vertices()\n (A vertex at (0, 0, 0),)\n\n ::\n\n sage: all(options.reflection_hyperplane(c, as_polyhedron=True).dim() == 2\n ....: for c in alphacheck)\n True\n\n\n .. TODO::\n\n Display the periodic orientation by adding a `+` and\n a `-` sign close to the label. Typically by using\n the associated root to shift a bit from the vertex\n upon which the hyperplane label is attached.\n '
from sage.matrix.constructor import matrix
L = self.space
label = coroot
coroot = self.space.coroot_lattice()(coroot)
vectors = matrix([b.scalar(coroot) for b in L.basis()]).right_kernel().basis()
basis = [L.from_vector(v) for v in vectors]
if (self.dimension == 3):
text_label = ('H_%s$' % str(label))
else:
text_label = ('$H_{%s}$' % latex(label))
return self.cone(lines=basis, color=self.color(label), label=text_label, as_polyhedron=as_polyhedron)
|
@cached_function
def barycentric_projection_matrix(n, angle=0):
'\n Return a family of `n+1` vectors evenly spaced in a real vector space of dimension `n`.\n\n Those vectors are of norm `1`, the scalar product between any two\n vector is `1/n`, thus the distance between two tips is constant.\n\n The family is built recursively and uniquely determined by the\n following property: the last vector is `(0,\\dots,0,-1)`, and the\n projection of the first `n` vectors in dimension `n-1`, after\n appropriate rescaling to norm `1`, retrieves the family for `n-1`.\n\n OUTPUT:\n\n A matrix with `n+1` columns of height `n` with rational or\n symbolic coefficients.\n\n EXAMPLES:\n\n One vector in dimension `0`::\n\n sage: from sage.combinat.root_system.root_lattice_realizations import barycentric_projection_matrix\n sage: m = barycentric_projection_matrix(0); m\n []\n sage: matrix(QQ,0,1).nrows()\n 0\n sage: matrix(QQ,0,1).ncols()\n 1\n\n Two vectors in dimension 1::\n\n sage: barycentric_projection_matrix(1)\n [ 1 -1]\n\n Three vectors in dimension 2::\n\n sage: barycentric_projection_matrix(2)\n [ 1/2*sqrt(3) -1/2*sqrt(3) 0]\n [ 1/2 1/2 -1]\n\n Four vectors in dimension 3::\n\n sage: m = barycentric_projection_matrix(3); m\n [ 1/3*sqrt(3)*sqrt(2) -1/3*sqrt(3)*sqrt(2) 0 0]\n [ 1/3*sqrt(2) 1/3*sqrt(2) -2/3*sqrt(2) 0]\n [ 1/3 1/3 1/3 -1]\n\n The columns give four vectors that sum up to zero::\n\n sage: sum(m.columns())\n (0, 0, 0)\n\n and have regular mutual angles::\n\n sage: m.transpose()*m\n [ 1 -1/3 -1/3 -1/3]\n [-1/3 1 -1/3 -1/3]\n [-1/3 -1/3 1 -1/3]\n [-1/3 -1/3 -1/3 1]\n\n Here is a plot of them::\n\n sage: sum(arrow((0,0,0),x) for x in m.columns())\n Graphics3d Object\n\n For 2D drawings of root systems, it is desirable to rotate the\n result to match with the usual conventions::\n\n sage: barycentric_projection_matrix(2, angle=2*pi/3)\n [ 1/2 -1 1/2]\n [ 1/2*sqrt(3) 0 -1/2*sqrt(3)]\n\n TESTS::\n\n sage: for n in range(1, 7):\n ....: m = barycentric_projection_matrix(n)\n ....: assert sum(m.columns()).is_zero()\n ....: assert matrix(QQ, n+1,n+1, lambda i,j: 1 if i==j else -1/n) == m.transpose()*m\n\n '
from sage.matrix.constructor import matrix
from sage.misc.functional import sqrt
n = ZZ(n)
if (n == 0):
return matrix(QQ, 0, 1)
a = (1 / n)
b = sqrt((1 - (a ** 2)))
result = (b * barycentric_projection_matrix((n - 1)))
result = result.augment(vector(([0] * (n - 1))))
result = result.stack(matrix([(([a] * n) + [(- 1)])]))
assert sum(result.columns()).is_zero()
if (angle and (n == 2)):
from sage.functions.trig import sin
from sage.functions.trig import cos
rotation = matrix([[sin(angle), cos(angle)], [(- cos(angle)), sin(angle)]])
result = (rotation * result)
result.set_immutable()
return result
|
class ComplexReflectionGroup(UniqueRepresentation, PermutationGroup_generic):
'\n A complex reflection group given as a permutation group.\n\n .. SEEALSO::\n\n :func:`ReflectionGroup`\n '
def __init__(self, W_types, index_set=None, hyperplane_index_set=None, reflection_index_set=None):
'\n TESTS::\n\n sage: from sage.categories.complex_reflection_groups import ComplexReflectionGroups\n sage: W = ComplexReflectionGroups().example()\n sage: TestSuite(W).run()\n '
W_components = []
reflection_type = []
for W_type in W_types:
if (W_type == (1, 1, 1)):
raise ValueError('the one element group is not considered a reflection group')
elif (W_type in ZZ):
call_str = ('ComplexReflectionGroup(%s)' % W_type)
elif isinstance(W_type, CartanMatrix):
call_str = ('PermRootGroup(IdentityMat(%s),%s)' % (W_type._rank, str(W_type._M._gap_())))
elif is_Matrix(W_type):
call_str = ('PermRootGroup(IdentityMat(%s),%s)' % (W_type._rank, str(W_type._gap_())))
elif ((W_type in ZZ) or (isinstance(W_type, tuple) and (len(W_type) == 3))):
call_str = ('ComplexReflectionGroup%s' % str(W_type))
elif (W_type[0] == 'I'):
call_str = ('CoxeterGroup("I",2,%s)' % W_type[1])
else:
call_str = ('CoxeterGroup("%s",%s)' % W_type)
W_components.append(gap3(call_str))
X = list(W_components[(- 1)].ReflectionType())
if (len(X) > 1):
raise ValueError(('input data %s is invalid' % W_type))
X = X[0]
type_dict = {}
type_dict['series'] = X.series.sage()
type_dict['rank'] = X.rank.sage()
type_dict['indices'] = X.indices.sage()
if hasattr(X.ST, 'sage'):
type_dict['ST'] = X.ST.sage()
elif (hasattr(X.p, 'sage') and hasattr(X.q, 'sage')):
type_dict['ST'] = (X.p.sage(), X.q.sage(), X.rank.sage())
elif hasattr(X.bond, 'sage'):
type_dict['bond'] = X.bond.sage()
if ((type_dict['series'] == 'B') and ((X.cartanType.sage() == 1) or (X.indices.sage() == [2, 1]))):
type_dict['series'] = 'C'
reflection_type.append(type_dict)
self._type = reflection_type
self._gap_group = prod(W_components)
generators = [str(x) for x in self._gap_group.generators]
self._index_set = index_set
self._hyperplane_index_set = hyperplane_index_set
self._reflection_index_set = reflection_index_set
self._conjugacy_classes = {}
self._conjugacy_classes_representatives = None
self._reflection_representation = None
self._rank = self._gap_group.rank.sage()
if (len(generators) == self._rank):
category = ComplexReflectionGroups().Finite().WellGenerated()
if all(((str(W_comp).find('CoxeterGroup') >= 0) for W_comp in W_components)):
category = Category.join([category, CoxeterGroups()])
else:
category = ComplexReflectionGroups().Finite()
if (len(self._type) == 1):
category = category.Irreducible()
category = Category.join([category, PermutationGroups()]).Finite()
PermutationGroup_generic.__init__(self, gens=generators, canonicalize=False, category=category)
l_set = list(range(1, (len(self.gens()) + 1)))
if (self._index_set is None):
self._index_set = tuple(l_set)
elif (len(self._index_set) != len(l_set)):
raise ValueError(('the given index set (= %s) does not have the right size' % self._index_set.values()))
self._index_set_inverse = {i: ii for (ii, i) in enumerate(self._index_set)}
Nstar_set = list(range(1, (self.number_of_reflection_hyperplanes() + 1)))
if (self._hyperplane_index_set is None):
self._hyperplane_index_set = tuple(Nstar_set)
elif (len(self._hyperplane_index_set) != len(Nstar_set)):
raise ValueError(('the given hyperplane index set (= %s) does not have the right size' % self._index_set.values()))
self._hyperplane_index_set_inverse = {i: ii for (ii, i) in enumerate(self._hyperplane_index_set)}
N_set = list(range(1, (self.number_of_reflections() + 1)))
if (self._reflection_index_set is None):
self._reflection_index_set = tuple(N_set)
elif (len(self._reflection_index_set) != len(N_set)):
raise ValueError(('the given reflection index set (= %s) does not have the right size' % self._index_set.values()))
self._reflection_index_set_inverse = {i: ii for (ii, i) in enumerate(self._reflection_index_set)}
def _irrcomp_repr_(self, W_type):
'\n Return the string representation of an irreducible component\n of ``self``.\n\n TESTS::\n\n sage: W = ReflectionGroup(25,[4,1,4],[1,1,4],[5,5,2]); W\n Reducible complex reflection group of rank 12 and type ST25 x G(4,1,4) x A3 x I2(5)\n sage: for W_type in W._type: print(W._irrcomp_repr_(W_type))\n ST25\n G(4,1,4)\n A3\n I2(5)\n '
type_str = ''
if ('ST' in W_type):
if (W_type['ST'] in ZZ):
type_str += ('ST' + str(W_type['ST']))
else:
type_str += ('G' + str(W_type['ST']).replace(' ', ''))
else:
type_str += str(W_type['series'])
if (W_type['series'] == 'I'):
type_str += (('2(' + str(W_type['bond'])) + ')')
else:
type_str += str(W_type['rank'])
return type_str
def _repr_(self):
'\n Return the string representation of ``self``.\n\n EXAMPLES::\n\n sage: W = ReflectionGroup(25, [4,1,4],[1,1,4],[5,5,2]); W\n Reducible complex reflection group of rank 12 and type ST25 x G(4,1,4) x A3 x I2(5)\n '
type_str = ''
for W_type in self._type:
type_str += self._irrcomp_repr_(W_type)
type_str += ' x '
type_str = type_str[:(- 3)]
return ('Reducible complex reflection group of rank %s and type %s' % (self._rank, type_str))
def iteration_tracking_words(self):
'\n Return an iterator going through all elements in ``self`` that\n tracks the reduced expressions.\n\n This can be much slower than using the iteration as a permutation\n group with strong generating set.\n\n EXAMPLES::\n\n sage: W = ReflectionGroup((1,1,3))\n sage: for w in W.iteration_tracking_words(): w\n ()\n (1,4)(2,3)(5,6)\n (1,3)(2,5)(4,6)\n (1,6,2)(3,5,4)\n (1,2,6)(3,4,5)\n (1,5)(2,4)(3,6)\n '
from sage.combinat.root_system.reflection_group_c import iterator_tracking_words
for (w, word) in iterator_tracking_words(self):
w._reduced_word = word
(yield w)
@cached_method
def index_set(self):
"\n Return the index set of the simple reflections of ``self``.\n\n EXAMPLES::\n\n sage: W = ReflectionGroup((1,1,4))\n sage: W.index_set()\n (1, 2, 3)\n sage: W = ReflectionGroup((1,1,4), index_set=[1,3,'asdf'])\n sage: W.index_set()\n (1, 3, 'asdf')\n sage: W = ReflectionGroup((1,1,4), index_set=('a', 'b', 'c'))\n sage: W.index_set()\n ('a', 'b', 'c')\n "
return self._index_set
def simple_reflection(self, i):
'\n Return the ``i``-th simple reflection of ``self``.\n\n EXAMPLES::\n\n sage: W = ReflectionGroup((1,1,3))\n sage: W.simple_reflection(1)\n (1,4)(2,3)(5,6)\n sage: W.simple_reflections()\n Finite family {1: (1,4)(2,3)(5,6), 2: (1,3)(2,5)(4,6)}\n '
return self.gens()[self._index_set_inverse[i]]
def series(self):
'\n Return the series of the classification type to which ``self``\n belongs.\n\n For real reflection groups, these are the Cartan-Killing\n classification types "A","B","C","D","E","F","G","H","I", and\n for complx non-real reflection groups these are the\n Shephard-Todd classification type "ST".\n\n EXAMPLES::\n\n sage: ReflectionGroup((1,1,3)).series()\n [\'A\']\n sage: ReflectionGroup((3,1,3)).series()\n [\'ST\']\n '
return [self._type[i]['series'] for i in range(len(self._type))]
@cached_method
def hyperplane_index_set(self):
"\n Return the index set of the hyperplanes of ``self``.\n\n EXAMPLES::\n\n sage: W = ReflectionGroup((1,1,4))\n sage: W.hyperplane_index_set()\n (1, 2, 3, 4, 5, 6)\n sage: W = ReflectionGroup((1,1,4), hyperplane_index_set=[1,3,'asdf',7,9,11])\n sage: W.hyperplane_index_set()\n (1, 3, 'asdf', 7, 9, 11)\n sage: W = ReflectionGroup((1,1,4),hyperplane_index_set=('a','b','c','d','e','f'))\n sage: W.hyperplane_index_set()\n ('a', 'b', 'c', 'd', 'e', 'f')\n "
return self._hyperplane_index_set
@cached_method
def distinguished_reflections(self):
"\n Return a finite family containing the distinguished reflections\n of ``self`` indexed by :meth:`hyperplane_index_set`.\n\n These are the reflections in ``self`` acting on the complement\n of the fixed hyperplane `H` as `\\operatorname{exp}(2 \\pi i / n)`,\n where `n` is the order of the reflection subgroup fixing `H`.\n\n EXAMPLES::\n\n sage: W = ReflectionGroup((1,1,3))\n sage: W.distinguished_reflections()\n Finite family {1: (1,4)(2,3)(5,6), 2: (1,3)(2,5)(4,6), 3: (1,5)(2,4)(3,6)}\n\n sage: W = ReflectionGroup((1,1,3),hyperplane_index_set=['a','b','c'])\n sage: W.distinguished_reflections()\n Finite family {'a': (1,4)(2,3)(5,6), 'b': (1,3)(2,5)(4,6), 'c': (1,5)(2,4)(3,6)}\n\n sage: W = ReflectionGroup((3,1,1))\n sage: W.distinguished_reflections()\n Finite family {1: (1,2,3)}\n\n sage: W = ReflectionGroup((1,1,3),(3,1,2))\n sage: W.distinguished_reflections()\n Finite family {1: (1,6)(2,5)(7,8), 2: (1,5)(2,7)(6,8),\n 3: (3,9,15)(4,10,16)(12,17,23)(14,18,24)(20,25,29)(21,22,26)(27,28,30),\n 4: (3,11)(4,12)(9,13)(10,14)(15,19)(16,20)(17,21)(18,22)(23,27)(24,28)(25,26)(29,30),\n 5: (1,7)(2,6)(5,8),\n 6: (3,19)(4,25)(9,11)(10,17)(12,28)(13,15)(14,30)(16,18)(20,27)(21,29)(22,23)(24,26),\n 7: (4,21,27)(10,22,28)(11,13,19)(12,14,20)(16,26,30)(17,18,25)(23,24,29),\n 8: (3,13)(4,24)(9,19)(10,29)(11,15)(12,26)(14,21)(16,23)(17,30)(18,27)(20,22)(25,28)}\n "
gens = self.gens()
R = [t for t in gens]
for r in self._gap_group.Reflections():
t = self(str(r))
if (t not in R):
R.append(t)
return Family(self._hyperplane_index_set, (lambda i: R[self._hyperplane_index_set_inverse[i]]))
def distinguished_reflection(self, i):
"\n Return the ``i``-th distinguished reflection of ``self``.\n\n These are the reflections in ``self`` acting on the complement\n of the fixed hyperplane `H` as `\\operatorname{exp}(2 \\pi i / n)`,\n where `n` is the order of the reflection subgroup fixing `H`.\n\n EXAMPLES::\n\n sage: W = ReflectionGroup((1,1,3))\n sage: W.distinguished_reflection(1)\n (1,4)(2,3)(5,6)\n sage: W.distinguished_reflection(2)\n (1,3)(2,5)(4,6)\n sage: W.distinguished_reflection(3)\n (1,5)(2,4)(3,6)\n\n sage: W = ReflectionGroup((3,1,1),hyperplane_index_set=['a'])\n sage: W.distinguished_reflection('a')\n (1,2,3)\n\n sage: W = ReflectionGroup((1,1,3),(3,1,2))\n sage: for i in range(W.number_of_reflection_hyperplanes()):\n ....: W.distinguished_reflection(i+1)\n (1,6)(2,5)(7,8)\n (1,5)(2,7)(6,8)\n (3,9,15)(4,10,16)(12,17,23)(14,18,24)(20,25,29)(21,22,26)(27,28,30)\n (3,11)(4,12)(9,13)(10,14)(15,19)(16,20)(17,21)(18,22)(23,27)(24,28)(25,26)(29,30)\n (1,7)(2,6)(5,8)\n (3,19)(4,25)(9,11)(10,17)(12,28)(13,15)(14,30)(16,18)(20,27)(21,29)(22,23)(24,26)\n (4,21,27)(10,22,28)(11,13,19)(12,14,20)(16,26,30)(17,18,25)(23,24,29)\n (3,13)(4,24)(9,19)(10,29)(11,15)(12,26)(14,21)(16,23)(17,30)(18,27)(20,22)(25,28)\n "
return self.distinguished_reflections()[i]
@cached_method
def reflection_hyperplanes(self, as_linear_functionals=False, with_order=False):
'\n Return the list of all reflection hyperplanes of ``self``,\n either as a codimension 1 space, or as its linear functional.\n\n INPUT:\n\n - ``as_linear_functionals`` -- (default:``False``) flag whether\n to return the hyperplane or its linear functional in the basis\n dual to the given root basis\n\n EXAMPLES::\n\n sage: W = ReflectionGroup((1,1,3))\n sage: for H in W.reflection_hyperplanes(): H\n Vector space of degree 2 and dimension 1 over Rational Field\n Basis matrix:\n [1 2]\n Vector space of degree 2 and dimension 1 over Rational Field\n Basis matrix:\n [ 1 1/2]\n Vector space of degree 2 and dimension 1 over Rational Field\n Basis matrix:\n [ 1 -1]\n\n sage: for H in W.reflection_hyperplanes(as_linear_functionals=True): H\n (1, -1/2)\n (1, -2)\n (1, 1)\n\n\n sage: W = ReflectionGroup((2,1,2))\n sage: for H in W.reflection_hyperplanes(): H\n Vector space of degree 2 and dimension 1 over Rational Field\n Basis matrix:\n [1 1]\n Vector space of degree 2 and dimension 1 over Rational Field\n Basis matrix:\n [ 1 1/2]\n Vector space of degree 2 and dimension 1 over Rational Field\n Basis matrix:\n [1 0]\n Vector space of degree 2 and dimension 1 over Rational Field\n Basis matrix:\n [0 1]\n\n sage: for H in W.reflection_hyperplanes(as_linear_functionals=True): H\n (1, -1)\n (1, -2)\n (0, 1)\n (1, 0)\n\n sage: for H in W.reflection_hyperplanes(as_linear_functionals=True, with_order=True): H\n ((1, -1), 2)\n ((1, -2), 2)\n ((0, 1), 2)\n ((1, 0), 2)\n '
Hs = []
for r in self.distinguished_reflections():
mat = (r.to_matrix().transpose() - identity_matrix(self.rank()))
if as_linear_functionals:
Hs.append(mat.row_space().gen())
else:
Hs.append(mat.right_kernel())
if with_order:
Hs[(- 1)] = (Hs[(- 1)], r.order())
return Family(self._hyperplane_index_set, (lambda i: Hs[self._hyperplane_index_set_inverse[i]]))
def reflection_hyperplane(self, i, as_linear_functional=False, with_order=False):
'\n Return the ``i``-th reflection hyperplane of ``self``.\n\n The ``i``-th reflection hyperplane corresponds to the ``i``\n distinguished reflection.\n\n INPUT:\n\n - ``i`` -- an index in the index set\n - ``as_linear_functionals`` -- (default:``False``) flag whether\n to return the hyperplane or its linear functional in the basis\n dual to the given root basis\n\n EXAMPLES::\n\n sage: W = ReflectionGroup((2,1,2))\n sage: W.reflection_hyperplane(3)\n Vector space of degree 2 and dimension 1 over Rational Field\n Basis matrix:\n [1 0]\n\n One can ask for the result as a linear form::\n\n sage: W.reflection_hyperplane(3, True)\n (0, 1)\n '
return self.reflection_hyperplanes(as_linear_functionals=as_linear_functional, with_order=with_order)[i]
@cached_method
def reflection_index_set(self):
"\n Return the index set of the reflections of ``self``.\n\n EXAMPLES::\n\n sage: W = ReflectionGroup((1,1,4))\n sage: W.reflection_index_set()\n (1, 2, 3, 4, 5, 6)\n sage: W = ReflectionGroup((1,1,4), reflection_index_set=[1,3,'asdf',7,9,11])\n sage: W.reflection_index_set()\n (1, 3, 'asdf', 7, 9, 11)\n sage: W = ReflectionGroup((1,1,4), reflection_index_set=('a','b','c','d','e','f'))\n sage: W.reflection_index_set()\n ('a', 'b', 'c', 'd', 'e', 'f')\n "
return self._reflection_index_set
@cached_method
def reflections(self):
"\n Return a finite family containing the reflections of ``self``,\n indexed by :meth:`self.reflection_index_set`.\n\n EXAMPLES::\n\n sage: W = ReflectionGroup((1,1,3))\n sage: W.reflections()\n Finite family {1: (1,4)(2,3)(5,6), 2: (1,3)(2,5)(4,6), 3: (1,5)(2,4)(3,6)}\n\n sage: W = ReflectionGroup((1,1,3),reflection_index_set=['a','b','c'])\n sage: W.reflections()\n Finite family {'a': (1,4)(2,3)(5,6), 'b': (1,3)(2,5)(4,6), 'c': (1,5)(2,4)(3,6)}\n\n sage: W = ReflectionGroup((3,1,1))\n sage: W.reflections()\n Finite family {1: (1,2,3), 2: (1,3,2)}\n\n sage: W = ReflectionGroup((1,1,3),(3,1,2))\n sage: W.reflections()\n Finite family {1: (1,6)(2,5)(7,8), 2: (1,5)(2,7)(6,8),\n 3: (3,9,15)(4,10,16)(12,17,23)(14,18,24)(20,25,29)(21,22,26)(27,28,30),\n 4: (3,11)(4,12)(9,13)(10,14)(15,19)(16,20)(17,21)(18,22)(23,27)(24,28)(25,26)(29,30),\n 5: (1,7)(2,6)(5,8),\n 6: (3,19)(4,25)(9,11)(10,17)(12,28)(13,15)(14,30)(16,18)(20,27)(21,29)(22,23)(24,26),\n 7: (4,21,27)(10,22,28)(11,13,19)(12,14,20)(16,26,30)(17,18,25)(23,24,29),\n 8: (3,13)(4,24)(9,19)(10,29)(11,15)(12,26)(14,21)(16,23)(17,30)(18,27)(20,22)(25,28),\n 9: (3,15,9)(4,16,10)(12,23,17)(14,24,18)(20,29,25)(21,26,22)(27,30,28),\n 10: (4,27,21)(10,28,22)(11,19,13)(12,20,14)(16,30,26)(17,25,18)(23,29,24)}\n "
T = self.distinguished_reflections().values()
for i in range(self.number_of_reflection_hyperplanes()):
for j in range(2, T[i].order()):
T.append((T[i] ** j))
return Family(self._reflection_index_set, (lambda i: T[self._reflection_index_set_inverse[i]]))
def reflection(self, i):
"\n Return the ``i``-th reflection of ``self``.\n\n EXAMPLES::\n\n sage: W = ReflectionGroup((1,1,3))\n sage: W.reflection(1)\n (1,4)(2,3)(5,6)\n sage: W.reflection(2)\n (1,3)(2,5)(4,6)\n sage: W.reflection(3)\n (1,5)(2,4)(3,6)\n\n sage: W = ReflectionGroup((3,1,1),reflection_index_set=['a','b'])\n sage: W.reflection('a')\n (1,2,3)\n sage: W.reflection('b')\n (1,3,2)\n "
return self.reflections()[i]
def reflection_character(self):
'\n Return the reflection characters of ``self``.\n\n EXAMPLES::\n\n sage: W = ReflectionGroup((1,1,3))\n sage: W.reflection_character()\n [2, 0, -1]\n '
return self._gap_group.ReflectionCharacter().sage()
@cached_method
def discriminant(self):
"\n Return the discriminant of ``self`` in the polynomial ring on\n which the group acts.\n\n This is the product\n\n .. MATH::\n\n \\prod_H \\alpha_H^{e_H},\n\n where `\\alpha_H` is the linear form of the hyperplane `H` and\n `e_H` is its stabilizer order.\n\n EXAMPLES::\n\n sage: W = ReflectionGroup(['A',2])\n sage: W.discriminant()\n x0^6 - 3*x0^5*x1 - 3/4*x0^4*x1^2 + 13/2*x0^3*x1^3\n - 3/4*x0^2*x1^4 - 3*x0*x1^5 + x1^6\n\n sage: W = ReflectionGroup(['B',2])\n sage: W.discriminant()\n x0^6*x1^2 - 6*x0^5*x1^3 + 13*x0^4*x1^4 - 12*x0^3*x1^5 + 4*x0^2*x1^6\n "
from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
n = self.rank()
P = PolynomialRing(QQ, 'x', n)
x = P.gens()
return prod(((sum(((x[i] * alpha[i]) for i in range(n))) ** o) for (alpha, o) in self.reflection_hyperplanes(True, True)))
@cached_method
def discriminant_in_invariant_ring(self, invariants=None):
"\n Return the discriminant of ``self`` in the invariant ring.\n\n This is the function `f` in the invariants such that\n `f(F_1(x), \\ldots, F_n(x))` is the discriminant.\n\n EXAMPLES::\n\n sage: W = ReflectionGroup(['A',3])\n sage: W.discriminant_in_invariant_ring()\n 6*t0^3*t1^2 - 18*t0^4*t2 + 9*t1^4 - 36*t0*t1^2*t2 + 24*t0^2*t2^2 - 8*t2^3\n\n sage: W = ReflectionGroup(['B',3])\n sage: W.discriminant_in_invariant_ring()\n -t0^2*t1^2*t2 + 16*t0^3*t2^2 + 2*t1^3*t2 - 36*t0*t1*t2^2 + 108*t2^3\n\n sage: W = ReflectionGroup(['H',3])\n sage: W.discriminant_in_invariant_ring() # long time\n (-829*E(5) - 1658*E(5)^2 - 1658*E(5)^3 - 829*E(5)^4)*t0^15\n + (213700*E(5) + 427400*E(5)^2 + 427400*E(5)^3 + 213700*E(5)^4)*t0^12*t1\n + (-22233750*E(5) - 44467500*E(5)^2 - 44467500*E(5)^3 - 22233750*E(5)^4)*t0^9*t1^2\n + (438750*E(5) + 877500*E(5)^2 + 877500*E(5)^3 + 438750*E(5)^4)*t0^10*t2\n + (1162187500*E(5) + 2324375000*E(5)^2 + 2324375000*E(5)^3 + 1162187500*E(5)^4)*t0^6*t1^3\n + (-74250000*E(5) - 148500000*E(5)^2 - 148500000*E(5)^3 - 74250000*E(5)^4)*t0^7*t1*t2\n + (-28369140625*E(5) - 56738281250*E(5)^2 - 56738281250*E(5)^3 - 28369140625*E(5)^4)*t0^3*t1^4\n + (1371093750*E(5) + 2742187500*E(5)^2 + 2742187500*E(5)^3 + 1371093750*E(5)^4)*t0^4*t1^2*t2\n + (1191796875*E(5) + 2383593750*E(5)^2 + 2383593750*E(5)^3 + 1191796875*E(5)^4)*t0^5*t2^2\n + (175781250000*E(5) + 351562500000*E(5)^2 + 351562500000*E(5)^3 + 175781250000*E(5)^4)*t1^5\n + (131835937500*E(5) + 263671875000*E(5)^2 + 263671875000*E(5)^3 + 131835937500*E(5)^4)*t0*t1^3*t2\n + (-100195312500*E(5) - 200390625000*E(5)^2 - 200390625000*E(5)^3 - 100195312500*E(5)^4)*t0^2*t1*t2^2\n + (395507812500*E(5) + 791015625000*E(5)^2 + 791015625000*E(5)^3 + 395507812500*E(5)^4)*t2^3\n "
from sage.arith.functions import lcm
from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
n = self.rank()
if (invariants is None):
Fs = self.fundamental_invariants()
else:
Fs = invariants
D = self.discriminant()
if self.is_crystallographic():
R = QQ
else:
from sage.rings.universal_cyclotomic_field import UniversalCyclotomicField
R = UniversalCyclotomicField()
Dd = D.degree()
Fd = [F.degree() for F in Fs]
Ps = multi_partitions(Dd, Fd)
m = len(Ps)
P = PolynomialRing(R, 'X', m)
X = P.gens()
T = PolynomialRing(R, 't', n)
FsPowers = [prod((power(val, part[j]) for (j, val) in enumerate(Fs))).change_ring(P) for part in Ps]
D = D.change_ring(P)
f = (D - sum(((X[i] * F) for (i, F) in enumerate(FsPowers))))
coeffs = f.coefficients()
lhs = Matrix(R, [[coeff.coefficient(X[i]) for i in range(m)] for coeff in coeffs])
rhs = vector([coeff.constant_coefficient() for coeff in coeffs])
coeffs = lhs.solve_right(rhs)
coeffs = (lcm((i.denominator() for i in coeffs)) * coeffs)
mons = vector([prod(((tj ** part[j]) for (j, tj) in enumerate(T.gens()))) for part in Ps])
return sum(((coeffs[i] * mons[i]) for i in range(m)))
@cached_method
def is_crystallographic(self):
'\n Return ``True`` if self is crystallographic.\n\n This is, if the field of definition is the rational field.\n\n .. TODO::\n\n Make this more robust and do not use the matrix\n representation of the simple reflections.\n\n EXAMPLES::\n\n sage: W = ReflectionGroup((1,1,3)); W\n Irreducible real reflection group of rank 2 and type A2\n sage: W.is_crystallographic()\n True\n\n sage: W = ReflectionGroup((2,1,3)); W\n Irreducible real reflection group of rank 3 and type B3\n sage: W.is_crystallographic()\n True\n\n sage: W = ReflectionGroup(23); W\n Irreducible real reflection group of rank 3 and type H3\n sage: W.is_crystallographic()\n False\n\n sage: W = ReflectionGroup((3,1,3)); W\n Irreducible complex reflection group of rank 3 and type G(3,1,3)\n sage: W.is_crystallographic()\n False\n\n sage: W = ReflectionGroup((4,2,2)); W\n Irreducible complex reflection group of rank 2 and type G(4,2,2)\n sage: W.is_crystallographic()\n False\n '
return (self.is_real() and all(((t.to_matrix().base_ring() is QQ) for t in self.simple_reflections())))
def number_of_irreducible_components(self):
'\n Return the number of irreducible components of ``self``.\n\n EXAMPLES::\n\n sage: W = ReflectionGroup((1,1,3))\n sage: W.number_of_irreducible_components()\n 1\n\n sage: W = ReflectionGroup((1,1,3),(2,1,3))\n sage: W.number_of_irreducible_components()\n 2\n '
return len(self._type)
def irreducible_components(self):
'\n Return a list containing the irreducible components of ``self``\n as finite reflection groups.\n\n EXAMPLES::\n\n sage: W = ReflectionGroup((1,1,3))\n sage: W.irreducible_components()\n [Irreducible real reflection group of rank 2 and type A2]\n\n sage: W = ReflectionGroup((1,1,3),(2,1,3))\n sage: W.irreducible_components()\n [Irreducible real reflection group of rank 2 and type A2,\n Irreducible real reflection group of rank 3 and type B3]\n '
from sage.combinat.root_system.reflection_group_real import ReflectionGroup
irr_comps = []
for W_type in self._type:
if (W_type['series'] in ['A', 'B', 'D', 'E', 'F', 'G', 'H', 'I']):
W_str = (W_type['series'], W_type['rank'])
elif ('ST' in W_type):
W_str = W_type['ST']
irr_comps.append(ReflectionGroup(W_str))
return irr_comps
@cached_method
def conjugacy_classes_representatives(self):
'\n Return the shortest representatives of the conjugacy classes of\n ``self``.\n\n EXAMPLES::\n\n sage: W = ReflectionGroup((1,1,3))\n sage: [w.reduced_word() for w in W.conjugacy_classes_representatives()]\n [[], [1], [1, 2]]\n\n sage: W = ReflectionGroup((1,1,4))\n sage: [w.reduced_word() for w in W.conjugacy_classes_representatives()]\n [[], [1], [1, 3], [1, 2], [1, 3, 2]]\n\n sage: W = ReflectionGroup((3,1,2))\n sage: [w.reduced_word() for w in W.conjugacy_classes_representatives()]\n [[], [1], [1, 1], [2, 1, 2, 1], [2, 1, 2, 1, 1],\n [2, 1, 1, 2, 1, 1], [2], [1, 2], [1, 1, 2]]\n\n sage: W = ReflectionGroup(23)\n sage: [w.reduced_word() for w in W.conjugacy_classes_representatives()]\n [[],\n [1],\n [1, 2],\n [1, 3],\n [2, 3],\n [1, 2, 3],\n [1, 2, 1, 2],\n [1, 2, 1, 2, 3],\n [1, 2, 1, 2, 3, 2, 1, 2, 3],\n [1, 2, 1, 2, 1, 3, 2, 1, 2, 1, 3, 2, 1, 2, 3]]\n '
S = str(gap3(('List(ConjugacyClasses(%s),Representative)' % self._gap_group._name)))
return sage_eval(_gap_return(S), {'self': self})
def conjugacy_classes(self):
'\n Return the conjugacy classes of ``self``.\n\n EXAMPLES::\n\n sage: W = ReflectionGroup((1,1,3))\n sage: for C in W.conjugacy_classes(): sorted(C)\n [()]\n [(1,3)(2,5)(4,6), (1,4)(2,3)(5,6), (1,5)(2,4)(3,6)]\n [(1,2,6)(3,4,5), (1,6,2)(3,5,4)]\n\n sage: W = ReflectionGroup((1,1,4))\n sage: sum(len(C) for C in W.conjugacy_classes()) == W.cardinality()\n True\n\n sage: W = ReflectionGroup((3,1,2))\n sage: sum(len(C) for C in W.conjugacy_classes()) == W.cardinality()\n True\n\n sage: W = ReflectionGroup(23)\n sage: sum(len(C) for C in W.conjugacy_classes()) == W.cardinality()\n True\n '
return Family(self.conjugacy_classes_representatives(), (lambda w: w.conjugacy_class()))
def rank(self):
'\n Return the rank of ``self``.\n\n This is the dimension of the underlying vector space.\n\n EXAMPLES::\n\n sage: W = ReflectionGroup((1,1,3))\n sage: W.rank()\n 2\n sage: W = ReflectionGroup((2,1,3))\n sage: W.rank()\n 3\n sage: W = ReflectionGroup((4,1,3))\n sage: W.rank()\n 3\n sage: W = ReflectionGroup((4,2,3))\n sage: W.rank()\n 3\n '
return self._rank
@cached_method
def degrees(self):
'\n Return the degrees of ``self`` ordered within each irreducible\n component of ``self``.\n\n EXAMPLES::\n\n sage: W = ReflectionGroup((1,1,4))\n sage: W.degrees()\n (2, 3, 4)\n\n sage: W = ReflectionGroup((2,1,4))\n sage: W.degrees()\n (2, 4, 6, 8)\n\n sage: W = ReflectionGroup((4,1,4))\n sage: W.degrees()\n (4, 8, 12, 16)\n\n sage: W = ReflectionGroup((4,2,4))\n sage: W.degrees()\n (4, 8, 8, 12)\n\n sage: W = ReflectionGroup((4,4,4))\n sage: W.degrees()\n (4, 4, 8, 12)\n\n Examples of reducible types::\n\n sage: W = ReflectionGroup((1,1,4), (3,1,2)); W\n Reducible complex reflection group of rank 5 and type A3 x G(3,1,2)\n sage: W.degrees()\n (2, 3, 4, 3, 6)\n\n sage: W = ReflectionGroup((1,1,4), (6,1,12), 23)\n sage: W.degrees()\n (2, 3, 4, 6, 12, 18, 24, 30, 36, 42, 48, 54, 60, 66, 72, 2, 6, 10)\n '
if self.is_irreducible():
try:
return tuple(sorted(self._gap_group.degrees.sage()))
except AttributeError:
return tuple(sorted(self._gap_group.ReflectionDegrees().sage()))
else:
return sum([comp.degrees() for comp in self.irreducible_components()], tuple())
@cached_method
def codegrees(self):
'\n Return the codegrees of ``self`` ordered within each irreducible\n component of ``self``.\n\n EXAMPLES::\n\n sage: W = ReflectionGroup((1,1,4))\n sage: W.codegrees()\n (2, 1, 0)\n\n sage: W = ReflectionGroup((2,1,4))\n sage: W.codegrees()\n (6, 4, 2, 0)\n\n sage: W = ReflectionGroup((4,1,4))\n sage: W.codegrees()\n (12, 8, 4, 0)\n\n sage: W = ReflectionGroup((4,2,4))\n sage: W.codegrees()\n (12, 8, 4, 0)\n\n sage: W = ReflectionGroup((4,4,4))\n sage: W.codegrees()\n (8, 8, 4, 0)\n\n sage: W = ReflectionGroup((1,1,4), (3,1,2))\n sage: W.codegrees()\n (2, 1, 0, 3, 0)\n\n sage: W = ReflectionGroup((1,1,4), (6,1,12), 23)\n sage: W.codegrees()\n (2, 1, 0, 66, 60, 54, 48, 42, 36, 30, 24, 18, 12, 6, 0, 8, 4, 0)\n '
if self.is_irreducible():
if self.is_well_generated():
h = self.coxeter_number()
return tuple([(h - d) for d in self.degrees()])
else:
return tuple(sorted(self._gap_group.ReflectionCoDegrees().sage(), reverse=True))
else:
return sum([comp.codegrees() for comp in self.irreducible_components()], tuple())
@cached_method
def reflection_eigenvalues_family(self):
"\n Return the reflection eigenvalues of ``self`` as a finite family\n indexed by the class representatives of ``self``.\n\n OUTPUT:\n\n - list with entries `k/n` representing the eigenvalue `\\zeta_n^k`.\n\n EXAMPLES::\n\n sage: W = ReflectionGroup((1,1,3))\n sage: W.reflection_eigenvalues_family()\n Finite family {(): [0, 0], (1,4)(2,3)(5,6): [1/2, 0], (1,6,2)(3,5,4): [1/3, 2/3]}\n\n sage: W = ReflectionGroup((3,1,2))\n sage: reflection_eigenvalues = W.reflection_eigenvalues_family()\n sage: for elt in sorted(reflection_eigenvalues.keys()):\n ....: print('%s %s'%(elt, reflection_eigenvalues[elt]))\n () [0, 0]\n (1,3,9)(2,4,10)(6,11,17)(8,12,18)(14,19,23)(15,16,20)(21,22,24) [1/3, 0]\n (1,3,9)(2,16,24)(4,20,21)(5,7,13)(6,12,23)(8,19,17)(10,15,22)(11,18,14) [1/3, 1/3]\n (1,5)(2,6)(3,7)(4,8)(9,13)(10,14)(11,15)(12,16)(17,21)(18,22)(19,20)(23,24) [1/2, 0]\n (1,7,3,13,9,5)(2,8,16,19,24,17)(4,14,20,11,21,18)(6,15,12,22,23,10) [1/6, 2/3]\n (1,9,3)(2,10,4)(6,17,11)(8,18,12)(14,23,19)(15,20,16)(21,24,22) [2/3, 0]\n (1,9,3)(2,20,22)(4,15,24)(5,7,13)(6,18,19)(8,23,11)(10,16,21)(12,14,17) [1/3, 2/3]\n (1,9,3)(2,24,16)(4,21,20)(5,13,7)(6,23,12)(8,17,19)(10,22,15)(11,14,18) [2/3, 2/3]\n (1,13,9,7,3,5)(2,14,24,18,16,11)(4,6,21,23,20,12)(8,22,17,15,19,10) [1/3, 5/6]\n\n sage: W = ReflectionGroup(23)\n sage: reflection_eigenvalues = W.reflection_eigenvalues_family()\n sage: for elt in sorted(reflection_eigenvalues.keys()):\n ....: print('%s %s'%(elt, reflection_eigenvalues[elt]))\n () [0, 0, 0]\n (1,8,4)(2,21,3)(5,10,11)(6,18,17)(7,9,12)(13,14,15)(16,23,19)(20,25,26)(22,24,27)(28,29,30) [1/3, 2/3, 0]\n (1,16)(2,5)(4,7)(6,9)(8,10)(11,13)(12,14)(17,20)(19,22)(21,24)(23,25)(26,28)(27,29) [1/2, 0, 0]\n (1,16)(2,9)(3,18)(4,10)(5,6)(7,8)(11,14)(12,13)(17,24)(19,25)(20,21)(22,23)(26,29)(27,28) [1/2, 1/2, 0]\n (1,16)(2,17)(3,18)(4,19)(5,20)(6,21)(7,22)(8,23)(9,24)(10,25)(11,26)(12,27)(13,28)(14,29)(15,30) [1/2, 1/2, 1/2]\n (1,19,20,2,7)(3,6,11,13,9)(4,5,17,22,16)(8,12,15,14,10)(18,21,26,28,24)(23,27,30,29,25) [1/5, 4/5, 0]\n (1,20,7,19,2)(3,11,9,6,13)(4,17,16,5,22)(8,15,10,12,14)(18,26,24,21,28)(23,30,25,27,29) [2/5, 3/5, 0]\n (1,23,26,29,22,16,8,11,14,7)(2,10,4,9,18,17,25,19,24,3)(5,21,27,30,28,20,6,12,15,13) [1/10, 1/2, 9/10]\n (1,24,17,16,9,2)(3,12,13,18,27,28)(4,21,29,19,6,14)(5,25,26,20,10,11)(7,23,30,22,8,15) [1/6, 1/2, 5/6]\n (1,29,8,7,26,16,14,23,22,11)(2,9,25,3,4,17,24,10,18,19)(5,30,6,13,27,20,15,21,28,12) [3/10, 1/2, 7/10]\n "
class_representatives = self.conjugacy_classes_representatives()
Ev_list = self._gap_group.ReflectionEigenvalues().sage()
return Family(class_representatives, (lambda w: Ev_list[class_representatives.index(w)]))
@cached_method
def reflection_eigenvalues(self, w, is_class_representative=False):
"\n Return the reflection eigenvalue of ``w`` in ``self``.\n\n INPUT:\n\n - ``is_class_representative`` -- boolean (default ``True``) whether to\n compute instead on the conjugacy class representative.\n\n .. SEEALSO:: :meth:`reflection_eigenvalues_family`\n\n EXAMPLES::\n\n sage: W = ReflectionGroup((1,1,3))\n sage: for w in W:\n ....: print('%s %s'%(w.reduced_word(), W.reflection_eigenvalues(w)))\n [] [0, 0]\n [2] [1/2, 0]\n [1] [1/2, 0]\n [1, 2] [1/3, 2/3]\n [2, 1] [1/3, 2/3]\n [1, 2, 1] [1/2, 0]\n "
if (not is_class_representative):
w = w.conjugacy_class_representative()
return self.reflection_eigenvalues_family()[w]
@cached_method
def simple_roots(self):
'\n Return the simple roots of ``self``.\n\n These are the roots corresponding to the simple reflections.\n\n EXAMPLES::\n\n sage: W = ReflectionGroup((1,1,3))\n sage: W.simple_roots()\n Finite family {1: (1, 0), 2: (0, 1)}\n\n sage: W = ReflectionGroup((1,1,4), (2,1,2))\n sage: W.simple_roots()\n Finite family {1: (1, 0, 0, 0, 0), 2: (0, 1, 0, 0, 0), 3: (0, 0, 1, 0, 0), 4: (0, 0, 0, 1, 0), 5: (0, 0, 0, 0, 1)}\n\n sage: W = ReflectionGroup((3,1,2))\n sage: W.simple_roots()\n Finite family {1: (1, 0), 2: (-1, 1)}\n\n sage: W = ReflectionGroup((1,1,4), (3,1,2))\n sage: W.simple_roots()\n Finite family {1: (1, 0, 0, 0, 0), 2: (0, 1, 0, 0, 0), 3: (0, 0, 1, 0, 0), 4: (0, 0, 0, 1, 0), 5: (0, 0, 0, -1, 1)}\n '
from sage.sets.family import Family
return Family({ind: self.roots()[i] for (i, ind) in enumerate(self._index_set)})
def simple_root(self, i):
"\n Return the simple root with index ``i``.\n\n EXAMPLES::\n\n sage: W = ReflectionGroup(['A',3])\n sage: W.simple_root(1)\n (1, 0, 0)\n sage: W.simple_root(2)\n (0, 1, 0)\n sage: W.simple_root(3)\n (0, 0, 1)\n\n TESTS::\n\n sage: W.simple_root(0)\n Traceback (most recent call last):\n ...\n KeyError: 0\n "
return self.simple_roots()[i]
@cached_method
def simple_coroots(self):
'\n Return the simple coroots of ``self``.\n\n These are the coroots corresponding to the simple reflections.\n\n EXAMPLES::\n\n sage: W = ReflectionGroup((1,1,3))\n sage: W.simple_coroots()\n Finite family {1: (2, -1), 2: (-1, 2)}\n\n sage: W = ReflectionGroup((1,1,4), (2,1,2))\n sage: W.simple_coroots()\n Finite family {1: (2, -1, 0, 0, 0), 2: (-1, 2, -1, 0, 0), 3: (0, -1, 2, 0, 0), 4: (0, 0, 0, 2, -2), 5: (0, 0, 0, -1, 2)}\n\n sage: W = ReflectionGroup((3,1,2))\n sage: W.simple_coroots()\n Finite family {1: (-2*E(3) - E(3)^2, 0), 2: (-1, 1)}\n\n sage: W = ReflectionGroup((1,1,4), (3,1,2))\n sage: W.simple_coroots()\n Finite family {1: (2, -1, 0, 0, 0), 2: (-1, 2, -1, 0, 0), 3: (0, -1, 2, 0, 0), 4: (0, 0, 0, -2*E(3) - E(3)^2, 0), 5: (0, 0, 0, -1, 1)}\n '
from sage.sets.family import Family
coroots = self._gap_group.simpleCoroots.sage()
for (i, coroot) in enumerate(coroots):
coroot = vector(coroot)
coroot.set_immutable()
coroots[i] = coroot
return Family({ind: coroots[i] for (i, ind) in enumerate(self.index_set())})
def simple_coroot(self, i):
"\n Return the simple root with index ``i``.\n\n EXAMPLES::\n\n sage: W = ReflectionGroup(['A',3])\n sage: W.simple_coroot(1)\n (2, -1, 0)\n "
return self.simple_coroots()[i]
@cached_method
def independent_roots(self):
'\n Return a collection of simple roots generating the underlying\n vector space of ``self``.\n\n For well-generated groups, these are all simple roots.\n Otherwise, a linearly independent subset of the simple roots is\n chosen.\n\n EXAMPLES::\n\n sage: W = ReflectionGroup((1,1,3))\n sage: W.independent_roots()\n Finite family {1: (1, 0), 2: (0, 1)}\n\n sage: W = ReflectionGroup((4,2,3))\n sage: W.simple_roots()\n Finite family {1: (1, 0, 0), 2: (-E(4), 1, 0), 3: (-1, 1, 0), 4: (0, -1, 1)}\n sage: W.independent_roots()\n Finite family {1: (1, 0, 0), 2: (-E(4), 1, 0), 4: (0, -1, 1)}\n '
Delta = self.simple_roots()
if self.is_well_generated():
return Delta
from sage.sets.family import Family
basis = {}
for ind in self._index_set:
vec = Delta[ind]
if (Matrix((list(basis.values()) + [vec])).rank() == (len(basis) + 1)):
basis[ind] = vec
return Family(basis)
@cached_method
def roots(self):
'\n Return all roots corresponding to all reflections of ``self``.\n\n EXAMPLES::\n\n sage: W = ReflectionGroup((1,1,3))\n sage: W.roots()\n [(1, 0), (0, 1), (1, 1), (-1, 0), (0, -1), (-1, -1)]\n\n sage: W = ReflectionGroup((3,1,2))\n sage: W.roots()\n [(1, 0), (-1, 1), (E(3), 0), (-E(3), 1), (0, 1), (1, -1),\n (0, E(3)), (1, -E(3)), (E(3)^2, 0), (-E(3)^2, 1),\n (E(3), -1), (E(3), -E(3)), (0, E(3)^2), (1, -E(3)^2),\n (-1, E(3)), (-E(3), E(3)), (E(3)^2, -1), (E(3)^2, -E(3)),\n (E(3), -E(3)^2), (-E(3)^2, E(3)), (-1, E(3)^2),\n (-E(3), E(3)^2), (E(3)^2, -E(3)^2), (-E(3)^2, E(3)^2)]\n\n sage: W = ReflectionGroup((4,2,2))\n sage: W.roots()\n [(1, 0), (-E(4), 1), (-1, 1), (-1, 0), (E(4), 1), (1, 1),\n (0, -E(4)), (E(4), -1), (E(4), E(4)), (0, E(4)),\n (E(4), -E(4)), (0, 1), (1, -E(4)), (1, -1), (0, -1),\n (1, E(4)), (-E(4), 0), (-1, E(4)), (E(4), 0), (-E(4), E(4)),\n (-E(4), -1), (-E(4), -E(4)), (-1, -E(4)), (-1, -1)]\n\n sage: W = ReflectionGroup((1,1,4), (3,1,2))\n sage: W.roots()\n [(1, 0, 0, 0, 0), (0, 1, 0, 0, 0), (0, 0, 1, 0, 0),\n (0, 0, 0, 1, 0), (0, 0, 0, -1, 1), (1, 1, 0, 0, 0),\n (0, 1, 1, 0, 0), (1, 1, 1, 0, 0), (-1, 0, 0, 0, 0),\n (0, -1, 0, 0, 0), (0, 0, -1, 0, 0), (-1, -1, 0, 0, 0),\n (0, -1, -1, 0, 0), (-1, -1, -1, 0, 0), (0, 0, 0, E(3), 0),\n (0, 0, 0, -E(3), 1), (0, 0, 0, 0, 1), (0, 0, 0, 1, -1),\n (0, 0, 0, 0, E(3)), (0, 0, 0, 1, -E(3)), (0, 0, 0, E(3)^2, 0),\n (0, 0, 0, -E(3)^2, 1), (0, 0, 0, E(3), -1), (0, 0, 0, E(3), -E(3)),\n (0, 0, 0, 0, E(3)^2), (0, 0, 0, 1, -E(3)^2), (0, 0, 0, -1, E(3)),\n (0, 0, 0, -E(3), E(3)), (0, 0, 0, E(3)^2, -1),\n (0, 0, 0, E(3)^2, -E(3)), (0, 0, 0, E(3), -E(3)^2),\n (0, 0, 0, -E(3)^2, E(3)), (0, 0, 0, -1, E(3)^2),\n (0, 0, 0, -E(3), E(3)^2), (0, 0, 0, E(3)^2, -E(3)^2),\n (0, 0, 0, -E(3)^2, E(3)^2)]\n '
roots = [vector(sage_eval(str(root).replace('^', '**'))) for root in self._gap_group.roots]
for v in roots:
v.set_immutable()
return roots
@cached_method
def braid_relations(self):
'\n Return the braid relations of ``self``.\n\n EXAMPLES::\n\n sage: W = ReflectionGroup((1,1,3))\n sage: W.braid_relations()\n [[[1, 2, 1], [2, 1, 2]]]\n\n sage: W = ReflectionGroup((2,1,3))\n sage: W.braid_relations()\n [[[1, 2, 1, 2], [2, 1, 2, 1]], [[1, 3], [3, 1]], [[2, 3, 2], [3, 2, 3]]]\n\n sage: W = ReflectionGroup((2,2,3))\n sage: W.braid_relations()\n [[[1, 2, 1], [2, 1, 2]], [[1, 3], [3, 1]], [[2, 3, 2], [3, 2, 3]]]\n '
if self.is_real():
return super().braid_relations()
else:
return self._gap_group.BraidRelations().sage()
@cached_method
def fundamental_invariants(self):
'\n Return the fundamental invariants of ``self``.\n\n EXAMPLES::\n\n sage: W = ReflectionGroup((1,1,3))\n sage: W.fundamental_invariants()\n (-2*x0^2 + 2*x0*x1 - 2*x1^2, 6*x0^2*x1 - 6*x0*x1^2)\n\n sage: W = ReflectionGroup((3,1,2))\n sage: W.fundamental_invariants()\n (x0^3 + x1^3, x0^3*x1^3)\n '
import re
from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
if (not self.is_irreducible()):
return sum([W.fundamental_invariants() for W in self.irreducible_components()], tuple())
I = [str(p) for p in gap3(('List(Invariants(%s),x->ApplyFunc(x,List([0..%s],i->Mvp(SPrint("x",i)))))' % (self._gap_group._name, (self.rank() - 1))))]
P = PolynomialRing(QQ, [('x%s' % i) for i in range(self.rank())])
x = P.gens()
for i in range(len(I)):
I[i] = I[i].replace('^', '**')
I[i] = re.compile('E(\\d\\d*)').sub('E(\\1)', I[i])
I[i] = re.compile('(\\d)E\\(').sub('\\1*E(', I[i])
for j in range(len(x)):
I[i] = I[i].replace(('x%s' % j), ('*x[%s]' % j))
I[i] = I[i].replace('+*', '+').replace('-*', '-').replace('ER(5)', '*(E(5)-E(5)**2-E(5)**3+E(5)**4)').lstrip('*')
I = [sage_eval(p, locals={'x': x}) for p in I]
return tuple(sorted(I, key=(lambda f: f.degree())))
@cached_method
def jacobian_of_fundamental_invariants(self, invs=None):
"\n Return the matrix `[ \\partial_{x_i} F_j ]`, where ``invs`` are\n are any polynomials `F_1,\\ldots,F_n` in `x_1,\\ldots,x_n`.\n\n INPUT:\n\n - ``invs`` -- (default: the fundamental invariants) the polynomials\n `F_1, \\ldots, F_n`\n\n EXAMPLES::\n\n sage: W = ReflectionGroup(['A',2])\n sage: W.fundamental_invariants()\n (-2*x0^2 + 2*x0*x1 - 2*x1^2, 6*x0^2*x1 - 6*x0*x1^2)\n\n sage: W.jacobian_of_fundamental_invariants()\n [ -4*x0 + 2*x1 2*x0 - 4*x1]\n [12*x0*x1 - 6*x1^2 6*x0^2 - 12*x0*x1]\n "
if (invs is None):
invs = self.fundamental_invariants()
P = invs[0].parent()
X = P.gens()
return Matrix(P, [[P(g).derivative(x) for x in X] for g in invs])
@cached_method
def primitive_vector_field(self, invs=None):
"\n Return the primitive vector field of ``self`` is irreducible and\n well-generated.\n\n The primitive vector field is given as the coefficients (being rational\n functions) in the basis `\\partial_{x_1}, \\ldots, \\partial_{x_n}`.\n\n This is the partial derivation along the unique invariant of\n degree given by the Coxeter number. It can be computed as the\n row of the inverse of the Jacobian given by the highest degree.\n\n EXAMPLES::\n\n sage: W = ReflectionGroup(['A',2])\n sage: W.primitive_vector_field()\n (3*x1/(6*x0^2 - 6*x0*x1 - 12*x1^2), 1/(6*x0^2 - 6*x0*x1 - 12*x1^2))\n "
if (not self.is_irreducible()):
raise ValueError('only possible for irreducible complex reflection groups')
if (not self.is_well_generated()):
raise ValueError('only possible for well-generated complex reflection groups')
h = self.coxeter_number()
if (invs is None):
invs = self.fundamental_invariants()
degs = [f.degree() for f in invs]
J = self.jacobian_of_fundamental_invariants(invs)
return J.inverse().row(degs.index(h))
def apply_vector_field(self, f, vf=None):
"\n Returns a rational function obtained by applying the vector\n field ``vf`` to the rational function ``f``.\n\n If ``vf`` is not given, the primitive vector field is used.\n\n EXAMPLES::\n\n sage: W = ReflectionGroup(['A',2])\n sage: for x in W.primitive_vector_field()[0].parent().gens():\n ....: print(W.apply_vector_field(x))\n 3*x1/(6*x0^2 - 6*x0*x1 - 12*x1^2)\n 1/(6*x0^2 - 6*x0*x1 - 12*x1^2)\n "
if (vf is None):
vf = self.primitive_vector_field()
return sum(((vf[i] * f.derivative(gen)) for (i, gen) in enumerate(f.parent().gens())))
def cartan_matrix(self):
"\n Return the Cartan matrix associated with ``self``.\n\n If ``self`` is crystallographic, the returned Cartan matrix is\n an instance of :class:`CartanMatrix`, and a normal matrix\n otherwise.\n\n Let `s_1, \\ldots, s_n` be a set of reflections which generate\n ``self`` with associated simple roots `s_1,\\ldots,s_n` and\n simple coroots `s^\\vee_i`. Then the Cartan matrix `C = (c_{ij})`\n is given by `s^\\vee_i(s_j)`. The Cartan matrix completely\n determines the reflection representation if the `s_i` are\n linearly independent.\n\n EXAMPLES::\n\n sage: ReflectionGroup(['A',4]).cartan_matrix()\n [ 2 -1 0 0]\n [-1 2 -1 0]\n [ 0 -1 2 -1]\n [ 0 0 -1 2]\n\n sage: ReflectionGroup(['H',4]).cartan_matrix()\n [ 2 E(5)^2 + E(5)^3 0 0]\n [E(5)^2 + E(5)^3 2 -1 0]\n [ 0 -1 2 -1]\n [ 0 0 -1 2]\n\n sage: ReflectionGroup(4).cartan_matrix()\n [-2*E(3) - E(3)^2 E(3)^2]\n [ -E(3)^2 -2*E(3) - E(3)^2]\n\n sage: ReflectionGroup((4,2,2)).cartan_matrix()\n [ 2 -2*E(4) -2]\n [ E(4) 2 1 - E(4)]\n [ -1 1 + E(4) 2]\n "
if self.is_crystallographic():
from sage.combinat.root_system.cartan_matrix import CartanMatrix as CartanMat
else:
from sage.matrix.constructor import Matrix as CartanMat
return CartanMat(self._gap_group.CartanMat().sage())
def invariant_form(self, brute_force=False):
'\n Return the form that is invariant under the action of ``self``.\n\n This is unique only up to a global scalar on the irreducible\n components.\n\n INPUT:\n\n - ``brute_force`` -- if ``True``, the computation is done by\n applying the Reynolds operator; this is, the invariant form\n of `e_i` and `e_j` is computed as the sum\n `\\langle w(e_i), w(e_j)\\rangle`, where\n `\\langle \\cdot, \\cdot\\rangle` is the standard scalar product\n\n EXAMPLES::\n\n sage: W = ReflectionGroup([\'A\',3])\n sage: F = W.invariant_form(); F\n [ 1 -1/2 0]\n [-1/2 1 -1/2]\n [ 0 -1/2 1]\n\n To check that this is indeed the invariant form, see::\n\n sage: S = W.simple_reflections()\n sage: all( F == S[i].matrix()*F*S[i].matrix().transpose() for i in W.index_set() )\n True\n\n sage: W = ReflectionGroup([\'B\',3])\n sage: F = W.invariant_form(); F\n [ 1 -1 0]\n [-1 2 -1]\n [ 0 -1 2]\n sage: w = W.an_element().to_matrix()\n sage: w * F * w.transpose().conjugate() == F\n True\n\n sage: S = W.simple_reflections()\n sage: all( F == S[i].matrix()*F*S[i].matrix().transpose() for i in W.index_set() )\n True\n\n sage: W = ReflectionGroup((3,1,2))\n sage: F = W.invariant_form(); F\n [1 0]\n [0 1]\n\n sage: S = W.simple_reflections()\n sage: all( F == S[i].matrix()*F*S[i].matrix().transpose().conjugate() for i in W.index_set() )\n True\n\n It also worked for badly generated groups::\n\n sage: W = ReflectionGroup(7)\n sage: W.is_well_generated()\n False\n\n sage: F = W.invariant_form(); F\n [1 0]\n [0 1]\n sage: S = W.simple_reflections()\n sage: all( F == S[i].matrix()*F*S[i].matrix().transpose().conjugate() for i in W.index_set() )\n True\n\n And also for reducible types::\n\n sage: W = ReflectionGroup([\'B\',3],(4,2,3),4,7); W\n Reducible complex reflection group of rank 10 and type B3 x G(4,2,3) x ST4 x ST7\n sage: F = W.invariant_form(); S = W.simple_reflections()\n sage: all( F == S[i].matrix()*F*S[i].matrix().transpose().conjugate() for i in W.index_set() )\n True\n\n TESTS::\n\n sage: tests = [[\'A\',3],[\'B\',3],[\'F\',4],(4,2,2),4,7]\n sage: for ty in tests:\n ....: W = ReflectionGroup(ty)\n ....: A = W.invariant_form()\n ....: B = W.invariant_form(brute_force=True)\n ....: print("{} {}".format(ty, A == B/B[0,0]))\n [\'A\', 3] True\n [\'B\', 3] True\n [\'F\', 4] True\n (4, 2, 2) True\n 4 True\n 7 True\n '
if brute_force:
form = self._invariant_form_brute_force()
else:
n = self.rank()
from sage.matrix.constructor import zero_matrix
if self.is_crystallographic():
ring = QQ
else:
from sage.rings.universal_cyclotomic_field import UniversalCyclotomicField
ring = UniversalCyclotomicField()
form = zero_matrix(ring, n, n)
C = self.cartan_matrix()
if (not self.is_well_generated()):
indep_inds = sorted((self._index_set_inverse[key] for key in self.independent_roots().keys()))
C = C.matrix_from_rows_and_columns(indep_inds, indep_inds)
for j in range(n):
for i in range(j):
if (C[(j, i)] != 0):
form[(j, j)] = ((form[(i, i)] * (C[(i, j)] * C[(j, j)].conjugate())) / (C[(j, i)].conjugate() * C[(i, i)]))
if (form[(j, j)] == 0):
form[(j, j)] = ring.one()
for j in range(n):
for i in range(j):
form[(j, i)] = ((C[(i, j)] * form[(i, i)]) / C[(i, i)])
form[(i, j)] = form[(j, i)].conjugate()
B = self.base_change_matrix()
form = ((B * form) * B.conjugate().transpose())
form /= form[(0, 0)]
try:
form = form.change_ring(QQ)
except TypeError:
pass
else:
try:
form = form.change_ring(ZZ)
except TypeError:
pass
form.set_immutable()
return form
def _invariant_form_brute_force(self):
'\n Return the form that is invariant under the action of ``self``.\n\n This brute force algorithm is only kept for possible testing.\n\n EXAMPLES::\n\n sage: W = ReflectionGroup((3,1,2))\n sage: W._invariant_form_brute_force()\n [1 0]\n [0 1]\n '
from sage.rings.universal_cyclotomic_field import E
base_change = self.base_change_matrix()
Delta = tuple(self.independent_roots())
basis_is_Delta = base_change.is_one()
if (not basis_is_Delta):
Delta = [(beta * base_change) for beta in Delta]
S = self.simple_reflections()
n = self.rank()
def action_on_root(w, beta):
if basis_is_Delta:
return w.action_on_root(beta)
else:
return (beta * w.to_matrix())
@cached_function
def invariant_value(i, j):
if (i > j):
return invariant_value(j, i).conjugate()
val = sum(((action_on_root(w, Delta[i]) * action_on_root(w, Delta[j]).conjugate()) for w in self))
if (val in QQ):
val = QQ(val)
return val
coeffs = []
for i in self.index_set():
coeff = (1 - E(S[i].order()))
if (coeff in QQ):
coeff = QQ(coeff)
coeffs.append(coeff)
return Matrix([[(invariant_value(i, j) / self.cardinality()) for j in range(n)] for i in range(n)])
def invariant_form_standardization(self):
'\n Return the transformation of the space that turns the invariant\n form of ``self`` into the standard scalar product.\n\n Let `I` be the invariant form of a complex reflection group, and\n let `A` be the Hermitian matrix such that `A^2 = I`. The matrix\n `A` defines a change of basis such that the identity matrix is\n the invariant form. Indeed, we have\n\n .. MATH::\n\n (A^{-1} x A) \\mathcal{I} (A^{-1} y A)^* = A^{-1} x I y^* A^{-1}\n = A^{-1} I A^{-1} = \\mathcal{I},\n\n where `\\mathcal{I}` is the identity matrix.\n\n EXAMPLES::\n\n sage: W = ReflectionGroup((4,2,5))\n sage: I = W.invariant_form()\n sage: A = W.invariant_form_standardization()\n sage: A^2 == I\n True\n\n TESTS::\n\n sage: W = ReflectionGroup(9)\n sage: A = W.invariant_form_standardization()\n sage: S = W.simple_reflections()\n sage: Ainv = A.inverse()\n sage: T = {i: Ainv * S[i] * A for i in W.index_set()}\n sage: all(T[i] * T[i].conjugate_transpose()\n ....: == 1 for i in W.index_set() )\n True\n '
return self.invariant_form().principal_square_root()
def set_reflection_representation(self, refl_repr=None):
'\n Set the reflection representation of ``self``.\n\n INPUT:\n\n - ``refl_repr`` -- a dictionary representing the matrices of the\n generators of ``self`` with keys given by the index set, or\n ``None`` to reset to the default reflection representation\n\n EXAMPLES::\n\n sage: W = ReflectionGroup((1,1,3))\n sage: for w in W: w.to_matrix(); print("-----")\n [1 0]\n [0 1]\n -----\n [ 1 1]\n [ 0 -1]\n -----\n [-1 0]\n [ 1 1]\n -----\n [-1 -1]\n [ 1 0]\n -----\n [ 0 1]\n [-1 -1]\n -----\n [ 0 -1]\n [-1 0]\n -----\n\n sage: W.set_reflection_representation({1: matrix([[0,1,0],[1,0,0],[0,0,1]]), 2: matrix([[1,0,0],[0,0,1],[0,1,0]])})\n sage: for w in W: w.to_matrix(); print("-----")\n [1 0 0]\n [0 1 0]\n [0 0 1]\n -----\n [1 0 0]\n [0 0 1]\n [0 1 0]\n -----\n [0 1 0]\n [1 0 0]\n [0 0 1]\n -----\n [0 0 1]\n [1 0 0]\n [0 1 0]\n -----\n [0 1 0]\n [0 0 1]\n [1 0 0]\n -----\n [0 0 1]\n [0 1 0]\n [1 0 0]\n -----\n sage: W.set_reflection_representation()\n '
if ((refl_repr is None) or (set(refl_repr) == set(self.index_set()))):
self._reflection_representation = refl_repr
else:
raise ValueError('the reflection representation must be defined for the complete index set')
def fake_degrees(self):
'\n Return the list of the fake degrees associated to ``self``.\n\n The fake degrees are `q`-versions of the degree of the character.\n In particular, they sum to Hilbert series of the coinvariant\n algebra of ``self``.\n\n .. NOTE::\n\n The ordering follows the one in Chevie and is not compatible with\n the current implementation of :meth:`irredubile_characters()`.\n\n EXAMPLES::\n\n sage: W = ReflectionGroup(12)\n sage: W.fake_degrees()\n [1, q^12, q^11 + q, q^8 + q^4, q^7 + q^5, q^6 + q^4 + q^2,\n q^10 + q^8 + q^6, q^9 + q^7 + q^5 + q^3]\n\n sage: W = ReflectionGroup(["H",4])\n sage: W.cardinality()\n 14400\n sage: sum(fdeg.subs(q=1)**2 for fdeg in W.fake_degrees())\n 14400\n '
from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
R = PolynomialRing(ZZ, 'q')
fake_deg_list = []
gap_fak_deg = gap3.FakeDegrees(self._gap_group, 'X(Rationals)')
for fake_poly in gap_fak_deg:
fake_coef = fake_poly.coefficients.sage()
coeffs = ([ZZ.zero()] * ((fake_poly.Degree().sage() - len(fake_coef)) + 1))
coeffs.extend(fake_coef)
fake_deg_list.append(R(coeffs))
return fake_deg_list
def coxeter_number(self, chi=None):
'\n Return the Coxeter number associated to the irreducible character\n chi of the reflection group ``self``.\n\n The *Coxeter number* of a complex reflection group `W` is the trace\n in a character `\\chi` of `\\sum_t (Id - t)`, where `t` runs over all\n reflections. The result is always an integer.\n\n When `\\chi` is the reflection representation, the Coxeter number\n is equal to `\\frac{N + N^*}{n}` where `N` is the number of\n reflections, `N^*` is the number of reflection hyperplanes, and\n `n` is the rank of `W`. If `W` is further well-generated, the\n Coxeter number is equal to the highest degree d_n and to the\n order of a Coxeter element `c` of `W`.\n\n EXAMPLES::\n\n sage: W = ReflectionGroup(["H",4])\n sage: W.coxeter_number()\n 30\n sage: all(W.coxeter_number(chi).is_integer()\n ....: for chi in W.irreducible_characters())\n True\n sage: W = ReflectionGroup(14)\n sage: W.coxeter_number()\n 24\n '
if (chi is None):
return super().coxeter_number()
G = self.gens()
cox_chi = 0
gap_hyp_rec = self._gap_group.HyperplaneOrbits()
for rec in gap_hyp_rec:
for k in range(1, int(rec.e_s)):
cox_chi += (chi((G[(int(rec.s) - 1)] ** k)) * rec.N_s.sage())
return (self.number_of_reflections() - (cox_chi // chi.degree()))
class Element(ComplexReflectionGroupElement):
def conjugacy_class_representative(self):
"\n Return a representative of the conjugacy class of ``self``.\n\n EXAMPLES::\n\n sage: W = ReflectionGroup((1,1,3))\n sage: for w in W:\n ....: print('%s %s'%(w.reduced_word(), w.conjugacy_class_representative().reduced_word()))\n [] []\n [2] [1]\n [1] [1]\n [1, 2] [1, 2]\n [2, 1] [1, 2]\n [1, 2, 1] [1]\n "
W = self.parent()
for w in W._conjugacy_classes:
if (self in W._conjugacy_classes[w]):
return w
return W.conjugacy_classes_representatives()[(gap3(('PositionClass(%s,%s)' % (W._gap_group._name, self))).sage() - 1)]
def conjugacy_class(self):
'\n Return the conjugacy class of ``self``.\n\n EXAMPLES::\n\n sage: W = ReflectionGroup((1,1,3))\n sage: for w in W: sorted(w.conjugacy_class())\n [()]\n [(1,3)(2,5)(4,6), (1,4)(2,3)(5,6), (1,5)(2,4)(3,6)]\n [(1,3)(2,5)(4,6), (1,4)(2,3)(5,6), (1,5)(2,4)(3,6)]\n [(1,2,6)(3,4,5), (1,6,2)(3,5,4)]\n [(1,2,6)(3,4,5), (1,6,2)(3,5,4)]\n [(1,3)(2,5)(4,6), (1,4)(2,3)(5,6), (1,5)(2,4)(3,6)]\n '
W = self.parent()
if (self not in W.conjugacy_classes_representatives()):
self = self.conjugacy_class_representative()
if (self in W._conjugacy_classes):
return W._conjugacy_classes[self]
gens = W.simple_reflections()
count = 0
orbit = [self]
orbit_set = set(orbit)
while (count < len(orbit)):
w = orbit[count]
count += 1
for s in gens:
w_new = ((s * w) * (s ** (- 1)))
if (w_new not in orbit_set):
orbit.append(w_new)
orbit_set.add(w_new)
orbit_set = frozenset(orbit_set)
W._conjugacy_classes[self] = orbit_set
return orbit_set
def reflection_length(self, in_unitary_group=False):
'\n Return the reflection length of ``self``.\n\n This is the minimal numbers of reflections needed to obtain\n ``self``.\n\n INPUT:\n\n - ``in_unitary_group`` -- (default: ``False``) if ``True``,\n the reflection length is computed in the unitary group\n which is the dimension of the move space of ``self``\n\n EXAMPLES::\n\n sage: W = ReflectionGroup((1,1,3))\n sage: sorted([t.reflection_length() for t in W])\n [0, 1, 1, 1, 2, 2]\n\n sage: W = ReflectionGroup((2,1,2))\n sage: sorted([t.reflection_length() for t in W])\n [0, 1, 1, 1, 1, 2, 2, 2]\n\n sage: W = ReflectionGroup((2,2,2))\n sage: sorted([t.reflection_length() for t in W])\n [0, 1, 1, 2]\n\n sage: W = ReflectionGroup((3,1,2))\n sage: sorted([t.reflection_length() for t in W])\n [0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]\n '
W = self.parent()
if (self in W.conjugacy_classes_representatives()):
if (in_unitary_group or W.is_real()):
return (W.rank() - self.reflection_eigenvalues(is_class_representative=True).count(0))
else:
return len(self.reduced_word_in_reflections())
else:
w = self.conjugacy_class_representative()
assert (w in self.parent().conjugacy_classes_representatives())
return w.reflection_length(in_unitary_group=in_unitary_group)
|
class IrreducibleComplexReflectionGroup(ComplexReflectionGroup):
def _repr_(self):
'\n Return the string representation of ``self``.\n\n EXAMPLES::\n\n sage: W = ReflectionGroup((1,1,3)); W\n Irreducible real reflection group of rank 2 and type A2\n sage: W = ReflectionGroup((3,1,4)); W\n Irreducible complex reflection group of rank 4 and type G(3,1,4)\n '
type_str = self._irrcomp_repr_(self._type[0])
return ('Irreducible complex reflection group of rank %s and type %s' % (self._rank, type_str))
class Element(ComplexReflectionGroup.Element):
def is_coxeter_element(self, which_primitive=1, is_class_representative=False):
"\n Return ``True`` if ``self`` is a Coxeter element.\n\n This is, whether ``self`` has an eigenvalue that is a\n primitive `h`-th root of unity.\n\n INPUT:\n\n - ``which_primitive`` -- (default:``1``) for which power of\n the first primitive ``h``-th root of unity to look as a\n reflection eigenvalue for a regular element\n\n - ``is_class_representative`` -- boolean (default ``True``) whether\n to compute instead on the conjugacy class representative\n\n .. SEEALSO::\n\n :meth:`~IrreducibleComplexReflectionGroup.coxeter_element`\n :meth:`~sage.categories.finite_complex_reflection_groups.coxeter_elements`\n\n EXAMPLES::\n\n sage: W = ReflectionGroup((1,1,3))\n sage: for w in W:\n ....: print('%s %s'%(w.reduced_word(), w.is_coxeter_element()))\n [] False\n [2] False\n [1] False\n [1, 2] True\n [2, 1] True\n [1, 2, 1] False\n "
if ((not self.parent().is_irreducible()) or (not self.parent().is_well_generated())):
raise ValueError('this method is available for elements in irreducible, well-generated complex reflection groups')
h = self.parent().coxeter_number()
return any((((QQ(ev).denom() == h) and (QQ(ev).numer() == which_primitive)) for ev in self.reflection_eigenvalues(is_class_representative=is_class_representative)))
def is_h_regular(self, is_class_representative=False):
"\n Return whether ``self`` is regular.\n\n This is if ``self`` has an eigenvector with eigenvalue `h`\n and which does not lie in any reflection hyperplane.\n Here, `h` denotes the Coxeter number.\n\n EXAMPLES::\n\n sage: W = ReflectionGroup((1,1,3))\n sage: for w in W:\n ....: print('%s %s'%(w.reduced_word(), w.is_h_regular()))\n [] False\n [2] False\n [1] False\n [1, 2] True\n [2, 1] True\n [1, 2, 1] False\n "
if ((not self.parent().is_irreducible()) or (not self.parent().is_well_generated())):
raise ValueError('This method is available for elements in irreducible, well-generated complex reflection groups')
h = self.parent().coxeter_number()
return any(((QQ(ev).denom() == h) for ev in self.reflection_eigenvalues(is_class_representative=is_class_representative)))
def is_regular(self, h, is_class_representative=False):
'\n Return whether ``self`` is regular.\n\n This is, if ``self`` has an eigenvector with eigenvalue of order\n ``h`` and which does not lie in any reflection hyperplane.\n\n INPUT:\n\n - ``h`` -- the order of the eigenvalue\n - ``is_class_representative`` -- boolean (default ``True``) whether\n to compute instead on the conjugacy class representative\n\n EXAMPLES::\n\n sage: W = ReflectionGroup((1,1,3))\n sage: h = W.coxeter_number()\n sage: for w in W:\n ....: print("{} {}".format(w.reduced_word(), w.is_regular(h)))\n [] False\n [2] False\n [1] False\n [1, 2] True\n [2, 1] True\n [1, 2, 1] False\n\n sage: W = ReflectionGroup(23); h = W.coxeter_number()\n sage: for w in W:\n ....: if w.is_regular(h):\n ....: w.reduced_word()\n [1, 2, 3]\n [2, 1, 3]\n [1, 3, 2]\n [3, 2, 1]\n [2, 1, 2, 3, 2]\n [2, 3, 2, 1, 2]\n [1, 2, 1, 2, 3, 2, 1]\n [1, 2, 3, 2, 1, 2, 1]\n [1, 2, 1, 2, 3, 2, 1, 2, 3]\n [2, 1, 2, 1, 3, 2, 1, 2, 3]\n [2, 1, 2, 3, 2, 1, 2, 1, 3]\n [1, 2, 3, 2, 1, 2, 1, 3, 2]\n [3, 2, 1, 2, 1, 3, 2, 1, 2]\n [1, 2, 1, 2, 1, 3, 2, 1, 2]\n [2, 3, 2, 1, 2, 1, 3, 2, 1]\n [2, 1, 2, 1, 3, 2, 1, 2, 1]\n [2, 3, 2, 1, 2, 1, 3, 2, 1, 2, 3]\n [1, 3, 2, 1, 2, 1, 3, 2, 1, 2, 3]\n [1, 2, 1, 2, 1, 3, 2, 1, 2, 1, 3]\n [1, 2, 1, 2, 3, 2, 1, 2, 1, 3, 2]\n [1, 2, 3, 2, 1, 2, 1, 3, 2, 1, 2]\n [2, 1, 2, 3, 2, 1, 2, 1, 3, 2, 1]\n [2, 1, 2, 3, 2, 1, 2, 1, 3, 2, 1, 2, 3]\n [1, 2, 1, 3, 2, 1, 2, 1, 3, 2, 1, 2, 3]\n\n Check that :trac:`25478` is fixed::\n\n sage: W = ReflectionGroup(["A",5])\n sage: w = W.from_reduced_word([1,2,3,5])\n sage: w.is_regular(4)\n False\n sage: W = ReflectionGroup(["A",3])\n sage: len([w for w in W if w.is_regular(w.order())])\n 18\n '
from sage.rings.universal_cyclotomic_field import UniversalCyclotomicField, E
evs = self.reflection_eigenvalues(is_class_representative=is_class_representative)
P = self.parent()
I = identity_matrix(P.rank())
UCF = UniversalCyclotomicField()
mat = self.to_matrix().transpose()
for ev in evs:
ev = QQ(ev)
if (h == ev.denom()):
M = (mat - (E(ev.denom(), ev.numer()) * I))
if all(((not M.right_kernel().is_subspace(H.change_ring(UCF))) for H in P.reflection_hyperplanes())):
return True
return False
|
def multi_partitions(n, S, i=None):
'\n Return all vectors as lists of the same length as ``S`` whose\n standard inner product with ``S`` equals ``n``.\n\n EXAMPLES::\n\n sage: from sage.combinat.root_system.reflection_group_complex import multi_partitions\n sage: multi_partitions(10, [2,3,3,4])\n [[5, 0, 0, 0],\n [3, 0, 0, 1],\n [2, 2, 0, 0],\n [2, 1, 1, 0],\n [2, 0, 2, 0],\n [1, 0, 0, 2],\n [0, 2, 0, 1],\n [0, 1, 1, 1],\n [0, 0, 2, 1]]\n '
if (i is None):
i = 0
S = sorted(S)
if (n == 0):
return [([0] * len(S))]
if (i == len(S)):
return []
k = S[i]
if (k > n):
return []
coeffs1 = multi_partitions((n - k), S, i)
coeffs2 = multi_partitions(n, S, (i + 1))
for coeff in coeffs1:
coeff[i] += 1
coeffs = (coeffs1 + coeffs2)
return coeffs
|
@cached_function
def power(f, k):
"\n Return `f^k` and caching all intermediate results.\n\n Speeds the computation if one has to compute `f^k`'s for many\n values of `k`.\n\n EXAMPLES::\n\n sage: P.<x,y,z> = PolynomialRing(QQ)\n sage: f = -2*x^2 + 2*x*y - 2*y^2 + 2*y*z - 2*z^2\n sage: all( f^k == power(f,k) for k in range(20) )\n True\n "
if (k == 1):
return f
b = [int(a) for a in reversed(ZZ(k).binary())]
if (sum(b) == 1):
if (b[1] == 1):
return (f ** 2)
else:
return (power(f, ((2 ** b.index(1)) / 2)) ** 2)
else:
return prod((power(f, (2 ** i)) for (i, a) in enumerate(b) if a))
|
def ReflectionGroup(*args, **kwds):
"\n Construct a finite (complex or real) reflection group as a Sage\n permutation group by fetching the permutation representation of the\n generators from chevie's database.\n\n INPUT:\n\n can be one or multiple of the following:\n\n - a triple `(r, p, n)` with `p` divides `r`, which denotes the group\n `G(r, p, n)`\n\n - an integer between `4` and `37`, which denotes an exceptional\n irreducible complex reflection group\n\n - a finite Cartan-Killing type\n\n EXAMPLES:\n\n Finite reflection groups can be constructed from\n\n Cartan-Killing classification types::\n\n sage: W = ReflectionGroup(['A',3]); W\n Irreducible real reflection group of rank 3 and type A3\n\n sage: W = ReflectionGroup(['H',4]); W\n Irreducible real reflection group of rank 4 and type H4\n\n sage: W = ReflectionGroup(['I',5]); W\n Irreducible real reflection group of rank 2 and type I2(5)\n\n the complex infinite family `G(r,p,n)` with `p` divides `r`::\n\n sage: W = ReflectionGroup((1,1,4)); W\n Irreducible real reflection group of rank 3 and type A3\n\n sage: W = ReflectionGroup((2,1,3)); W\n Irreducible real reflection group of rank 3 and type B3\n\n Chevalley-Shepard-Todd exceptional classification types::\n\n sage: W = ReflectionGroup(23); W\n Irreducible real reflection group of rank 3 and type H3\n\n Cartan types and matrices::\n\n sage: ReflectionGroup(CartanType(['A',2]))\n Irreducible real reflection group of rank 2 and type A2\n\n sage: ReflectionGroup(CartanType((['A',2],['A',2])))\n Reducible real reflection group of rank 4 and type A2 x A2\n\n sage: C = CartanMatrix(['A',2])\n sage: ReflectionGroup(C)\n Irreducible real reflection group of rank 2 and type A2\n\n multiples of the above::\n\n sage: W = ReflectionGroup(['A',2],['B',2]); W\n Reducible real reflection group of rank 4 and type A2 x B2\n\n sage: W = ReflectionGroup(['A',2],4); W\n Reducible complex reflection group of rank 4 and type A2 x ST4\n\n sage: W = ReflectionGroup((4,2,2),4); W\n Reducible complex reflection group of rank 4 and type G(4,2,2) x ST4\n "
if (not is_chevie_available()):
raise ImportError("the GAP3 package 'chevie' is needed to work with (complex) reflection groups")
from sage.interfaces.gap3 import gap3
gap3.load_package('chevie')
error_msg = 'the input data (%s) is not valid for reflection groups'
W_types = []
is_complex = False
for arg in args:
if isinstance(arg, list):
X = tuple(arg)
else:
X = arg
if (not (isinstance(X, (CartanType_abstract, tuple)) or ((X in ZZ) and (4 <= X <= 37)))):
raise ValueError((error_msg % X))
if isinstance(X, CartanType_abstract):
if (not X.is_finite()):
raise ValueError((error_msg % X))
if hasattr(X, 'cartan_type'):
X = X.cartan_type()
if X.is_irreducible():
W_types.extend([(X.letter, X.n)])
else:
W_types.extend([(x.letter, x.n) for x in X.component_types()])
elif ((X == (2, 2, 2)) or (X == ('I', 2))):
W_types.extend([('A', 1), ('A', 1)])
elif (X == (2, 2, 3)):
W_types.extend([('A', 3)])
else:
W_types.append(X)
for (i, W_type) in enumerate(W_types):
if (W_type in ZZ):
if (W_type == 23):
W_types[i] = ('H', 3)
elif (W_type == 28):
W_types[i] = ('F', 4)
elif (W_type == 30):
W_types[i] = ('H', 4)
elif (W_type == 35):
W_types[i] = ('E', 6)
elif (W_type == 36):
W_types[i] = ('E', 7)
elif (W_type == 37):
W_types[i] = ('E', 8)
if (isinstance(W_type, tuple) and (len(W_type) == 3)):
if (W_type[0] == W_type[1] == 1):
W_types[i] = ('A', (W_type[2] - 1))
elif ((W_type[0] == 2) and (W_type[1] == 1)):
W_types[i] = ('B', W_type[2])
elif (W_type[0] == W_type[1] == 2):
W_types[i] = ('D', W_type[2])
elif ((W_type[0] == W_type[1]) and (W_type[2] == 2)):
W_types[i] = ('I', W_type[0])
W_type = W_types[i]
if ((W_type in ZZ) or (isinstance(W_type, tuple) and (len(W_type) == 3))):
is_complex = True
for index_set_kwd in ['index_set', 'hyperplane_index_set', 'reflection_index_set']:
index_set = kwds.get(index_set_kwd, None)
if (index_set is not None):
if isinstance(index_set, (list, tuple)):
kwds[index_set_kwd] = tuple(index_set)
else:
raise ValueError(('the keyword %s must be a list or tuple' % index_set_kwd))
if (len(W_types) == 1):
if (is_complex is True):
cls = IrreducibleComplexReflectionGroup
else:
cls = IrreducibleRealReflectionGroup
elif (is_complex is True):
cls = ComplexReflectionGroup
else:
cls = RealReflectionGroup
return cls(tuple(W_types), index_set=kwds.get('index_set', None), hyperplane_index_set=kwds.get('hyperplane_index_set', None), reflection_index_set=kwds.get('reflection_index_set', None))
|
@cached_function
def is_chevie_available():
'\n Test whether the GAP3 Chevie package is available.\n\n EXAMPLES::\n\n sage: # needs sage.groups\n sage: from sage.combinat.root_system.reflection_group_real import is_chevie_available\n sage: is_chevie_available() # random\n False\n sage: is_chevie_available() in [True, False]\n True\n '
try:
from sage.interfaces.gap3 import gap3
gap3._start()
gap3.load_package('chevie')
return True
except Exception:
return False
|
class RealReflectionGroup(ComplexReflectionGroup):
'\n A real reflection group given as a permutation group.\n\n .. SEEALSO::\n\n :func:`ReflectionGroup`\n '
def __init__(self, W_types, index_set=None, hyperplane_index_set=None, reflection_index_set=None):
"\n Initialize ``self``.\n\n TESTS::\n\n sage: W = ReflectionGroup(['A',3])\n sage: TestSuite(W).run()\n "
W_types = tuple([(tuple(W_type) if isinstance(W_type, (list, tuple)) else W_type) for W_type in W_types])
cartan_types = []
for W_type in W_types:
W_type = CartanType(W_type)
if ((not W_type.is_finite()) or (not W_type.is_irreducible())):
raise ValueError('the given Cartan type of a component is not irreducible and finite')
cartan_types.append(W_type)
if (len(W_types) == 1):
cls = IrreducibleComplexReflectionGroup
else:
cls = ComplexReflectionGroup
cls.__init__(self, W_types, index_set=index_set, hyperplane_index_set=hyperplane_index_set, reflection_index_set=reflection_index_set)
def _repr_(self):
"\n Return the string representation of ``self``.\n\n EXAMPLES::\n\n sage: W = ReflectionGroup(['A',3],['B',2],['I',5],['I',6])\n sage: W._repr_()\n 'Reducible real reflection group of rank 9 and type A3 x B2 x I2(5) x G2'\n "
type_str = ''
for W_type in self._type:
type_str += self._irrcomp_repr_(W_type)
type_str += ' x '
type_str = type_str[:(- 3)]
return ('Reducible real reflection group of rank %s and type %s' % (self._rank, type_str))
def iteration(self, algorithm='breadth', tracking_words=True):
'\n Return an iterator going through all elements in ``self``.\n\n INPUT:\n\n - ``algorithm`` (default: ``\'breadth\'``) -- must be one of\n the following:\n\n * ``\'breadth\'`` - iterate over in a linear extension of the\n weak order\n * ``\'depth\'`` - iterate by a depth-first-search\n * ``\'parabolic\'`` - iterate by using parabolic subgroups\n\n - ``tracking_words`` (default: ``True``) -- whether or not to keep\n track of the reduced words and store them in ``_reduced_word``\n\n .. NOTE::\n\n The fastest iteration is the parabolic iteration and the\n depth first algorithm without tracking words is second.\n In particular, ``\'depth\'`` is ~1.5x faster than ``\'breadth\'``.\n\n .. NOTE::\n\n The ``\'parabolic\'`` iteration does not track words and requires\n keeping the subgroup corresponding to `I \\setminus \\{i\\}` in\n memory (for each `i` individually).\n\n EXAMPLES::\n\n sage: W = ReflectionGroup(["B",2])\n\n sage: for w in W.iteration("breadth",True):\n ....: print("%s %s"%(w, w._reduced_word))\n () []\n (1,3)(2,6)(5,7) [1]\n (1,5)(2,4)(6,8) [0]\n (1,7,5,3)(2,4,6,8) [0, 1]\n (1,3,5,7)(2,8,6,4) [1, 0]\n (2,8)(3,7)(4,6) [1, 0, 1]\n (1,7)(3,5)(4,8) [0, 1, 0]\n (1,5)(2,6)(3,7)(4,8) [0, 1, 0, 1]\n\n sage: for w in W.iteration("depth", False): w\n ()\n (1,3)(2,6)(5,7)\n (1,5)(2,4)(6,8)\n (1,3,5,7)(2,8,6,4)\n (1,7)(3,5)(4,8)\n (1,7,5,3)(2,4,6,8)\n (2,8)(3,7)(4,6)\n (1,5)(2,6)(3,7)(4,8)\n '
from sage.combinat.root_system.reflection_group_c import Iterator
return iter(Iterator(self, N=self.number_of_reflections(), algorithm=algorithm, tracking_words=tracking_words))
def __iter__(self):
'\n Return an iterator going through all elements in ``self``.\n\n For options and faster iteration see :meth:`iteration`.\n\n EXAMPLES::\n\n sage: W = ReflectionGroup(["B",2])\n\n sage: for w in W: print("%s %s"%(w, w._reduced_word))\n () []\n (1,3)(2,6)(5,7) [1]\n (1,5)(2,4)(6,8) [0]\n (1,7,5,3)(2,4,6,8) [0, 1]\n (1,3,5,7)(2,8,6,4) [1, 0]\n (2,8)(3,7)(4,6) [1, 0, 1]\n (1,7)(3,5)(4,8) [0, 1, 0]\n (1,5)(2,6)(3,7)(4,8) [0, 1, 0, 1]\n '
return self.iteration(algorithm='breadth', tracking_words=True)
@cached_method
def bipartite_index_set(self):
'\n Return the bipartite index set of a real reflection group.\n\n EXAMPLES::\n\n sage: W = ReflectionGroup(["A",5])\n sage: W.bipartite_index_set()\n [[1, 3, 5], [2, 4]]\n\n sage: W = ReflectionGroup(["A",5],index_set=[\'a\',\'b\',\'c\',\'d\',\'e\'])\n sage: W.bipartite_index_set()\n [[\'a\', \'c\', \'e\'], [\'b\', \'d\']]\n '
(L, R) = self._gap_group.BipartiteDecomposition().sage()
inv = self._index_set_inverse
L = [i for i in self._index_set if ((inv[i] + 1) in L)]
R = [i for i in self._index_set if ((inv[i] + 1) in R)]
return [L, R]
def cartan_type(self):
"\n Return the Cartan type of ``self``.\n\n EXAMPLES::\n\n sage: W = ReflectionGroup(['A',3])\n sage: W.cartan_type()\n ['A', 3]\n\n sage: W = ReflectionGroup(['A',3], ['B',3])\n sage: W.cartan_type()\n A3xB3 relabelled by {1: 3, 2: 2, 3: 1}\n\n TESTS:\n\n Check that dihedral types are handled properly::\n\n sage: W = ReflectionGroup(['I',3]); W\n Irreducible real reflection group of rank 2 and type A2\n\n sage: W = ReflectionGroup(['I',4]); W\n Irreducible real reflection group of rank 2 and type C2\n\n sage: W = ReflectionGroup(['I',5]); W\n Irreducible real reflection group of rank 2 and type I2(5)\n "
if (len(self._type) == 1):
ct = self._type[0]
if (ct['series'] == 'I'):
C = CartanType([ct['series'], ct['bond']])
else:
C = CartanType([ct['series'], ct['rank']])
CG = C.coxeter_diagram()
G = self.coxeter_diagram()
return C.relabel(CG.is_isomorphic(G, edge_labels=True, certificate=True)[1])
else:
return CartanType([W.cartan_type() for W in self.irreducible_components()])
def positive_roots(self):
"\n Return the positive roots of ``self``.\n\n EXAMPLES::\n\n sage: W = ReflectionGroup(['A',3], ['B',2])\n sage: W.positive_roots()\n [(1, 0, 0, 0, 0),\n (0, 1, 0, 0, 0),\n (0, 0, 1, 0, 0),\n (0, 0, 0, 1, 0),\n (0, 0, 0, 0, 1),\n (1, 1, 0, 0, 0),\n (0, 1, 1, 0, 0),\n (0, 0, 0, 1, 1),\n (1, 1, 1, 0, 0),\n (0, 0, 0, 2, 1)]\n\n sage: W = ReflectionGroup(['A',3])\n sage: W.positive_roots()\n [(1, 0, 0), (0, 1, 0), (0, 0, 1), (1, 1, 0), (0, 1, 1), (1, 1, 1)]\n "
return self.roots()[:self.number_of_reflections()]
def almost_positive_roots(self):
"\n Return the almost positive roots of ``self``.\n\n EXAMPLES::\n\n sage: W = ReflectionGroup(['A',3], ['B',2])\n sage: W.almost_positive_roots()\n [(-1, 0, 0, 0, 0),\n (0, -1, 0, 0, 0),\n (0, 0, -1, 0, 0),\n (0, 0, 0, -1, 0),\n (0, 0, 0, 0, -1),\n (1, 0, 0, 0, 0),\n (0, 1, 0, 0, 0),\n (0, 0, 1, 0, 0),\n (0, 0, 0, 1, 0),\n (0, 0, 0, 0, 1),\n (1, 1, 0, 0, 0),\n (0, 1, 1, 0, 0),\n (0, 0, 0, 1, 1),\n (1, 1, 1, 0, 0),\n (0, 0, 0, 2, 1)]\n\n sage: W = ReflectionGroup(['A',3])\n sage: W.almost_positive_roots()\n [(-1, 0, 0),\n (0, -1, 0),\n (0, 0, -1),\n (1, 0, 0),\n (0, 1, 0),\n (0, 0, 1),\n (1, 1, 0),\n (0, 1, 1),\n (1, 1, 1)]\n "
return ([(- beta) for beta in self.simple_roots()] + self.positive_roots())
def root_to_reflection(self, root):
"\n Return the reflection along the given ``root``.\n\n EXAMPLES::\n\n sage: W = ReflectionGroup(['A',2])\n sage: for beta in W.roots(): W.root_to_reflection(beta)\n (1,4)(2,3)(5,6)\n (1,3)(2,5)(4,6)\n (1,5)(2,4)(3,6)\n (1,4)(2,3)(5,6)\n (1,3)(2,5)(4,6)\n (1,5)(2,4)(3,6)\n "
Phi = self.roots()
R = self.reflections()
i = (Phi.index(root) + 1)
j = (Phi.index((- root)) + 1)
for r in R:
if (r(i) == j):
return r
raise AssertionError('there is a bug in root_to_reflection')
def reflection_to_positive_root(self, r):
"\n Return the positive root orthogonal to the given reflection.\n\n EXAMPLES::\n\n sage: W = ReflectionGroup(['A',2])\n sage: for r in W.reflections():\n ....: print(W.reflection_to_positive_root(r))\n (1, 0)\n (0, 1)\n (1, 1)\n "
Phi = self.roots()
N = (len(Phi) // 2)
for i in range(1, (N + 1)):
if (r(i) == (i + N)):
return Phi[(i - 1)]
raise AssertionError('there is a bug in reflection_to_positive_root')
@cached_method
def fundamental_weights(self):
'\n Return the fundamental weights of ``self`` in terms of the simple roots.\n\n The fundamental weights are defined by\n `s_j(\\omega_i) = \\omega_i - \\delta_{i=j}\\alpha_j`\n for the simple reflection `s_j` with corresponding simple\n roots `\\alpha_j`.\n\n In other words, the transpose Cartan matrix sends the weight\n basis to the root basis. Observe again that the action here is\n defined as a right action, see the example below.\n\n EXAMPLES::\n\n sage: W = ReflectionGroup([\'A\',3], [\'B\',2])\n sage: W.fundamental_weights()\n Finite family {1: (3/4, 1/2, 1/4, 0, 0), 2: (1/2, 1, 1/2, 0, 0), 3: (1/4, 1/2, 3/4, 0, 0), 4: (0, 0, 0, 1, 1/2), 5: (0, 0, 0, 1, 1)}\n\n sage: W = ReflectionGroup([\'A\',3])\n sage: W.fundamental_weights()\n Finite family {1: (3/4, 1/2, 1/4), 2: (1/2, 1, 1/2), 3: (1/4, 1/2, 3/4)}\n\n sage: W = ReflectionGroup([\'A\',3])\n sage: S = W.simple_reflections()\n sage: N = W.fundamental_weights()\n sage: for i in W.index_set():\n ....: for j in W.index_set():\n ....: print("{} {} {} {}".format(i, j, N[i], N[i]*S[j].to_matrix()))\n 1 1 (3/4, 1/2, 1/4) (-1/4, 1/2, 1/4)\n 1 2 (3/4, 1/2, 1/4) (3/4, 1/2, 1/4)\n 1 3 (3/4, 1/2, 1/4) (3/4, 1/2, 1/4)\n 2 1 (1/2, 1, 1/2) (1/2, 1, 1/2)\n 2 2 (1/2, 1, 1/2) (1/2, 0, 1/2)\n 2 3 (1/2, 1, 1/2) (1/2, 1, 1/2)\n 3 1 (1/4, 1/2, 3/4) (1/4, 1/2, 3/4)\n 3 2 (1/4, 1/2, 3/4) (1/4, 1/2, 3/4)\n 3 3 (1/4, 1/2, 3/4) (1/4, 1/2, -1/4)\n '
from sage.sets.family import Family
m = self.cartan_matrix().transpose().inverse()
Delta = tuple(self.simple_roots())
zero = Delta[0].parent().zero()
weights = [sum([(m[(i, j)] * sj) for (j, sj) in enumerate(Delta)], zero) for i in range(len(Delta))]
for weight in weights:
weight.set_immutable()
return Family({ind: weights[i] for (i, ind) in enumerate(self._index_set)})
def fundamental_weight(self, i):
"\n Return the fundamental weight with index ``i``.\n\n EXAMPLES::\n\n sage: W = ReflectionGroup(['A',3])\n sage: [ W.fundamental_weight(i) for i in W.index_set() ]\n [(3/4, 1/2, 1/4), (1/2, 1, 1/2), (1/4, 1/2, 3/4)]\n "
return self.fundamental_weights()[i]
@cached_method
def coxeter_diagram(self):
"\n Return the Coxeter diagram associated to ``self``.\n\n EXAMPLES::\n\n sage: G = ReflectionGroup(['B',3])\n sage: G.coxeter_diagram().edges(labels=True, sort=True)\n [(1, 2, 4), (2, 3, 3)]\n "
from sage.graphs.graph import Graph
from itertools import combinations
V = self.index_set()
S = self.simple_reflections()
E = []
for (i, j) in combinations(V, 2):
o = (S[i] * S[j]).order()
if (o >= 3):
E.append((i, j, o))
return Graph([V, E], format='vertices_and_edges', immutable=True)
@cached_method
def coxeter_matrix(self):
"\n Return the Coxeter matrix associated to ``self``.\n\n EXAMPLES::\n\n sage: G = ReflectionGroup(['A',3])\n sage: G.coxeter_matrix()\n [1 3 2]\n [3 1 3]\n [2 3 1]\n "
return self.cartan_type().coxeter_matrix()
@cached_method
def right_coset_representatives(self, J):
'\n Return the right coset representatives of ``self`` for the\n parabolic subgroup generated by the simple reflections in ``J``.\n\n EXAMPLES::\n\n sage: W = ReflectionGroup(["A",3])\n sage: for J in Subsets([1,2,3]): W.right_coset_representatives(J)\n [(), (2,5)(3,9)(4,6)(8,11)(10,12), (1,4)(2,8)(3,5)(7,10)(9,11),\n (1,7)(2,4)(5,6)(8,10)(11,12), (1,2,10)(3,6,5)(4,7,8)(9,12,11),\n (1,4,6)(2,3,11)(5,8,9)(7,10,12), (1,6,4)(2,11,3)(5,9,8)(7,12,10),\n (1,7)(2,6)(3,9)(4,5)(8,12)(10,11),\n (1,10,2)(3,5,6)(4,8,7)(9,11,12), (1,2,3,12)(4,5,10,11)(6,7,8,9),\n (1,5,9,10)(2,12,8,6)(3,4,7,11), (1,6)(2,9)(3,8)(5,11)(7,12),\n (1,8)(2,7)(3,6)(4,10)(9,12), (1,10,9,5)(2,6,8,12)(3,11,7,4),\n (1,12,3,2)(4,11,10,5)(6,9,8,7), (1,3)(2,12)(4,10)(5,11)(6,8)(7,9),\n (1,5,12)(2,9,4)(3,10,8)(6,7,11), (1,8,11)(2,5,7)(3,12,4)(6,10,9),\n (1,11,8)(2,7,5)(3,4,12)(6,9,10), (1,12,5)(2,4,9)(3,8,10)(6,11,7),\n (1,3,7,9)(2,11,6,10)(4,8,5,12), (1,9,7,3)(2,10,6,11)(4,12,5,8),\n (1,11)(3,10)(4,9)(5,7)(6,12), (1,9)(2,8)(3,7)(4,11)(5,10)(6,12)]\n [(), (2,5)(3,9)(4,6)(8,11)(10,12), (1,4)(2,8)(3,5)(7,10)(9,11),\n (1,2,10)(3,6,5)(4,7,8)(9,12,11), (1,4,6)(2,3,11)(5,8,9)(7,10,12),\n (1,6,4)(2,11,3)(5,9,8)(7,12,10), (1,2,3,12)(4,5,10,11)(6,7,8,9),\n (1,5,9,10)(2,12,8,6)(3,4,7,11), (1,6)(2,9)(3,8)(5,11)(7,12),\n (1,3)(2,12)(4,10)(5,11)(6,8)(7,9),\n (1,5,12)(2,9,4)(3,10,8)(6,7,11), (1,3,7,9)(2,11,6,10)(4,8,5,12)]\n [(), (2,5)(3,9)(4,6)(8,11)(10,12), (1,7)(2,4)(5,6)(8,10)(11,12),\n (1,4,6)(2,3,11)(5,8,9)(7,10,12),\n (1,7)(2,6)(3,9)(4,5)(8,12)(10,11),\n (1,10,2)(3,5,6)(4,8,7)(9,11,12), (1,2,3,12)(4,5,10,11)(6,7,8,9),\n (1,10,9,5)(2,6,8,12)(3,11,7,4), (1,12,3,2)(4,11,10,5)(6,9,8,7),\n (1,8,11)(2,5,7)(3,12,4)(6,10,9), (1,12,5)(2,4,9)(3,8,10)(6,11,7),\n (1,11)(3,10)(4,9)(5,7)(6,12)]\n [(), (1,4)(2,8)(3,5)(7,10)(9,11), (1,7)(2,4)(5,6)(8,10)(11,12),\n (1,2,10)(3,6,5)(4,7,8)(9,12,11), (1,6,4)(2,11,3)(5,9,8)(7,12,10),\n (1,10,2)(3,5,6)(4,8,7)(9,11,12), (1,5,9,10)(2,12,8,6)(3,4,7,11),\n (1,8)(2,7)(3,6)(4,10)(9,12), (1,12,3,2)(4,11,10,5)(6,9,8,7),\n (1,3)(2,12)(4,10)(5,11)(6,8)(7,9),\n (1,11,8)(2,7,5)(3,4,12)(6,9,10), (1,9,7,3)(2,10,6,11)(4,12,5,8)]\n [(), (2,5)(3,9)(4,6)(8,11)(10,12), (1,4,6)(2,3,11)(5,8,9)(7,10,12),\n (1,2,3,12)(4,5,10,11)(6,7,8,9)]\n [(), (1,4)(2,8)(3,5)(7,10)(9,11), (1,2,10)(3,6,5)(4,7,8)(9,12,11),\n (1,6,4)(2,11,3)(5,9,8)(7,12,10), (1,5,9,10)(2,12,8,6)(3,4,7,11),\n (1,3)(2,12)(4,10)(5,11)(6,8)(7,9)]\n [(), (1,7)(2,4)(5,6)(8,10)(11,12), (1,10,2)(3,5,6)(4,8,7)(9,11,12),\n (1,12,3,2)(4,11,10,5)(6,9,8,7)]\n [()]\n '
from sage.combinat.root_system.reflection_group_element import _gap_return
J_inv = [(self._index_set_inverse[j] + 1) for j in J]
S = str(gap3(('ReducedRightCosetRepresentatives(%s,ReflectionSubgroup(%s,%s))' % (self._gap_group._name, self._gap_group._name, J_inv))))
return sage_eval(_gap_return(S), locals={'self': self})
def simple_root_index(self, i):
"\n Return the index of the simple root `\\alpha_i`.\n\n This is the position of `\\alpha_i` in the list of simple roots.\n\n EXAMPLES::\n\n sage: W = ReflectionGroup(['A',3])\n sage: [W.simple_root_index(i) for i in W.index_set()]\n [0, 1, 2]\n "
return self._index_set_inverse[i]
def bruhat_cone(self, x, y, side='upper', backend='cdd'):
"\n Return the (upper or lower) Bruhat cone associated to the interval ``[x,y]``.\n\n To a cover relation `v \\prec w` in strong Bruhat order you can assign a positive\n root `\\beta` given by the unique reflection `s_\\beta` such that `s_\\beta v = w`.\n\n The upper Bruhat cone of the interval `[x,y]` is the non-empty, polyhedral cone generated\n by the roots corresponding to `x \\prec a` for all atoms `a` in the interval.\n The lower Bruhat cone of the interval `[x,y]` is the non-empty, polyhedral cone generated\n by the roots corresponding to `c \\prec y` for all coatoms `c` in the interval.\n\n INPUT:\n\n - ``x`` - an element in the group `W`\n - ``y`` - an element in the group `W`\n - ``side`` (default: ``'upper'``) -- must be one of the following:\n\n * ``'upper'`` - return the upper Bruhat cone of the interval [``x``, ``y``]\n * ``'lower'`` - return the lower Bruhat cone of the interval [``x``, ``y``]\n\n - ``backend`` -- string (default: ``'cdd'``); the backend to use to create the polyhedron\n\n EXAMPLES::\n\n sage: W = ReflectionGroup(['A',2])\n sage: x = W.from_reduced_word([1])\n sage: y = W.w0\n sage: W.bruhat_cone(x, y)\n A 2-dimensional polyhedron in QQ^2 defined as the convex hull of 1 vertex and 2 rays\n\n sage: W = ReflectionGroup(['E',6])\n sage: x = W.one()\n sage: y = W.w0\n sage: W.bruhat_cone(x, y, side='lower')\n A 6-dimensional polyhedron in QQ^6 defined as the convex hull of 1 vertex and 6 rays\n\n TESTS::\n\n sage: W = ReflectionGroup(['A',2])\n sage: x = W.one()\n sage: y = W.w0\n sage: W.bruhat_cone(x, y, side='nonsense')\n Traceback (most recent call last):\n ...\n ValueError: side must be either 'upper' or 'lower'\n\n REFERENCES:\n\n - [Dy1994]_\n - [JS2021]_\n "
if (side == 'upper'):
roots = [self.reflection_to_positive_root(((x * r) * x.inverse())) for (z, r) in x.bruhat_upper_covers_reflections() if z.bruhat_le(y)]
elif (side == 'lower'):
roots = [self.reflection_to_positive_root(((y * r) * y.inverse())) for (z, r) in y.bruhat_lower_covers_reflections() if x.bruhat_le(z)]
else:
raise ValueError("side must be either 'upper' or 'lower'")
from sage.geometry.polyhedron.constructor import Polyhedron
if self.is_crystallographic():
return Polyhedron(vertices=[([0] * self.rank())], rays=roots, ambient_dim=self.rank(), backend=backend)
if (backend == 'cdd'):
from warnings import warn
warn('Using floating point numbers for roots of unity. This might cause numerical errors!')
from sage.rings.real_double import RDF as base_ring
else:
from sage.rings.qqbar import AA as base_ring
return Polyhedron(vertices=[([0] * self.rank())], rays=roots, ambient_dim=self.rank(), base_ring=base_ring, backend=backend)
class Element(RealReflectionGroupElement, ComplexReflectionGroup.Element):
@cached_in_parent_method
def right_coset_representatives(self):
'\n Return the right coset representatives of ``self``.\n\n EXAMPLES::\n\n sage: W = ReflectionGroup([\'A\',2])\n sage: for w in W:\n ....: rcr = w.right_coset_representatives()\n ....: print("%s %s"%(w.reduced_word(),\n ....: [v.reduced_word() for v in rcr]))\n [] [[], [2], [1], [2, 1], [1, 2], [1, 2, 1]]\n [2] [[], [2], [1]]\n [1] [[], [1], [1, 2]]\n [1, 2] [[]]\n [2, 1] [[]]\n [1, 2, 1] [[], [2], [2, 1]]\n '
W = self.parent()
T = W.reflections()
T_fix = [(i + 1) for i in T.keys() if self.fix_space().is_subspace(T[i].fix_space())]
S = str(gap3(('ReducedRightCosetRepresentatives(%s,ReflectionSubgroup(%s,%s))' % (W._gap_group._name, W._gap_group._name, T_fix))))
from sage.combinat.root_system.reflection_group_element import _gap_return
return sage_eval(_gap_return(S, coerce_obj='W'), locals={'self': self, 'W': W})
def left_coset_representatives(self):
'\n Return the left coset representatives of ``self``.\n\n .. SEEALSO:: :meth:`right_coset_representatives`\n\n EXAMPLES::\n\n sage: W = ReflectionGroup([\'A\',2])\n sage: for w in W:\n ....: lcr = w.left_coset_representatives()\n ....: print("%s %s"%(w.reduced_word(),\n ....: [v.reduced_word() for v in lcr]))\n [] [[], [2], [1], [1, 2], [2, 1], [1, 2, 1]]\n [2] [[], [2], [1]]\n [1] [[], [1], [2, 1]]\n [1, 2] [[]]\n [2, 1] [[]]\n [1, 2, 1] [[], [2], [1, 2]]\n '
return [(~ w) for w in self.right_coset_representatives()]
|
class IrreducibleRealReflectionGroup(RealReflectionGroup, IrreducibleComplexReflectionGroup):
def _repr_(self):
'\n Return the string representation of ``self``.\n\n EXAMPLES::\n\n sage: for i in [2..7]: ReflectionGroup(["I", i])\n Reducible real reflection group of rank 2 and type A1 x A1\n Irreducible real reflection group of rank 2 and type A2\n Irreducible real reflection group of rank 2 and type C2\n Irreducible real reflection group of rank 2 and type I2(5)\n Irreducible real reflection group of rank 2 and type G2\n Irreducible real reflection group of rank 2 and type I2(7)\n '
type_str = self._irrcomp_repr_(self._type[0])
return ('Irreducible real reflection group of rank %s and type %s' % (self._rank, type_str))
class Element(RealReflectionGroup.Element, IrreducibleComplexReflectionGroup.Element):
pass
|
class Algebras(AlgebrasCategory):
'\n The category of group algebras of root lattice realizations.\n\n This includes typically weight rings (group algebras of weight lattices).\n\n TESTS::\n\n sage: for ct in CartanType.samples(crystallographic=True): # long time\n ....: TestSuite(RootSystem(ct).root_lattice().algebra(QQ)).run()\n '
class ParentMethods():
def _repr_(self):
'\n EXAMPLES::\n\n sage: RootSystem(["A",2,1]).ambient_space().algebra(QQ) # indirect doctest\n Algebra of the Ambient space of the Root system of type [\'A\', 2, 1] over Rational Field\n '
return ('Algebra of the %s over %s' % (self.basis().keys(), self.base_ring()))
def some_elements(self):
'\n Return some elements of the algebra ``self``.\n\n EXAMPLES::\n\n sage: A = RootSystem(["A",2,1]).ambient_space().algebra(QQ)\n sage: A.some_elements()\n [B[2*e[0] + 2*e[1] + 3*e[2]]...]\n sage: A.some_elements() # needs sage.graphs\n [B[2*e[0] + 2*e[1] + 3*e[2]],\n B[-e[0] + e[2] + e[\'delta\']],\n B[e[0] - e[1]],\n B[e[1] - e[2]],\n B[e[\'deltacheck\']],\n B[e[0] + e[\'deltacheck\']],\n B[e[0] + e[1] + e[\'deltacheck\']]]\n\n sage: A = RootSystem(["B",2]).weight_space().algebra(QQ)\n sage: A.some_elements()\n [B[2*Lambda[1] + 2*Lambda[2]], ... B[Lambda[1]], B[Lambda[2]]]\n sage: A.some_elements() # needs sage.graphs\n [B[2*Lambda[1] + 2*Lambda[2]],\n B[2*Lambda[1] - 2*Lambda[2]],\n B[-Lambda[1] + 2*Lambda[2]],\n B[Lambda[1]],\n B[Lambda[2]]]\n '
return [self.monomial(weight) for weight in self.basis().keys().some_elements()]
@cached_method
def cartan_type(self):
'\n Return the Cartan type of ``self``.\n\n EXAMPLES::\n\n sage: A = RootSystem(["A",2,1]).ambient_space().algebra(QQ)\n sage: A.cartan_type()\n [\'A\', 2, 1]\n sage: A = RootSystem(["B",2]).weight_space().algebra(QQ)\n sage: A.cartan_type()\n [\'B\', 2]\n '
return self.basis().keys().cartan_type()
def from_polynomial(self, p):
'\n Construct an element of ``self`` from a polynomial `p`.\n\n INPUT:\n\n - ``p`` -- a polynomial\n\n EXAMPLES::\n\n sage: L = RootSystem(["A",2]).ambient_lattice()\n sage: KL = L.algebra(QQ)\n sage: x,y,z = QQ[\'x,y,z\'].gens()\n sage: KL.from_polynomial(x)\n B[(1, 0, 0)]\n sage: KL.from_polynomial(x^2*y + 2*y - z)\n B[(2, 1, 0)] + 2*B[(0, 1, 0)] - B[(0, 0, 1)]\n\n TESTS::\n\n sage: KL.from_polynomial(x).leading_support().parent() is L\n True\n sage: KL.from_polynomial(x-x)\n 0\n sage: KL.from_polynomial(x-x).parent() is KL\n True\n\n .. TODO:: make this work for Laurent polynomials too\n '
L = self.basis().keys()
return self.sum_of_terms(((L.from_vector(vector(t)), c) for (t, c) in p.dict().items()))
@cached_method
def divided_difference_on_basis(self, weight, i):
'\n Return the result of applying the `i`-th divided difference on ``weight``.\n\n INPUT:\n\n - ``weight`` -- a weight\n - ``i`` -- an element of the index set\n\n .. TODO:: type free definition (Viviane\'s definition uses that we are in the ambient space)\n\n EXAMPLES::\n\n sage: L = RootSystem(["A",1]).ambient_space()\n sage: KL = L.algebra(QQ)\n sage: KL.divided_difference_on_basis(L((2,2)), 1) # todo: not implemented\n 0\n sage: KL.divided_difference_on_basis(L((3,0)), 1) # todo: not implemented\n B[(2, 0)] + B[(1, 1)] + B[(0, 2)]\n sage: KL.divided_difference_on_basis(L((0,3)), 1) # todo: not implemented\n -B[(2, 0)] - B[(1, 1)] - B[(0, 2)]\n\n In type `A` and in the ambient lattice, we recover the\n usual action of divided differences polynomials::\n\n sage: x,y = QQ[\'x,y\'].gens()\n sage: d = lambda p: (p - p(y,x)) / (x-y)\n sage: d(x^2*y^2)\n 0\n sage: d(x^3)\n x^2 + x*y + y^2\n sage: d(y^3)\n -x^2 - x*y - y^2\n '
raise NotImplementedError()
@cached_method
def isobaric_divided_difference_on_basis(self, weight, i):
'\n Return the result of applying the `i`-th isobaric divided difference on ``weight``.\n\n INPUT:\n\n - ``weight`` -- a weight\n - ``i`` -- an element of the index set\n\n .. SEEALSO:: :meth:`demazure_operators`\n\n EXAMPLES::\n\n sage: L = RootSystem(["A",1]).ambient_space()\n sage: KL = L.algebra(QQ)\n sage: KL.isobaric_divided_difference_on_basis(L((2,2)), 1)\n B[(2, 2)]\n sage: KL.isobaric_divided_difference_on_basis(L((3,0)), 1)\n B[(1, 2)] + B[(2, 1)] + B[(3, 0)] + B[(0, 3)]\n sage: KL.isobaric_divided_difference_on_basis(L((0,3)), 1)\n -B[(1, 2)] - B[(2, 1)]\n\n In type `A` and in the ambient lattice, we recover the\n usual action of divided differences on polynomials::\n\n sage: x,y = QQ[\'x,y\'].gens()\n sage: d = lambda p: (x*p - (x*p)(y,x)) / (x-y)\n sage: d(x^2*y^2)\n x^2*y^2\n sage: d(x^3)\n x^3 + x^2*y + x*y^2 + y^3\n sage: d(y^3)\n -x^2*y - x*y^2\n\n REFERENCES:\n\n .. [Lascoux2003] Alain Lascoux, Symmetric functions and combinatorial operators on polynomials,\n CBMS Regional Conference Series in Mathematics, 99, 2003.\n '
P = self.basis().keys()
n = weight.scalar(P.simple_coroot(i))
if (n not in ZZ):
raise ValueError('the weight does not have an integral scalar product with the coroot')
alphai = P.simple_root(i)
if (n >= 0):
return self.sum_of_monomials(((weight - (j * alphai)) for j in range((n + 1))))
return (- self.sum_of_monomials(((weight - (j * alphai)) for j in range((n + 1), 0))))
def demazure_operators(self):
'\n Return the Demazure operators acting on ``self``.\n\n The `i`-th Demazure operator is defined by:\n\n .. MATH::\n\n \\pi_i = \\frac{ 1 - e^{-\\alpha_i}s_i }{ 1-e^{-\\alpha_i} }\n\n It acts on `e^\\lambda`, for `\\lambda` a weight, by:\n\n .. MATH::\n\n \\pi_i e^\\lambda = \\frac{e^\\lambda - e^{-\\alpha_i+s_i\\lambda}}{1-e^{-\\alpha_i}}\n\n This matches with Lascoux\' definition [Lascoux2003]_ of `\\pi_i`, and\n with the `i`-th Demazure operator of [Kumar1987]_, which also works for\n general Kac-Moody types.\n\n REFERENCES:\n\n .. [Kumar1987] \\S. Kumar, Demazure character formula in arbitrary Kac-Moody setting,\n Invent. Math. 89 (1987), no. 2, 395-423.\n\n EXAMPLES:\n\n We compute some Schur functions, as images of dominant\n monomials under the action of the maximal isobaric divided\n difference `\\Delta_{w_0}`::\n\n sage: L = RootSystem(["A",2]).ambient_lattice()\n sage: KL = L.algebra(QQ)\n sage: w0 = tuple(L.weyl_group().long_element().reduced_word()) # needs sage.libs.gap\n sage: pi = KL.demazure_operators()\n sage: pi0 = pi[w0] # needs sage.libs.gap\n sage: pi0(KL.monomial(L((2,1)))) # needs sage.libs.gap\n 2*B[(1, 1, 1)] + B[(1, 2, 0)] + B[(1, 0, 2)] + B[(2, 1, 0)]\n + B[(2, 0, 1)] + B[(0, 1, 2)] + B[(0, 2, 1)]\n\n Let us make the result into an actual polynomial::\n\n sage: P = QQ[\'x,y,z\']\n sage: pi0(KL.monomial(L((2,1)))).expand(P.gens()) # needs sage.libs.gap\n x^2*y + x*y^2 + x^2*z + 2*x*y*z + y^2*z + x*z^2 + y*z^2\n\n This is indeed a Schur function::\n\n sage: s = SymmetricFunctions(QQ).s() # needs sage.combinat\n sage: s[2,1].expand(3, P.variable_names()) # needs sage.combinat\n x^2*y + x*y^2 + x^2*z + 2*x*y*z + y^2*z + x*z^2 + y*z^2\n\n Let us check this systematically on Schur functions of degree 6::\n\n sage: for p in Partitions(6, max_length=3).list(): # needs sage.combinat sage.libs.gap\n ....: assert (s.monomial(p).expand(3, P.variable_names())\n ....: == pi0(KL.monomial(L(tuple(p)))).expand(P.gens()))\n\n We check systematically that these operators satisfy the Iwahori-Hecke algebra relations::\n\n sage: for cartan_type in CartanType.samples(crystallographic=True): # long time (12s)\n ....: L = RootSystem(cartan_type).weight_lattice()\n ....: KL = L.algebra(QQ)\n ....: T = KL.demazure_operators()\n ....: T._test_relations()\n\n sage: L = RootSystem([\'A\',1,1]).weight_lattice()\n sage: KL = L.algebra(QQ)\n sage: T = KL.demazure_operators()\n sage: T._test_relations()\n\n .. WARNING::\n\n The Demazure operators are only defined if all the\n elements in the support have integral scalar products\n with the coroots (basically, they are in the weight\n lattice). Otherwise an error is raised::\n\n sage: L = RootSystem(CartanType(["G",2]).dual()).ambient_space()\n sage: KL = L.algebra(QQ)\n sage: pi = KL.demazure_operators()\n sage: pi[1](KL.monomial(L([0,0,1])))\n Traceback (most recent call last):\n ...\n ValueError: the weight does not have an integral scalar product with the coroot\n '
return HeckeAlgebraRepresentation(self, self.isobaric_divided_difference_on_basis, self.cartan_type(), 0, 1, side='left')
def _test_demazure_operators(self, **options):
'\n Test that the Demazure operators satisfy their defining formulas.\n\n EXAMPLES::\n\n sage: RootSystem(["A",2]).root_lattice().algebra(QQ)._test_demazure_operators()\n '
tester = self._tester(**options)
try:
pi = self.demazure_operators()
L = self.basis().keys()
alpha = L.simple_roots()
alphacheck = L.simple_coroots()
s = L.simple_reflections()
for i in self.cartan_type().index_set():
emalphai = self.monomial((- alpha[i]))
for weight in L.some_elements():
if (weight.scalar(alphacheck[i]) not in ZZ):
continue
x = self.monomial(weight)
result = pi[i](x)
tester.assertEqual((result * (self.one() - emalphai)), (x - (emalphai * x.map_support(s[i]))))
except ImportError:
pass
def demazure_lusztig_operator_on_basis(self, weight, i, q1, q2, convention='antidominant'):
'\n Return the result of applying the `i`-th Demazure-Lusztig operator on ``weight``.\n\n INPUT:\n\n - ``weight`` -- an element `\\lambda` of the weight lattice\n - ``i`` -- an element of the index set\n - ``q1``, ``q2`` -- two elements of the ground ring\n - ``convention`` -- ``"antidominant"``, ``"bar"``, or ``"dominant"`` (default: ``"antidominant"``)\n\n See :meth:`demazure_lusztig_operators` for the details.\n\n EXAMPLES::\n\n sage: L = RootSystem(["A",1]).ambient_space()\n sage: K = QQ[\'q1,q2\']\n sage: q1, q2 = K.gens()\n sage: KL = L.algebra(K)\n sage: KL.demazure_lusztig_operator_on_basis(L((2,2)), 1, q1, q2)\n q1*B[(2, 2)]\n sage: KL.demazure_lusztig_operator_on_basis(L((3,0)), 1, q1, q2)\n (q1+q2)*B[(1, 2)] + (q1+q2)*B[(2, 1)] + (q1+q2)*B[(3, 0)] + q1*B[(0, 3)]\n sage: KL.demazure_lusztig_operator_on_basis(L((0,3)), 1, q1, q2)\n (-q1-q2)*B[(1, 2)] + (-q1-q2)*B[(2, 1)] + (-q2)*B[(3, 0)]\n\n At `q_1=1` and `q_2=0` we recover the action of the isobaric divided differences `\\pi_i`::\n\n sage: KL.demazure_lusztig_operator_on_basis(L((2,2)), 1, 1, 0)\n B[(2, 2)]\n sage: KL.demazure_lusztig_operator_on_basis(L((3,0)), 1, 1, 0)\n B[(1, 2)] + B[(2, 1)] + B[(3, 0)] + B[(0, 3)]\n sage: KL.demazure_lusztig_operator_on_basis(L((0,3)), 1, 1, 0)\n -B[(1, 2)] - B[(2, 1)]\n\n Or `1-\\pi_i` for ``bar=True``::\n\n sage: KL.demazure_lusztig_operator_on_basis(L((2,2)), 1, 1, 0, convention="bar")\n 0\n sage: KL.demazure_lusztig_operator_on_basis(L((3,0)), 1, 1, 0, convention="bar")\n -B[(1, 2)] - B[(2, 1)] - B[(0, 3)]\n sage: KL.demazure_lusztig_operator_on_basis(L((0,3)), 1, 1, 0, convention="bar")\n B[(1, 2)] + B[(2, 1)] + B[(0, 3)]\n\n At `q_1=1` and `q_2=-1` we recover the action of the simple reflection `s_i`::\n\n sage: KL.demazure_lusztig_operator_on_basis(L((2,2)), 1, 1, -1)\n B[(2, 2)]\n sage: KL.demazure_lusztig_operator_on_basis(L((3,0)), 1, 1, -1)\n B[(0, 3)]\n sage: KL.demazure_lusztig_operator_on_basis(L((0,3)), 1, 1, -1)\n B[(3, 0)]\n '
if (convention == 'dominant'):
weight = (- weight)
pi_on_weight = self.isobaric_divided_difference_on_basis(weight, i)
if (convention == 'bar'):
pi_on_weight = (self.monomial(weight) - pi_on_weight)
result = (((q1 + q2) * pi_on_weight) - self.term(weight.simple_reflection(i), q2))
if (convention == 'dominant'):
return result.map_support(operator.neg)
else:
return result
def demazure_lusztig_operators(self, q1, q2, convention='antidominant'):
'\n Return the Demazure-Lusztig operators acting on ``self``.\n\n INPUT:\n\n - ``q1,q2`` -- two elements of the ground ring\n - ``convention`` -- "antidominant", "bar", or "dominant" (default: "antidominant")\n\n If `R` is the parent weight ring, the Demazure-Lusztig\n operator `T_i` is the linear map `R\\rightarrow R` obtained\n by interpolating between the isobaric divided difference\n operator `\\pi_i` (see :meth:`.isobaric_divided_difference_on_basis`)\n and the simple reflection `s_i`.\n\n .. MATH::\n\n (q_1+q_2) \\pi_i - q_2 s_i\n\n The Demazure-Lusztig operators give the usual\n representation of the operator `T_i` of the (affine) Hecke\n algebra with eigenvalues `q_1` and `q_2` associated to the\n Weyl group.\n\n Several variants are available to match with various\n conventions used in the literature:\n\n - "bar" replaces `\\pi_i` in the formula above by\n `\\overline{\\pi}_i = (1-\\pi_i)`.\n - "dominant" conjugates the operator by\n `x^\\lambda \\mapsto x^-\\lambda`.\n\n The names dominant and antidominant for the conventions were chosen with regards to\n the nonsymmetric Macdonald polynomials. The `Y` operators for the Macdonald polynomials\n in the "dominant" convention satisfy `Y_\\lambda = T_{t_{\\lambda}}` for `\\lambda` dominant.\n This is also the convention used in [Haiman06]_. For the "antidominant" convention,\n `Y_\\lambda = T_{t_{\\lambda}}` with `\\lambda` antidominant.\n\n .. SEEALSO::\n\n - :meth:`demazure_lusztig_operator_on_basis`.\n - :class:`~.non_symmetric_macdonald_polynomials.NonSymmetricMacdonaldPolynomials`.\n\n REFERENCES:\n\n .. [Lusztig1985] \\G. Lusztig,\n *Equivariant K-theory and representations of Hecke algebras*,\n Proc. Amer. Math. Soc. 94 (1985), no. 2, 337-342.\n\n .. [Cherednik1995] \\I. Cherednik,\n *Nonsymmetric Macdonald polynomials*. IMRN 10, 483-515 (1995).\n\n EXAMPLES::\n\n sage: L = RootSystem(["A",1]).ambient_space()\n sage: K = QQ[\'q1,q2\'].fraction_field()\n sage: q1, q2 = K.gens()\n sage: KL = L.algebra(K)\n sage: T = KL.demazure_lusztig_operators(q1, q2)\n sage: Tbar = KL.demazure_lusztig_operators(q1, q2, convention="bar")\n sage: Tdominant = KL.demazure_lusztig_operators(q1, q2,\n ....: convention="dominant")\n sage: x = KL.monomial(L((3,0)))\n sage: T[1](x)\n (q1+q2)*B[(1, 2)] + (q1+q2)*B[(2, 1)] + (q1+q2)*B[(3, 0)] + q1*B[(0, 3)]\n sage: Tbar[1](x)\n (-q1-q2)*B[(1, 2)] + (-q1-q2)*B[(2, 1)] + (-q1-2*q2)*B[(0, 3)]\n sage: Tbar[1](x) + T[1](x)\n (q1+q2)*B[(3, 0)] + (-2*q2)*B[(0, 3)]\n sage: Tdominant[1](x)\n (-q1-q2)*B[(1, 2)] + (-q1-q2)*B[(2, 1)] + (-q2)*B[(0, 3)]\n\n sage: Tdominant.Tw_inverse(1)(KL.monomial(-L.simple_root(1)))\n ((-q1-q2)/(q1*q2))*B[(0, 0)] - 1/q2*B[(1, -1)]\n\n We repeat similar computation in the affine setting::\n\n sage: L = RootSystem(["A",2,1]).ambient_space()\n sage: K = QQ[\'q1,q2\'].fraction_field()\n sage: q1, q2 = K.gens()\n sage: KL = L.algebra(K)\n sage: T = KL.demazure_lusztig_operators(q1, q2)\n sage: Tbar = KL.demazure_lusztig_operators(q1, q2, convention="bar")\n sage: Tdominant = KL.demazure_lusztig_operators(q1, q2,\n ....: convention="dominant")\n sage: e = L.basis()\n sage: x = KL.monomial(3*e[0])\n sage: T[1](x)\n (q1+q2)*B[e[0] + 2*e[1]] + (q1+q2)*B[2*e[0] + e[1]]\n + (q1+q2)*B[3*e[0]] + q1*B[3*e[1]]\n sage: Tbar[1](x)\n (-q1-q2)*B[e[0] + 2*e[1]] + (-q1-q2)*B[2*e[0] + e[1]]\n + (-q1-2*q2)*B[3*e[1]]\n sage: Tbar[1](x) + T[1](x)\n (q1+q2)*B[3*e[0]] + (-2*q2)*B[3*e[1]]\n sage: Tdominant[1](x)\n (-q1-q2)*B[e[0] + 2*e[1]] + (-q1-q2)*B[2*e[0] + e[1]] + (-q2)*B[3*e[1]]\n sage: Tdominant.Tw_inverse(1)(KL.monomial(-L.simple_root(1)))\n ((-q1-q2)/(q1*q2))*B[0] - 1/q2*B[e[0] - e[1]]\n\n One can obtain iterated operators by passing a reduced\n word or an element of the Weyl group::\n\n sage: T[1,2](x)\n (q1^2+2*q1*q2+q2^2)*B[e[0] + e[1] + e[2]] +\n (q1^2+2*q1*q2+q2^2)*B[e[0] + 2*e[1]] +\n (q1^2+q1*q2)*B[e[0] + 2*e[2]] + (q1^2+2*q1*q2+q2^2)*B[2*e[0] + e[1]] +\n (q1^2+q1*q2)*B[2*e[0] + e[2]] + (q1^2+q1*q2)*B[3*e[0]] +\n (q1^2+q1*q2)*B[e[1] + 2*e[2]] + (q1^2+q1*q2)*B[2*e[1] + e[2]] +\n (q1^2+q1*q2)*B[3*e[1]] + q1^2*B[3*e[2]]\n\n and use that to check, for example, the braid relations::\n\n sage: T[1,2,1](x) - T[2,1,2](x)\n 0\n\n The operators satisfy the relations of the affine Hecke\n algebra with parameters `q_1`, `q_2`::\n\n sage: T._test_relations()\n sage: Tdominant._test_relations()\n sage: Tbar._test_relations() #-q2,q1+2*q2 # todo: not implemented: set the appropriate eigenvalues!\n\n And the `\\bar{T}` are basically the inverses of the `T` s::\n\n sage: Tinv = KL.demazure_lusztig_operators(2/q1 + 1/q2, -1/q1,\n ....: convention="bar")\n sage: [Tinv[1](T[1](x)) - x for x in KL.some_elements()] # needs sage.graphs\n [0, 0, 0, 0, 0, 0, 0]\n\n We check that `\\Lambda_1-\\Lambda_0` is an eigenvector for\n the `Y` s in affine type::\n\n sage: K = QQ[\'q,q1,q2\'].fraction_field()\n sage: q,q1,q2 = K.gens()\n sage: L = RootSystem(["A",2,1]).ambient_space()\n sage: L0 = L.classical()\n sage: Lambda = L.fundamental_weights() # needs sage.graphs\n sage: alphacheck = L0.simple_coroots()\n sage: KL = L.algebra(K)\n sage: T = KL.demazure_lusztig_operators(q1, q2, convention="dominant")\n sage: Y = T.Y()\n sage: alphacheck = Y.keys().alpha() # alpha of coroot lattice is alphacheck\n sage: alphacheck\n Finite family {0: alphacheck[0], 1: alphacheck[1], 2: alphacheck[2]}\n sage: x = KL.monomial(Lambda[1] - Lambda[0]); x # needs sage.graphs\n B[e[0]]\n\n In fact it is not exactly an eigenvector, but the extra\n \'\\delta` term is to be interpreted as a `q` parameter::\n\n sage: # needs sage.graphs\n sage: Y[alphacheck[0]](KL.one())\n q2^2/q1^2*B[0]\n sage: Y[alphacheck[1]](x)\n ((-q2^2)/(-q1^2))*B[e[0] - e[\'delta\']]\n sage: Y[alphacheck[2]](x)\n (q1/(-q2))*B[e[0]]\n sage: KL.q_project(Y[alphacheck[1]](x),q)\n ((-q2^2)/(-q*q1^2))*B[(1, 0, 0)]\n\n sage: # needs sage.graphs\n sage: KL.q_project(x, q)\n B[(1, 0, 0)]\n sage: KL.q_project(Y[alphacheck[0]](x),q)\n ((-q*q1)/q2)*B[(1, 0, 0)]\n sage: KL.q_project(Y[alphacheck[1]](x),q)\n ((-q2^2)/(-q*q1^2))*B[(1, 0, 0)]\n sage: KL.q_project(Y[alphacheck[2]](x),q)\n (q1/(-q2))*B[(1, 0, 0)]\n\n We now check systematically that the Demazure-Lusztig\n operators satisfy the relations of the Iwahori-Hecke\n algebra::\n\n sage: K = QQ[\'q1,q2\']\n sage: q1, q2 = K.gens()\n sage: for cartan_type in CartanType.samples(crystallographic=True): # long time 12s\n ....: L = RootSystem(cartan_type).root_lattice()\n ....: KL = L.algebra(K)\n ....: T = KL.demazure_lusztig_operators(q1,q2)\n ....: T._test_relations()\n\n sage: for cartan_type in CartanType.samples(crystallographic=True): # long time 12s\n ....: L = RootSystem(cartan_type).weight_lattice()\n ....: KL = L.algebra(K)\n ....: T = KL.demazure_lusztig_operators(q1,q2)\n ....: T._test_relations()\n\n Recall that the Demazure-Lusztig operators are only\n defined when all monomials belong to the weight lattice.\n Thus, in the group algebra of the ambient space, we need\n to specify explicitly the elements on which to run the\n tests::\n\n sage: for cartan_type in CartanType.samples(crystallographic=True): # long time 12s\n ....: L = RootSystem(cartan_type).ambient_space()\n ....: KL = L.algebra(K)\n ....: weight_lattice = RootSystem(cartan_type).weight_lattice(extended=L.is_extended())\n ....: elements = [ KL.monomial(L(weight)) for weight in weight_lattice.some_elements() ]\n ....: T = KL.demazure_lusztig_operators(q1,q2)\n ....: T._test_relations(elements=elements)\n '
T_on_basis = functools.partial(self.demazure_lusztig_operator_on_basis, q1=q1, q2=q2, convention=convention)
return HeckeAlgebraRepresentation(self, T_on_basis, self.cartan_type(), q1, q2, side='left')
def demazure_lusztig_operator_on_classical_on_basis(self, weight, i, q, q1, q2, convention='antidominant'):
'\n Return the result of applying the `i`-th Demazure-Lusztig operator on the classical weight ``weight`` embedded at level 0.\n\n INPUT:\n\n - ``weight`` -- a classical weight `\\lambda`\n - ``i`` -- an element of the index set\n - ``q1,q2`` -- two elements of the ground ring\n - ``convention`` -- ``"antidominant"``, ``"bar"``, or ``"dominant"`` (default: ``"antidominant"``)\n\n See :meth:`demazure_lusztig_operators` for the details.\n\n .. TODO::\n\n - Optimize the code to only do the embedding/projection for T_0\n - Add an option to specify at which level one wants to\n work. Currently this is level 0.\n\n EXAMPLES::\n\n sage: L = RootSystem(["A",1,1]).ambient_space()\n sage: L0 = L.classical()\n sage: K = QQ[\'q,q1,q2\']\n sage: q, q1, q2 = K.gens()\n sage: KL = L.algebra(K)\n sage: KL0 = L0.algebra(K)\n\n These operators coincide with the usual Demazure-Lusztig\n operators::\n\n sage: KL.demazure_lusztig_operator_on_classical_on_basis(L0((2,2)), # needs sage.graphs\n ....: 1, q, q1, q2)\n q1*B[(2, 2)]\n sage: KL0.demazure_lusztig_operator_on_basis(L0((2,2)), 1, q1, q2)\n q1*B[(2, 2)]\n\n sage: KL.demazure_lusztig_operator_on_classical_on_basis(L0((3,0)), # needs sage.graphs\n ....: 1, q, q1, q2)\n (q1+q2)*B[(1, 2)] + (q1+q2)*B[(2, 1)] + (q1+q2)*B[(3, 0)] + q1*B[(0, 3)]\n sage: KL0.demazure_lusztig_operator_on_basis(L0((3,0)), 1, q1, q2)\n (q1+q2)*B[(1, 2)] + (q1+q2)*B[(2, 1)] + (q1+q2)*B[(3, 0)] + q1*B[(0, 3)]\n\n except that we now have an action of `T_0`, which introduces some `q` s::\n\n sage: KL.demazure_lusztig_operator_on_classical_on_basis(L0((2,2)), # needs sage.graphs\n ....: 0, q, q1, q2)\n q1*B[(2, 2)]\n sage: KL.demazure_lusztig_operator_on_classical_on_basis(L0((3,0)), # needs sage.graphs\n ....: 0, q, q1, q2)\n (-q^2*q1-q^2*q2)*B[(1, 2)] + (-q*q1-q*q2)*B[(2, 1)] + (-q^3*q2)*B[(0, 3)]\n '
L = self.basis().keys()
weight = L.embed_at_level(weight, 0)
return self.q_project(self.demazure_lusztig_operator_on_basis(weight, i, q1, q2, convention=convention), q)
def demazure_lusztig_operators_on_classical(self, q, q1, q2, convention='antidominant'):
'\n Return the Demazure-Lusztig operators acting at level 1 on ``self.classical()``.\n\n INPUT:\n\n - ``q,q1,q2`` -- three elements of the ground ring\n - ``convention`` -- ``"antidominant"``, ``"bar"``, or ``"dominant"`` (default: ``"antidominant"``)\n\n Let `KL` be the group algebra of an affine weight lattice\n realization `L`. The Demazure-Lusztig operators for `KL`\n act on the group algebra of the corresponding classical\n weight lattice by embedding it at level 1, and projecting\n back.\n\n .. SEEALSO::\n\n - :meth:`demazure_lusztig_operators`.\n - :meth:`demazure_lusztig_operator_on_classical_on_basis`.\n - :meth:`q_project`\n\n EXAMPLES::\n\n sage: L = RootSystem(["A",1,1]).ambient_space()\n sage: K = QQ[\'q,q1,q2\'].fraction_field()\n sage: q, q1, q2 = K.gens()\n sage: KL = L.algebra(K)\n sage: KL0 = KL.classical()\n sage: L0 = KL0.basis().keys()\n sage: T = KL.demazure_lusztig_operators_on_classical(q, q1, q2) # needs sage.graphs\n\n sage: x = KL0.monomial(L0((3,0))); x\n B[(3, 0)]\n\n For `T_1,\\dots` we recover the usual Demazure-Lusztig operators::\n\n sage: T[1](x) # needs sage.graphs\n (q1+q2)*B[(1, 2)] + (q1+q2)*B[(2, 1)] + (q1+q2)*B[(3, 0)] + q1*B[(0, 3)]\n\n For `T_0`, we can note that, in the projection, `\\delta`\n is mapped to `q`::\n\n sage: T[0](x) # needs sage.graphs\n (-q^2*q1-q^2*q2)*B[(1, 2)] + (-q*q1-q*q2)*B[(2, 1)] + (-q^3*q2)*B[(0, 3)]\n\n Note that there is no translation part, and in particular\n 1 is an eigenvector for all `T_i`\'s::\n\n sage: # needs sage.graphs\n sage: T[0](KL0.one())\n q1*B[(0, 0)]\n sage: T[1](KL0.one())\n q1*B[(0, 0)]\n sage: Y = T.Y()\n sage: alphacheck = Y.keys().simple_roots()\n sage: Y[alphacheck[0]](KL0.one())\n ((-q2)/(q*q1))*B[(0, 0)]\n\n Matching with Ion Bogdan\'s hand calculations from 3/15/2013::\n\n sage: L = RootSystem(["A",1,1]).weight_space(extended=True)\n sage: K = QQ[\'q,u\'].fraction_field()\n sage: q, u = K.gens()\n sage: KL = L.algebra(K)\n sage: KL0 = KL.classical()\n sage: L0 = KL0.basis().keys()\n sage: omega = L0.fundamental_weights()\n\n sage: # needs sage.graphs\n sage: T = KL.demazure_lusztig_operators_on_classical(q, u, -1/u,\n ....: convention="dominant")\n sage: Y = T.Y()\n sage: alphacheck = Y.keys().simple_roots()\n sage: Ydelta = Y[Y.keys().null_root()]\n sage: Ydelta.word, Ydelta.signs, Ydelta.scalar\n ((), (), 1/q)\n sage: Y1 = Y[alphacheck[1]]\n sage: Y1.word, Y1.signs, Y1.scalar # This is T_0 T_1 (T_1 acts first, then T_0); Ion gets T_1 T_0\n ((1, 0), (1, 1), 1)\n sage: Y0 = Y[alphacheck[0]]\n sage: Y0.word, Y0.signs, Y0.scalar # This is 1/q T_1^-1 T_0^-1\n ((0, 1), (-1, -1), 1/q)\n\n Note that the following computations use the "dominant" convention::\n\n sage: # needs sage.graphs\n sage: T0 = T.Tw(0)\n sage: T0(KL0.monomial(omega[1]))\n q*u*B[-Lambda[1]] + ((u^2-1)/u)*B[Lambda[1]]\n sage: T0(KL0.monomial(2*omega[1]))\n ((q*u^2-q)/u)*B[0] + q^2*u*B[-2*Lambda[1]] + ((u^2-1)/u)*B[2*Lambda[1]]\n sage: T0(KL0.monomial(-omega[1]))\n 1/(q*u)*B[Lambda[1]]\n sage: T0(KL0.monomial(-2*omega[1]))\n ((-u^2+1)/(q*u))*B[0] + 1/(q^2*u)*B[2*Lambda[1]]\n\n '
ct = self.cartan_type()
a0check = ct.acheck()[ct.special_node()]
T_on_basis = functools.partial(self.demazure_lusztig_operator_on_classical_on_basis, q1=q1, q2=q2, q=(q ** a0check), convention=convention)
return HeckeAlgebraRepresentation(self.classical(), T_on_basis, self.cartan_type(), q1=q1, q2=q2, q=q, side='left')
@cached_method
def T0_check_on_basis(self, q1, q2, convention='antidominant'):
'\n Return the `T_0^\\vee` operator acting on the basis.\n\n This implements the formula for `T_{0\'}` in Section 6.12 of [Haiman06]_.\n\n REFERENCES:\n\n .. [Haiman06] \\M. Haiman, Cherednik algebras, Macdonald polynomials and combinatorics, ICM 2006.\n\n .. WARNING::\n\n The current implementation probably returns just\n nonsense, if the convention is not "dominant".\n\n EXAMPLES::\n\n sage: K = QQ[\'q1,q2\'].fraction_field()\n sage: q1,q2 = K.gens()\n\n sage: L = RootSystem(["A",1,1]).ambient_space()\n sage: L0 = L.classical()\n sage: KL = L.algebra(K)\n sage: some_weights = L.fundamental_weights() # needs sage.graphs\n sage: f = KL.T0_check_on_basis(q1,q2, convention="dominant") # needs sage.graphs\n sage: f(L0.zero()) # needs sage.graphs\n (q1+q2)*B[(0, 0)] + q1*B[(1, -1)]\n\n sage: L = RootSystem(["A",3,1]).ambient_space()\n sage: L0 = L.classical()\n sage: KL = L.algebra(K)\n sage: some_weights = L0.fundamental_weights()\n sage: f = KL.T0_check_on_basis(q1,q2, convention="dominant") # needs sage.graphs\n sage: f(L0.zero()) # not checked # needs sage.graphs\n (q1+q2)*B[(0, 0, 0, 0)] + q1^3/q2^2*B[(1, 0, 0, -1)]\n\n The following results have not been checked::\n\n sage: for x in some_weights: # needs sage.graphs\n ....: print("{} : {}".format(x, f(x)))\n (1, 0, 0, 0) : q1*B[(1, 0, 0, 0)]\n (1, 1, 0, 0) : q1*B[(1, 1, 0, 0)]\n (1, 1, 1, 0) : q1*B[(1, 1, 1, 0)]\n\n Some examples for type `B_2^{(1)}` dual::\n\n sage: L = RootSystem("B2~*").ambient_space()\n sage: L0 = L.classical()\n sage: e = L.basis()\n sage: K = QQ[\'q,u\'].fraction_field()\n sage: q,u = K.gens()\n sage: q1 = u\n sage: q2 = -1/u\n sage: KL = L.algebra(K)\n sage: KL0 = KL.classical()\n sage: f = KL.T0_check_on_basis(q1,q2, convention="dominant") # needs sage.graphs\n sage: T = KL.twisted_demazure_lusztig_operators(q1,q2, convention="dominant")\n\n Direct calculation::\n\n sage: T.Tw(0)(KL0.monomial(L0([0,0]))) # needs sage.graphs\n ((u^2-1)/u)*B[(0, 0)] + u^3*B[(1, 1)]\n sage: KL.T0_check_on_basis(q1,q2, convention="dominant")(L0([0,0])) # needs sage.graphs\n ((u^2-1)/u)*B[(0, 0)] + u^3*B[(1, 1)]\n\n Step by step calculation, comparing by hand with Mark Shimozono::\n\n sage: res = T.Tw(2)(KL0.monomial(L0([0,0]))); res\n u*B[(0, 0)]\n sage: res = res * KL0.monomial(L0([-1,1])); res\n u*B[(-1, 1)]\n sage: res = T.Tw_inverse(1)(res); res\n (u^2-1)*B[(0, 0)] + u^2*B[(1, -1)]\n sage: res = T.Tw_inverse(2)(res); res\n ((u^2-1)/u)*B[(0, 0)] + u^3*B[(1, 1)]\n '
L = self.basis().keys()
ct = L.cartan_type()
special_node = ct.special_node()
a0 = ct.a()[special_node]
A0 = self.classical()
T = A0.demazure_lusztig_operators(q1, q2, convention=convention)
L0 = A0.basis().keys()
if (ct.type() == 'BC'):
phi = ((- a0) * L0(L.simple_roots()[0]))
else:
phi = L0(L0.root_system.coroot_lattice().highest_root().associated_coroot())
(j, v) = phi.to_simple_root(reduced_word=True)
translation = A0.monomial(((- L0.simple_root(j)) / a0))
Tv = T[v]
Tinv = T.Tw_inverse((v + (j,)))
def T0_check(weight):
return (((- q1) * q2) * Tinv((translation * Tv(A0.monomial(weight)))))
T0_check.phi = phi
T0_check.j = j
T0_check.v = v
return T0_check
@cached_method
def classical(self):
'\n Return the group algebra of the corresponding classical lattice.\n\n EXAMPLES::\n\n sage: KL = RootSystem(["A",2,1]).ambient_space().algebra(QQ)\n sage: KL.classical()\n Algebra of the Ambient space of the Root system of type [\'A\', 2] over Rational Field\n '
return self.basis().keys().classical().algebra(self.base_ring())
def q_project_on_basis(self, l, q):
'\n Return the monomial `c * cl(l)` in the group algebra of the classical lattice.\n\n INPUT:\n\n - ``l`` -- an element of the root lattice realization\n - ``q`` -- an element of the ground ring\n\n Here, `cl(l)` is the projection of `l` in the classical\n lattice, and `c` is the coefficient of `l` in `\\delta`.\n\n .. SEEALSO:: :meth:`q_project_on_basis`\n\n EXAMPLES::\n\n sage: K = QQ[\'q\'].fraction_field()\n sage: q = K.gen()\n sage: KL = RootSystem(["A",2,1]).ambient_space().algebra(K)\n sage: L = KL.basis().keys()\n sage: e = L.basis()\n sage: KL.q_project_on_basis(4*e[1] + 3*e[2]\n ....: + e[\'deltacheck\'] - 2*e[\'delta\'], q)\n 1/q^2*B[(0, 4, 3)]\n '
KL0 = self.classical()
L0 = KL0.basis().keys()
return KL0.term(L0(l), (q ** l['delta']))
def q_project(self, x, q):
'\n Implement the `q`-projection morphism from ``self`` to the group algebra of the classical space.\n\n INPUT:\n\n - ``x`` -- an element of the group algebra of ``self``\n - ``q`` -- an element of the ground ring\n\n This is an algebra morphism mapping `\\delta` to `q` and\n `X^b` to its classical counterpart for the other elements\n `b` of the basis of the realization.\n\n EXAMPLES::\n\n sage: K = QQ[\'q\'].fraction_field()\n sage: q = K.gen()\n sage: KL = RootSystem(["A",2,1]).ambient_space().algebra(K)\n sage: L = KL.basis().keys()\n sage: e = L.basis()\n sage: x = (KL.an_element()\n ....: + KL.monomial(4*e[1] + 3*e[2]\n ....: + e[\'deltacheck\'] - 2*e[\'delta\'])); x\n B[2*e[0] + 2*e[1] + 3*e[2]]\n + B[4*e[1] + 3*e[2] - 2*e[\'delta\'] + e[\'deltacheck\']]\n sage: KL.q_project(x, q)\n B[(2, 2, 3)] + 1/q^2*B[(0, 4, 3)]\n\n sage: KL = RootSystem(["BC",3,2]).ambient_space().algebra(K)\n sage: L = KL.basis().keys()\n sage: e = L.basis()\n sage: x = (KL.an_element()\n ....: + KL.monomial(4*e[1] + 3*e[2]\n ....: + e[\'deltacheck\'] - 2*e[\'delta\'])); x\n B[2*e[0] + 2*e[1] + 3*e[2]]\n + B[4*e[1] + 3*e[2] - 2*e[\'delta\'] + e[\'deltacheck\']]\n sage: KL.q_project(x, q)\n B[(2, 2, 3)] + 1/q^2*B[(0, 4, 3)]\n\n .. WARNING::\n\n Recall that the null root, usually denoted `\\delta`,\n is in fact ``a[0]\\delta`` in Sage\'s notation, in order\n to avoid half integer coefficients (this only makes a\n difference in type BC). Similarly, what\'s usually\n denoted `q` is in fact ``q^a[0]`` in Sage\'s notations,\n to avoid manipulating square roots::\n\n sage: KL.q_project(KL.monomial(L.null_root()),q) # needs sage.graphs\n q^2*B[(0, 0, 0)]\n '
L0 = self.classical()
return L0.linear_combination(((self.q_project_on_basis(l, q), c) for (l, c) in x))
def twisted_demazure_lusztig_operator_on_basis(self, weight, i, q1, q2, convention='antidominant'):
'\n Return the twisted Demazure-Lusztig operator acting on the basis.\n\n INPUT:\n\n - ``weight`` -- an element `\\lambda` of the weight lattice\n - ``i`` -- an element of the index set\n - ``q1,q2`` -- two elements of the ground ring\n - ``convention`` -- ``"antidominant"``, ``"bar"``, or ``"dominant"`` (default: ``"antidominant"``)\n\n .. SEEALSO:: :meth:`twisted_demazure_lusztig_operators`\n\n EXAMPLES::\n\n sage: L = RootSystem(["A",3,1]).ambient_space()\n sage: e = L.basis()\n sage: K = QQ[\'q1,q2\'].fraction_field()\n sage: q1, q2 = K.gens()\n sage: KL = L.algebra(K)\n sage: Lambda = L.classical().fundamental_weights()\n sage: KL.twisted_demazure_lusztig_operator_on_basis(\n ....: Lambda[1] + 2*Lambda[2], 1, q1, q2, convention="dominant")\n (-q2)*B[(2, 3, 0, 0)]\n sage: KL.twisted_demazure_lusztig_operator_on_basis(\n ....: Lambda[1] + 2*Lambda[2], 2, q1, q2, convention="dominant")\n (-q1-q2)*B[(3, 1, 1, 0)] + (-q2)*B[(3, 0, 2, 0)]\n sage: KL.twisted_demazure_lusztig_operator_on_basis(\n ....: Lambda[1] + 2*Lambda[2], 3, q1, q2, convention="dominant")\n q1*B[(3, 2, 0, 0)]\n sage: KL.twisted_demazure_lusztig_operator_on_basis( # needs sage.graphs\n ....: Lambda[1]+2*Lambda[2], 0, q1, q2, convention="dominant")\n ((q1*q2+q2^2)/q1)*B[(1, 2, 1, 1)] + ((q1*q2+q2^2)/q1)*B[(1, 2, 2, 0)]\n + q2^2/q1*B[(1, 2, 0, 2)] + ((q1^2+2*q1*q2+q2^2)/q1)*B[(2, 1, 1, 1)]\n + ((q1^2+2*q1*q2+q2^2)/q1)*B[(2, 1, 2, 0)]\n + ((q1*q2+q2^2)/q1)*B[(2, 1, 0, 2)]\n + ((q1^2+2*q1*q2+q2^2)/q1)*B[(2, 2, 1, 0)]\n + ((q1*q2+q2^2)/q1)*B[(2, 2, 0, 1)]\n '
if (i == 0):
if (convention != 'dominant'):
raise NotImplementedError('The twisted Demazure-Lusztig operator T_0 is only implemented in the dominant convention')
return self.T0_check_on_basis(q1, q2, convention=convention)(weight)
else:
L = self.classical()
return L.demazure_lusztig_operators(q1, q2, convention=convention)[i](L.monomial(weight))
def twisted_demazure_lusztig_operators(self, q1, q2, convention='antidominant'):
'\n Return the twisted Demazure-Lusztig operators acting on ``self``.\n\n INPUT:\n\n - ``q1,q2`` -- two elements of the ground ring\n - ``convention`` -- ``"antidominant"``, ``"bar"``, or ``"dominant"`` (default: ``"antidominant"``)\n\n .. WARNING::\n\n - the code is currently only tested for `q_1q_2=-1`\n - only the ``"dominant"`` convention is functional for `i=0`\n\n For `T_1,\\ldots,T_n`, these operators are the usual\n Demazure-Lusztig operators. On the other hand, the\n operator `T_0` is twisted::\n\n sage: L = RootSystem(["A",3,1]).ambient_space()\n sage: e = L.basis()\n sage: K = QQ[\'q1,q2\'].fraction_field()\n sage: q1, q2 = K.gens()\n sage: KL = L.algebra(K)\n sage: T = KL.twisted_demazure_lusztig_operators(q1, q2, convention="dominant")\n sage: T._test_relations()\n\n TESTS:\n\n The following computations were checked with Mark Shimozono for type `A_1^{(1)}`::\n\n sage: L = RootSystem(["A",1,1]).ambient_space()\n sage: e = L.basis()\n sage: K = QQ[\'q1,q2\'].fraction_field()\n sage: q1,q2 = K.gens()\n sage: KL = L.algebra(K)\n sage: T = KL.twisted_demazure_lusztig_operators(q1, q2, convention="dominant")\n sage: T._test_relations()\n sage: L0 = L.classical()\n sage: alpha = L0.simple_roots()\n sage: T.Ti_on_basis(L0.zero(), 1)\n q1*B[(0, 0)]\n sage: T.Ti_inverse_on_basis(L0.zero(), 1)\n 1/q1*B[(0, 0)]\n sage: T.Ti_on_basis(alpha[1], 1)\n (-q1-q2)*B[(0, 0)] + (-q2)*B[(-1, 1)]\n sage: T.Ti_inverse_on_basis(alpha[1], 1)\n ((q1+q2)/(q1*q2))*B[(0, 0)] + 1/q1*B[(-1, 1)] + ((q1+q2)/(q1*q2))*B[(1, -1)]\n sage: T.Ti_on_basis(L0.zero(), 0) # needs sage.graphs\n (q1+q2)*B[(0, 0)] + q1*B[(1, -1)]\n\n The next computations were checked with Mark Shimozono for type `A_2^{(1)}`::\n\n sage: L = RootSystem(["A",2,1]).ambient_space()\n sage: e = L.basis()\n sage: K = QQ[\'u\'].fraction_field()\n sage: u = K.gen()\n sage: KL = L.algebra(K)\n sage: T = KL.twisted_demazure_lusztig_operators(u, -~u, convention="dominant")\n sage: T._test_relations()\n sage: L0 = L.classical()\n sage: KL0 = L0.algebra(K)\n sage: alpha = L0.simple_roots()\n\n sage: phi = L0.highest_root(); phi\n (1, 0, -1)\n sage: phi.to_simple_root(reduced_word=True)\n (2, (1,))\n sage: res = T.Ti_on_basis(L0([1,0,1]), 1); res\n 1/u*B[(0, 1, 1)]\n sage: res = res * KL0.monomial(-alpha[2]); res\n 1/u*B[(0, 0, 2)]\n sage: res = T.Tw_inverse(2)(res); res\n ((u^2-1)/u^2)*B[(0, 1, 1)] + B[(0, 2, 0)]\n sage: res = T.Tw_inverse(1)(res); res\n ((u^2-1)/u)*B[(1, 1, 0)] + ((u^2-1)/u)*B[(1, 0, 1)] + u*B[(2, 0, 0)]\n\n .. TODO::\n\n Choose a good set of Cartan Type to run on. Rank >4 is\n too big. But `C_1` and `B_1` are boring.\n\n We now check systematically that those operators satisfy\n the relations of the Iwahori-Hecke algebra::\n\n sage: K = QQ[\'q1,q2\'].fraction_field()\n sage: q1, q2 = K.gens()\n sage: for cartan_type in CartanType.samples(affine=True, crystallographic=True): # long time 12s\n ....: if cartan_type.rank() > 4: continue\n ....: if cartan_type.type() == \'BC\': continue\n ....: KL = RootSystem(cartan_type).weight_lattice().algebra(K)\n ....: T = KL.twisted_demazure_lusztig_operators(q1, q2, convention="dominant")\n ....: T._test_relations()\n\n .. TODO::\n\n Investigate why `T_0^\\vee` currently does not satisfy\n the quadratic relation in type `BC`. This should\n hopefully be fixed when `T_0^\\vee` will have a more\n uniform implementation::\n\n sage: cartan_type = CartanType(["BC",1,2])\n sage: KL = RootSystem(cartan_type).weight_lattice().algebra(K)\n sage: T = KL.twisted_demazure_lusztig_operators(q1,q2, convention="dominant")\n sage: T._test_relations() # needs sage.graphs\n Traceback (most recent call last):\n ... tester.assertTrue(Ti(Ti(x,i,-q2),i,-q1).is_zero()) ...\n AssertionError: False is not true\n\n Comparison with T0::\n\n sage: L = RootSystem(["A",2,1]).ambient_space()\n sage: e = L.basis()\n sage: K = QQ[\'t,q\'].fraction_field()\n sage: t,q = K.gens()\n sage: q1 = t\n sage: q2 = -1\n sage: KL = L.algebra(K)\n sage: L0 = L.classical()\n sage: T = KL.demazure_lusztig_operators(q1,q2, convention="dominant")\n sage: def T0(*l0): return KL.q_project(T[0].on_basis()(L.embed_at_level(L0(l0), 1)), q)\n sage: T0_check_on_basis = KL.T0_check_on_basis(q1, q2, # needs sage.graphs\n ....: convention="dominant")\n sage: def T0c(*l0): return T0_check_on_basis(L0(l0))\n\n sage: T0(0,0,1) # not double checked # needs sage.graphs\n ((-t+1)/q)*B[(1, 0, 0)] + 1/q^2*B[(2, 0, -1)]\n sage: T0c(0,0,1) # needs sage.graphs\n (t^2-t)*B[(1, 0, 0)] + (t^2-t)*B[(1, 1, -1)] + t^2*B[(2, 0, -1)] + (t-1)*B[(0, 0, 1)]\n '
T_on_basis = functools.partial(self.twisted_demazure_lusztig_operator_on_basis, q1=q1, q2=q2, convention=convention)
return HeckeAlgebraRepresentation(self.classical(), T_on_basis, self.cartan_type().classical().dual().affine().dual(), q1, q2, side='left')
class ElementMethods():
def acted_upon(self, w):
'\n Implements the action of ``w`` on ``self``.\n\n INPUT:\n\n - ``w`` -- an element of the Weyl group acting on the underlying weight lattice realization\n\n EXAMPLES::\n\n sage: L = RootSystem(["A",3]).ambient_space()\n sage: W = L.weyl_group() # needs sage.libs.gap\n sage: M = L.algebra(QQ[\'q\',\'t\'])\n sage: m = M.an_element(); m # TODO: investigate why we don\'t get something more interesting\n B[(2, 2, 3, 0)]\n sage: m = (m+1)^2; m\n B[(0, 0, 0, 0)] + 2*B[(2, 2, 3, 0)] + B[(4, 4, 6, 0)]\n sage: w = W.an_element(); w.reduced_word() # needs sage.libs.gap\n [1, 2, 3]\n sage: m.acted_upon(w) # needs sage.libs.gap\n B[(0, 0, 0, 0)] + 2*B[(0, 2, 2, 3)] + B[(0, 4, 4, 6)]\n '
return self.map_support(w.action)
def expand(self, alphabet):
'\n Expand ``self`` into variables in the ``alphabet``.\n\n INPUT:\n\n - ``alphabet`` -- a non empty list/tuple of (invertible) variables in a ring to expand in\n\n EXAMPLES::\n\n sage: L = RootSystem(["A",2]).ambient_lattice()\n sage: KL = L.algebra(QQ)\n sage: p = KL.an_element() + KL.sum_of_monomials(L.some_elements()); p\n B[(1, 0, 0)] + B[(1, -1, 0)] + B[(1, 1, 0)] + 2*B[(2, 2, 3)] + B[(0, 1, -1)]\n sage: F = LaurentPolynomialRing(QQ, \'x,y,z\')\n sage: p.expand(F.gens())\n 2*x^2*y^2*z^3 + x*y + x + y*z^-1 + x*y^-1\n\n TESTS::\n\n sage: type(p.expand(F.gens()))\n <class \'sage.rings.polynomial.laurent_polynomial_mpair.LaurentPolynomial_mpair\'>\n\n sage: p = KL.zero()\n sage: p.expand(F.gens())\n 0\n sage: type(p.expand(F.gens()))\n <class \'sage.rings.polynomial.laurent_polynomial_mpair.LaurentPolynomial_mpair\'>\n '
codomain = alphabet[0].parent()
return codomain.sum(((c * prod(((X ** int(n)) for (X, n) in zip(alphabet, vector(m))))) for (m, c) in self))
|
class RootSpace(CombinatorialFreeModule):
'\n The root space of a root system over a given base ring\n\n INPUT:\n\n - ``root_system`` - a root system\n - ``base_ring``: a ring `R`\n\n The *root space* (or lattice if ``base_ring`` is `\\ZZ`) of a root\n system is the formal free module `\\bigoplus_i R \\alpha_i`\n generated by the simple roots `(\\alpha_i)_{i\\in I}` of the root system.\n\n This class is also used for coroot spaces (or lattices).\n\n .. SEEALSO::\n\n - :meth:`RootSystem`\n - :meth:`RootSystem.root_lattice` and :meth:`RootSystem.root_space`\n - :meth:`~sage.combinat.root_system.root_lattice_realizations.RootLatticeRealizations`\n\n Todo: standardize the variable used for the root space in the examples (P?)\n\n TESTS::\n\n sage: for ct in CartanType.samples(crystallographic=True)+[CartanType(["A",2],["C",5,1])]:\n ....: TestSuite(ct.root_system().root_lattice()).run()\n ....: TestSuite(ct.root_system().root_space()).run()\n sage: r = RootSystem([\'A\',4]).root_lattice()\n sage: r.simple_root(1)\n alpha[1]\n sage: latex(r.simple_root(1))\n \\alpha_{1}\n\n '
def __init__(self, root_system, base_ring):
"\n EXAMPLES::\n\n sage: P = RootSystem(['A',4]).root_space()\n sage: s = P.simple_reflections()\n\n "
from sage.categories.morphism import SetMorphism
from sage.categories.homset import Hom
from sage.categories.sets_with_partial_maps import SetsWithPartialMaps
self.root_system = root_system
CombinatorialFreeModule.__init__(self, base_ring, root_system.index_set(), prefix=('alphacheck' if root_system.dual_side else 'alpha'), latex_prefix=('\\alpha^\\vee' if root_system.dual_side else '\\alpha'), category=RootLatticeRealizations(base_ring))
if (base_ring is not ZZ):
root_lattice = self.root_system.root_lattice()
SetMorphism(Hom(self, root_lattice, SetsWithPartialMaps()), self._to_root_lattice).register_as_conversion()
def _repr_(self):
"\n EXAMPLES::\n\n sage: RootSystem(['A',4]).root_lattice() # indirect doctest\n Root lattice of the Root system of type ['A', 4]\n sage: RootSystem(['B',4]).root_space()\n Root space over the Rational Field of the Root system of type ['B', 4]\n sage: RootSystem(['A',4]).coroot_lattice()\n Coroot lattice of the Root system of type ['A', 4]\n sage: RootSystem(['B',4]).coroot_space()\n Coroot space over the Rational Field of the Root system of type ['B', 4]\n\n "
return self._name_string()
def _name_string(self, capitalize=True, base_ring=True, type=True):
'\n EXAMPLES::\n\n sage: RootSystem([\'A\',4]).root_space()._name_string()\n "Root space over the Rational Field of the Root system of type [\'A\', 4]"\n '
return self._name_string_helper('root', capitalize=capitalize, base_ring=base_ring, type=type)
simple_root = CombinatorialFreeModule.monomial
@cached_method
def to_coroot_space_morphism(self):
"\n Returns the ``nu`` map to the coroot space over the same base ring, using the symmetrizer of the Cartan matrix\n\n It does not map the root lattice to the coroot lattice, but\n has the property that any root is mapped to some scalar\n multiple of its associated coroot.\n\n EXAMPLES::\n\n sage: R = RootSystem(['A',3]).root_space()\n sage: alpha = R.simple_roots()\n sage: f = R.to_coroot_space_morphism() # needs sage.graphs\n sage: f(alpha[1]) # needs sage.graphs\n alphacheck[1]\n sage: f(alpha[1] + alpha[2]) # needs sage.graphs\n alphacheck[1] + alphacheck[2]\n\n sage: R = RootSystem(['A',3]).root_lattice()\n sage: alpha = R.simple_roots()\n sage: f = R.to_coroot_space_morphism() # needs sage.graphs\n sage: f(alpha[1]) # needs sage.graphs\n alphacheck[1]\n sage: f(alpha[1] + alpha[2]) # needs sage.graphs\n alphacheck[1] + alphacheck[2]\n\n sage: S = RootSystem(['G',2]).root_space()\n sage: alpha = S.simple_roots()\n sage: f = S.to_coroot_space_morphism() # needs sage.graphs\n sage: f(alpha[1]) # needs sage.graphs\n alphacheck[1]\n sage: f(alpha[1] + alpha[2]) # needs sage.graphs\n alphacheck[1] + 3*alphacheck[2]\n "
R = self.base_ring()
C = self.cartan_type().symmetrizer().map(R)
return self.module_morphism(diagonal=C.__getitem__, codomain=self.coroot_space(R))
def _to_root_lattice(self, x):
"\n Try to convert ``x`` to the root lattice.\n\n INPUT:\n\n - ``x`` -- an element of ``self``\n\n EXAMPLES::\n\n sage: R = RootSystem(['A',3])\n sage: root_space = R.root_space()\n sage: x = root_space.an_element(); x\n 2*alpha[1] + 2*alpha[2] + 3*alpha[3]\n sage: root_space._to_root_lattice(x)\n 2*alpha[1] + 2*alpha[2] + 3*alpha[3]\n sage: root_space._to_root_lattice(x).parent()\n Root lattice of the Root system of type ['A', 3]\n\n This will fail if ``x`` does not have integral coefficients::\n\n sage: root_space._to_root_lattice(x/2)\n Traceback (most recent call last):\n ...\n ValueError: alpha[1] + alpha[2] + 3/2*alpha[3] does not have integral coefficients\n\n .. note::\n\n For internal use only; instead use a conversion::\n\n sage: R.root_lattice()(x)\n 2*alpha[1] + 2*alpha[2] + 3*alpha[3]\n sage: R.root_lattice()(x/2)\n Traceback (most recent call last):\n ...\n ValueError: alpha[1] + alpha[2] + 3/2*alpha[3] does not have integral coefficients\n\n .. TODO:: generalize diagonal module morphisms to implement this\n "
try:
return self.root_system.root_lattice().sum_of_terms(((i, ZZ(c)) for (i, c) in x))
except TypeError:
raise ValueError(('%s does not have integral coefficients' % x))
@cached_method
def _to_classical_on_basis(self, i):
'\n Implement the projection onto the corresponding classical root space or lattice, on the basis.\n\n EXAMPLES::\n\n sage: L = RootSystem(["A",3,1]).root_space()\n sage: L._to_classical_on_basis(0) # needs sage.graphs\n -alpha[1] - alpha[2] - alpha[3]\n sage: L._to_classical_on_basis(1)\n alpha[1]\n sage: L._to_classical_on_basis(2)\n alpha[2]\n '
if (i == self.cartan_type().special_node()):
return self._classical_alpha_0()
else:
return self.classical().simple_root(i)
@cached_method
def to_ambient_space_morphism(self):
"\n The morphism from ``self`` to its associated ambient space.\n\n EXAMPLES::\n\n sage: CartanType(['A',2]).root_system().root_lattice().to_ambient_space_morphism()\n Generic morphism:\n From: Root lattice of the Root system of type ['A', 2]\n To: Ambient space of the Root system of type ['A', 2]\n\n "
if self.root_system.dual_side:
L = self.cartan_type().dual().root_system().ambient_space()
basis = L.simple_coroots()
else:
L = self.cartan_type().root_system().ambient_space()
basis = L.simple_roots()
def basis_value(basis, i):
return basis[i]
return self.module_morphism(on_basis=functools.partial(basis_value, basis), codomain=L)
|
class RootSpaceElement(CombinatorialFreeModule.Element):
def scalar(self, lambdacheck):
"\n The scalar product between the root lattice and\n the coroot lattice.\n\n EXAMPLES::\n\n sage: L = RootSystem(['B',4]).root_lattice()\n sage: alpha = L.simple_roots()\n sage: alphacheck = L.simple_coroots()\n sage: alpha[1].scalar(alphacheck[1]) # needs sage.graphs\n 2\n sage: alpha[1].scalar(alphacheck[2]) # needs sage.graphs\n -1\n\n The scalar products between the roots and coroots are given by\n the Cartan matrix::\n\n sage: matrix([ [ alpha[i].scalar(alphacheck[j]) # needs sage.graphs\n ....: for i in L.index_set() ]\n ....: for j in L.index_set() ])\n [ 2 -1 0 0]\n [-1 2 -1 0]\n [ 0 -1 2 -1]\n [ 0 0 -2 2]\n\n sage: L.cartan_type().cartan_matrix() # needs sage.graphs\n [ 2 -1 0 0]\n [-1 2 -1 0]\n [ 0 -1 2 -1]\n [ 0 0 -2 2]\n "
if (not ((lambdacheck in self.parent().coroot_lattice()) or (lambdacheck in self.parent().coroot_space()))):
raise TypeError(('%s is not in a coroot lattice/space' % lambdacheck))
zero = self.parent().base_ring().zero()
cartan_matrix = self.parent().dynkin_diagram()
return sum(((sum(((lambdacheck[i] * s) for (i, s) in cartan_matrix.column(j)), zero) * c) for (j, c) in self), zero)
def is_positive_root(self):
"\n Checks whether an element in the root space lies in the\n nonnegative cone spanned by the simple roots.\n\n EXAMPLES::\n\n sage: R = RootSystem(['A',3,1]).root_space()\n sage: B = R.basis()\n sage: w = B[0] + B[3]\n sage: w.is_positive_root()\n True\n sage: w = B[1] - B[2]\n sage: w.is_positive_root()\n False\n "
return all(((c >= 0) for c in self.coefficients()))
@cached_in_parent_method
def associated_coroot(self):
'\n Returns the coroot associated to this root\n\n OUTPUT:\n\n An element of the coroot space over the same base ring; in\n particular the result is in the coroot lattice whenever\n ``self`` is in the root lattice.\n\n EXAMPLES::\n\n sage: L = RootSystem(["B", 3]).root_space()\n sage: alpha = L.simple_roots()\n sage: alpha[1].associated_coroot() # needs sage.graphs\n alphacheck[1]\n sage: alpha[1].associated_coroot().parent() # needs sage.graphs\n Coroot space over the Rational Field of the Root system of type [\'B\', 3]\n\n sage: L.highest_root() # needs sage.graphs\n alpha[1] + 2*alpha[2] + 2*alpha[3]\n sage: L.highest_root().associated_coroot() # needs sage.graphs\n alphacheck[1] + 2*alphacheck[2] + alphacheck[3]\n\n sage: alpha = RootSystem(["B", 3]).root_lattice().simple_roots()\n sage: alpha[1].associated_coroot() # needs sage.graphs\n alphacheck[1]\n sage: alpha[1].associated_coroot().parent() # needs sage.graphs\n Coroot lattice of the Root system of type [\'B\', 3]\n '
scaled_coroot = self.parent().to_coroot_space_morphism()(self)
s = self.scalar(scaled_coroot)
return scaled_coroot.map_coefficients((lambda c: ((2 * c) // s)))
def quantum_root(self):
'\n Check whether ``self`` is a quantum root.\n\n INPUT:\n\n - ``self`` -- an element of the nonnegative integer span of simple roots.\n\n A root `\\alpha` is a quantum root if `\\ell(s_\\alpha) = \\langle 2 \\rho, \\alpha^\\vee \\rangle - 1`\n where `\\ell` is the length function, `s_\\alpha` is the reflection across the hyperplane\n orthogonal to `\\alpha`, and `2\\rho` is the sum of positive roots.\n\n .. warning::\n\n This implementation only handles finite Cartan types and assumes that ``self`` is a root.\n\n .. TODO:: Rename to is_quantum_root\n\n EXAMPLES::\n\n sage: Q = RootSystem([\'C\',2]).root_lattice()\n sage: positive_roots = Q.positive_roots()\n sage: for x in sorted(positive_roots): # needs sage.graphs\n ....: print("{} {}".format(x, x.quantum_root()))\n alpha[1] True\n alpha[1] + alpha[2] False\n 2*alpha[1] + alpha[2] True\n alpha[2] True\n '
return (len(self.associated_reflection()) == ((- 1) + self.parent().nonparabolic_positive_root_sum(()).scalar(self.associated_coroot())))
def max_coroot_le(self):
"\n Return the highest positive coroot whose associated root is less than or equal to ``self``.\n\n INPUT:\n\n - ``self`` -- an element of the nonnegative integer span of simple roots.\n\n Returns None for the zero element.\n\n Really ``self`` is an element of a coroot lattice and this method returns the highest root whose\n associated coroot is <= ``self``.\n\n .. warning::\n\n This implementation only handles finite Cartan types\n\n EXAMPLES::\n\n sage: # needs sage.graphs\n sage: root_lattice = RootSystem(['C',2]).root_lattice()\n sage: root_lattice.from_vector(vector([1,1])).max_coroot_le()\n alphacheck[1] + 2*alphacheck[2]\n sage: root_lattice.from_vector(vector([2,1])).max_coroot_le()\n alphacheck[1] + 2*alphacheck[2]\n sage: root_lattice = RootSystem(['B',2]).root_lattice()\n sage: root_lattice.from_vector(vector([1,1])).max_coroot_le()\n 2*alphacheck[1] + alphacheck[2]\n sage: root_lattice.from_vector(vector([1,2])).max_coroot_le()\n 2*alphacheck[1] + alphacheck[2]\n\n sage: root_lattice.zero().max_coroot_le() is None # needs sage.graphs\n True\n sage: root_lattice.from_vector(vector([-1,0])).max_coroot_le() # needs sage.graphs\n Traceback (most recent call last):\n ...\n ValueError: -alpha[1] is not in the positive cone of roots\n sage: root_lattice = RootSystem(['A',2,1]).root_lattice()\n sage: root_lattice.simple_root(1).max_coroot_le() # needs sage.graphs\n Traceback (most recent call last):\n ...\n NotImplementedError: Only implemented for finite Cartan type\n "
if (not self.parent().cartan_type().is_finite()):
raise NotImplementedError('Only implemented for finite Cartan type')
if (not self.is_positive_root()):
raise ValueError(f'{self} is not in the positive cone of roots')
coroots = self.parent().coroot_lattice().positive_roots_by_height(increasing=False)
for beta in coroots:
if beta.quantum_root():
gamma = (self - beta.associated_coroot())
if gamma.is_positive_root():
return beta
return None
def max_quantum_element(self):
"\n Return a reduced word for the longest element of the Weyl group\n whose shortest path in the quantum Bruhat graph to the identity\n has sum of quantum coroots at most ``self``.\n\n INPUT:\n\n - ``self`` -- an element of the nonnegative integer span of simple roots.\n\n Really ``self`` is an element of a coroot lattice.\n\n .. warning::\n\n This implementation only handles finite Cartan types\n\n EXAMPLES::\n\n sage: # needs sage.graphs sage.libs.gap\n sage: Qvee = RootSystem(['C',2]).coroot_lattice()\n sage: Qvee.from_vector(vector([1,2])).max_quantum_element()\n [2, 1, 2, 1]\n sage: Qvee.from_vector(vector([1,1])).max_quantum_element()\n [1, 2, 1]\n sage: Qvee.from_vector(vector([0,2])).max_quantum_element()\n [2]\n\n "
Qvee = self.parent()
word = []
while (self != Qvee.zero()):
beta = self.max_coroot_le()
word += [x for x in beta.associated_reflection()]
self = (self - beta.associated_coroot())
W = self.parent().weyl_group()
return W.demazure_product(word).reduced_word()
def to_ambient(self):
"\n Map ``self`` to the ambient space.\n\n EXAMPLES::\n\n sage: alpha = CartanType(['B',2]).root_system().root_lattice().an_element(); alpha\n 2*alpha[1] + 2*alpha[2]\n sage: alpha.to_ambient()\n (2, 0)\n sage: alphavee = CartanType(['B',2]).root_system().coroot_lattice().an_element(); alphavee\n 2*alphacheck[1] + 2*alphacheck[2]\n sage: alphavee.to_ambient()\n (2, 2)\n\n "
return self.parent().to_ambient_space_morphism()(self)
|
class RootSystem(UniqueRepresentation, SageObject):
'\n A class for root systems.\n\n EXAMPLES:\n\n We construct the root system for type `B_3`::\n\n sage: R = RootSystem([\'B\',3]); R\n Root system of type [\'B\', 3]\n\n ``R`` models the root system abstractly. It comes equipped with various\n realizations of the root and weight lattices, where all computations\n take place. Let us play first with the root lattice::\n\n sage: space = R.root_lattice(); space\n Root lattice of the Root system of type [\'B\', 3]\n\n This is the free `\\ZZ`-module `\\bigoplus_i \\ZZ.\\alpha_i` spanned\n by the simple roots::\n\n sage: space.base_ring()\n Integer Ring\n sage: list(space.basis())\n [alpha[1], alpha[2], alpha[3]]\n\n Let us do some computations with the simple roots::\n\n sage: alpha = space.simple_roots()\n sage: alpha[1] + alpha[2]\n alpha[1] + alpha[2]\n\n There is a canonical pairing between the root lattice and the\n coroot lattice::\n\n sage: R.coroot_lattice()\n Coroot lattice of the Root system of type [\'B\', 3]\n\n We construct the simple coroots, and do some computations (see\n comments about duality below for some caveat)::\n\n sage: alphacheck = space.simple_coroots()\n sage: list(alphacheck)\n [alphacheck[1], alphacheck[2], alphacheck[3]]\n\n We can carry over the same computations in any of the other\n realizations of the root lattice, like the root space\n `\\bigoplus_i \\QQ.\\alpha_i`, the weight lattice\n `\\bigoplus_i \\ZZ.\\Lambda_i`, the weight\n space `\\bigoplus_i \\QQ.\\Lambda_i`. For example::\n\n sage: space = R.weight_space(); space\n Weight space over the Rational Field of the Root system of type [\'B\', 3]\n\n ::\n\n sage: space.base_ring()\n Rational Field\n sage: list(space.basis())\n [Lambda[1], Lambda[2], Lambda[3]]\n\n ::\n\n sage: alpha = space.simple_roots() # needs sage.graphs\n sage: alpha[1] + alpha[2] # needs sage.graphs\n Lambda[1] + Lambda[2] - 2*Lambda[3]\n\n The fundamental weights are the dual basis of the coroots::\n\n sage: Lambda = space.fundamental_weights()\n sage: Lambda[1]\n Lambda[1]\n\n ::\n\n sage: alphacheck = space.simple_coroots() # needs sage.graphs\n sage: list(alphacheck) # needs sage.graphs\n [alphacheck[1], alphacheck[2], alphacheck[3]]\n\n ::\n\n sage: [Lambda[i].scalar(alphacheck[1]) for i in space.index_set()]\n [1, 0, 0]\n sage: [Lambda[i].scalar(alphacheck[2]) for i in space.index_set()]\n [0, 1, 0]\n sage: [Lambda[i].scalar(alphacheck[3]) for i in space.index_set()]\n [0, 0, 1]\n\n Let us use the simple reflections. In the weight space, they\n work as in the *number game*: firing the node `i` on an\n element `x` adds `c` times the simple root\n `\\alpha_i`, where `c` is the coefficient of\n `i` in `x`::\n\n sage: # needs sage.graphs\n sage: Lambda[1].simple_reflection(1)\n -Lambda[1] + Lambda[2]\n sage: Lambda[2].simple_reflection(1)\n Lambda[2]\n sage: Lambda[3].simple_reflection(1)\n Lambda[3]\n sage: (-2*Lambda[1] + Lambda[2] + Lambda[3]).simple_reflection(1)\n 2*Lambda[1] - Lambda[2] + Lambda[3]\n\n It can be convenient to manipulate the simple reflections\n themselves::\n\n sage: # needs sage.graphs\n sage: s = space.simple_reflections()\n sage: s[1](Lambda[1])\n -Lambda[1] + Lambda[2]\n sage: s[1](Lambda[2])\n Lambda[2]\n sage: s[1](Lambda[3])\n Lambda[3]\n\n .. RUBRIC:: Ambient spaces\n\n The root system may also come equipped with an ambient space.\n This is a `\\QQ`-module, endowed with its canonical Euclidean\n scalar product, which admits simultaneous embeddings of the\n (extended) weight and the (extended) coweight lattice, and\n therefore the root and the coroot lattice. This is implemented on\n a type by type basis for the finite crystallographic root systems\n following Bourbaki\'s conventions and is extended to the affine\n cases. Coefficients permitting, this is also available as an\n ambient lattice.\n\n .. SEEALSO:: :meth:`ambient_space` and :meth:`ambient_lattice` for details\n\n In finite type `A`, we recover the natural representation of the\n symmetric group as group of permutation matrices::\n\n sage: RootSystem(["A",2]).ambient_space().weyl_group().simple_reflections() # needs sage.libs.gap sage.libs.pari\n Finite family {1: [0 1 0]\n [1 0 0]\n [0 0 1],\n 2: [1 0 0]\n [0 0 1]\n [0 1 0]}\n\n In type `B`, `C`, and `D`, we recover the natural representation\n of the Weyl group as groups of signed permutation matrices::\n\n sage: RootSystem(["B",3]).ambient_space().weyl_group().simple_reflections() # needs sage.libs.gap sage.libs.pari\n Finite family {1: [0 1 0]\n [1 0 0]\n [0 0 1],\n 2: [1 0 0]\n [0 0 1]\n [0 1 0],\n 3: [ 1 0 0]\n [ 0 1 0]\n [ 0 0 -1]}\n\n In (untwisted) affine types `A`, ..., `D`, one can recover from\n the ambient space the affine permutation representation, in window\n notation. Let us consider the ambient space for affine type `A`::\n\n sage: L = RootSystem(["A",2,1]).ambient_space(); L\n Ambient space of the Root system of type [\'A\', 2, 1]\n\n Define the "identity" by an appropriate vector at level `-3`::\n\n sage: e = L.basis(); Lambda = L.fundamental_weights() # needs sage.graphs\n sage: id = e[0] + 2*e[1] + 3*e[2] - 3*Lambda[0] # needs sage.graphs\n\n The corresponding permutation is obtained by projecting it onto\n the classical ambient space::\n\n sage: L.classical()\n Ambient space of the Root system of type [\'A\', 2]\n sage: L.classical()(id) # needs sage.graphs\n (1, 2, 3)\n\n Here is the orbit of the identity under the action of the finite\n group::\n\n sage: # needs sage.graphs sage.libs.gap sage.libs.pari\n sage: W = L.weyl_group()\n sage: S3 = [ w.action(id) for w in W.classical() ]\n sage: [L.classical()(x) for x in S3]\n [(1, 2, 3), (3, 1, 2), (2, 3, 1), (2, 1, 3), (1, 3, 2), (3, 2, 1)]\n\n And the action of `s_0` on these yields::\n\n sage: # needs sage.graphs sage.libs.gap sage.libs.pari\n sage: s = W.simple_reflections()\n sage: [L.classical()(s[0].action(x)) for x in S3]\n [(0, 2, 4), (-1, 1, 6), (-2, 3, 5), (0, 1, 5), (-1, 3, 4), (-2, 2, 6)]\n\n We can also plot various components of the ambient spaces::\n\n sage: L = RootSystem([\'A\',2]).ambient_space()\n sage: L.plot() # needs sage.plot sage.symbolic\n Graphics object consisting of 13 graphics primitives\n\n For more on plotting, see :ref:`sage.combinat.root_system.plot`.\n\n .. RUBRIC:: Dual root systems\n\n The root system is aware of its dual root system::\n\n sage: R.dual\n Dual of root system of type [\'B\', 3]\n\n ``R.dual`` is really the root system of type `C_3`::\n\n sage: R.dual.cartan_type()\n [\'C\', 3]\n\n And the coroot lattice that we have been manipulating before is\n really implemented as the root lattice of the dual root system::\n\n sage: R.dual.root_lattice()\n Coroot lattice of the Root system of type [\'B\', 3]\n\n In particular, the coroots for the root lattice are in fact the\n roots of the coroot lattice::\n\n sage: list(R.root_lattice().simple_coroots())\n [alphacheck[1], alphacheck[2], alphacheck[3]]\n sage: list(R.coroot_lattice().simple_roots())\n [alphacheck[1], alphacheck[2], alphacheck[3]]\n sage: list(R.dual.root_lattice().simple_roots())\n [alphacheck[1], alphacheck[2], alphacheck[3]]\n\n The coweight lattice and space are defined similarly. Note that, to\n limit confusion, all the output have been tweaked appropriately.\n\n .. SEEALSO::\n\n - :mod:`sage.combinat.root_system`\n - :class:`RootSpace`\n - :class:`WeightSpace`\n - :class:`AmbientSpace`\n - :class:`~sage.combinat.root_system.root_lattice_realizations.RootLatticeRealizations`\n - :class:`~sage.combinat.root_system.weight_lattice_realizations.WeightLatticeRealizations`\n\n TESTS::\n\n sage: R = RootSystem([\'C\',3])\n sage: TestSuite(R).run() # needs sage.graphs\n sage: L = R.ambient_space()\n sage: s = L.simple_reflections() # this used to break the testsuite below due to caching an unpicklable method\n sage: s = L.simple_projections() # todo: not implemented\n sage: TestSuite(L).run() # needs sage.graphs\n sage: L = R.root_space()\n sage: s = L.simple_reflections()\n sage: TestSuite(L).run()\n\n ::\n\n sage: for T in CartanType.samples(crystallographic=True): # long time (13s on sage.math, 2012)\n ....: TestSuite(RootSystem(T)).run()\n\n Some checks for equality::\n\n sage: r1 = RootSystem([\'A\',3])\n sage: r2 = RootSystem([\'B\',3])\n sage: r1 == r1\n True\n sage: r1 == r2\n False\n sage: r1 != r1\n False\n\n Check that root systems inherit a hash method from ``UniqueRepresentation``::\n\n sage: hash(r1) # random\n 42\n '
@staticmethod
def __classcall__(cls, cartan_type, as_dual_of=None):
'\n Straighten arguments to enable unique representation\n\n .. SEEALSO:: :class:`UniqueRepresentation`\n\n TESTS::\n\n sage: RootSystem(["A",3]) is RootSystem(CartanType(["A",3]))\n True\n sage: RootSystem(["B",3], as_dual_of=None) is RootSystem("B3")\n True\n '
return super().__classcall__(cls, CartanType(cartan_type), as_dual_of)
def __init__(self, cartan_type, as_dual_of=None):
"\n TESTS::\n\n sage: R = RootSystem(['A',3])\n sage: R\n Root system of type ['A', 3]\n "
self._cartan_type = CartanType(cartan_type)
if (as_dual_of is None):
self.dual_side = False
try:
self.dual = RootSystem(self._cartan_type.dual(), as_dual_of=self)
except Exception:
pass
else:
self.dual_side = True
self.dual = as_dual_of
def _test_root_lattice_realizations(self, **options):
'\n Runs tests on all the root lattice realizations of this root\n system.\n\n EXAMPLES::\n\n sage: RootSystem(["A",3])._test_root_lattice_realizations() # needs sage.graphs\n\n .. SEEALSO:: :class:`TestSuite`.\n '
options.pop('tester', None)
from sage.misc.sage_unittest import TestSuite
TestSuite(self.root_lattice()).run(**options)
TestSuite(self.root_space()).run(**options)
TestSuite(self.weight_lattice()).run(**options)
TestSuite(self.weight_space()).run(**options)
if self.cartan_type().is_affine():
TestSuite(self.weight_lattice(extended=True)).run(**options)
TestSuite(self.weight_space(extended=True)).run(**options)
if (self.ambient_lattice() is not None):
TestSuite(self.ambient_lattice()).run(**options)
if (self.ambient_space() is not None):
TestSuite(self.ambient_space()).run(**options)
def _repr_(self):
"\n EXAMPLES::\n\n sage: RootSystem(['A',3]) # indirect doctest\n Root system of type ['A', 3]\n sage: RootSystem(['B',3]).dual # indirect doctest\n Dual of root system of type ['B', 3]\n "
if self.dual_side:
return ('Dual of root system of type %s' % self.dual.cartan_type())
else:
return ('Root system of type %s' % self.cartan_type())
def cartan_type(self):
"\n Return the Cartan type of the root system.\n\n EXAMPLES::\n\n sage: R = RootSystem(['A',3])\n sage: R.cartan_type()\n ['A', 3]\n "
return self._cartan_type
@cached_method
def dynkin_diagram(self):
"\n Return the Dynkin diagram of the root system.\n\n EXAMPLES::\n\n sage: R = RootSystem(['A',3])\n sage: R.dynkin_diagram() # needs sage.graphs\n O---O---O\n 1 2 3\n A3\n "
return self.cartan_type().dynkin_diagram()
@cached_method
def cartan_matrix(self):
"\n EXAMPLES::\n\n sage: RootSystem(['A',3]).cartan_matrix() # needs sage.graphs\n [ 2 -1 0]\n [-1 2 -1]\n [ 0 -1 2]\n "
return self.cartan_type().cartan_matrix()
@cached_method
def index_set(self):
"\n EXAMPLES::\n\n sage: RootSystem(['A',3]).index_set()\n (1, 2, 3)\n "
return self.cartan_type().index_set()
@cached_method
def is_finite(self):
'\n Return ``True`` if ``self`` is a finite root system.\n\n EXAMPLES::\n\n sage: RootSystem(["A",3]).is_finite()\n True\n sage: RootSystem(["A",3,1]).is_finite()\n False\n '
return self.cartan_type().is_finite()
@cached_method
def is_irreducible(self):
'\n Return ``True`` if ``self`` is an irreducible root system.\n\n EXAMPLES::\n\n sage: RootSystem([\'A\', 3]).is_irreducible()\n True\n sage: RootSystem("A2xB2").is_irreducible()\n False\n '
return self.cartan_type().is_irreducible()
def root_lattice(self):
"\n Return the root lattice associated to ``self``.\n\n EXAMPLES::\n\n sage: RootSystem(['A',3]).root_lattice()\n Root lattice of the Root system of type ['A', 3]\n "
return self.root_space(ZZ)
@cached_method
def root_space(self, base_ring=QQ):
"\n Return the root space associated to ``self``.\n\n EXAMPLES::\n\n sage: RootSystem(['A',3]).root_space()\n Root space over the Rational Field of the Root system of type ['A', 3]\n "
return RootSpace(self, base_ring)
def root_poset(self, restricted=False, facade=False):
"\n Return the (restricted) root poset associated to ``self``.\n\n The elements are given by the positive roots (resp. non-simple, positive roots), and\n `\\alpha \\leq \\beta` iff `\\beta - \\alpha` is a non-negative linear combination of simple roots.\n\n INPUT:\n\n - ``restricted`` -- (default:False) if True, only non-simple roots are considered.\n - ``facade`` -- (default:False) passes facade option to the poset generator.\n\n EXAMPLES::\n\n sage: Phi = RootSystem(['A',2]).root_poset(); Phi # needs sage.graphs\n Finite poset containing 3 elements\n sage: sorted(Phi.cover_relations(), key=str) # needs sage.graphs\n [[alpha[1], alpha[1] + alpha[2]], [alpha[2], alpha[1] + alpha[2]]]\n\n sage: Phi = RootSystem(['A',3]).root_poset(restricted=True); Phi # needs sage.graphs\n Finite poset containing 3 elements\n sage: sorted(Phi.cover_relations(), key=str) # needs sage.graphs\n [[alpha[1] + alpha[2], alpha[1] + alpha[2] + alpha[3]],\n [alpha[2] + alpha[3], alpha[1] + alpha[2] + alpha[3]]]\n\n sage: Phi = RootSystem(['B',2]).root_poset(); Phi # needs sage.graphs\n Finite poset containing 4 elements\n sage: Phi.cover_relations() # needs sage.graphs\n [[alpha[2], alpha[1] + alpha[2]], [alpha[1], alpha[1] + alpha[2]],\n [alpha[1] + alpha[2], alpha[1] + 2*alpha[2]]]\n "
return self.root_lattice().root_poset(restricted=restricted, facade=facade)
def coroot_lattice(self):
"\n Return the coroot lattice associated to ``self``.\n\n EXAMPLES::\n\n sage: RootSystem(['A',3]).coroot_lattice()\n Coroot lattice of the Root system of type ['A', 3]\n "
return self.dual.root_lattice()
def coroot_space(self, base_ring=QQ):
"\n Return the coroot space associated to ``self``.\n\n EXAMPLES::\n\n sage: RootSystem(['A',3]).coroot_space()\n Coroot space over the Rational Field of the Root system of type ['A', 3]\n "
return self.dual.root_space(base_ring)
@cached_method
def weight_lattice(self, extended=False):
"\n Return the weight lattice associated to ``self``.\n\n .. SEEALSO::\n\n - :meth:`weight_space`\n - :meth:`coweight_space`, :meth:`coweight_lattice`\n - :class:`~sage.combinat.root_system.WeightSpace`\n\n EXAMPLES::\n\n sage: RootSystem(['A',3]).weight_lattice()\n Weight lattice of the Root system of type ['A', 3]\n\n sage: RootSystem(['A',3,1]).weight_space(extended=True)\n Extended weight space over the Rational Field\n of the Root system of type ['A', 3, 1]\n "
return WeightSpace(self, ZZ, extended=extended)
@cached_method
def weight_space(self, base_ring=QQ, extended=False):
"\n Returns the weight space associated to ``self``.\n\n .. SEEALSO::\n\n - :meth:`weight_lattice`\n - :meth:`coweight_space`, :meth:`coweight_lattice`\n - :class:`~sage.combinat.root_system.WeightSpace`\n\n EXAMPLES::\n\n sage: RootSystem(['A',3]).weight_space()\n Weight space over the Rational Field of the Root system of type ['A', 3]\n\n sage: RootSystem(['A',3,1]).weight_space(extended=True)\n Extended weight space over the Rational Field\n of the Root system of type ['A', 3, 1]\n "
return WeightSpace(self, base_ring, extended=extended)
def coweight_lattice(self, extended=False):
"\n Return the coweight lattice associated to ``self``.\n\n This is the weight lattice of the dual root system.\n\n .. SEEALSO::\n\n - :meth:`coweight_space`\n - :meth:`weight_space`, :meth:`weight_lattice`\n - :class:`~sage.combinat.root_system.WeightSpace`\n\n EXAMPLES::\n\n sage: RootSystem(['A',3]).coweight_lattice()\n Coweight lattice of the Root system of type ['A', 3]\n\n sage: RootSystem(['A',3,1]).coweight_lattice(extended=True)\n Extended coweight lattice of the Root system of type ['A', 3, 1]\n "
return self.dual.weight_lattice(extended=extended)
def coweight_space(self, base_ring=QQ, extended=False):
"\n Return the coweight space associated to ``self``.\n\n This is the weight space of the dual root system.\n\n .. SEEALSO::\n\n - :meth:`coweight_lattice`\n - :meth:`weight_space`, :meth:`weight_lattice`\n - :class:`~sage.combinat.root_system.WeightSpace`\n\n EXAMPLES::\n\n sage: RootSystem(['A',3]).coweight_space()\n Coweight space over the Rational Field of the Root system of type ['A', 3]\n\n sage: RootSystem(['A',3,1]).coweight_space(extended=True)\n Extended coweight space over the Rational Field\n of the Root system of type ['A', 3, 1]\n "
return self.dual.weight_space(base_ring, extended=extended)
def ambient_lattice(self):
"\n Return the ambient lattice for this root_system.\n\n This is the ambient space, over `\\ZZ`.\n\n .. SEEALSO::\n\n - :meth:`ambient_space`\n - :meth:`root_lattice`\n - :meth:`weight_lattice`\n\n EXAMPLES::\n\n sage: RootSystem(['A',4]).ambient_lattice()\n Ambient lattice of the Root system of type ['A', 4]\n sage: RootSystem(['A',4,1]).ambient_lattice()\n Ambient lattice of the Root system of type ['A', 4, 1]\n\n Except in type A, only an ambient space can be realized::\n\n sage: RootSystem(['B',4]).ambient_lattice()\n sage: RootSystem(['C',4]).ambient_lattice()\n sage: RootSystem(['D',4]).ambient_lattice()\n sage: RootSystem(['E',6]).ambient_lattice()\n sage: RootSystem(['F',4]).ambient_lattice()\n sage: RootSystem(['G',2]).ambient_lattice()\n "
return self.ambient_space(ZZ)
@cached_method
def ambient_space(self, base_ring=QQ):
"\n Return the usual ambient space for this root_system.\n\n INPUT:\n\n - ``base_ring`` -- a base ring (default: `\\QQ`)\n\n This is a ``base_ring``-module, endowed with its canonical\n Euclidean scalar product, which admits simultaneous embeddings\n into the weight and the coweight lattice, and therefore the\n root and the coroot lattice, and preserves scalar products\n between elements of the coroot lattice and elements of the\n root or weight lattice (and dually).\n\n There is no mechanical way to define the ambient space just\n from the Cartan matrix. Instead it is constructed from hard\n coded type by type data, according to the usual Bourbaki\n conventions. Such data is provided for all the finite\n (crystallographic) types. From this data, ambient spaces can be\n built as well for dual types, reducible types and affine\n types. When no data is available, or if the base ring is not\n large enough, None is returned.\n\n .. WARNING:: for affine types\n\n .. SEEALSO::\n\n - The section on ambient spaces in :class:`RootSystem`\n - :meth:`ambient_lattice`\n - :class:`~sage.combinat.root_system.ambient_space.AmbientSpace`\n - :class:`~sage.combinat.root_system.ambient_space.type_affine.AmbientSpace`\n - :meth:`root_space`\n - :meth:`weight:space`\n\n EXAMPLES::\n\n sage: RootSystem(['A',4]).ambient_space()\n Ambient space of the Root system of type ['A', 4]\n\n ::\n\n sage: RootSystem(['B',4]).ambient_space()\n Ambient space of the Root system of type ['B', 4]\n\n ::\n\n sage: RootSystem(['C',4]).ambient_space()\n Ambient space of the Root system of type ['C', 4]\n\n ::\n\n sage: RootSystem(['D',4]).ambient_space()\n Ambient space of the Root system of type ['D', 4]\n\n ::\n\n sage: RootSystem(['E',6]).ambient_space()\n Ambient space of the Root system of type ['E', 6]\n\n ::\n\n sage: RootSystem(['F',4]).ambient_space()\n Ambient space of the Root system of type ['F', 4]\n\n ::\n\n sage: RootSystem(['G',2]).ambient_space()\n Ambient space of the Root system of type ['G', 2]\n\n An alternative base ring can be provided as an option::\n\n sage: e = RootSystem(['B',3]).ambient_space(RR)\n sage: TestSuite(e).run() # needs sage.graphs\n\n It should contain the smallest ring over which the ambient\n space can be defined (`\\ZZ` in type `A` or `\\QQ` otherwise).\n Otherwise ``None`` is returned::\n\n sage: RootSystem(['B',2]).ambient_space(ZZ)\n\n The base ring should also be totally ordered. In practice,\n only `\\ZZ` and `\\QQ` are really supported at this point, but\n you are welcome to experiment::\n\n sage: e = RootSystem(['G',2]).ambient_space(RR)\n sage: TestSuite(e).run() # needs sage.graphs\n Failure in _test_root_lattice_realization:\n Traceback (most recent call last):\n ...\n AssertionError: 2.00000000000000 != 2.00000000000000\n ------------------------------------------------------------\n The following tests failed: _test_root_lattice_realization\n "
if (not hasattr(self.cartan_type(), 'AmbientSpace')):
return None
AmbientSpace = self.cartan_type().AmbientSpace
if (not base_ring.has_coerce_map_from(AmbientSpace.smallest_base_ring(self.cartan_type()))):
return None
return AmbientSpace(self, base_ring)
def coambient_space(self, base_ring=QQ):
'\n Return the coambient space for this root system.\n\n This is the ambient space of the dual root system.\n\n .. SEEALSO::\n\n - :meth:`ambient_space`\n\n EXAMPLES::\n\n sage: L = RootSystem(["B",2]).ambient_space(); L\n Ambient space of the Root system of type [\'B\', 2]\n sage: coL = RootSystem(["B",2]).coambient_space(); coL\n Coambient space of the Root system of type [\'B\', 2]\n\n The roots and coroots are interchanged::\n\n sage: coL.simple_roots()\n Finite family {1: (1, -1), 2: (0, 2)}\n sage: L.simple_coroots()\n Finite family {1: (1, -1), 2: (0, 2)}\n\n sage: coL.simple_coroots()\n Finite family {1: (1, -1), 2: (0, 1)}\n sage: L.simple_roots()\n Finite family {1: (1, -1), 2: (0, 1)}\n '
return self.dual.ambient_space(base_ring)
|
def WeylDim(ct, coeffs):
"\n The Weyl Dimension Formula.\n\n INPUT:\n\n\n - ``ct`` -- a Cartan type\n\n - ``coeffs`` -- a list of nonnegative integers\n\n\n The length of the list must equal the rank type[1]. A dominant\n weight hwv is constructed by summing the fundamental weights with\n coefficients from this list. The dimension of the irreducible\n representation of the semisimple complex Lie algebra with highest\n weight vector hwv is returned.\n\n EXAMPLES:\n\n For `SO(7)`, the Cartan type is `B_3`, so::\n\n sage: WeylDim(['B',3],[1,0,0]) # standard representation of SO(7)\n 7\n sage: WeylDim(['B',3],[0,1,0]) # exterior square\n 21\n sage: WeylDim(['B',3],[0,0,1]) # spin representation of spin(7)\n 8\n sage: WeylDim(['B',3],[1,0,1]) # sum of the first and third fundamental weights\n 48\n sage: [WeylDim(['F',4],x) for x in ([1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1])]\n [52, 1274, 273, 26]\n sage: [WeylDim(['E', 6], x)\n ....: for x in ([0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1],\n ....: [0, 0, 0, 0, 0, 2], [0, 0, 0, 0, 1, 0], [0, 0, 1, 0, 0, 0],\n ....: [1, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 1], [2, 0, 0, 0, 0, 0])]\n [1, 78, 27, 351, 351, 351, 27, 650, 351]\n "
ct = CartanType(ct)
lattice = RootSystem(ct).ambient_space()
rank = ct.rank()
fw = lattice.fundamental_weights()
hwv = lattice.sum(((coeffs[i] * fw[(i + 1)]) for i in range(min(rank, len(coeffs)))))
return lattice.weyl_dimension(hwv)
|
class AmbientSpace(ambient_space.AmbientSpace):
'\n EXAMPLES::\n\n sage: R = RootSystem(["A",3])\n sage: e = R.ambient_space(); e\n Ambient space of the Root system of type [\'A\', 3]\n sage: TestSuite(e).run() # needs sage.graphs\n\n By default, this ambient space uses the barycentric projection for plotting::\n\n sage: # needs sage.symbolic\n sage: L = RootSystem(["A",2]).ambient_space()\n sage: e = L.basis()\n sage: L._plot_projection(e[0])\n (1/2, 989/1142)\n sage: L._plot_projection(e[1])\n (-1, 0)\n sage: L._plot_projection(e[2])\n (1/2, -989/1142)\n sage: L = RootSystem(["A",3]).ambient_space()\n sage: l = L.an_element(); l\n (2, 2, 3, 0)\n sage: L._plot_projection(l)\n (0, -1121/1189, 7/3)\n\n .. SEEALSO::\n\n - :meth:`sage.combinat.root_system.root_lattice_realizations.RootLatticeRealizations.ParentMethods._plot_projection`\n '
@classmethod
def smallest_base_ring(cls, cartan_type=None):
'\n Returns the smallest base ring the ambient space can be defined upon\n\n .. SEEALSO:: :meth:`~sage.combinat.root_system.ambient_space.AmbientSpace.smallest_base_ring`\n\n EXAMPLES::\n\n sage: e = RootSystem(["A",3]).ambient_space()\n sage: e.smallest_base_ring()\n Integer Ring\n '
return ZZ
def dimension(self):
'\n EXAMPLES::\n\n sage: e = RootSystem(["A",3]).ambient_space()\n sage: e.dimension()\n 4\n '
return (self.root_system.cartan_type().rank() + 1)
def root(self, i, j):
"\n Note that indexing starts at 0.\n\n EXAMPLES::\n\n sage: e = RootSystem(['A',3]).ambient_lattice()\n sage: e.root(0,1)\n (1, -1, 0, 0)\n "
return (self.monomial(i) - self.monomial(j))
def simple_root(self, i):
"\n EXAMPLES::\n\n sage: e = RootSystem(['A',3]).ambient_lattice()\n sage: e.simple_roots()\n Finite family {1: (1, -1, 0, 0), 2: (0, 1, -1, 0), 3: (0, 0, 1, -1)}\n "
return self.root((i - 1), i)
def negative_roots(self):
"\n EXAMPLES::\n\n sage: e = RootSystem(['A',3]).ambient_lattice()\n sage: e.negative_roots()\n [(-1, 1, 0, 0),\n (-1, 0, 1, 0),\n (-1, 0, 0, 1),\n (0, -1, 1, 0),\n (0, -1, 0, 1),\n (0, 0, -1, 1)]\n "
res = []
for j in range((self.n - 1)):
for i in range((j + 1), self.n):
res.append(self.root(i, j))
return res
def positive_roots(self):
"\n EXAMPLES::\n\n sage: e = RootSystem(['A',3]).ambient_lattice()\n sage: e.positive_roots()\n [(1, -1, 0, 0),\n (1, 0, -1, 0),\n (0, 1, -1, 0),\n (1, 0, 0, -1),\n (0, 1, 0, -1),\n (0, 0, 1, -1)]\n\n "
res = []
for j in range(self.n):
for i in range(j):
res.append(self.root(i, j))
return res
def highest_root(self):
"\n EXAMPLES::\n\n sage: e = RootSystem(['A',3]).ambient_lattice()\n sage: e.highest_root()\n (1, 0, 0, -1)\n "
return self.root(0, (self.n - 1))
def fundamental_weight(self, i):
"\n EXAMPLES::\n\n sage: e = RootSystem(['A',3]).ambient_lattice()\n sage: e.fundamental_weights()\n Finite family {1: (1, 0, 0, 0), 2: (1, 1, 0, 0), 3: (1, 1, 1, 0)}\n\n "
return self.sum((self.monomial(j) for j in range(i)))
def det(self, k=1):
"\n returns the vector (1, ... ,1) which in the ['A',r]\n weight lattice, interpreted as a weight of GL(r+1,CC)\n is the determinant. If the optional parameter k is\n given, returns (k, ... ,k), the k-th power of the\n determinant.\n\n EXAMPLES::\n\n sage: e = RootSystem(['A',3]).ambient_space()\n sage: e.det(1/2)\n (1/2, 1/2, 1/2, 1/2)\n "
return self.sum(((self.monomial(j) * k) for j in range(self.n)))
_plot_projection = RootLatticeRealizations.ParentMethods.__dict__['_plot_projection_barycentric']
|
class CartanType(CartanType_standard_finite, CartanType_simply_laced, CartanType_simple):
'\n Cartan Type `A_n`\n\n .. SEEALSO:: :func:`~sage.combinat.root_systems.cartan_type.CartanType`\n '
def __init__(self, n):
"\n EXAMPLES::\n\n sage: ct = CartanType(['A',4])\n sage: ct\n ['A', 4]\n sage: ct._repr_(compact = True)\n 'A4'\n\n sage: ct.is_irreducible()\n True\n sage: ct.is_finite()\n True\n sage: ct.is_affine()\n False\n sage: ct.is_crystallographic()\n True\n sage: ct.is_simply_laced()\n True\n sage: ct.affine()\n ['A', 4, 1]\n sage: ct.dual()\n ['A', 4]\n\n TESTS::\n\n sage: TestSuite(ct).run()\n "
assert (n >= 0)
CartanType_standard_finite.__init__(self, 'A', n)
def _latex_(self):
"\n Return a latex representation of ``self``.\n\n EXAMPLES::\n\n sage: latex(CartanType(['A',4]))\n A_{4}\n "
return ('A_{%s}' % self.n)
AmbientSpace = AmbientSpace
def coxeter_number(self):
"\n Return the Coxeter number associated with ``self``.\n\n EXAMPLES::\n\n sage: CartanType(['A',4]).coxeter_number()\n 5\n "
return (self.n + 1)
def dual_coxeter_number(self):
"\n Return the dual Coxeter number associated with ``self``.\n\n EXAMPLES::\n\n sage: CartanType(['A',4]).dual_coxeter_number()\n 5\n "
return (self.n + 1)
def dynkin_diagram(self):
"\n Returns the Dynkin diagram of type A.\n\n EXAMPLES::\n\n sage: a = CartanType(['A',3]).dynkin_diagram(); a # needs sage.graphs\n O---O---O\n 1 2 3\n A3\n sage: a.edges(sort=True) # needs sage.graphs\n [(1, 2, 1), (2, 1, 1), (2, 3, 1), (3, 2, 1)]\n\n TESTS::\n\n sage: a = DynkinDiagram(['A',1]); a # needs sage.graphs\n O\n 1\n A1\n sage: a.vertices(sort=False), a.edges(sort=False) # needs sage.graphs\n ([1], [])\n "
from .dynkin_diagram import DynkinDiagram_class
n = self.n
g = DynkinDiagram_class(self)
for i in range(1, n):
g.add_edge(i, (i + 1))
return g
def _latex_dynkin_diagram(self, label=None, node=None, node_dist=2):
"\n Return a latex representation of the Dynkin diagram.\n\n EXAMPLES::\n\n sage: print(CartanType(['A',4])._latex_dynkin_diagram())\n \\draw (0 cm,0) -- (6 cm,0);\n \\draw[fill=white] (0 cm, 0 cm) circle (.25cm) node[below=4pt]{$1$};\n \\draw[fill=white] (2 cm, 0 cm) circle (.25cm) node[below=4pt]{$2$};\n \\draw[fill=white] (4 cm, 0 cm) circle (.25cm) node[below=4pt]{$3$};\n \\draw[fill=white] (6 cm, 0 cm) circle (.25cm) node[below=4pt]{$4$};\n <BLANKLINE>\n\n sage: print(CartanType(['A',0])._latex_dynkin_diagram())\n <BLANKLINE>\n sage: print(CartanType(['A',1])._latex_dynkin_diagram())\n \\draw[fill=white] (0 cm, 0 cm) circle (.25cm) node[below=4pt]{$1$};\n <BLANKLINE>\n "
if (label is None):
label = (lambda i: i)
if (node is None):
node = self._latex_draw_node
if (self.n > 1):
ret = '\\draw (0 cm,0) -- ({} cm,0);\n'.format(((self.n - 1) * node_dist))
else:
ret = ''
return (ret + ''.join((node(((i - 1) * node_dist), 0, label(i)) for i in self.index_set())))
def ascii_art(self, label=None, node=None):
"\n Return an ascii art representation of the Dynkin diagram.\n\n EXAMPLES::\n\n sage: print(CartanType(['A',0]).ascii_art())\n sage: print(CartanType(['A',1]).ascii_art())\n O\n 1\n sage: print(CartanType(['A',3]).ascii_art())\n O---O---O\n 1 2 3\n sage: print(CartanType(['A',12]).ascii_art())\n O---O---O---O---O---O---O---O---O---O---O---O\n 1 2 3 4 5 6 7 8 9 10 11 12\n sage: print(CartanType(['A',5]).ascii_art(label = lambda x: x+2))\n O---O---O---O---O\n 3 4 5 6 7\n sage: print(CartanType(['A',5]).ascii_art(label = lambda x: x-2))\n O---O---O---O---O\n -1 0 1 2 3\n "
n = self.n
if (n == 0):
return ''
if (label is None):
label = (lambda i: i)
if (node is None):
node = self._ascii_art_node
ret = ('---'.join((node(label(i)) for i in range(1, (n + 1)))) + '\n')
ret += ''.join(('{!s:4}'.format(label(i)) for i in range(1, (n + 1))))
return ret
|
class CartanType(CartanType_standard_untwisted_affine):
def __init__(self, n):
"\n EXAMPLES::\n\n sage: ct = CartanType(['A',4,1])\n sage: ct\n ['A', 4, 1]\n sage: ct._repr_(compact = True)\n 'A4~'\n\n sage: ct.is_irreducible()\n True\n sage: ct.is_finite()\n False\n sage: ct.is_affine()\n True\n sage: ct.is_untwisted_affine()\n True\n sage: ct.is_crystallographic()\n True\n sage: ct.is_simply_laced()\n True\n sage: ct.classical()\n ['A', 4]\n sage: ct.dual()\n ['A', 4, 1]\n\n sage: ct = CartanType(['A', 1, 1])\n sage: ct.is_simply_laced()\n False\n sage: ct.dual()\n ['A', 1, 1]\n\n TESTS::\n\n sage: TestSuite(ct).run()\n "
assert (n >= 1)
CartanType_standard_untwisted_affine.__init__(self, 'A', n)
if (n >= 2):
self._add_abstract_superclass(CartanType_simply_laced)
def _latex_(self):
"\n Return a latex representation of ``self``.\n\n EXAMPLES::\n\n sage: ct = CartanType(['A',4,1])\n sage: latex(ct)\n A_{4}^{(1)}\n "
return ('A_{%s}^{(1)}' % self.n)
def dynkin_diagram(self):
"\n Returns the extended Dynkin diagram for affine type A.\n\n EXAMPLES::\n\n sage: a = CartanType(['A',3,1]).dynkin_diagram(); a # needs sage.graphs\n 0\n O-------+\n | |\n | |\n O---O---O\n 1 2 3\n A3~\n sage: a.edges(sort=True) # needs sage.graphs\n [(0, 1, 1),\n (0, 3, 1),\n (1, 0, 1),\n (1, 2, 1),\n (2, 1, 1),\n (2, 3, 1),\n (3, 0, 1),\n (3, 2, 1)]\n\n sage: a = DynkinDiagram(['A',1,1]); a # needs sage.graphs\n O<=>O\n 0 1\n A1~\n sage: a.edges(sort=True) # needs sage.graphs\n [(0, 1, 2), (1, 0, 2)]\n "
from .dynkin_diagram import DynkinDiagram_class
n = self.n
g = DynkinDiagram_class(self)
if (n == 1):
g.add_edge(0, 1, 2)
g.add_edge(1, 0, 2)
else:
for i in range(1, n):
g.add_edge(i, (i + 1))
g.add_edge(0, 1)
g.add_edge(0, n)
return g
def _latex_dynkin_diagram(self, label=None, node=None, node_dist=2):
"\n Return a latex representation of the Dynkin diagram.\n\n EXAMPLES::\n\n sage: print(CartanType(['A',4,1])._latex_dynkin_diagram())\n \\draw (0 cm,0) -- (6 cm,0);\n \\draw (0 cm,0) -- (3.0 cm, 1.2 cm);\n \\draw (3.0 cm, 1.2 cm) -- (6 cm, 0);\n \\draw[fill=white] (0 cm, 0 cm) circle (.25cm) node[below=4pt]{$1$};\n \\draw[fill=white] (2 cm, 0 cm) circle (.25cm) node[below=4pt]{$2$};\n \\draw[fill=white] (4 cm, 0 cm) circle (.25cm) node[below=4pt]{$3$};\n \\draw[fill=white] (6 cm, 0 cm) circle (.25cm) node[below=4pt]{$4$};\n \\draw[fill=white] (3.0 cm, 1.2 cm) circle (.25cm) node[anchor=south east]{$0$};\n <BLANKLINE>\n "
if (label is None):
label = (lambda i: i)
if (node is None):
node = self._latex_draw_node
if (self.n == 1):
ret = ('\\draw (0, 0.1 cm) -- +(%s cm,0);\n' % node_dist)
ret += ('\\draw (0, -0.1 cm) -- +(%s cm,0);\n' % node_dist)
ret += self._latex_draw_arrow_tip(((0.33 * node_dist) - 0.2), 0, 180)
ret += self._latex_draw_arrow_tip(((0.66 * node_dist) + 0.2), 0, 0)
ret += node(0, 0, label(0))
ret += node(node_dist, 0, label(1))
return ret
rt_most = ((self.n - 1) * node_dist)
mid = (0.5 * rt_most)
ret = ('\\draw (0 cm,0) -- (%s cm,0);\n' % rt_most)
ret += ('\\draw (0 cm,0) -- (%s cm, 1.2 cm);\n' % mid)
ret += ('\\draw (%s cm, 1.2 cm) -- (%s cm, 0);\n' % (mid, rt_most))
for i in range(self.n):
ret += node((i * node_dist), 0, label((i + 1)))
ret += node(mid, 1.2, label(0), 'anchor=south east')
return ret
def ascii_art(self, label=None, node=None):
"\n Return an ascii art representation of the extended Dynkin diagram.\n\n EXAMPLES::\n\n sage: print(CartanType(['A',3,1]).ascii_art())\n 0\n O-------+\n | |\n | |\n O---O---O\n 1 2 3\n\n sage: print(CartanType(['A',5,1]).ascii_art(label = lambda x: x+2))\n 2\n O---------------+\n | |\n | |\n O---O---O---O---O\n 3 4 5 6 7\n\n sage: print(CartanType(['A',1,1]).ascii_art())\n O<=>O\n 0 1\n\n sage: print(CartanType(['A',1,1]).ascii_art(label = lambda x: x+2))\n O<=>O\n 2 3\n "
if (label is None):
label = (lambda i: i)
if (node is None):
node = self._ascii_art_node
n = self.n
if (n == 1):
l0 = label(0)
l1 = label(1)
return '{}<=>{}\n{!s:4}{}'.format(node(l0), node(l1), l0, l1)
ret = '{}\n{}'.format(label(0), node(label(0)))
ret += (((((('----' * (n - 2)) + '---+\n|') + (' ' * (n - 2))) + ' |\n|') + (' ' * (n - 2))) + ' |\n')
ret += ('---'.join((node(label(i)) for i in range(1, (n + 1)))) + '\n')
ret += ''.join(('{!s:4}'.format(label(i)) for i in range(1, (n + 1))))
return ret
def dual(self):
"\n Type `A_1^1` is self dual despite not being simply laced.\n\n EXAMPLES::\n\n sage: CartanType(['A',1,1]).dual()\n ['A', 1, 1]\n "
return self
def _default_folded_cartan_type(self):
"\n Return the default folded Cartan type.\n\n In general, this just returns ``self`` in ``self`` with `\\sigma` as\n the identity map.\n\n EXAMPLES::\n\n sage: CartanType(['A',1,1])._default_folded_cartan_type()\n ['A', 1, 1] as a folding of ['A', 3, 1]\n sage: CartanType(['A',3,1])._default_folded_cartan_type()\n ['A', 3, 1] as a folding of ['A', 3, 1]\n "
from sage.combinat.root_system.type_folded import CartanTypeFolded
if (self.n == 1):
return CartanTypeFolded(self, ['A', 3, 1], [[0, 2], [1, 3]])
return CartanTypeFolded(self, self, [[i] for i in self.index_set()])
|
class CartanType(CartanType_standard, CartanType_simple):
'\n The Cartan type `A_{\\infty}`.\n\n We use ``NN`` and ``ZZ`` to explicitly differentiate between the\n `A_{+\\infty}` and `A_{\\infty}` root systems, respectively.\n While ``oo`` is the same as ``+Infinity`` in Sage, it is used as\n an alias for ``ZZ``.\n '
def __init__(self, index_set):
"\n EXAMPLES::\n\n sage: CartanType(['A',oo]) is CartanType(['A', ZZ])\n True\n sage: CartanType(['A',oo]) is CartanType(['A', NN])\n False\n sage: ct=CartanType(['A',ZZ])\n sage: ct\n ['A', ZZ]\n sage: ct._repr_(compact = True)\n 'A_ZZ'\n sage: ct.is_irreducible()\n True\n sage: ct.is_finite()\n False\n sage: ct.is_affine()\n False\n sage: ct.is_untwisted_affine()\n False\n sage: ct.is_crystallographic()\n True\n sage: ct.is_simply_laced()\n True\n sage: ct.dual()\n ['A', ZZ]\n\n TESTS::\n\n sage: TestSuite(ct).run()\n "
super().__init__()
self.letter = 'A'
self.n = index_set
def _repr_(self, compact=False):
"\n Return a representation of ``self``.\n\n TESTS::\n\n sage: CartanType(['A',ZZ])\n ['A', ZZ]\n sage: CartanType(['A',NN])._repr_(compact=True)\n 'A_NN'\n "
ret = ('%s_%s' if compact else "['%s', %s]")
return (ret % (self.letter, ('ZZ' if (self.n == ZZ) else 'NN')))
def _latex_(self):
"\n Return a latex representation of ``self``.\n\n EXAMPLES::\n\n sage: latex( CartanType(['A',NN]) )\n A_{\\Bold{N}}\n sage: latex( CartanType(['A',ZZ]) )\n A_{\\Bold{Z}}\n "
return 'A_{{{}}}'.format(self.n._latex_())
def ascii_art(self, label=None, node=None):
"\n Return an ascii art representation of the extended Dynkin diagram.\n\n EXAMPLES::\n\n sage: print(CartanType(['A', ZZ]).ascii_art())\n ..---O---O---O---O---O---O---O---..\n -3 -2 -1 0 1 2 3\n sage: print(CartanType(['A', NN]).ascii_art())\n O---O---O---O---O---O---O---..\n 0 1 2 3 4 5 6\n\n "
if (label is None):
label = (lambda i: i)
if (node is None):
node = self._ascii_art_node
if (self.n == ZZ):
ret = (('..---' + '---'.join((node(label(i)) for i in range(7)))) + '---..\n')
ret += (' ' + ''.join(('{:4}'.format(label(i)) for i in range((- 3), 4))))
else:
ret = ('---'.join((node(label(i)) for i in range(7))) + '---..\n')
ret += ('0' + ''.join(('{:4}'.format(label(i)) for i in range(1, 7))))
return ret
def dual(self):
'\n Simply laced Cartan types are self-dual, so return ``self``.\n\n EXAMPLES::\n\n sage: CartanType(["A", NN]).dual()\n [\'A\', NN]\n sage: CartanType(["A", ZZ]).dual()\n [\'A\', ZZ]\n '
return self
def is_simply_laced(self):
"\n Return ``True`` because ``self`` is simply laced.\n\n EXAMPLES::\n\n sage: CartanType(['A', NN]).is_simply_laced()\n True\n sage: CartanType(['A', ZZ]).is_simply_laced()\n True\n "
return True
def is_crystallographic(self):
"\n Return ``False`` because ``self`` is not crystallographic.\n\n EXAMPLES::\n\n sage: CartanType(['A', NN]).is_crystallographic()\n True\n sage: CartanType(['A', ZZ]).is_crystallographic()\n True\n "
return True
def is_finite(self):
"\n Return ``True`` because ``self`` is not finite.\n\n EXAMPLES::\n\n sage: CartanType(['A', NN]).is_finite()\n False\n sage: CartanType(['A', ZZ]).is_finite()\n False\n "
return False
def is_affine(self):
"\n Return ``False`` because ``self`` is not (untwisted) affine.\n\n EXAMPLES::\n\n sage: CartanType(['A', NN]).is_affine()\n False\n sage: CartanType(['A', ZZ]).is_affine()\n False\n "
return False
def is_untwisted_affine(self):
"\n Return ``False`` because ``self`` is not (untwisted) affine.\n\n EXAMPLES::\n\n sage: CartanType(['A', NN]).is_untwisted_affine()\n False\n sage: CartanType(['A', ZZ]).is_untwisted_affine()\n False\n "
return False
def rank(self):
"\n Return the rank of ``self`` which for type `X_n` is `n`.\n\n EXAMPLES::\n\n sage: CartanType(['A', NN]).rank()\n +Infinity\n sage: CartanType(['A', ZZ]).rank()\n +Infinity\n\n As this example shows, the rank is slightly ambiguous because the root\n systems of type `['A',NN]` and type `['A',ZZ]` have the same rank.\n Instead, it is better ot use :meth:`index_set` to differentiate between\n these two root systems.\n "
return self.n.cardinality()
def type(self):
"\n Return the type of ``self``.\n\n EXAMPLES::\n\n sage: CartanType(['A', NN]).type()\n 'A'\n sage: CartanType(['A', ZZ]).type()\n 'A'\n "
return self.letter
def index_set(self):
"\n Return the index set for the Cartan type ``self``.\n\n The index set for all standard finite Cartan types is of the form\n `\\{1, \\ldots, n\\}`. (See :mod:`~sage.combinat.root_system.type_I`\n for a slight abuse of this).\n\n EXAMPLES::\n\n sage: CartanType(['A', NN]).index_set()\n Non negative integer semiring\n sage: CartanType(['A', ZZ]).index_set()\n Integer Ring\n "
return self.n
|
class AmbientSpace(ambient_space.AmbientSpace):
def dimension(self):
"\n EXAMPLES::\n\n sage: e = RootSystem(['B',3]).ambient_space()\n sage: e.dimension()\n 3\n "
return self.root_system.cartan_type().rank()
def root(self, i, j):
"\n Note that indexing starts at 0.\n\n EXAMPLES::\n\n sage: e = RootSystem(['B',3]).ambient_space()\n sage: e.root(0,1)\n (1, -1, 0)\n\n "
return (self.monomial(i) - self.monomial(j))
def simple_root(self, i):
"\n EXAMPLES::\n\n sage: e = RootSystem(['B',4]).ambient_space()\n sage: e.simple_roots()\n Finite family {1: (1, -1, 0, 0), 2: (0, 1, -1, 0), 3: (0, 0, 1, -1), 4: (0, 0, 0, 1)}\n sage: e.positive_roots()\n [(1, -1, 0, 0),\n (1, 1, 0, 0),\n (1, 0, -1, 0),\n (1, 0, 1, 0),\n (1, 0, 0, -1),\n (1, 0, 0, 1),\n (0, 1, -1, 0),\n (0, 1, 1, 0),\n (0, 1, 0, -1),\n (0, 1, 0, 1),\n (0, 0, 1, -1),\n (0, 0, 1, 1),\n (1, 0, 0, 0),\n (0, 1, 0, 0),\n (0, 0, 1, 0),\n (0, 0, 0, 1)]\n sage: e.fundamental_weights()\n Finite family {1: (1, 0, 0, 0), 2: (1, 1, 0, 0), 3: (1, 1, 1, 0), 4: (1/2, 1/2, 1/2, 1/2)}\n "
if (i not in self.index_set()):
raise ValueError('{} is not in the index set'.format(i))
return (self.root((i - 1), i) if (i < self.n) else self.monomial((self.n - 1)))
def negative_roots(self):
"\n EXAMPLES::\n\n sage: RootSystem(['B',3]).ambient_space().negative_roots()\n [(-1, 1, 0),\n (-1, -1, 0),\n (-1, 0, 1),\n (-1, 0, -1),\n (0, -1, 1),\n (0, -1, -1),\n (-1, 0, 0),\n (0, -1, 0),\n (0, 0, -1)]\n "
return [(- a) for a in self.positive_roots()]
def positive_roots(self):
"\n EXAMPLES::\n\n sage: RootSystem(['B',3]).ambient_space().positive_roots()\n [(1, -1, 0),\n (1, 1, 0),\n (1, 0, -1),\n (1, 0, 1),\n (0, 1, -1),\n (0, 1, 1),\n (1, 0, 0),\n (0, 1, 0),\n (0, 0, 1)]\n\n "
res = []
for i in range((self.n - 1)):
for j in range((i + 1), self.n):
res.append((self.monomial(i) - self.monomial(j)))
res.append((self.monomial(i) + self.monomial(j)))
for i in range(self.n):
res.append(self.monomial(i))
return res
def fundamental_weight(self, i):
"\n EXAMPLES::\n\n sage: RootSystem(['B',3]).ambient_space().fundamental_weights()\n Finite family {1: (1, 0, 0), 2: (1, 1, 0), 3: (1/2, 1/2, 1/2)}\n "
if (i not in self.index_set()):
raise ValueError('{} is not in the index set'.format(i))
n = self.dimension()
if (i == n):
return (self.sum((self.monomial(j) for j in range(n))) / 2)
else:
return self.sum((self.monomial(j) for j in range(i)))
|
class CartanType(CartanType_standard_finite, CartanType_simple, CartanType_crystallographic):
def __init__(self, n):
"\n EXAMPLES::\n\n sage: ct = CartanType(['B',4])\n sage: ct\n ['B', 4]\n sage: ct._repr_(compact = True)\n 'B4'\n\n sage: ct.is_irreducible()\n True\n sage: ct.is_finite()\n True\n sage: ct.is_affine()\n False\n sage: ct.is_crystallographic()\n True\n sage: ct.is_simply_laced()\n False\n sage: ct.affine()\n ['B', 4, 1]\n sage: ct.dual()\n ['C', 4]\n\n sage: ct = CartanType(['B',1])\n sage: ct.is_simply_laced()\n True\n sage: ct.affine()\n ['B', 1, 1]\n\n TESTS::\n\n sage: TestSuite(ct).run()\n "
assert (n >= 1)
CartanType_standard_finite.__init__(self, 'B', n)
if (n == 1):
self._add_abstract_superclass(CartanType_simply_laced)
def _latex_(self):
"\n Return a latex representation of ``self``.\n\n EXAMPLES::\n\n sage: latex(CartanType(['B',4]))\n B_{4}\n "
return ('B_{%s}' % self.n)
AmbientSpace = AmbientSpace
def coxeter_number(self):
"\n Return the Coxeter number associated with ``self``.\n\n EXAMPLES::\n\n sage: CartanType(['B',4]).coxeter_number()\n 8\n "
return (2 * self.n)
def dual_coxeter_number(self):
"\n Return the dual Coxeter number associated with ``self``.\n\n EXAMPLES::\n\n sage: CartanType(['B',4]).dual_coxeter_number()\n 7\n "
return ((2 * self.n) - 1)
def dual(self):
'\n Types B and C are in duality:\n\n EXAMPLES::\n\n sage: CartanType(["C", 3]).dual()\n [\'B\', 3]\n '
from . import cartan_type
return cartan_type.CartanType(['C', self.n])
def dynkin_diagram(self):
"\n Returns a Dynkin diagram for type B.\n\n EXAMPLES::\n\n sage: b = CartanType(['B',3]).dynkin_diagram(); b # needs sage.graphs\n O---O=>=O\n 1 2 3\n B3\n sage: b.edges(sort=True) # needs sage.graphs\n [(1, 2, 1), (2, 1, 1), (2, 3, 2), (3, 2, 1)]\n\n sage: b = CartanType(['B',1]).dynkin_diagram(); b # needs sage.graphs\n O\n 1\n B1\n sage: b.edges(sort=True) # needs sage.graphs\n []\n "
from .dynkin_diagram import DynkinDiagram_class
n = self.n
g = DynkinDiagram_class(self)
for i in range(1, n):
g.add_edge(i, (i + 1))
if (n >= 2):
g.set_edge_label((n - 1), n, 2)
return g
def ascii_art(self, label=None, node=None):
"\n Return an ascii art representation of the Dynkin diagram.\n\n EXAMPLES::\n\n sage: print(CartanType(['B',1]).ascii_art())\n O\n 1\n sage: print(CartanType(['B',2]).ascii_art())\n O=>=O\n 1 2\n sage: print(CartanType(['B',5]).ascii_art(label = lambda x: x+2))\n O---O---O---O=>=O\n 3 4 5 6 7\n "
if (label is None):
label = (lambda i: i)
if (node is None):
node = self._ascii_art_node
n = self.n
if (n == 1):
ret = (node(label(1)) + '\n')
else:
ret = ((('---'.join((node(label(i)) for i in range(1, n))) + '=>=') + node(label(n))) + '\n')
ret += ''.join(('{!s:4}'.format(label(i)) for i in range(1, (n + 1))))
return ret
def _latex_dynkin_diagram(self, label=None, node=None, node_dist=2, dual=False):
"\n Return a latex representation of the Dynkin diagram.\n\n EXAMPLES::\n\n sage: print(CartanType(['B',4])._latex_dynkin_diagram())\n \\draw (0 cm,0) -- (4 cm,0);\n \\draw (4 cm, 0.1 cm) -- +(2 cm,0);\n \\draw (4 cm, -0.1 cm) -- +(2 cm,0);\n \\draw[shift={(5.2, 0)}, rotate=0] (135 : 0.45cm) -- (0,0) -- (-135 : 0.45cm);\n \\draw[fill=white] (0 cm, 0 cm) circle (.25cm) node[below=4pt]{$1$};\n \\draw[fill=white] (2 cm, 0 cm) circle (.25cm) node[below=4pt]{$2$};\n \\draw[fill=white] (4 cm, 0 cm) circle (.25cm) node[below=4pt]{$3$};\n \\draw[fill=white] (6 cm, 0 cm) circle (.25cm) node[below=4pt]{$4$};\n <BLANKLINE>\n\n When ``dual=True``, the Dynkin diagram for the dual Cartan\n type `C_n` is returned::\n\n sage: print(CartanType(['B',4])._latex_dynkin_diagram(dual=True))\n \\draw (0 cm,0) -- (4 cm,0);\n \\draw (4 cm, 0.1 cm) -- +(2 cm,0);\n \\draw (4 cm, -0.1 cm) -- +(2 cm,0);\n \\draw[shift={(4.8, 0)}, rotate=180] (135 : 0.45cm) -- (0,0) -- (-135 : 0.45cm);\n \\draw[fill=white] (0 cm, 0 cm) circle (.25cm) node[below=4pt]{$1$};\n \\draw[fill=white] (2 cm, 0 cm) circle (.25cm) node[below=4pt]{$2$};\n \\draw[fill=white] (4 cm, 0 cm) circle (.25cm) node[below=4pt]{$3$};\n \\draw[fill=white] (6 cm, 0 cm) circle (.25cm) node[below=4pt]{$4$};\n <BLANKLINE>\n\n .. SEEALSO::\n\n - :meth:`sage.combinat.root_system.type_C.CartanType._latex_dynkin_diagram`\n - :meth:`sage.combinat.root_system.type_BC_affine.CartanType._latex_dynkin_diagram`\n "
if (label is None):
label = (lambda i: i)
if (node is None):
node = self._latex_draw_node
if (self.n == 1):
return node(0, 0, label(1))
n = self.n
ret = ('\\draw (0 cm,0) -- (%s cm,0);\n' % ((n - 2) * node_dist))
ret += ('\\draw (%s cm, 0.1 cm) -- +(%s cm,0);\n' % (((n - 2) * node_dist), node_dist))
ret += ('\\draw (%s cm, -0.1 cm) -- +(%s cm,0);\n' % (((n - 2) * node_dist), node_dist))
if dual:
ret += self._latex_draw_arrow_tip((((n - 1.5) * node_dist) - 0.2), 0, 180)
else:
ret += self._latex_draw_arrow_tip((((n - 1.5) * node_dist) + 0.2), 0, 0)
for i in range(self.n):
ret += node((i * node_dist), 0, label((i + 1)))
return ret
def _default_folded_cartan_type(self):
"\n Return the default folded Cartan type.\n\n EXAMPLES::\n\n sage: CartanType(['B', 3])._default_folded_cartan_type()\n ['B', 3] as a folding of ['D', 4]\n "
from sage.combinat.root_system.type_folded import CartanTypeFolded
n = self.n
return CartanTypeFolded(self, ['D', (n + 1)], ([[i] for i in range(1, n)] + [[n, (n + 1)]]))
|
class CartanType(CartanType_standard_affine):
def __init__(self, n):
"\n EXAMPLES::\n\n sage: ct = CartanType(['BC',4,2])\n sage: ct\n ['BC', 4, 2]\n sage: ct._repr_(compact=True)\n 'BC4~'\n sage: ct.dynkin_diagram() # needs sage.graphs\n O=<=O---O---O=<=O\n 0 1 2 3 4\n BC4~\n\n sage: ct.is_irreducible()\n True\n sage: ct.is_finite()\n False\n sage: ct.is_affine()\n True\n sage: ct.is_crystallographic()\n True\n sage: ct.is_simply_laced()\n False\n sage: ct.classical()\n ['C', 4]\n\n sage: dual = ct.dual()\n sage: dual.dynkin_diagram() # needs sage.graphs\n O=>=O---O---O=>=O\n 0 1 2 3 4\n BC4~*\n\n sage: dual.special_node()\n 0\n sage: dual.classical().dynkin_diagram() # needs sage.graphs\n O---O---O=>=O\n 1 2 3 4\n B4\n\n sage: CartanType(['BC',1,2]).dynkin_diagram() # needs sage.graphs\n 4\n O=<=O\n 0 1\n BC1~\n\n TESTS::\n\n sage: TestSuite(ct).run()\n "
assert ((n in ZZ) and (n >= 1))
CartanType_standard_affine.__init__(self, 'BC', n, 2)
def dynkin_diagram(self):
'\n Returns the extended Dynkin diagram for affine type BC.\n\n EXAMPLES::\n\n sage: c = CartanType([\'BC\',3,2]).dynkin_diagram(); c # needs sage.graphs\n O=<=O---O=<=O\n 0 1 2 3\n BC3~\n sage: c.edges(sort=True) # needs sage.graphs\n [(0, 1, 1), (1, 0, 2), (1, 2, 1), (2, 1, 1), (2, 3, 1), (3, 2, 2)]\n\n sage: c = CartanType(["A", 6, 2]).dynkin_diagram() # should be the same as above; did fail at some point! # needs sage.graphs\n sage: c # needs sage.graphs\n O=<=O---O=<=O\n 0 1 2 3\n BC3~\n sage: c.edges(sort=True) # needs sage.graphs\n [(0, 1, 1), (1, 0, 2), (1, 2, 1), (2, 1, 1), (2, 3, 1), (3, 2, 2)]\n\n sage: c = CartanType([\'BC\',2,2]).dynkin_diagram(); c # needs sage.graphs\n O=<=O=<=O\n 0 1 2\n BC2~\n sage: c.edges(sort=True) # needs sage.graphs\n [(0, 1, 1), (1, 0, 2), (1, 2, 1), (2, 1, 2)]\n\n sage: c = CartanType([\'BC\',1,2]).dynkin_diagram(); c # needs sage.graphs\n 4\n O=<=O\n 0 1\n BC1~\n sage: c.edges(sort=True) # needs sage.graphs\n [(0, 1, 1), (1, 0, 4)]\n\n '
from .dynkin_diagram import DynkinDiagram_class
n = self.n
g = DynkinDiagram_class(self)
if (n == 1):
g.add_edge(1, 0, 4)
return g
g.add_edge(1, 0, 2)
for i in range(1, (n - 1)):
g.add_edge(i, (i + 1))
g.add_edge(n, (n - 1), 2)
return g
def _latex_(self):
"\n Return a latex representation of ``self``.\n\n EXAMPLES::\n\n sage: latex(CartanType(['BC',4,2]))\n BC_{4}^{(2)}\n\n sage: CartanType.options.notation = 'Kac'\n sage: latex(CartanType(['BC',4,2]))\n A_{8}^{(2)}\n sage: latex(CartanType(['A',8,2]))\n A_{8}^{(2)}\n sage: CartanType.options._reset()\n "
if (self.options.notation == 'Kac'):
return ('A_{%s}^{(2)}' % (2 * self.classical().rank()))
else:
return ('BC_{%s}^{(2)}' % self.n)
def _latex_dynkin_diagram(self, label=None, node=None, node_dist=2, dual=False):
"\n Return a latex representation of the Dynkin diagram.\n\n EXAMPLES::\n\n sage: print(CartanType(['BC',4,2])._latex_dynkin_diagram())\n \\draw (0, 0.1 cm) -- +(2 cm,0);\n \\draw (0, -0.1 cm) -- +(2 cm,0);\n \\draw[shift={(0.8, 0)}, rotate=180] (135 : 0.45cm) -- (0,0) -- (-135 : 0.45cm);\n {\n \\pgftransformxshift{2 cm}\n \\draw (0 cm,0) -- (4 cm,0);\n \\draw (4 cm, 0.1 cm) -- +(2 cm,0);\n \\draw (4 cm, -0.1 cm) -- +(2 cm,0);\n \\draw[shift={(4.8, 0)}, rotate=180] (135 : 0.45cm) -- (0,0) -- (-135 : 0.45cm);\n \\draw[fill=white] (0 cm, 0 cm) circle (.25cm) node[below=4pt]{$1$};\n \\draw[fill=white] (2 cm, 0 cm) circle (.25cm) node[below=4pt]{$2$};\n \\draw[fill=white] (4 cm, 0 cm) circle (.25cm) node[below=4pt]{$3$};\n \\draw[fill=white] (6 cm, 0 cm) circle (.25cm) node[below=4pt]{$4$};\n }\n \\draw[fill=white] (0 cm, 0 cm) circle (.25cm) node[below=4pt]{$0$};\n <BLANKLINE>\n\n sage: print(CartanType(['BC',4,2]).dual()._latex_dynkin_diagram())\n \\draw (0, 0.1 cm) -- +(2 cm,0);\n \\draw (0, -0.1 cm) -- +(2 cm,0);\n \\draw[shift={(1.2, 0)}, rotate=0] (135 : 0.45cm) -- (0,0) -- (-135 : 0.45cm);\n {\n \\pgftransformxshift{2 cm}\n \\draw (0 cm,0) -- (4 cm,0);\n \\draw (4 cm, 0.1 cm) -- +(2 cm,0);\n \\draw (4 cm, -0.1 cm) -- +(2 cm,0);\n \\draw[shift={(5.2, 0)}, rotate=0] (135 : 0.45cm) -- (0,0) -- (-135 : 0.45cm);\n \\draw[fill=white] (0 cm, 0 cm) circle (.25cm) node[below=4pt]{$1$};\n \\draw[fill=white] (2 cm, 0 cm) circle (.25cm) node[below=4pt]{$2$};\n \\draw[fill=white] (4 cm, 0 cm) circle (.25cm) node[below=4pt]{$3$};\n \\draw[fill=white] (6 cm, 0 cm) circle (.25cm) node[below=4pt]{$4$};\n }\n \\draw[fill=white] (0 cm, 0 cm) circle (.25cm) node[below=4pt]{$0$};\n <BLANKLINE>\n "
if (label is None):
label = (lambda i: i)
if (node is None):
node = self._latex_draw_node
if (self.n == 1):
ret = ('\\draw (0, 0.05 cm) -- +(%s cm,0);\n' % node_dist)
ret += ('\\draw (0, -0.05 cm) -- +(%s cm,0);\n' % node_dist)
ret += ('\\draw (0, 0.15 cm) -- +(%s cm,0);\n' % node_dist)
ret += ('\\draw (0, -0.15 cm) -- +(%s cm,0);\n' % node_dist)
if dual:
ret += self._latex_draw_arrow_tip(((0.5 * node_dist) + 0.2), 0, 0)
else:
ret += self._latex_draw_arrow_tip(((0.5 * node_dist) - 0.2), 0, 180)
ret += node(0, 0, label(0))
ret += node(node_dist, 0, label(1))
return ret
ret = ('\\draw (0, 0.1 cm) -- +(%s cm,0);\n' % node_dist)
ret += ('\\draw (0, -0.1 cm) -- +(%s cm,0);\n' % node_dist)
if dual:
ret += self._latex_draw_arrow_tip(((0.5 * node_dist) + 0.2), 0, 0)
else:
ret += self._latex_draw_arrow_tip(((0.5 * node_dist) - 0.2), 0, 180)
ret += ('{\n\\pgftransformxshift{%s cm}\n' % node_dist)
ret += self.classical()._latex_dynkin_diagram(label, node, node_dist, dual=dual)
ret += ('}\n' + node(0, 0, label(0)))
return ret
def ascii_art(self, label=None, node=None):
"\n Return a ascii art representation of the extended Dynkin diagram.\n\n EXAMPLES::\n\n sage: print(CartanType(['BC',2,2]).ascii_art())\n O=<=O=<=O\n 0 1 2\n sage: print(CartanType(['BC',3,2]).ascii_art())\n O=<=O---O=<=O\n 0 1 2 3\n sage: print(CartanType(['BC',5,2]).ascii_art(label = lambda x: x+2))\n O=<=O---O---O---O=<=O\n 2 3 4 5 6 7\n\n sage: print(CartanType(['BC',1,2]).ascii_art(label = lambda x: x+2))\n 4\n O=<=O\n 2 3\n "
if (label is None):
label = (lambda i: i)
if (node is None):
node = self._ascii_art_node
n = self.n
if (n == 1):
return ' 4\n{}=<={}\n{!s:4}{!s:4}'.format(node(label(0)), node(label(1)), label(0), label(1))
ret = ((node(label(0)) + '=<=') + '---'.join((node(label(i)) for i in range(1, n))))
ret += (('=<=' + node(label(n))) + '\n')
ret += ''.join(('{!s:4}'.format(label(i)) for i in range((n + 1))))
return ret
def classical(self):
'\n Returns the classical Cartan type associated with self\n\n sage: CartanType(["BC", 3, 2]).classical()\n [\'C\', 3]\n '
from . import cartan_type
return cartan_type.CartanType(['C', self.n])
def basic_untwisted(self):
"\n Return the basic untwisted Cartan type associated with this affine\n Cartan type.\n\n Given an affine type `X_n^{(r)}`, the basic untwisted type is `X_n`.\n In other words, it is the classical Cartan type that is twisted to\n obtain ``self``.\n\n EXAMPLES::\n\n sage: CartanType(['A', 2, 2]).basic_untwisted()\n ['A', 2]\n sage: CartanType(['A', 4, 2]).basic_untwisted()\n ['A', 4]\n sage: CartanType(['BC', 4, 2]).basic_untwisted()\n ['A', 8]\n "
from . import cartan_type
return cartan_type.CartanType(['A', (2 * self.n)])
def _default_folded_cartan_type(self):
"\n Return the default folded Cartan type.\n\n EXAMPLES::\n\n sage: CartanType(['BC', 3, 2])._default_folded_cartan_type()\n ['BC', 3, 2] as a folding of ['A', 5, 1]\n "
from sage.combinat.root_system.type_folded import CartanTypeFolded
n = self.n
return CartanTypeFolded(self, ['A', ((2 * n) - 1), 1], (([[0]] + [[i, ((2 * n) - i)] for i in range(1, n)]) + [[n]]))
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.