Quantum Groups Using GAP’s QuaGroup Package - Algebras

Skip to content
Back to top
View this page
Edit this page

# Quantum Groups Using GAP’s QuaGroup Package

AUTHORS:

- Travis Scrimshaw (03-2017): initial version

See the documentation for GAP’s QuaGroup package, originally authored by Willem Adriaan de Graaf.

class sage.algebras.quantum_groups.quantum_group_gap.CrystalGraphVertex(V, s)

  Bases: `SageObject`

  Helper class used as the vertices of a crystal graph.

class sage.algebras.quantum_groups.quantum_group_gap.HighestWeightModule(Q, weight)

  Bases: `QuantumGroupModule`

  A highest weight module of a quantum group.

  Element

    alias of `QuaGroupRepresentationElement`

  an_element()

    alias of `highest_weight_vector()`.

  highest_weight_vector()

    Return the highest weight vector of `self`.

    EXAMPLES:

    Sage

        sage: Q = QuantumGroup(['A',2])
        sage: V = Q.highest_weight_module([1,1])
        sage: V.highest_weight_vector()
        1*v0

    Python

        >>> from sage.all import *
        >>> Q = QuantumGroup(['A',Integer(2)])
        >>> V = Q.highest_weight_module([Integer(1),Integer(1)])
        >>> V.highest_weight_vector()
        1*v0

  tensor(*V, **options)

    Return the tensor product of `self` with `V`.

    EXAMPLES:

    Sage

        sage: Q = QuantumGroup(['A',2])
        sage: V = Q.highest_weight_module([1,1])
        sage: Vp = Q.highest_weight_module([1,0])
        sage: Vp.tensor(V)
        Highest weight module of weight Lambda[1] of Quantum Group of type ['A', 2] with q=q
         # Highest weight module of weight Lambda[1] + Lambda[2] of Quantum Group of type ['A', 2] with q=q

    Python

        >>> from sage.all import *
        >>> Q = QuantumGroup(['A',Integer(2)])
        >>> V = Q.highest_weight_module([Integer(1),Integer(1)])
        >>> Vp = Q.highest_weight_module([Integer(1),Integer(0)])
        >>> Vp.tensor(V)
        Highest weight module of weight Lambda[1] of Quantum Group of type ['A', 2] with q=q
         # Highest weight module of weight Lambda[1] + Lambda[2] of Quantum Group of type ['A', 2] with q=q

class sage.algebras.quantum_groups.quantum_group_gap.HighestWeightSubmodule(ambient, gen, weight)

  Bases: `QuantumGroupModule`

  Initialize `self`.

  EXAMPLES:

  Sage

      sage: Q = QuantumGroup(['A',2])
      sage: V = Q.highest_weight_module([1,0])
      sage: T = tensor([V,V])
      sage: S = T.highest_weight_decomposition()[0]
      sage: TestSuite(S).run()

  Python

      >>> from sage.all import *
      >>> Q = QuantumGroup(['A',Integer(2)])
      >>> V = Q.highest_weight_module([Integer(1),Integer(0)])
      >>> T = tensor([V,V])
      >>> S = T.highest_weight_decomposition()[Integer(0)]
      >>> TestSuite(S).run()

  Element

    alias of `QuaGroupRepresentationElement`

  ambient()

    Return the ambient module of `self`.

    EXAMPLES:

    Sage

        sage: Q = QuantumGroup(['A',2])
        sage: V = Q.highest_weight_module([1,0])
        sage: T = tensor([V,V])
        sage: S = T.highest_weight_decomposition()[0]
        sage: S.ambient() is T
        True

    Python

        >>> from sage.all import *
        >>> Q = QuantumGroup(['A',Integer(2)])
        >>> V = Q.highest_weight_module([Integer(1),Integer(0)])
        >>> T = tensor([V,V])
        >>> S = T.highest_weight_decomposition()[Integer(0)]
        >>> S.ambient() is T
        True

  an_element()

    alias of `highest_weight_vector()`.

  crystal_graph(use_ambient=True)

    Return the crystal graph of `self`.

    INPUT:

    - `use_ambient` – boolean (default: `True`); if `True`, the vertices are given in terms of the ambient module

    EXAMPLES:

    Sage

        sage: Q = QuantumGroup(['A',2])
        sage: V = Q.highest_weight_module([1,0])
        sage: T = tensor([V,V])
        sage: S = T.highest_weight_decomposition()[1]
        sage: G = S.crystal_graph()
        sage: sorted(G.vertices(sort=False), key=str)
        [<-q^-1*(1*v0<x>F[a1+a2]*v0) + 1*(F[a1+a2]*v0<x>1*v0)>,
         <-q^-1*(1*v0<x>F[a1]*v0) + 1*(F[a1]*v0<x>1*v0)>,
         <-q^-1*(F[a1]*v0<x>F[a1+a2]*v0) + 1*(F[a1+a2]*v0<x>F[a1]*v0)>]
        sage: sorted(S.crystal_graph(False).vertices(sort=False), key=str)
        [<(1)*e.1>, <(1)*e.2>, <(1)*e.3>]

    Python

        >>> from sage.all import *
        >>> Q = QuantumGroup(['A',Integer(2)])
        >>> V = Q.highest_weight_module([Integer(1),Integer(0)])
        >>> T = tensor([V,V])
        >>> S = T.highest_weight_decomposition()[Integer(1)]
        >>> G = S.crystal_graph()
        >>> sorted(G.vertices(sort=False), key=str)
        [<-q^-1*(1*v0<x>F[a1+a2]*v0) + 1*(F[a1+a2]*v0<x>1*v0)>,
         <-q^-1*(1*v0<x>F[a1]*v0) + 1*(F[a1]*v0<x>1*v0)>,
         <-q^-1*(F[a1]*v0<x>F[a1+a2]*v0) + 1*(F[a1+a2]*v0<x>F[a1]*v0)>]
        >>> sorted(S.crystal_graph(False).vertices(sort=False), key=str)
        [<(1)*e.1>, <(1)*e.2>, <(1)*e.3>]

  highest_weight_vector()

    Return the highest weight vector of `self`.

    EXAMPLES:

    Sage

        sage: Q = QuantumGroup(['A',2])
        sage: V = Q.highest_weight_module([1,0])
        sage: T = tensor([V,V])
        sage: S = T.highest_weight_decomposition()[1]
        sage: u = S.highest_weight_vector(); u
        (1)*e.1
        sage: u.lift()
        -q^-1*(1*v0<x>F[a1]*v0) + 1*(F[a1]*v0<x>1*v0)

    Python

        >>> from sage.all import *
        >>> Q = QuantumGroup(['A',Integer(2)])
        >>> V = Q.highest_weight_module([Integer(1),Integer(0)])
        >>> T = tensor([V,V])
        >>> S = T.highest_weight_decomposition()[Integer(1)]
        >>> u = S.highest_weight_vector(); u
        (1)*e.1
        >>> u.lift()
        -q^-1*(1*v0<x>F[a1]*v0) + 1*(F[a1]*v0<x>1*v0)

  lift()

    The lift morphism from `self` to the ambient space.

    EXAMPLES:

    Sage

        sage: Q = QuantumGroup(['A',2])
        sage: V = Q.highest_weight_module([1,0])
        sage: T = tensor([V,V])
        sage: S = T.highest_weight_decomposition()[0]
        sage: S.lift
        Generic morphism:
          From: Highest weight submodule with weight 2*Lambda[1] generated by 1*(1*v0<x>1*v0)
          To:   Highest weight module ... # Highest weight module ...
        sage: x = sum(S.basis())
        sage: x.lift()
        1*(1*v0<x>1*v0) + 1*(1*v0<x>F[a1]*v0) + 1*(1*v0<x>F[a1+a2]*v0)
         + q^-1*(F[a1]*v0<x>1*v0) + 1*(F[a1]*v0<x>F[a1]*v0)
         + 1*(F[a1]*v0<x>F[a1+a2]*v0) + q^-1*(F[a1+a2]*v0<x>1*v0)
         + q^-1*(F[a1+a2]*v0<x>F[a1]*v0) + 1*(F[a1+a2]*v0<x>F[a1+a2]*v0)

    Python

        >>> from sage.all import *
        >>> Q = QuantumGroup(['A',Integer(2)])
        >>> V = Q.highest_weight_module([Integer(1),Integer(0)])
        >>> T = tensor([V,V])
        >>> S = T.highest_weight_decomposition()[Integer(0)]
        >>> S.lift
        Generic morphism:
          From: Highest weight submodule with weight 2*Lambda[1] generated by 1*(1*v0<x>1*v0)
          To:   Highest weight module ... # Highest weight module ...
        >>> x = sum(S.basis())
        >>> x.lift()
        1*(1*v0<x>1*v0) + 1*(1*v0<x>F[a1]*v0) + 1*(1*v0<x>F[a1+a2]*v0)
         + q^-1*(F[a1]*v0<x>1*v0) + 1*(F[a1]*v0<x>F[a1]*v0)
         + 1*(F[a1]*v0<x>F[a1+a2]*v0) + q^-1*(F[a1+a2]*v0<x>1*v0)
         + q^-1*(F[a1+a2]*v0<x>F[a1]*v0) + 1*(F[a1+a2]*v0<x>F[a1+a2]*v0)

  retract(elt)

    The retract map from the ambient space to `self`.

    EXAMPLES:

    Sage

        sage: Q = QuantumGroup(['A',2])
        sage: V = Q.highest_weight_module([1,0])
        sage: T = tensor([V,V])
        sage: all(S.retract(S.lift(x)) == x
        ....:     for S in T.highest_weight_decomposition()
        ....:     for x in S.basis())
        True

    Python

        >>> from sage.all import *
        >>> Q = QuantumGroup(['A',Integer(2)])
        >>> V = Q.highest_weight_module([Integer(1),Integer(0)])
        >>> T = tensor([V,V])
        >>> all(S.retract(S.lift(x)) == x
        ...     for S in T.highest_weight_decomposition()
        ...     for x in S.basis())
        True

