Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Replacing the indedxing set of the Yangian with cartesian_product.
Browse files Browse the repository at this point in the history
  • Loading branch information
tscrim committed Aug 27, 2022
1 parent 12be2d9 commit b4f413d
Showing 1 changed file with 18 additions and 154 deletions.
172 changes: 18 additions & 154 deletions src/sage/algebras/yangian.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from sage.structure.unique_representation import UniqueRepresentation
from sage.categories.hopf_algebras_with_basis import HopfAlgebrasWithBasis
from sage.categories.graded_hopf_algebras_with_basis import GradedHopfAlgebrasWithBasis
from sage.categories.cartesian_product import cartesian_product
from sage.rings.integer_ring import ZZ
from sage.rings.infinity import infinity
from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
Expand All @@ -34,155 +35,6 @@
import itertools


class GeneratorIndexingSet(UniqueRepresentation):
"""
Helper class for the indexing set of the generators.
"""
def __init__(self, index_set, level=None):
"""
Initialize ``self``.
TESTS::
sage: from sage.algebras.yangian import GeneratorIndexingSet
sage: I = GeneratorIndexingSet((1,2))
"""
self._index_set = index_set
self._level = level

def __repr__(self):
"""
Return a string representation of ``self``.
TESTS::
sage: from sage.algebras.yangian import GeneratorIndexingSet
sage: GeneratorIndexingSet((1,2))
Cartesian product of Positive integers, (1, 2), (1, 2)
sage: GeneratorIndexingSet((1,2), 4)
Cartesian product of (1, 2, 3, 4), (1, 2), (1, 2)
"""
if self._level is None:
L = PositiveIntegers()
else:
L = tuple(range(1, self._level + 1))
return "Cartesian product of {L}, {I}, {I}".format(L=L, I=self._index_set)

def an_element(self):
"""
Initialize ``self``.
TESTS::
sage: from sage.algebras.yangian import GeneratorIndexingSet
sage: I = GeneratorIndexingSet((1,2))
sage: I.an_element()
(3, 1, 1)
sage: I = GeneratorIndexingSet((1,2), 5)
sage: I.an_element()
(3, 1, 1)
sage: I = GeneratorIndexingSet((1,2), 1)
sage: I.an_element()
(1, 1, 1)
"""
if self._level is not None and self._level < 3:
return (1, self._index_set[0], self._index_set[0])
return (3, self._index_set[0], self._index_set[0])

def cardinality(self):
"""
Return the cardinality of ``self``.
TESTS::
sage: from sage.algebras.yangian import GeneratorIndexingSet
sage: I = GeneratorIndexingSet((1,2))
sage: I.cardinality()
+Infinity
sage: I = GeneratorIndexingSet((1,2), level=3)
sage: I.cardinality() == 3 * 2 * 2
True
"""
if self._level is not None:
return self._level * len(self._index_set)**2
return infinity

__len__ = cardinality

def __call__(self, x):
"""
Call ``self``.
TESTS::
sage: from sage.algebras.yangian import GeneratorIndexingSet
sage: I = GeneratorIndexingSet((1,2))
sage: I([1, 2])
(1, 2)
"""
return tuple(x)

def __contains__(self, x):
"""
Check containment of ``x`` in ``self``.
TESTS::
sage: from sage.algebras.yangian import GeneratorIndexingSet
sage: I = GeneratorIndexingSet((1,2))
sage: (4, 1, 2) in I
True
sage: [4, 2, 1] in I
True
sage: (-1, 1, 1) in I
False
sage: (1, 3, 1) in I
False
::
sage: I3 = GeneratorIndexingSet((1,2), 3)
sage: (1, 1, 2) in I3
True
sage: (3, 1, 1) in I3
True
sage: (4, 1, 1) in I3
False
"""
return (isinstance(x, (tuple, list)) and len(x) == 3
and x[0] in ZZ and x[0] > 0
and (self._level is None or x[0] <= self._level)
and x[1] in self._index_set
and x[2] in self._index_set)

def __iter__(self):
"""
Iterate over ``self``.
TESTS::
sage: from sage.algebras.yangian import GeneratorIndexingSet
sage: I = GeneratorIndexingSet((1,2))
sage: it = iter(I)
sage: [next(it) for dummy in range(5)]
[(1, 1, 1), (1, 1, 2), (1, 2, 1), (1, 2, 2), (2, 1, 1)]
sage: I = GeneratorIndexingSet((1,2), 3)
sage: list(I)
[(1, 1, 1), (1, 1, 2), (1, 2, 1), (1, 2, 2),
(2, 1, 1), (2, 1, 2), (2, 2, 1), (2, 2, 2),
(3, 1, 1), (3, 1, 2), (3, 2, 1), (3, 2, 2)]
"""
I = self._index_set
if self._level is not None:
for x in itertools.product(range(1, self._level + 1), I, I):
yield x
return
for i in PositiveIntegers():
for x in itertools.product(I, I):
yield (i, x[0], x[1])


