Skip to content

U_q(sl_2) facade

quantum_group_sl2

quantum_group_sl2.py

QuantumGroupSL2: the package's high-level facade.

This class wraps U_q(sl_2) in one object, bringing together its generators, relations and representation-building methods.

QuantumGroupSL2

Facade class representing the quantum group U_q(sl_2).

Parameters:

Name Type Description Default
q sympy expression, defaults to the module symbol `q`

Deformation parameter. May be numerical (e.g. sp.Rational(2,1)) or symbolic.

q
Example

Uq = QuantumGroupSL2() print(Uq) U_q(sl_2) quantum group (q symbolic) rep = Uq.representation(2) Uq.verify(rep)['R4'].holds True

Source code in quantum_group/quantum_group_sl2.py
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
class QuantumGroupSL2:
    """Facade class representing the quantum group U_q(sl_2).

    Parameters
    ----------
    q : sympy expression, defaults to the module symbol `q`
        Deformation parameter. May be numerical (e.g. sp.Rational(2,1))
        or symbolic.

    Example
    -------
    >>> Uq = QuantumGroupSL2()
    >>> print(Uq)
    U_q(sl_2) quantum group (q symbolic)
    >>> rep = Uq.representation(2)
    >>> Uq.verify(rep)['R4'].holds
    True
    """

    def __init__(self, q: sp.Expr = default_q):
        self.q = sp.sympify(q)
        if self.q == 0:
            raise ValueError("q must be nonzero.")
        self.E = gens.E
        self.F = gens.F
        self.K = gens.K
        self.K_inv = gens.K_inv

    # ------------------------------------------------------------------
    # Generator and relation access
    # ------------------------------------------------------------------

    def generators(self) -> dict:
        """Return the generators as a name-to-symbol dictionary."""
        return {"E": self.E, "F": self.F, "K": self.K, "K_inv": self.K_inv,
                "q": self.q}

    def relations(self):
        """Return the symbolic defining relations."""
        return rels.symbolic_relations()

    def print_relations(self) -> None:
        """Print the relations in a readable form."""
        print(rels.pretty_print_relations())

    # ------------------------------------------------------------------
    # Representation construction and verification
    # ------------------------------------------------------------------

    def representation(self, n: int) -> reps.Representation:
        """Return the irreducible representation V_n (dimension n + 1)."""
        return reps.build_representation(n, q_sym=self.q)

    def verify(
        self,
        rep: reps.Representation | None = None,
        n: int | None = None,
    ) -> dict[str, rels.RelationCheck]:
        """Check the four relations on a representation.

        If `rep` is omitted and `n` is supplied, construct and check V_n.
        """
        if rep is None:
            if n is None:
                raise ValueError("Provide a representation or a value for n.")
            rep = self.representation(n)

        return rels.verify_on_representation(
            E_mat=rep.E,
            F_mat=rep.F,
            K_mat=rep.K,
            Kinv_mat=rep.K_inv,
            q_sym=self.q,
        )

    # ------------------------------------------------------------------
    # Readable representation
    # ------------------------------------------------------------------

    def __repr__(self) -> str:  # pragma: no cover
        q_desc = "symbolic" if self.q.free_symbols else f"={self.q}"
        return f"U_q(sl_2) quantum group (q {q_desc})"

    def __str__(self) -> str:  # pragma: no cover
        return self.__repr__()

generators

generators() -> dict

Return the generators as a name-to-symbol dictionary.

Source code in quantum_group/quantum_group_sl2.py
53
54
55
56
def generators(self) -> dict:
    """Return the generators as a name-to-symbol dictionary."""
    return {"E": self.E, "F": self.F, "K": self.K, "K_inv": self.K_inv,
            "q": self.q}

relations

relations()

Return the symbolic defining relations.

Source code in quantum_group/quantum_group_sl2.py
58
59
60
def relations(self):
    """Return the symbolic defining relations."""
    return rels.symbolic_relations()

print_relations

print_relations() -> None

Print the relations in a readable form.

Source code in quantum_group/quantum_group_sl2.py
62
63
64
def print_relations(self) -> None:
    """Print the relations in a readable form."""
    print(rels.pretty_print_relations())

representation

representation(n: int) -> reps.Representation

Return the irreducible representation V_n (dimension n + 1).

Source code in quantum_group/quantum_group_sl2.py
70
71
72
def representation(self, n: int) -> reps.Representation:
    """Return the irreducible representation V_n (dimension n + 1)."""
    return reps.build_representation(n, q_sym=self.q)

verify

verify(rep: Representation | None = None, n: int | None = None) -> dict[str, rels.RelationCheck]

Check the four relations on a representation.

If rep is omitted and n is supplied, construct and check V_n.

Source code in quantum_group/quantum_group_sl2.py
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
def verify(
    self,
    rep: reps.Representation | None = None,
    n: int | None = None,
) -> dict[str, rels.RelationCheck]:
    """Check the four relations on a representation.

    If `rep` is omitted and `n` is supplied, construct and check V_n.
    """
    if rep is None:
        if n is None:
            raise ValueError("Provide a representation or a value for n.")
        rep = self.representation(n)

    return rels.verify_on_representation(
        E_mat=rep.E,
        F_mat=rep.F,
        K_mat=rep.K,
        Kinv_mat=rep.K_inv,
        q_sym=self.q,
    )