class sage.algebras.quantum_groups.quantum_group_gap.LowerHalfQuantumGroup(Q)

  Bases: `Parent`, `UniqueRepresentation`

  The lower half of the quantum group.

  class Element(parent, libgap_elt)

    Bases: `QuaGroupModuleElement`

    An element of the lower half of the quantum group.

    bar()

      Return the bar involution on `self`.

      EXAMPLES:

      Sage

          sage: Q = QuantumGroup(['A',2])
          sage: F1, F2 = Q.F_simple()
          sage: B = Q.lower_half()
          sage: x = B(Q.an_element()); x
          1 + (q)*F[a1]
          sage: x.bar()
          1 + (q^-1)*F[a1]
          sage: (F1*x).bar() == F1 * x.bar()
          True
          sage: (F2*x).bar() == F2 * x.bar()
          True

          sage: Q = QuantumGroup(['G',2])
          sage: F1, F2 = Q.F_simple()
          sage: q = Q.q()
          sage: B = Q.lower_half()
          sage: x = B(q^-2*F1*F2^2*F1)
          sage: x
          (q + q^-5)*F[a1]*F[a1+a2]*F[a2]
           + (q^8 + q^6 + q^2 + 1)*F[a1]^(2)*F[a2]^(2)
          sage: x.bar()
          (q^5 + q^-1)*F[a1]*F[a1+a2]*F[a2]
           + (q^12 + q^10 + q^6 + q^4)*F[a1]^(2)*F[a2]^(2)

      Python

          >>> from sage.all import *
          >>> Q = QuantumGroup(['A',Integer(2)])
          >>> F1, F2 = Q.F_simple()
          >>> B = Q.lower_half()
          >>> x = B(Q.an_element()); x
          1 + (q)*F[a1]
          >>> x.bar()
          1 + (q^-1)*F[a1]
          >>> (F1*x).bar() == F1 * x.bar()
          True
          >>> (F2*x).bar() == F2 * x.bar()
          True

          >>> Q = QuantumGroup(['G',Integer(2)])
          >>> F1, F2 = Q.F_simple()
          >>> q = Q.q()
          >>> B = Q.lower_half()
          >>> x = B(q**-Integer(2)*F1*F2**Integer(2)*F1)
          >>> x
          (q + q^-5)*F[a1]*F[a1+a2]*F[a2]
           + (q^8 + q^6 + q^2 + 1)*F[a1]^(2)*F[a2]^(2)
          >>> x.bar()
          (q^5 + q^-1)*F[a1]*F[a1+a2]*F[a2]
           + (q^12 + q^10 + q^6 + q^4)*F[a1]^(2)*F[a2]^(2)

    braid_group_action(braid)

      Return the action of the braid group element `braid` projected into `self`.

      INPUT:

      - `braid` – a reduced word of a braid group element

      EXAMPLES:

      Sage

          sage: Q = QuantumGroup(['A',2])
          sage: L = Q.lower_half()
          sage: v = L.highest_weight_vector().f_tilde([1,2,2,1]); v
          F[a1]*F[a1+a2]*F[a2]
          sage: v.braid_group_action([1])
          (-q^3-q)*F[a2]^(2)
          sage: v.braid_group_action([]) == v
          True

      Python

          >>> from sage.all import *
          >>> Q = QuantumGroup(['A',Integer(2)])
          >>> L = Q.lower_half()
          >>> v = L.highest_weight_vector().f_tilde([Integer(1),Integer(2),Integer(2),Integer(1)]); v
          F[a1]*F[a1+a2]*F[a2]
          >>> v.braid_group_action([Integer(1)])
          (-q^3-q)*F[a2]^(2)
          >>> v.braid_group_action([]) == v
          True

    monomial_coefficients(copy=True)

      Return the dictionary of `self` whose keys are the basis indices and the values are coefficients.

      EXAMPLES:

      Sage

          sage: Q = QuantumGroup(['A',2])
          sage: B = Q.lower_half()
          sage: x = B.retract(Q.an_element()); x
          1 + (q)*F[a1]
          sage: sorted(x.monomial_coefficients().items(), key=str)
          [((0, 0, 0), 1), ((1, 0, 0), q)]

      Python

          >>> from sage.all import *
          >>> Q = QuantumGroup(['A',Integer(2)])
          >>> B = Q.lower_half()
          >>> x = B.retract(Q.an_element()); x
          1 + (q)*F[a1]
          >>> sorted(x.monomial_coefficients().items(), key=str)
          [((0, 0, 0), 1), ((1, 0, 0), q)]

    tau()

      Return the action of the \(\tau\) anti-automorphism on `self`.

      EXAMPLES:

      Sage

          sage: Q = QuantumGroup(['A',2])
          sage: F1, F2 = Q.F_simple()
          sage: B = Q.lower_half()
          sage: x = B(Q.an_element()); x
          1 + (q)*F[a1]
          sage: x.tau()
          1 + (q)*F[a1]
          sage: (F1*x).tau() == x.tau() * F1.tau()
          True
          sage: (F2*x).tau() == x.tau() * F2.tau()
          True

          sage: Q = QuantumGroup(['G',2])
          sage: F1, F2 = Q.F_simple()
          sage: q = Q.q()
          sage: B = Q.lower_half()
          sage: x = B(q^-2*F1*F2^2*F1)
          sage: x
          (q + q^-5)*F[a1]*F[a1+a2]*F[a2]
           + (q^8 + q^6 + q^2 + 1)*F[a1]^(2)*F[a2]^(2)
          sage: x.tau()
          (q + q^-5)*F[a1]*F[a1+a2]*F[a2]
           + (q^8 + q^6 + q^2 + 1)*F[a1]^(2)*F[a2]^(2)

      Python

          >>> from sage.all import *
          >>> Q = QuantumGroup(['A',Integer(2)])
          >>> F1, F2 = Q.F_simple()
          >>> B = Q.lower_half()
          >>> x = B(Q.an_element()); x
          1 + (q)*F[a1]
          >>> x.tau()
          1 + (q)*F[a1]
          >>> (F1*x).tau() == x.tau() * F1.tau()
          True
          >>> (F2*x).tau() == x.tau() * F2.tau()
          True

          >>> Q = QuantumGroup(['G',Integer(2)])
          >>> F1, F2 = Q.F_simple()
          >>> q = Q.q()
          >>> B = Q.lower_half()
          >>> x = B(q**-Integer(2)*F1*F2**Integer(2)*F1)
          >>> x
          (q + q^-5)*F[a1]*F[a1+a2]*F[a2]
           + (q^8 + q^6 + q^2 + 1)*F[a1]^(2)*F[a2]^(2)
          >>> x.tau()
          (q + q^-5)*F[a1]*F[a1+a2]*F[a2]
           + (q^8 + q^6 + q^2 + 1)*F[a1]^(2)*F[a2]^(2)

  algebra_generators()

    Return the algebra generators of `self`.

    EXAMPLES:

    Sage

        sage: Q = QuantumGroup(['A',2])
        sage: B = Q.lower_half()
        sage: B.algebra_generators()
        Finite family {1: F[a1], 2: F[a2]}

    Python

        >>> from sage.all import *
        >>> Q = QuantumGroup(['A',Integer(2)])
        >>> B = Q.lower_half()
        >>> B.algebra_generators()
        Finite family {1: F[a1], 2: F[a2]}

  ambient()

    Return the ambient quantum group of `self`.

    EXAMPLES:

    Sage

        sage: Q = QuantumGroup(['A',2])
        sage: B = Q.lower_half()
        sage: B.ambient() is Q
        True

    Python

        >>> from sage.all import *
        >>> Q = QuantumGroup(['A',Integer(2)])
        >>> B = Q.lower_half()
        >>> B.ambient() is Q
        True

  an_element()

    alias of `highest_weight_vector()`.

  basis()

    Return the basis of `self`.

    This returns the PBW basis of `self`, which is given by monomials in \(\{F_{\alpha}\}\), where \(\alpha\) runs over all positive roots.

    EXAMPLES:

    Sage

        sage: Q = QuantumGroup(['A',2])
        sage: B = Q.lower_half()
        sage: basis = B.basis(); basis
        Lazy family (monomial(i))_{i in The Cartesian product of 3 copies of Non negative integers}
        sage: basis[1,2,1]
        F[a1]*F[a1+a2]^(2)*F[a2]
        sage: basis[1,2,4]
        F[a1]*F[a1+a2]^(2)*F[a2]^(4)
        sage: basis[1,0,4]
        F[a1]*F[a2]^(4)

    Python

        >>> from sage.all import *
        >>> Q = QuantumGroup(['A',Integer(2)])
        >>> B = Q.lower_half()
        >>> basis = B.basis(); basis
        Lazy family (monomial(i))_{i in The Cartesian product of 3 copies of Non negative integers}
        >>> basis[Integer(1),Integer(2),Integer(1)]
        F[a1]*F[a1+a2]^(2)*F[a2]
        >>> basis[Integer(1),Integer(2),Integer(4)]
        F[a1]*F[a1+a2]^(2)*F[a2]^(4)
        >>> basis[Integer(1),Integer(0),Integer(4)]
        F[a1]*F[a2]^(4)

  canonical_basis_elements()

    Construct the monomial elements of `self` indexed by `k`.

    EXAMPLES:

    Sage

        sage: Q = QuantumGroup(['A',2])
        sage: B = Q.lower_half()
        sage: C = B.canonical_basis_elements(); C
        Lazy family (Canonical basis(i))_{i in The Cartesian product of 2 copies of Non negative integers}
        sage: C[2,1]
        [F[a1]^(2)*F[a2], F[a1]*F[a1+a2] + (q^2)*F[a1]^(2)*F[a2]]
        sage: C[1,2]
        [F[a1]*F[a2]^(2), (q^2)*F[a1]*F[a2]^(2) + F[a1+a2]*F[a2]]

    Python

        >>> from sage.all import *
        >>> Q = QuantumGroup(['A',Integer(2)])
        >>> B = Q.lower_half()
        >>> C = B.canonical_basis_elements(); C
        Lazy family (Canonical basis(i))_{i in The Cartesian product of 2 copies of Non negative integers}
        >>> C[Integer(2),Integer(1)]
        [F[a1]^(2)*F[a2], F[a1]*F[a1+a2] + (q^2)*F[a1]^(2)*F[a2]]
        >>> C[Integer(1),Integer(2)]
        [F[a1]*F[a2]^(2), (q^2)*F[a1]*F[a2]^(2) + F[a1+a2]*F[a2]]

  gens()

    alias of `algebra_generators()`.

  highest_weight_vector()

    Return the highest weight vector of `self`.

    EXAMPLES:

    Sage

        sage: Q = QuantumGroup(['A',2])
        sage: B = Q.lower_half()
        sage: B.highest_weight_vector()
        1

    Python

        >>> from sage.all import *
        >>> Q = QuantumGroup(['A',Integer(2)])
        >>> B = Q.lower_half()
        >>> B.highest_weight_vector()
        1

  lift(elt)

    Lift `elt` to the ambient quantum group of `self`.

    EXAMPLES:

    Sage

        sage: Q = QuantumGroup(['A',2])
        sage: B = Q.lower_half()
        sage: x = B.lift(B.an_element()); x
        1
        sage: x.parent() is Q
        True

    Python

        >>> from sage.all import *
        >>> Q = QuantumGroup(['A',Integer(2)])
        >>> B = Q.lower_half()
        >>> x = B.lift(B.an_element()); x
        1
        >>> x.parent() is Q
        True

  one()

    alias of `highest_weight_vector()`.

  retract(elt)

    Retract `elt` from the ambient quantum group to `self`.

    EXAMPLES:

    Sage

        sage: Q = QuantumGroup(['A',2])
        sage: B = Q.lower_half()
        sage: x = Q.an_element(); x
        1 + (q)*F[a1] + E[a1] + (q^2-1-q^-2 + q^-4)*[ K1 ; 2 ]
         + K1 + (-q^-1 + q^-3)*K1[ K1 ; 1 ]
        sage: B.retract(x)
        1 + (q)*F[a1]

    Python

        >>> from sage.all import *
        >>> Q = QuantumGroup(['A',Integer(2)])
        >>> B = Q.lower_half()
        >>> x = Q.an_element(); x
        1 + (q)*F[a1] + E[a1] + (q^2-1-q^-2 + q^-4)*[ K1 ; 2 ]
         + K1 + (-q^-1 + q^-3)*K1[ K1 ; 1 ]
        >>> B.retract(x)
        1 + (q)*F[a1]

  zero()

    Return the zero element of `self`.

    EXAMPLES:

    Sage

        sage: Q = QuantumGroup(['A',2])
        sage: B = Q.lower_half()
        sage: B.zero()
        0

    Python

        >>> from sage.all import *
        >>> Q = QuantumGroup(['A',Integer(2)])
        >>> B = Q.lower_half()
        >>> B.zero()
        0