class Yangian(CombinatorialFreeModule):
r"""
The Yangian `Y(\mathfrak{gl}_n)`.
Expand Down Expand Up @@ -392,7 +244,7 @@ def __init__(self, base_ring, n, variable_name, filtration):
category = category.Connected()
self._index_set = tuple(range(1, n + 1))
# The keys for the basis are tuples (l, i, j)
indices = GeneratorIndexingSet(self._index_set)
indices = cartesian_product([PositiveIntegers(), self._index_set, self._index_set])
# We note that the generators are non-commutative, but we always sort
# them, so they are, in effect, indexed by the free abelian monoid
basis_keys = IndexedFreeAbelianMonoid(indices, bracket=False,
Expand Down Expand Up @@ -501,7 +353,7 @@ def _element_constructor_(self, x):
True
sage: Y6 = Yangian(QQ, 4, level=6, filtration='natural')
sage: Y(Y6.an_element())
t(1)[1,1]*t(1)[1,2]^2*t(1)[1,3]^3*t(3)[1,1]
t(1)[1,1]^2*t(1)[1,2]^2*t(1)[1,3]^3 + 2*t(1)[1,1] + 3*t(1)[1,2] + 1
"""
if isinstance(x, CombinatorialFreeModule.Element):
if isinstance(x.parent(), Yangian) and x.parent()._n <= self._n:
Expand Down Expand Up @@ -543,8 +395,8 @@ def algebra_generators(self):
sage: Y = Yangian(QQ, 4)
sage: Y.algebra_generators()
Lazy family (generator(i))_{i in Cartesian product of
Positive integers, (1, 2, 3, 4), (1, 2, 3, 4)}
Lazy family (generator(i))_{i in The Cartesian product of
(Positive integers, {1, 2, 3, 4}, {1, 2, 3, 4})}
"""
return Family(self._indices._indices, self.gen, name="generator")

Expand Down Expand Up @@ -816,7 +668,8 @@ def __init__(self, base_ring, n, level, variable_name, filtration):
category = HopfAlgebrasWithBasis(base_ring).Filtered()
self._index_set = tuple(range(1,n+1))
# The keys for the basis are tuples (l, i, j)
indices = GeneratorIndexingSet(self._index_set, level)
L = range(1, self._level + 1)
indices = cartesian_product([L, self._index_set, self._index_set])
# We note that the generators are non-commutative, but we always sort
# them, so they are, in effect, indexed by the free abelian monoid
basis_keys = IndexedFreeAbelianMonoid(indices, bracket=False, prefix=variable_name)
Expand Down Expand Up @@ -1170,6 +1023,17 @@ def antipode_on_basis(self, m):
-tbar(2)[1,1]
sage: x = grY.an_element(); x
tbar(1)[1,1]*tbar(1)[1,2]^2*tbar(1)[1,3]^3*tbar(42)[1,1]
sage: grY.antipode_on_basis(x.leading_support())
-tbar(1)[1,1]*tbar(1)[1,2]^2*tbar(1)[1,3]^3*tbar(42)[1,1]
- 2*tbar(1)[1,1]*tbar(1)[1,2]*tbar(1)[1,3]^3*tbar(42)[1,2]
- 3*tbar(1)[1,1]*tbar(1)[1,2]^2*tbar(1)[1,3]^2*tbar(42)[1,3]
+ 5*tbar(1)[1,2]^2*tbar(1)[1,3]^3*tbar(42)[1,1]
+ 10*tbar(1)[1,2]*tbar(1)[1,3]^3*tbar(42)[1,2]
+ 15*tbar(1)[1,2]^2*tbar(1)[1,3]^2*tbar(42)[1,3]
sage: g = grY.indices().gens()
sage: x = grY(g[1,1,1] * g[1,1,2]^2 * g[1,1,3]^3 * g[3,1,1]); x
tbar(1)[1,1]*tbar(1)[1,2]^2*tbar(1)[1,3]^3*tbar(3)[1,1]
sage: grY.antipode_on_basis(x.leading_support())
-tbar(1)[1,1]*tbar(1)[1,2]^2*tbar(1)[1,3]^3*tbar(3)[1,1]
Expand Down

0 comments on commit b4f413d

Please sign in to comment.