class sage.algebras.quantum_groups.quantum_group_gap.QuaGroupModuleElement(parent, libgap_elt)

  Bases: `Element`

  Base class for elements created using QuaGroup.

  e_tilde(i)

    Return the action of the Kashiwara operator \(\widetilde{e}_i\) on `self`.

    INPUT:

    - `i` – an element of the index set or a list to perform a string of operators

    EXAMPLES:

    Sage

        sage: Q = QuantumGroup(['B',2])
        sage: x = Q.one().f_tilde([1,2,1,1,2,2])
        sage: x.e_tilde([2,2,1,2])
        F[a1]^(2)

    Python

        >>> from sage.all import *
        >>> Q = QuantumGroup(['B',Integer(2)])
        >>> x = Q.one().f_tilde([Integer(1),Integer(2),Integer(1),Integer(1),Integer(2),Integer(2)])
        >>> x.e_tilde([Integer(2),Integer(2),Integer(1),Integer(2)])
        F[a1]^(2)

  f_tilde(i)

    Return the action of the Kashiwara operator \(\widetilde{f}_i\) on `self`.

    INPUT:

    - `i` – an element of the index set or a list to perform a string of operators

    EXAMPLES:

    Sage

        sage: Q = QuantumGroup(['B',2])
        sage: Q.one().f_tilde(1)
        F[a1]
        sage: Q.one().f_tilde(2)
        F[a2]
        sage: Q.one().f_tilde([1,2,1,1,2])
        F[a1]*F[a1+a2]^(2)

    Python

        >>> from sage.all import *
        >>> Q = QuantumGroup(['B',Integer(2)])
        >>> Q.one().f_tilde(Integer(1))
        F[a1]
        >>> Q.one().f_tilde(Integer(2))
        F[a2]
        >>> Q.one().f_tilde([Integer(1),Integer(2),Integer(1),Integer(1),Integer(2)])
        F[a1]*F[a1+a2]^(2)

  gap()

    Return the gap representation of `self`.

    EXAMPLES:

    Sage

        sage: Q = QuantumGroup(['B',3])
        sage: x = Q.an_element()
        sage: x.gap()
        1+(q)*F1+E1+(q^4-1-q^-4+q^-8)*[ K1 ; 2 ]+K1+(-q^-2+q^-6)*K1[ K1 ; 1 ]

    Python

        >>> from sage.all import *
        >>> Q = QuantumGroup(['B',Integer(3)])
        >>> x = Q.an_element()
        >>> x.gap()
        1+(q)*F1+E1+(q^4-1-q^-4+q^-8)*[ K1 ; 2 ]+K1+(-q^-2+q^-6)*K1[ K1 ; 1 ]

class sage.algebras.quantum_groups.quantum_group_gap.QuaGroupRepresentationElement(parent, libgap_elt)

  Bases: `QuaGroupModuleElement`

  Element of a quantum group representation.

  monomial_coefficients(copy=True)

    Return the dictionary of `self` whose keys are the basis indices and the values are coefficients.

    EXAMPLES:

    Sage

        sage: Q = QuantumGroup(['A',2])
        sage: V = Q.highest_weight_module([1,1])
        sage: v = V.highest_weight_vector()
        sage: F1, F2 = Q.F_simple()
        sage: q = Q.q()
        sage: x = v + F1*v + q*F2*F1*v; x
        1*v0 + F[a1]*v0 + (q^2)*F[a1]*F[a2]*v0 + (q)*F[a1+a2]*v0
        sage: sorted(x.monomial_coefficients().items(), key=str)
        [(0, 1), (1, 1), (3, q^2), (4, q)]

    Python

        >>> from sage.all import *
        >>> Q = QuantumGroup(['A',Integer(2)])
        >>> V = Q.highest_weight_module([Integer(1),Integer(1)])
        >>> v = V.highest_weight_vector()
        >>> F1, F2 = Q.F_simple()
        >>> q = Q.q()
        >>> x = v + F1*v + q*F2*F1*v; x
        1*v0 + F[a1]*v0 + (q^2)*F[a1]*F[a2]*v0 + (q)*F[a1+a2]*v0
        >>> sorted(x.monomial_coefficients().items(), key=str)
        [(0, 1), (1, 1), (3, q^2), (4, q)]

class sage.algebras.quantum_groups.quantum_group_gap.QuantumGroup(cartan_type, q)

  Bases: `UniqueRepresentation`, `Parent`

  A Drinfel’d-Jimbo quantum group (implemented using the optional GAP package `QuaGroup`).

  EXAMPLES:

  We check the quantum Serre relations. We first we import the \(q\)-binomial using the \(q\)-int for quantum groups:

  Sage

      sage: from sage.algebras.quantum_groups.q_numbers import q_binomial

  Python

      >>> from sage.all import *
      >>> from sage.algebras.quantum_groups.q_numbers import q_binomial

  We verify the Serre relations for type \(A_2\):

  Sage

      sage: Q = algebras.QuantumGroup(['A',2])
      sage: F1,F12,F2 = Q.F()
      sage: q = Q.q()
      sage: F1^2*F2 - q_binomial(2,1,q) * F1*F2*F1 + F2*F1^2
      0

  [Python]

      >>> from sage.all import *
      >>> Q = algebras.QuantumGroup(['A',Integer(2)])
      >>> F1,F12,F2 = Q.F()
      >>> q = Q.q()
      >>> F1**Integer(2)*F2 - q_binomial(Integer(2),Integer(1),q) * F1*F2*F1 + F2*F1**Integer(2)
      0

  We verify the Serre relations for type \(B_2\):

  Sage

      sage: Q = algebras.QuantumGroup(['B',2])
      sage: F1, F12, F122, F2 = Q.F()
      sage: F1^2*F2 - q_binomial(2,1,q^2) * F1*F2*F1 + F2*F1^2
      0
      sage: (F2^3*F1 - q_binomial(3,1,q) * F2^2*F1*F2
      ....:  + q_binomial(3,2,q) * F2*F1*F2^2 - F1*F2^3)
      0

  Python

      >>> from sage.all import *
      >>> Q = algebras.QuantumGroup(['B',Integer(2)])
      >>> F1, F12, F122, F2 = Q.F()
      >>> F1**Integer(2)*F2 - q_binomial(Integer(2),Integer(1),q**Integer(2)) * F1*F2*F1 + F2*F1**Integer(2)
      0
      >>> (F2**Integer(3)*F1 - q_binomial(Integer(3),Integer(1),q) * F2**Integer(2)*F1*F2
      ...  + q_binomial(Integer(3),Integer(2),q) * F2*F1*F2**Integer(2) - F1*F2**Integer(3))
      0

  REFERENCES:

  - Wikipedia article Quantum_group

  E()

    Return the family of generators \(\{E_{\alpha}\}_{\alpha \in \Phi}\), where \(\Phi\) is the root system of `self`.

    EXAMPLES:

    Sage

        sage: Q = QuantumGroup(['B',2])
        sage: list(Q.E())
        [E[a1], E[a1+a2], E[a1+2*a2], E[a2]]

    Python

        >>> from sage.all import *
        >>> Q = QuantumGroup(['B',Integer(2)])
        >>> list(Q.E())
        [E[a1], E[a1+a2], E[a1+2*a2], E[a2]]

  E_simple()

    Return the family of generators \(\{E_i := E_{\alpha_i}\}_{i \in I}\).

    EXAMPLES:

    Sage

        sage: Q = QuantumGroup(['B',2])
        sage: Q.E_simple()
        Finite family {1: E[a1], 2: E[a2]}

    Python

        >>> from sage.all import *
        >>> Q = QuantumGroup(['B',Integer(2)])
        >>> Q.E_simple()
        Finite family {1: E[a1], 2: E[a2]}

  class Element(parent, libgap_elt)

    Bases: `QuaGroupModuleElement`

    bar()

      Return the bar involution on `self`.

      The bar involution is defined by

      \[\overline{E_i} = E_i, \qquad\qquad \overline{F_i} = F_i, \qquad\qquad \overline{K_i} = K_i^{-1}.\]

      EXAMPLES:

      Sage

          sage: Q = QuantumGroup(['A',2])
          sage: [gen.bar() for gen in Q.gens()]
          [F[a1],
           (q-q^-1)*F[a1]*F[a2] + F[a1+a2],
           F[a2],
           (-q + q^-1)*[ K1 ; 1 ] + K1, K1,
           (-q + q^-1)*[ K2 ; 1 ] + K2, K2,
           E[a1],
           (-q^2 + 1)*E[a1]*E[a2] + (q^2)*E[a1+a2],
           E[a2]]

      Python

          >>> from sage.all import *
          >>> Q = QuantumGroup(['A',Integer(2)])
          >>> [gen.bar() for gen in Q.gens()]
          [F[a1],
           (q-q^-1)*F[a1]*F[a2] + F[a1+a2],
           F[a2],
           (-q + q^-1)*[ K1 ; 1 ] + K1, K1,
           (-q + q^-1)*[ K2 ; 1 ] + K2, K2,
           E[a1],
           (-q^2 + 1)*E[a1]*E[a2] + (q^2)*E[a1+a2],
           E[a2]]

    braid_group_action(braid)

      Return the action of the braid group element `braid`.

      The braid group operator \(T_i \colon U_q(\mathfrak{g}) \to U_q(\mathfrak{g})\) is defined by

      \[\begin{split}\begin{aligned} T_i(E_i) &= -F_iK_i, \\ T_i(E_j) &= \sum_{k=0}^{-a_{ij}} (-1)^k q_i^{-k} E_i^{(-a_{ij}-k)} E_j E_i^{(k)} \text{ if } i \neq j,\\ T_i(K_j) &= K_jK_i^{a_{ij}}, \\ T_i(F_i) &= -K_i^{-1}E_i, \\ T_i(F_j) &= \sum_{k=0}^{-a_{ij}} (-1)^k q_i^{-k} F_i^{(k)} F_j F_i^{(-a_{ij}-k)} \text{ if } i \neq j, \end{aligned}\end{split}\]

      where \(a_{ij} = \langle \alpha_j, \alpha_i^\vee \rangle\) is the \((i,j)\)-entry of the Cartan matrix associated to \(\mathfrak{g}\).

      INPUT:

      - `braid` – a reduced word of a braid group element

      EXAMPLES:

      Sage

          sage: Q = QuantumGroup(['A',2])
          sage: F1 = Q.F_simple()[1]
          sage: F1.braid_group_action([1])
          (q-q^-1)*[ K1 ; 1 ]*E[a1] + (-1)*K1*E[a1]
          sage: F1.braid_group_action([1,2])
          F[a2]
          sage: F1.braid_group_action([2,1])
          (-q^3 + 3*q-3*q^-1 + q^-3)*[ K1 ; 1 ]*[ K2 ; 1 ]*E[a1]*E[a2]
           + (q^3-2*q + q^-1)*[ K1 ; 1 ]*[ K2 ; 1 ]*E[a1+a2]
           + (q^2-2 + q^-2)*[ K1 ; 1 ]*K2*E[a1]*E[a2]
           + (-q^2 + 1)*[ K1 ; 1 ]*K2*E[a1+a2]
           + (q^2-2 + q^-2)*K1*[ K2 ; 1 ]*E[a1]*E[a2]
           + (-q^2 + 1)*K1*[ K2 ; 1 ]*E[a1+a2]
           + (-q + q^-1)*K1*K2*E[a1]*E[a2] + (q)*K1*K2*E[a1+a2]
          sage: F1.braid_group_action([1,2,1]) == F1.braid_group_action([2,1,2])
          True
          sage: F1.braid_group_action([]) == F1
          True

      Python

          >>> from sage.all import *
          >>> Q = QuantumGroup(['A',Integer(2)])
          >>> F1 = Q.F_simple()[Integer(1)]
          >>> F1.braid_group_action([Integer(1)])
          (q-q^-1)*[ K1 ; 1 ]*E[a1] + (-1)*K1*E[a1]
          >>> F1.braid_group_action([Integer(1),Integer(2)])
          F[a2]
          >>> F1.braid_group_action([Integer(2),Integer(1)])
          (-q^3 + 3*q-3*q^-1 + q^-3)*[ K1 ; 1 ]*[ K2 ; 1 ]*E[a1]*E[a2]
           + (q^3-2*q + q^-1)*[ K1 ; 1 ]*[ K2 ; 1 ]*E[a1+a2]
           + (q^2-2 + q^-2)*[ K1 ; 1 ]*K2*E[a1]*E[a2]
           + (-q^2 + 1)*[ K1 ; 1 ]*K2*E[a1+a2]
           + (q^2-2 + q^-2)*K1*[ K2 ; 1 ]*E[a1]*E[a2]
           + (-q^2 + 1)*K1*[ K2 ; 1 ]*E[a1+a2]
           + (-q + q^-1)*K1*K2*E[a1]*E[a2] + (q)*K1*K2*E[a1+a2]
          >>> F1.braid_group_action([Integer(1),Integer(2),Integer(1)]) == F1.braid_group_action([Integer(2),Integer(1),Integer(2)])
          True
          >>> F1.braid_group_action([]) == F1
          True

    omega()

      Return the action of the \(\omega\) automorphism on `self`.

      The \(\omega\) automorphism is defined by

      \[\omega(E_i) = F_i, \qquad\qquad \omega(F_i) = E_i, \qquad\qquad \omega(K_i) = K_i^{-1}.\]

      EXAMPLES:

      Sage

          sage: Q = QuantumGroup(['A',2])
          sage: [gen.omega() for gen in Q.gens()]
          [E[a1],
           (-q)*E[a1+a2],
           E[a2],
           (-q + q^-1)*[ K1 ; 1 ] + K1,
           K1,
           (-q + q^-1)*[ K2 ; 1 ] + K2,
           K2,
           F[a1],
           (-q^-1)*F[a1+a2],
           F[a2]]

      Python

          >>> from sage.all import *
          >>> Q = QuantumGroup(['A',Integer(2)])
          >>> [gen.omega() for gen in Q.gens()]
          [E[a1],
           (-q)*E[a1+a2],
           E[a2],
           (-q + q^-1)*[ K1 ; 1 ] + K1,
           K1,
           (-q + q^-1)*[ K2 ; 1 ] + K2,
           K2,
           F[a1],
           (-q^-1)*F[a1+a2],
           F[a2]]

    tau()

      Return the action of the \(\tau\) anti-automorphism on `self`.

      The \(\tau\) anti-automorphism is defined by

      \[\tau(E_i) = E_i, \qquad\qquad \tau(F_i) = F_i, \qquad\qquad \tau(K_i) = K_i^{-1}.\]

      EXAMPLES:

      Sage

          sage: Q = QuantumGroup(['A',2])
          sage: [gen.tau() for gen in Q.gens()]
          [F[a1],
           (-q^2 + 1)*F[a1]*F[a2] + (-q)*F[a1+a2],
           F[a2],
           (-q + q^-1)*[ K1 ; 1 ] + K1,
           K1,
           (-q + q^-1)*[ K2 ; 1 ] + K2,
           K2,
           E[a1],
           (q-q^-1)*E[a1]*E[a2] + (-q)*E[a1+a2],
           E[a2]]

      Python

          >>> from sage.all import *
          >>> Q = QuantumGroup(['A',Integer(2)])
          >>> [gen.tau() for gen in Q.gens()]
          [F[a1],
           (-q^2 + 1)*F[a1]*F[a2] + (-q)*F[a1+a2],
           F[a2],
           (-q + q^-1)*[ K1 ; 1 ] + K1,
           K1,
           (-q + q^-1)*[ K2 ; 1 ] + K2,
           K2,
           E[a1],
           (q-q^-1)*E[a1]*E[a2] + (-q)*E[a1+a2],
           E[a2]]

  F()

    Return the family of generators \(\{F_{\alpha}\}_{\alpha \in \Phi}\), where \(\Phi\) is the root system of `self`.

    EXAMPLES:

    Sage

        sage: Q = QuantumGroup(['G',2])
        sage: list(Q.F())
        [F[a1], F[3*a1+a2], F[2*a1+a2], F[3*a1+2*a2], F[a1+a2], F[a2]]

    Python

        >>> from sage.all import *
        >>> Q = QuantumGroup(['G',Integer(2)])
        >>> list(Q.F())
        [F[a1], F[3*a1+a2], F[2*a1+a2], F[3*a1+2*a2], F[a1+a2], F[a2]]

  F_simple()

    Return the family of generators \(\{F_i := F_{\alpha_i}\}_{i \in I}\).

    EXAMPLES:

    Sage

        sage: Q = QuantumGroup(['G',2])
        sage: Q.F_simple()
        Finite family {1: F[a1], 2: F[a2]}

    Python

        >>> from sage.all import *
        >>> Q = QuantumGroup(['G',Integer(2)])
        >>> Q.F_simple()
        Finite family {1: F[a1], 2: F[a2]}

  K()

    Return the family of generators \(\{K_i\}_{i \in I}\).

    EXAMPLES:

    Sage

        sage: Q = QuantumGroup(['A',3])
        sage: Q.K()
        Finite family {1: K1, 2: K2, 3: K3}
        sage: Q.K_inverse()
        Finite family {1: (-q + q^-1)*[ K1 ; 1 ] + K1,
                       2: (-q + q^-1)*[ K2 ; 1 ] + K2,
                       3: (-q + q^-1)*[ K3 ; 1 ] + K3}

    Python

        >>> from sage.all import *
        >>> Q = QuantumGroup(['A',Integer(3)])
        >>> Q.K()
        Finite family {1: K1, 2: K2, 3: K3}
        >>> Q.K_inverse()
        Finite family {1: (-q + q^-1)*[ K1 ; 1 ] + K1,
                       2: (-q + q^-1)*[ K2 ; 1 ] + K2,
                       3: (-q + q^-1)*[ K3 ; 1 ] + K3}

  K_inverse()

    Return the family of generators \(\{K_i^{-1}\}_{i \in I}\).

    EXAMPLES:

    Sage

        sage: Q = QuantumGroup(['A',3])
        sage: Q.K_inverse()
        Finite family {1: (-q + q^-1)*[ K1 ; 1 ] + K1,
                       2: (-q + q^-1)*[ K2 ; 1 ] + K2,
                       3: (-q + q^-1)*[ K3 ; 1 ] + K3}

    Python

        >>> from sage.all import *
        >>> Q = QuantumGroup(['A',Integer(3)])
        >>> Q.K_inverse()
        Finite family {1: (-q + q^-1)*[ K1 ; 1 ] + K1,
                       2: (-q + q^-1)*[ K2 ; 1 ] + K2,
                       3: (-q + q^-1)*[ K3 ; 1 ] + K3}

  algebra_generators()

    Return the algebra generators of `self`.

    EXAMPLES:

    Sage

        sage: Q = QuantumGroup(['A',2])
        sage: list(Q.algebra_generators())
        [F[a1], F[a2],
         K1, K2,
         (-q + q^-1)*[ K1 ; 1 ] + K1, (-q + q^-1)*[ K2 ; 1 ] + K2,
         E[a1], E[a2]]

    Python

        >>> from sage.all import *
        >>> Q = QuantumGroup(['A',Integer(2)])
        >>> list(Q.algebra_generators())
        [F[a1], F[a2],
         K1, K2,
         (-q + q^-1)*[ K1 ; 1 ] + K1, (-q + q^-1)*[ K2 ; 1 ] + K2,
         E[a1], E[a2]]

  antipode(elt)

    Return the antipode of `elt`.

    The antipode \(S \colon U_q(\mathfrak{g}) \to U_q(\mathfrak{g})\) is the anti-automorphism defined by

    \[S(E_i) = -K_i^{-1}E_i, \qquad S(F_i) = -F_iK_i, \qquad S(K_i) = K_i^{-1}.\]

    EXAMPLES:

    Sage

        sage: Q = QuantumGroup(['B',2])
        sage: [Q.antipode(f) for f in Q.F()]
        [(-1)*F[a1]*K1,
         (-q^6 + q^2)*F[a1]*F[a2]*K1*K2 + (-q^4)*F[a1+a2]*K1*K2,
         (-q^8 + q^6 + q^4-q^2)*F[a1]*F[a2]^(2)*K1
          + (-q^9 + 2*q^7-2*q^3 + q)*F[a1]*F[a2]^(2)*K1*K2[ K2 ; 1 ]
          + (-q^5 + q^3)*F[a1+a2]*F[a2]*K1
          + (-q^6 + 2*q^4-q^2)*F[a1+a2]*F[a2]*K1*K2[ K2 ; 1 ]
          + (-q^4)*F[a1+2*a2]*K1 + (-q^5 + q^3)*F[a1+2*a2]*K1*K2[ K2 ; 1 ],
         (-1)*F[a2]*K2]

    Python

        >>> from sage.all import *
        >>> Q = QuantumGroup(['B',Integer(2)])
        >>> [Q.antipode(f) for f in Q.F()]
        [(-1)*F[a1]*K1,
         (-q^6 + q^2)*F[a1]*F[a2]*K1*K2 + (-q^4)*F[a1+a2]*K1*K2,
         (-q^8 + q^6 + q^4-q^2)*F[a1]*F[a2]^(2)*K1
          + (-q^9 + 2*q^7-2*q^3 + q)*F[a1]*F[a2]^(2)*K1*K2[ K2 ; 1 ]
          + (-q^5 + q^3)*F[a1+a2]*F[a2]*K1
          + (-q^6 + 2*q^4-q^2)*F[a1+a2]*F[a2]*K1*K2[ K2 ; 1 ]
          + (-q^4)*F[a1+2*a2]*K1 + (-q^5 + q^3)*F[a1+2*a2]*K1*K2[ K2 ; 1 ],
         (-1)*F[a2]*K2]

  cartan_type()

    Return the Cartan type of `self`.

    EXAMPLES:

    Sage

        sage: Q = QuantumGroup(['A',2])
        sage: Q.cartan_type()
        ['A', 2]

    Python

        >>> from sage.all import *
        >>> Q = QuantumGroup(['A',Integer(2)])
        >>> Q.cartan_type()
        ['A', 2]

  coproduct(elt, n=1)

    Return the coproduct of `elt` (iterated `n` times).

    The comultiplication \(\Delta \colon U_q(\mathfrak{g}) \to U_q(\mathfrak{g}) \otimes U_q(\mathfrak{g})\) is defined by

    \[\begin{split}\begin{aligned} \Delta(E_i) &= E_i \otimes 1 + K_i \otimes E_i, \\ \Delta(F_i) &= F_i \otimes K_i^{-1} + 1 \otimes F_i, \\ \Delta(K_i) &= K_i \otimes K_i. \end{aligned}\end{split}\]

    EXAMPLES:

    Sage

        sage: Q = QuantumGroup(['B',2])
        sage: [Q.coproduct(e) for e in Q.E()]
        [1*(E[a1]<x>1) + 1*(K1<x>E[a1]),
         1*(E[a1+a2]<x>1) + 1*(K1*K2<x>E[a1+a2]) + q^2-q^-2*(K2*E[a1]<x>E[a2]),
         q^4-q^2-1 + q^-2*(E[a1]<x>E[a2]^(2)) + 1*(E[a1+2*a2]<x>1)
          + 1*(K1<x>E[a1+2*a2]) + q-q^-1*(K1*K2[ K2 ; 1 ]<x>E[a1+2*a2])
          + q-q^-1*(K2*E[a1+a2]<x>E[a2]) + q^5-2*q^3
          + 2*q^-1-q^-3*(K2[ K2 ; 1 ]*E[a1]<x>E[a2]^(2)),
         1*(E[a2]<x>1) + 1*(K2<x>E[a2])]
        sage: [Q.coproduct(f, 2) for f in Q.F_simple()]
        [1*(1<x>1<x>F[a1]) + -q^2 + q^-2*(1<x>F[a1]<x>[ K1 ; 1 ])
          + 1*(1<x>F[a1]<x>K1) + q^4-2 + q^-4*(F[a1]<x>[ K1 ; 1 ]<x>[ K1 ; 1 ])
          + -q^2 + q^-2*(F[a1]<x>[ K1 ; 1 ]<x>K1) + -q^2
          + q^-2*(F[a1]<x>K1<x>[ K1 ; 1 ]) + 1*(F[a1]<x>K1<x>K1),
         1*(1<x>1<x>F[a2]) + -q + q^-1*(1<x>F[a2]<x>[ K2 ; 1 ])
          + 1*(1<x>F[a2]<x>K2) + q^2-2 + q^-2*(F[a2]<x>[ K2 ; 1 ]<x>[ K2 ; 1 ])
          + -q + q^-1*(F[a2]<x>[ K2 ; 1 ]<x>K2) + -q
          + q^-1*(F[a2]<x>K2<x>[ K2 ; 1 ]) + 1*(F[a2]<x>K2<x>K2)]

    Python

        >>> from sage.all import *
        >>> Q = QuantumGroup(['B',Integer(2)])
        >>> [Q.coproduct(e) for e in Q.E()]
        [1*(E[a1]<x>1) + 1*(K1<x>E[a1]),
         1*(E[a1+a2]<x>1) + 1*(K1*K2<x>E[a1+a2]) + q^2-q^-2*(K2*E[a1]<x>E[a2]),
         q^4-q^2-1 + q^-2*(E[a1]<x>E[a2]^(2)) + 1*(E[a1+2*a2]<x>1)
          + 1*(K1<x>E[a1+2*a2]) + q-q^-1*(K1*K2[ K2 ; 1 ]<x>E[a1+2*a2])
          + q-q^-1*(K2*E[a1+a2]<x>E[a2]) + q^5-2*q^3
          + 2*q^-1-q^-3*(K2[ K2 ; 1 ]*E[a1]<x>E[a2]^(2)),
         1*(E[a2]<x>1) + 1*(K2<x>E[a2])]
        >>> [Q.coproduct(f, Integer(2)) for f in Q.F_simple()]
        [1*(1<x>1<x>F[a1]) + -q^2 + q^-2*(1<x>F[a1]<x>[ K1 ; 1 ])
          + 1*(1<x>F[a1]<x>K1) + q^4-2 + q^-4*(F[a1]<x>[ K1 ; 1 ]<x>[ K1 ; 1 ])
          + -q^2 + q^-2*(F[a1]<x>[ K1 ; 1 ]<x>K1) + -q^2
          + q^-2*(F[a1]<x>K1<x>[ K1 ; 1 ]) + 1*(F[a1]<x>K1<x>K1),
         1*(1<x>1<x>F[a2]) + -q + q^-1*(1<x>F[a2]<x>[ K2 ; 1 ])
          + 1*(1<x>F[a2]<x>K2) + q^2-2 + q^-2*(F[a2]<x>[ K2 ; 1 ]<x>[ K2 ; 1 ])
          + -q + q^-1*(F[a2]<x>[ K2 ; 1 ]<x>K2) + -q
          + q^-1*(F[a2]<x>K2<x>[ K2 ; 1 ]) + 1*(F[a2]<x>K2<x>K2)]

  counit(elt)

    Return the counit of `elt`.

    The counit \(\varepsilon \colon U_q(\mathfrak{g}) \to \QQ(q)\) is defined by

    \[\varepsilon(E_i) = \varepsilon(F_i) = 0, \qquad \varepsilon(K_i) = 1.\]

    EXAMPLES:

    Sage

        sage: Q = QuantumGroup(['B',2])
        sage: x = Q.an_element()^2
        sage: Q.counit(x)
        4
        sage: Q.counit(Q.one())
        1
        sage: Q.counit(Q.zero())
        0

    Python

        >>> from sage.all import *
        >>> Q = QuantumGroup(['B',Integer(2)])
        >>> x = Q.an_element()**Integer(2)
        >>> Q.counit(x)
        4
        >>> Q.counit(Q.one())
        1
        >>> Q.counit(Q.zero())
        0

  gap()

    Return the gap representation of `self`.

    EXAMPLES:

    Sage

        sage: Q = QuantumGroup(['A',2])
        sage: Q.gap()
        QuantumUEA( <root system of type A2>, Qpar = q )

    Python

        >>> from sage.all import *
        >>> Q = QuantumGroup(['A',Integer(2)])
        >>> Q.gap()
        QuantumUEA( <root system of type A2>, Qpar = q )

  gens()

    Return the generators of `self`.

    EXAMPLES:

    Sage

        sage: Q = QuantumGroup(['A',2])
        sage: Q.gens()
        (F[a1], F[a1+a2], F[a2],
         K1, (-q + q^-1)*[ K1 ; 1 ] + K1,
         K2, (-q + q^-1)*[ K2 ; 1 ] + K2,
         E[a1], E[a1+a2], E[a2])

    Python

        >>> from sage.all import *
        >>> Q = QuantumGroup(['A',Integer(2)])
        >>> Q.gens()
        (F[a1], F[a1+a2], F[a2],
         K1, (-q + q^-1)*[ K1 ; 1 ] + K1,
         K2, (-q + q^-1)*[ K2 ; 1 ] + K2,
         E[a1], E[a1+a2], E[a2])

  highest_weight_module(weight)

    Return the highest weight module of weight `weight` of `self`.

    EXAMPLES:

    Sage

        sage: Q = QuantumGroup(['A',2])
        sage: Q.highest_weight_module([1,3])
        Highest weight module of weight Lambda[1] + 3*Lambda[2] of
         Quantum Group of type ['A', 2] with q=q

    Python

        >>> from sage.all import *
        >>> Q = QuantumGroup(['A',Integer(2)])
        >>> Q.highest_weight_module([Integer(1),Integer(3)])
        Highest weight module of weight Lambda[1] + 3*Lambda[2] of
         Quantum Group of type ['A', 2] with q=q

  lower_half()

    Return the lower half of the quantum group `self`.

    EXAMPLES:

    Sage

        sage: Q = QuantumGroup(['A',2])
        sage: Q.lower_half()
        Lower Half of Quantum Group of type ['A', 2] with q=q

    Python

        >>> from sage.all import *
        >>> Q = QuantumGroup(['A',Integer(2)])
        >>> Q.lower_half()
        Lower Half of Quantum Group of type ['A', 2] with q=q

  one()

    Return the multiplicative identity of `self`.

    EXAMPLES:

    Sage

        sage: Q = QuantumGroup(['A',2])
        sage: Q.one()
        1

    Python

        >>> from sage.all import *
        >>> Q = QuantumGroup(['A',Integer(2)])
        >>> Q.one()
        1

  q()

    Return the parameter \(q\).

    EXAMPLES:

    Sage

        sage: Q = QuantumGroup(['A',3])
        sage: Q.q()
        q
        sage: zeta3 = CyclotomicField(3).gen()
        sage: Q = QuantumGroup(['B',2], q=zeta3)
        sage: Q.q()
        zeta3

    Python

        >>> from sage.all import *
        >>> Q = QuantumGroup(['A',Integer(3)])
        >>> Q.q()
        q
        >>> zeta3 = CyclotomicField(Integer(3)).gen()
        >>> Q = QuantumGroup(['B',Integer(2)], q=zeta3)
        >>> Q.q()
        zeta3

  some_elements()

    Return some elements of `self`.

    EXAMPLES:

    Sage

        sage: Q = QuantumGroup(['A',1])
        sage: Q.some_elements()
        [1 + (q)*F[a1] + E[a1] + (q^2-1-q^-2 + q^-4)*[ K1 ; 2 ]
          + K1 + (-q^-1 + q^-3)*K1[ K1 ; 1 ],
         K1, F[a1], E[a1]]

    Python

        >>> from sage.all import *
        >>> Q = QuantumGroup(['A',Integer(1)])
        >>> Q.some_elements()
        [1 + (q)*F[a1] + E[a1] + (q^2-1-q^-2 + q^-4)*[ K1 ; 2 ]
          + K1 + (-q^-1 + q^-3)*K1[ K1 ; 1 ],
         K1, F[a1], E[a1]]

  zero()

    Return the multiplicative identity of `self`.

    EXAMPLES:

    Sage

        sage: Q = QuantumGroup(['A',2])
        sage: Q.zero()
        0

    Python

        >>> from sage.all import *
        >>> Q = QuantumGroup(['A',Integer(2)])
        >>> Q.zero()
        0

class sage.algebras.quantum_groups.quantum_group_gap.QuantumGroupHomset(X, Y, category=None, check=True, base=None)

  Bases: `HomsetWithBase`

  The homset whose domain is a quantum group.

class sage.algebras.quantum_groups.quantum_group_gap.QuantumGroupModule(Q, category)

  Bases: `Parent`, `UniqueRepresentation`

  Abstract base class for quantum group representations.

  R_matrix()

    Return the \(R\)-matrix of `self`.

    EXAMPLES:

    Sage

        sage: Q = QuantumGroup(['A',1])
        sage: V = Q.highest_weight_module([1])
        sage: V.R_matrix()
        [       1        0        0        0]
        [       0        q -q^2 + 1        0]
        [       0        0        q        0]
        [       0        0        0        1]

    Python

        >>> from sage.all import *
        >>> Q = QuantumGroup(['A',Integer(1)])
        >>> V = Q.highest_weight_module([Integer(1)])
        >>> V.R_matrix()
        [       1        0        0        0]
        [       0        q -q^2 + 1        0]
        [       0        0        q        0]
        [       0        0        0        1]

  basis()

    Return a basis of `self`.

    EXAMPLES:

    Sage

        sage: Q = QuantumGroup(['A',2])
        sage: V = Q.highest_weight_module([1,1])
        sage: V.basis()
        Family (1*v0, F[a1]*v0, F[a2]*v0, F[a1]*F[a2]*v0, F[a1+a2]*v0,
                F[a1]*F[a1+a2]*v0, F[a1+a2]*F[a2]*v0, F[a1+a2]^(2)*v0)

    Python

        >>> from sage.all import *
        >>> Q = QuantumGroup(['A',Integer(2)])
        >>> V = Q.highest_weight_module([Integer(1),Integer(1)])
        >>> V.basis()
        Family (1*v0, F[a1]*v0, F[a2]*v0, F[a1]*F[a2]*v0, F[a1+a2]*v0,
                F[a1]*F[a1+a2]*v0, F[a1+a2]*F[a2]*v0, F[a1+a2]^(2)*v0)

  crystal_basis()

    Return the crystal basis of `self`.

    EXAMPLES:

    Sage

        sage: Q = QuantumGroup(['A',2])
        sage: V = Q.highest_weight_module([1,1])
        sage: V.crystal_basis()
        Family (1*v0, F[a1]*v0, F[a2]*v0, F[a1]*F[a2]*v0,
                (q)*F[a1]*F[a2]*v0 + F[a1+a2]*v0, F[a1+a2]*F[a2]*v0,
                (-q^-2)*F[a1]*F[a1+a2]*v0, (-q^-1)*F[a1+a2]^(2)*v0)

    Python

        >>> from sage.all import *
        >>> Q = QuantumGroup(['A',Integer(2)])
        >>> V = Q.highest_weight_module([Integer(1),Integer(1)])
        >>> V.crystal_basis()
        Family (1*v0, F[a1]*v0, F[a2]*v0, F[a1]*F[a2]*v0,
                (q)*F[a1]*F[a2]*v0 + F[a1+a2]*v0, F[a1+a2]*F[a2]*v0,
                (-q^-2)*F[a1]*F[a1+a2]*v0, (-q^-1)*F[a1+a2]^(2)*v0)

  crystal_graph()

    Return the crystal graph of `self`.

    EXAMPLES:

    Sage

        sage: Q = QuantumGroup(['A',2])
        sage: V = Q.highest_weight_module([1,1])
        sage: G = V.crystal_graph(); G
        Digraph on 8 vertices

        sage: B = crystals.Tableaux(['A',2], shape=[2,1])
        sage: G.is_isomorphic(B.digraph(), edge_labels=True)
        True

    Python

        >>> from sage.all import *
        >>> Q = QuantumGroup(['A',Integer(2)])
        >>> V = Q.highest_weight_module([Integer(1),Integer(1)])
        >>> G = V.crystal_graph(); G
        Digraph on 8 vertices

        >>> B = crystals.Tableaux(['A',Integer(2)], shape=[Integer(2),Integer(1)])
        >>> G.is_isomorphic(B.digraph(), edge_labels=True)
        True

  gap()

    Return the gap representation of `self`.

    EXAMPLES:

    Sage

        sage: Q = QuantumGroup(['A',2])
        sage: V = Q.highest_weight_module([1,1])
        sage: V.gap()
        <8-dimensional left-module over QuantumUEA( <root system of type A2>,
         Qpar = q )>

    Python

        >>> from sage.all import *
        >>> Q = QuantumGroup(['A',Integer(2)])
        >>> V = Q.highest_weight_module([Integer(1),Integer(1)])
        >>> V.gap()
        <8-dimensional left-module over QuantumUEA( <root system of type A2>,
         Qpar = q )>

  zero()

    Return the zero element of `self`.

    EXAMPLES:

    Sage

        sage: Q = QuantumGroup(['A',2])
        sage: V = Q.highest_weight_module([1,1])
        sage: V.zero()
        0*v0

    Python

        >>> from sage.all import *
        >>> Q = QuantumGroup(['A',Integer(2)])
        >>> V = Q.highest_weight_module([Integer(1),Integer(1)])
        >>> V.zero()
        0*v0

class sage.algebras.quantum_groups.quantum_group_gap.QuantumGroupMorphism(parent, im_gens, check=True)

  Bases: `Morphism`

  A morphism whose domain is a quantum group.

  im_gens()

    Return the image of the generators under `self`.

    EXAMPLES:

    Sage

        sage: Q = QuantumGroup(['A',1])
        sage: F, K, Ki, E = Q.gens()
        sage: phi = Q.hom([E, Ki, K, F])
        sage: phi.im_gens()
        (E[a1], (-q + q^-1)*[ K1 ; 1 ] + K1, K1, F[a1])

    Python

        >>> from sage.all import *
        >>> Q = QuantumGroup(['A',Integer(1)])
        >>> F, K, Ki, E = Q.gens()
        >>> phi = Q.hom([E, Ki, K, F])
        >>> phi.im_gens()
        (E[a1], (-q + q^-1)*[ K1 ; 1 ] + K1, K1, F[a1])

class sage.algebras.quantum_groups.quantum_group_gap.TensorProductOfHighestWeightModules(*modules, **options)

  Bases: `QuantumGroupModule`

  Initialize `self`.

  EXAMPLES:

  Sage

      sage: Q = QuantumGroup(['A',2])
      sage: V = Q.highest_weight_module([1,1])
      sage: T = tensor([V,V])
      sage: TestSuite(T).run()

  Python

      >>> from sage.all import *
      >>> Q = QuantumGroup(['A',Integer(2)])
      >>> V = Q.highest_weight_module([Integer(1),Integer(1)])
      >>> T = tensor([V,V])
      >>> TestSuite(T).run()

  Element

    alias of `QuaGroupRepresentationElement`

  highest_weight_decomposition()

    Return the highest weight decomposition of `self`.

    EXAMPLES:

    Sage

        sage: Q = QuantumGroup(['A',2])
        sage: V = Q.highest_weight_module([1,0])
        sage: T = tensor([V,V])
        sage: T.highest_weight_decomposition()
        [Highest weight submodule with weight 2*Lambda[1] generated by 1*(1*v0<x>1*v0),
         Highest weight submodule with weight Lambda[2] generated by -q^-1*(1*v0<x>F[a1]*v0) + 1*(F[a1]*v0<x>1*v0)]

    Python

        >>> from sage.all import *
        >>> Q = QuantumGroup(['A',Integer(2)])
        >>> V = Q.highest_weight_module([Integer(1),Integer(0)])
        >>> T = tensor([V,V])
        >>> T.highest_weight_decomposition()
        [Highest weight submodule with weight 2*Lambda[1] generated by 1*(1*v0<x>1*v0),
         Highest weight submodule with weight Lambda[2] generated by -q^-1*(1*v0<x>F[a1]*v0) + 1*(F[a1]*v0<x>1*v0)]

  highest_weight_vectors()

    Return the highest weight vectors of `self`.

    EXAMPLES:

    Sage

        sage: Q = QuantumGroup(['A',2])
        sage: V = Q.highest_weight_module([1,0])
        sage: T = tensor([V,V])
        sage: T.highest_weight_vectors()
        [1*(1*v0<x>1*v0), -q^-1*(1*v0<x>F[a1]*v0) + 1*(F[a1]*v0<x>1*v0)]

    Python

        >>> from sage.all import *
        >>> Q = QuantumGroup(['A',Integer(2)])
        >>> V = Q.highest_weight_module([Integer(1),Integer(0)])
        >>> T = tensor([V,V])
        >>> T.highest_weight_vectors()
        [1*(1*v0<x>1*v0), -q^-1*(1*v0<x>F[a1]*v0) + 1*(F[a1]*v0<x>1*v0)]

  some_elements()

    alias of `highest_weight_vectors()`.

  tensor_factors()

    Return the factors of `self`.

    EXAMPLES:

    Sage

        sage: Q = QuantumGroup(['A',2])
        sage: V = Q.highest_weight_module([1,0])
        sage: T = tensor([V,V])
        sage: T.tensor_factors()
        (Highest weight module of weight Lambda[1] of Quantum Group of type ['A', 2] with q=q,
         Highest weight module of weight Lambda[1] of Quantum Group of type ['A', 2] with q=q)

    Python

        >>> from sage.all import *
        >>> Q = QuantumGroup(['A',Integer(2)])
        >>> V = Q.highest_weight_module([Integer(1),Integer(0)])
        >>> T = tensor([V,V])
        >>> T.tensor_factors()
        (Highest weight module of weight Lambda[1] of Quantum Group of type ['A', 2] with q=q,
         Highest weight module of weight Lambda[1] of Quantum Group of type ['A', 2] with q=q)

sage.algebras.quantum_groups.quantum_group_gap.projection_lower_half(Q)

  Return the projection onto the lower half of the quantum group.

  EXAMPLES:

  Sage

      sage: from sage.algebras.quantum_groups.quantum_group_gap import projection_lower_half
      sage: Q = QuantumGroup(['G',2])
      sage: phi = projection_lower_half(Q); phi
      Quantum group homomorphism endomorphism of Quantum Group of type ['G', 2] with q=q
        Defn: F[a1] |--> F[a1]
              F[a2] |--> F[a2]
              K1 |--> 0
              K2 |--> 0
              (-q + q^-1)*[ K1 ; 1 ] + K1 |--> 0
              (-q^3 + q^-3)*[ K2 ; 1 ] + K2 |--> 0
              E[a1] |--> 0
              E[a2] |--> 0
      sage: all(phi(f) == f for f in Q.F())
      True
      sage: all(phi(e) == Q.zero() for e in Q.E())
      True
      sage: all(phi(K) == Q.zero() for K in Q.K())
      True

  Python

      >>> from sage.all import *
      >>> from sage.algebras.quantum_groups.quantum_group_gap import projection_lower_half
      >>> Q = QuantumGroup(['G',Integer(2)])
      >>> phi = projection_lower_half(Q); phi
      Quantum group homomorphism endomorphism of Quantum Group of type ['G', 2] with q=q
        Defn: F[a1] |--> F[a1]
              F[a2] |--> F[a2]
              K1 |--> 0
              K2 |--> 0
              (-q + q^-1)*[ K1 ; 1 ] + K1 |--> 0
              (-q^3 + q^-3)*[ K2 ; 1 ] + K2 |--> 0
              E[a1] |--> 0
              E[a2] |--> 0
      >>> all(phi(f) == f for f in Q.F())
      True
      >>> all(phi(e) == Q.zero() for e in Q.E())
      True
      >>> all(phi(K) == Q.zero() for K in Q.K())
      True