| 1 | """ |
| 2 | Iwahori Hecke Algebras |
| 3 | """ |
| 4 | #***************************************************************************** |
| 5 | # Copyright (C) 2008 Daniel Bump <bump at match.stanford.edu> |
| 6 | # |
| 7 | # Distributed under the terms of the GNU General Public License (GPL) |
| 8 | # http://www.gnu.org/licenses/ |
| 9 | #***************************************************************************** |
| 10 | from sage.categories.all import AlgebrasWithBasis, FiniteDimensionalAlgebrasWithBasis, CoxeterGroups |
| 11 | import sage.combinat.root_system.cartan_type |
| 12 | from sage.combinat.root_system.cartan_type import CartanType |
| 13 | from sage.combinat.root_system.weyl_group import WeylGroup |
| 14 | from sage.structure.element import is_Element |
| 15 | from sage.rings.all import ZZ |
| 16 | from sage.misc.misc import repr_lincomb |
| 17 | from sage.algebras.algebra_element import AlgebraElement |
| 18 | from sage.combinat.family import Family |
| 19 | import sage.rings.polynomial.laurent_polynomial |
| 20 | from sage.combinat.free_module import CombinatorialFreeModule, CombinatorialFreeModuleElement |
| 21 | from sage.misc.cachefunc import cached_method |
| 22 | |
| 23 | class IwahoriHeckeAlgebraT(CombinatorialFreeModule): |
| 24 | r""" |
| 25 | INPUT: |
| 26 | |
| 27 | - ``W`` -- A CoxeterGroup or CartanType |
| 28 | - ``q1`` -- a parameter. |
| 29 | |
| 30 | OPTIONAL ARGUMENTS: |
| 31 | |
| 32 | - ``q2`` -- another parameter (default -1) |
| 33 | - ``base_ring`` -- A ring containing q1 and q2 (default q1.parent()) |
| 34 | - ``prefix`` -- a label for the generators (default "T") |
| 35 | |
| 36 | The Iwahori Hecke algebra is defined in: |
| 37 | |
| 38 | Nagayoshi Iwahori, On the structure of a Hecke ring of a Chevalley group |
| 39 | over a finite field. J. Fac. Sci. Univ. Tokyo Sect. I 10 1964 215--236 |
| 40 | (1964). |
| 41 | |
| 42 | The Iwahori Hecke algebra is a deformation of the group algebra of |
| 43 | the Weyl/Coxeter group. Taking the deformation parameter `q=1` as in the |
| 44 | following example gives a ring isomorphic to that group |
| 45 | algebra. The parameter `q` is a deformation parameter. |
| 46 | |
| 47 | EXAMPLES:: |
| 48 | |
| 49 | sage: H = IwahoriHeckeAlgebraT("A3",1,prefix = "s") |
| 50 | sage: [s1,s2,s3] = H.algebra_generators() |
| 51 | sage: s1*s2*s3*s1*s2*s1 == s3*s2*s1*s3*s2*s3 |
| 52 | True |
| 53 | sage: w0 = H(H.coxeter_group().long_element()) |
| 54 | sage: w0 |
| 55 | s1*s2*s3*s1*s2*s1 |
| 56 | sage: H.an_element() |
| 57 | 3*s1*s2 + 3*s1 + 1 |
| 58 | |
| 59 | Iwahori Hecke algebras have proved to be fundamental. See for example: |
| 60 | |
| 61 | Kazhdan and Lusztig, Representations of Coxeter groups and Hecke algebras. |
| 62 | Invent. Math. 53 (1979), no. 2, 165--184. |
| 63 | |
| 64 | Iwahori-Hecke Algebras: Thomas J. Haines, Robert E. Kottwitz, |
| 65 | Amritanshu Prasad, http://front.math.ucdavis.edu/0309.5168 |
| 66 | |
| 67 | V. Jones, Hecke algebra representations of braid groups and link |
| 68 | polynomials. Ann. of Math. (2) 126 (1987), no. 2, 335--388. |
| 69 | |
| 70 | For every simple reflection `s_i` of the Coxeter group, there is a |
| 71 | corresponding generator `T_i` of the Iwahori Hecke algebra. These |
| 72 | are subject to the relations |
| 73 | |
| 74 | `(T_i-q_1)*(T_i-q_2) == 0` |
| 75 | |
| 76 | together with the braid relations `T_i T_j T_i ... == T_j T_i T_j ...`, |
| 77 | where the number of terms on both sides is `k/2` with `k` the order of |
| 78 | `s_i s_j` in the Coxeter group. |
| 79 | |
| 80 | Weyl group elements form a basis of the Iwahori Hecke algebra `H` |
| 81 | with the property that if `w1` and `w2` are Coxeter group elements |
| 82 | such that ``(w1*w2).length() == w1.length() + w2.length()`` then |
| 83 | ``H(w1*w2) == H(w1)*H(w2)``. |
| 84 | |
| 85 | With the default value `q_2 = -1` and with `q_1 = q` the |
| 86 | generating relation may be written `T_i^2 = (q-1)*T_i + q*1` as in |
| 87 | Iwahori's paper. |
| 88 | |
| 89 | EXAMPLES:: |
| 90 | |
| 91 | sage: R.<q>=PolynomialRing(ZZ) |
| 92 | sage: H=IwahoriHeckeAlgebraT("B3",q); H |
| 93 | The Iwahori Hecke Algebra of Type B3 in q,-1 over Univariate Polynomial Ring in q over Integer Ring and prefix T |
| 94 | sage: T1,T2,T3 = H.algebra_generators() |
| 95 | sage: T1*T1 |
| 96 | (q-1)*T1 + q |
| 97 | |
| 98 | It is useful to define ``T1,T2,T3 = H.algebra_generators()`` as above |
| 99 | so that H can parse its own output:: |
| 100 | |
| 101 | sage: H(T1) |
| 102 | T1 |
| 103 | |
| 104 | The Iwahori Hecke algebra associated with an affine Weyl group is |
| 105 | called an affine Hecke algebra. These may be implemented as follows:: |
| 106 | |
| 107 | sage: R.<q>=QQ[] |
| 108 | sage: H=IwahoriHeckeAlgebraT(['A',2,1],q) |
| 109 | sage: [T0,T1,T2]=H.algebra_generators() |
| 110 | sage: T1*T2*T1*T0*T1*T0 |
| 111 | (q-1)*T1*T2*T0*T1*T0 + q*T1*T2*T0*T1 |
| 112 | sage: T1*T2*T1*T0*T1*T1 |
| 113 | q*T1*T2*T1*T0 + (q-1)*T1*T2*T0*T1*T0 |
| 114 | sage: T1*T2*T1*T0*T1*T2 |
| 115 | T1*T2*T0*T1*T0*T2 |
| 116 | sage: (T1*T2*T0*T1*T0*T2).support_of_monomial() # get the underlying Weyl group element |
| 117 | [ 2 1 -2] |
| 118 | [ 3 1 -3] |
| 119 | [ 2 2 -3] |
| 120 | |
| 121 | sage: R = IwahoriHeckeAlgebraT("A3",0,0,prefix = "s") |
| 122 | sage: [s1,s2,s3] = R.algebra_generators() |
| 123 | sage: s1*s1 |
| 124 | 0 |
| 125 | |
| 126 | TESTS:: |
| 127 | |
| 128 | sage: H1 = IwahoriHeckeAlgebraT("A2",1) |
| 129 | sage: H2 = IwahoriHeckeAlgebraT("A2",1) |
| 130 | sage: H3 = IwahoriHeckeAlgebraT("A2",-1) |
| 131 | sage: H1 == H1, H1 == H2, H1 is H2 |
| 132 | (True, True, True) |
| 133 | sage: H1 == H3 |
| 134 | False |
| 135 | |
| 136 | sage: R.<q>=PolynomialRing(QQ) |
| 137 | sage: IwahoriHeckeAlgebraT("A3",q).base_ring() == R |
| 138 | True |
| 139 | |
| 140 | sage: R.<q>=QQ[]; H=IwahoriHeckeAlgebraT("A2",q) |
| 141 | sage: 1+H(q) |
| 142 | (q+1) |
| 143 | |
| 144 | sage: R.<q>=QQ[] |
| 145 | sage: H = IwahoriHeckeAlgebraT("A2",q) |
| 146 | sage: T1,T2 = H.algebra_generators() |
| 147 | sage: H(T1+2*T2) |
| 148 | T1 + 2*T2 |
| 149 | |
| 150 | .. rubric:: Design discussion |
| 151 | |
| 152 | This is a preliminary implementation. For work in progress, see: |
| 153 | http://wiki.sagemath.org/HeckeAlgebras. |
| 154 | |
| 155 | - Should we use q in QQ['q'] as default parameter for q_1? |
| 156 | |
| 157 | """ |
| 158 | |
| 159 | @staticmethod |
| 160 | def __classcall__(cls, W, q1, q2=-1, base_ring=None, prefix="T"): |
| 161 | """ |
| 162 | TESTS:: |
| 163 | |
| 164 | sage: H = IwahoriHeckeAlgebraT("A2", 1) |
| 165 | sage: H.coxeter_group() == WeylGroup("A2") |
| 166 | True |
| 167 | sage: H.cartan_type() == CartanType("A2") |
| 168 | True |
| 169 | sage: H.base_ring() == ZZ |
| 170 | True |
| 171 | sage: H._q2 == -1 |
| 172 | True |
| 173 | """ |
| 174 | if W not in CoxeterGroups(): |
| 175 | W = WeylGroup(W) |
| 176 | if base_ring is None: |
| 177 | base_ring = q1.parent() |
| 178 | q2 = base_ring(q2) |
| 179 | return super(IwahoriHeckeAlgebraT, cls).__classcall__(cls, W, q1=q1, q2=q2, base_ring=base_ring, prefix=prefix) |
| 180 | |
| 181 | def __init__(self, W, q1, q2, base_ring, prefix): |
| 182 | """ |
| 183 | EXAMPLES :: |
| 184 | |
| 185 | sage: R.<q1,q2>=QQ[] |
| 186 | sage: H = IwahoriHeckeAlgebraT("A2",q1,q2,base_ring=Frac(R),prefix="t"); H |
| 187 | The Iwahori Hecke Algebra of Type A2 in q1,q2 over Fraction Field of Multivariate Polynomial Ring in q1, q2 over Rational Field and prefix t |
| 188 | sage: TestSuite(H).run() |
| 189 | |
| 190 | """ |
| 191 | self._cartan_type = W.cartan_type() |
| 192 | self._prefix = prefix |
| 193 | self._index_set = W.index_set() |
| 194 | self._q1 = base_ring(q1) |
| 195 | self._q2 = base_ring(q2) |
| 196 | |
| 197 | if W.is_finite(): |
| 198 | category = FiniteDimensionalAlgebrasWithBasis(base_ring) |
| 199 | else: |
| 200 | category = AlgebrasWithBasis(base_ring) |
| 201 | CombinatorialFreeModule.__init__(self, base_ring, W, category = category) |
| 202 | |
| 203 | def _element_constructor_(self, w): |
| 204 | """ |
| 205 | Construct a basis element from an element of the Weyl group |
| 206 | |
| 207 | EXAMPLES :: |
| 208 | |
| 209 | sage: R.<q>=QQ[] |
| 210 | sage: H = IwahoriHeckeAlgebraT("A2",q) |
| 211 | sage: [H(x) for x in H.coxeter_group()] # indirect doctest |
| 212 | [1, T1, T1*T2, T1*T2*T1, T2, T2*T1] |
| 213 | |
| 214 | """ |
| 215 | assert w in self.basis().keys() |
| 216 | return self.term(w) |
| 217 | |
| 218 | @cached_method |
| 219 | def one_basis(self): |
| 220 | """ |
| 221 | Returns the unit of the underlying coxeter group, which index |
| 222 | the one of this algebra, as per |
| 223 | :meth:`AlgebrasWithBasis.ParentMethods.one_basis`. |
| 224 | |
| 225 | EXAMPLES:: |
| 226 | |
| 227 | sage: H = IwahoriHeckeAlgebraT("B3", 1) |
| 228 | sage: H.one_basis() |
| 229 | [1 0 0] |
| 230 | [0 1 0] |
| 231 | [0 0 1] |
| 232 | sage: H.one_basis() == H.coxeter_group().one() |
| 233 | True |
| 234 | sage: H.one() |
| 235 | 1 |
| 236 | """ |
| 237 | return self.coxeter_group().one() |
| 238 | |
| 239 | def _repr_(self): |
| 240 | """ |
| 241 | EXAMPLES :: |
| 242 | |
| 243 | sage: R.<q1,q2>=QQ[] |
| 244 | sage: IwahoriHeckeAlgebraT("A2",q1,-q2,base_ring=Frac(R),prefix="Z") # indirect doctest |
| 245 | The Iwahori Hecke Algebra of Type A2 in q1,-q2 over Fraction Field of Multivariate Polynomial Ring in q1, q2 over Rational Field and prefix Z |
| 246 | |
| 247 | """ |
| 248 | return "The Iwahori Hecke Algebra of Type %s in %s,%s over %s and prefix %s"%(self._cartan_type._repr_(compact=True), self._q1, self._q2, self.base_ring(), self._prefix) |
| 249 | |
| 250 | def cartan_type(self): |
| 251 | """ |
| 252 | EXAMPLES :: |
| 253 | |
| 254 | sage: IwahoriHeckeAlgebraT("D4",0).cartan_type() |
| 255 | ['D', 4] |
| 256 | |
| 257 | """ |
| 258 | return self._cartan_type |
| 259 | |
| 260 | def coxeter_group(self): |
| 261 | """ |
| 262 | EXAMPLES:: |
| 263 | |
| 264 | sage: IwahoriHeckeAlgebraT("B2",1).coxeter_group() |
| 265 | Weyl Group of type ['B', 2] (as a matrix group acting on the ambient space) |
| 266 | |
| 267 | """ |
| 268 | return self.basis().keys() |
| 269 | |
| 270 | def index_set(self): |
| 271 | """ |
| 272 | EXAMPLES:: |
| 273 | |
| 274 | sage: IwahoriHeckeAlgebraT("B2",1).index_set() |
| 275 | [1, 2] |
| 276 | """ |
| 277 | return self._index_set |
| 278 | |
| 279 | @cached_method |
| 280 | def algebra_generators(self): |
| 281 | """ |
| 282 | Returns the generators. They do not have order two but satisfy |
| 283 | a quadratic relation. They coincide with the simple |
| 284 | reflections in the Coxeter group when `q_1=1` and `q_2=-1`. In |
| 285 | this special case, the Iwahori Hecke algebra is identified |
| 286 | with the group algebra of the Coxeter group. |
| 287 | |
| 288 | EXAMPLES :: |
| 289 | |
| 290 | sage: R.<q>=QQ[] |
| 291 | sage: H = IwahoriHeckeAlgebraT("A3",q) |
| 292 | sage: T=H.algebra_generators(); T |
| 293 | Finite family {1: T1, 2: T2, 3: T3} |
| 294 | sage: T.list() |
| 295 | [T1, T2, T3] |
| 296 | sage: [T[i] for i in [1,2,3]] |
| 297 | [T1, T2, T3] |
| 298 | sage: [T1, T2, T3] = H.algebra_generators() |
| 299 | sage: T1 |
| 300 | T1 |
| 301 | sage: H = IwahoriHeckeAlgebraT(['A',2,1],q) |
| 302 | sage: T=H.algebra_generators(); T |
| 303 | Finite family {0: T0, 1: T1, 2: T2} |
| 304 | sage: T.list() |
| 305 | [T0, T1, T2] |
| 306 | sage: [T[i] for i in [0,1,2]] |
| 307 | [T0, T1, T2] |
| 308 | sage: [T0, T1, T2] = H.algebra_generators() |
| 309 | sage: T0 |
| 310 | T0 |
| 311 | """ |
| 312 | return self.coxeter_group().simple_reflections().map(self.term) |
| 313 | |
| 314 | def algebra_generator(self, i): |
| 315 | """ |
| 316 | EXAMPLES :: |
| 317 | |
| 318 | sage: R.<q>=QQ[] |
| 319 | sage: H = IwahoriHeckeAlgebraT("A3",q) |
| 320 | sage: [H.algebra_generator(i) for i in H.index_set()] |
| 321 | [T1, T2, T3] |
| 322 | |
| 323 | """ |
| 324 | return self.algebra_generators()[i] |
| 325 | |
| 326 | def inverse_generator(self, i): |
| 327 | """ |
| 328 | This method is only available if q1 and q2 are invertible. In |
| 329 | that case, the algebra generators are also invertible and this |
| 330 | method returns the inverse of self.algebra_generator(i). The |
| 331 | base ring should be either a field or a Laurent polynomial ring. |
| 332 | |
| 333 | EXAMPLES:: |
| 334 | |
| 335 | sage: P.<q1,q2>=QQ[] |
| 336 | sage: F=Frac(P) |
| 337 | sage: H = IwahoriHeckeAlgebraT("A2",q1,q2,base_ring=F) |
| 338 | sage: H.base_ring() |
| 339 | Fraction Field of Multivariate Polynomial Ring in q1, q2 over Rational Field |
| 340 | sage: H.inverse_generator(1) |
| 341 | ((-1)/(q1*q2))*T1 + ((q1+q2)/(q1*q2)) |
| 342 | sage: H = IwahoriHeckeAlgebraT("A2",q1,-1,base_ring=F) |
| 343 | sage: H.inverse_generator(2) |
| 344 | ((-1)/(-q1))*T2 + ((q1-1)/(-q1)) |
| 345 | sage: P1.<r1,r2>=LaurentPolynomialRing(QQ) |
| 346 | sage: H1 = IwahoriHeckeAlgebraT("B2",r1,r2,base_ring=P1) |
| 347 | sage: H1.base_ring() |
| 348 | Multivariate Laurent Polynomial Ring in r1, r2 over Rational Field |
| 349 | sage: H1.inverse_generator(2) |
| 350 | (-r1^-1*r2^-1)*T2 + (r2^-1+r1^-1) |
| 351 | sage: H2 = IwahoriHeckeAlgebraT("C2",r1,-1,base_ring=P1) |
| 352 | sage: H2.inverse_generator(2) |
| 353 | (r1^-1)*T2 + (-1+r1^-1) |
| 354 | |
| 355 | """ |
| 356 | try: |
| 357 | # This currently works better than ~(self._q1) if |
| 358 | # self.base_ring() is a Laurent polynomial ring since it |
| 359 | # avoids accidental coercion into a field of fractions. |
| 360 | i1 = self._q1.__pow__(-1) |
| 361 | i2 = self._q2.__pow__(-1) |
| 362 | except: |
| 363 | raise ValueError, "%s and %s must be invertible."%(self._q1, self._q2) |
| 364 | return (-i1*i2)*self.algebra_generator(i)+(i1+i2) |
| 365 | |
| 366 | @cached_method |
| 367 | def inverse_generators(self): |
| 368 | """ |
| 369 | This method is only available if q1 and q2 are invertible. In |
| 370 | that case, the algebra generators are also invertible and this |
| 371 | method returns their inverses. |
| 372 | |
| 373 | EXAMPLES :: |
| 374 | sage: P.<q> = PolynomialRing(QQ) |
| 375 | sage: F = Frac(P) |
| 376 | sage: H = IwahoriHeckeAlgebraT("A2",q,base_ring=F) |
| 377 | sage: [T1,T2]=H.algebra_generators() |
| 378 | sage: [U1,U2]=H.inverse_generators() |
| 379 | sage: U1*T1,T1*U1 |
| 380 | (1, 1) |
| 381 | sage: P1.<q> = LaurentPolynomialRing(QQ) |
| 382 | sage: H1 = IwahoriHeckeAlgebraT("A2",q,base_ring=P1,prefix="V") |
| 383 | sage: [V1,V2]=H1.algebra_generators() |
| 384 | sage: [W1,W2]=H1.inverse_generators() |
| 385 | sage: [W1,W2] |
| 386 | [(q^-1)*V1 + (-1+q^-1), (q^-1)*V2 + (-1+q^-1)] |
| 387 | sage: V1*W1, W2*V2 |
| 388 | (1, 1) |
| 389 | |
| 390 | """ |
| 391 | return Family(self.index_set(), self.inverse_generator) |
| 392 | |
| 393 | def product_on_basis(self, w1, w2): |
| 394 | """ |
| 395 | |
| 396 | Returns `T_w1 T_w2`, where `w_1` and `w_2` are in the Coxeter group |
| 397 | |
| 398 | EXAMPLES:: |
| 399 | |
| 400 | sage: R.<q>=QQ[]; H = IwahoriHeckeAlgebraT("A2",q) |
| 401 | sage: s1,s2 = H.coxeter_group().simple_reflections() |
| 402 | sage: [H.product_on_basis(s1,x) for x in [s1,s2]] |
| 403 | [(q-1)*T1 + q, T1*T2] |
| 404 | |
| 405 | """ |
| 406 | result = self.term(w1) |
| 407 | for i in w2.reduced_word(): |
| 408 | result = self.product_by_generator(result, i) |
| 409 | return result |
| 410 | |
| 411 | def product_by_generator_on_basis(self, w, i, side = "right"): |
| 412 | """ |
| 413 | INPUT: |
| 414 | - ``w`` - an element of the Coxeter group |
| 415 | - ``i`` - an element of the index set |
| 416 | - ``side`` - "left" or "right" (default: "right") |
| 417 | |
| 418 | Returns the product `T_w T_i` (resp. `T_i T_w`) if ``side`` is "right" (resp. "left") |
| 419 | |
| 420 | EXAMPLES:: |
| 421 | |
| 422 | sage: R.<q>=QQ[]; H = IwahoriHeckeAlgebraT("A2",q) |
| 423 | sage: s1,s2 = H.coxeter_group().simple_reflections() |
| 424 | sage: [H.product_by_generator_on_basis(w, 1) for w in [s1,s2,s1*s2]] |
| 425 | [(q-1)*T1 + q, T2*T1, T1*T2*T1] |
| 426 | sage: [H.product_by_generator_on_basis(w, 1, side = "left") for w in [s1,s2,s1*s2]] |
| 427 | [(q-1)*T1 + q, T1*T2, (q-1)*T1*T2 + q*T2] |
| 428 | """ |
| 429 | wi = w.apply_simple_reflection(i, side = side) |
| 430 | if w.has_descent(i, side = side): |
| 431 | return self.monomial(w , self._q1+self._q2) + \ |
| 432 | self.monomial(wi, -self._q1*self._q2) |
| 433 | else: |
| 434 | return self.term(wi) |
| 435 | |
| 436 | def product_by_generator(self, x, i, side = "right"): |
| 437 | """ |
| 438 | Returns T_i*x, where T_i is the i-th generator. This is coded |
| 439 | individually for use in x._mul_(). |
| 440 | |
| 441 | EXAMPLES :: |
| 442 | sage: R.<q>=QQ[]; H = IwahoriHeckeAlgebraT("A2",q) |
| 443 | sage: [T1,T2] = H.algebra_generators() |
| 444 | sage: [H.product_by_generator(x, 1, side = "left") for x in [T1,T2]] |
| 445 | [(q-1)*T1 + q, T2*T1] |
| 446 | |
| 447 | """ |
| 448 | return self.sum(self.product_by_generator_on_basis(w, i)._acted_upon_(c) for (w,c) in x) |
| 449 | |
| 450 | def _repr_term(self, t): |
| 451 | """ |
| 452 | EXAMPLES :: |
| 453 | |
| 454 | sage: R.<q>=QQ[] |
| 455 | sage: H = IwahoriHeckeAlgebraT("A3",q) |
| 456 | sage: W=H.coxeter_group() |
| 457 | sage: H._repr_term(W.from_reduced_word([1,2,3])) |
| 458 | 'T1*T2*T3' |
| 459 | |
| 460 | """ |
| 461 | redword = t.reduced_word() |
| 462 | if len(redword) == 0: |
| 463 | return "1" |
| 464 | else: |
| 465 | return "*".join("%s%d"%(self._prefix, i) for i in redword) |
| 466 | |
| 467 | class Element(CombinatorialFreeModuleElement): |
| 468 | """ |
| 469 | A class for elements of an IwahoriHeckeAlgebra |
| 470 | |
| 471 | TESTS:: |
| 472 | |
| 473 | sage: R.<q>=QQ[] |
| 474 | sage: H=IwahoriHeckeAlgebraT("B3",q) |
| 475 | sage: [T1, T2, T3] = H.algebra_generators() |
| 476 | sage: T1+2*T2*T3 |
| 477 | T1 + 2*T2*T3 |
| 478 | |
| 479 | sage: R.<q1,q2>=QQ[] |
| 480 | sage: H=IwahoriHeckeAlgebraT("A2",q1,q2,prefix="x") |
| 481 | sage: sum(H.algebra_generators())^2 |
| 482 | x1*x2 + x2*x1 + (q1+q2)*x1 + (q1+q2)*x2 + (-2*q1*q2) |
| 483 | |
| 484 | sage: H=IwahoriHeckeAlgebraT("A2",q1,q2,prefix="t") |
| 485 | sage: [t1,t2] = H.algebra_generators() |
| 486 | sage: (t1-t2)^3 |
| 487 | (q1^2-q1*q2+q2^2)*t1 + (-q1^2+q1*q2-q2^2)*t2 |
| 488 | |
| 489 | sage: R.<q>=QQ[] |
| 490 | sage: H=IwahoriHeckeAlgebraT("G2",q) |
| 491 | sage: [T1, T2] = H.algebra_generators() |
| 492 | sage: T1*T2*T1*T2*T1*T2 == T2*T1*T2*T1*T2*T1 |
| 493 | True |
| 494 | sage: T1*T2*T1 == T2*T1*T2 |
| 495 | False |
| 496 | |
| 497 | sage: H = IwahoriHeckeAlgebraT("A2",1) |
| 498 | sage: [T1,T2]=H.algebra_generators() |
| 499 | sage: T1+T2 |
| 500 | T1 + T2 |
| 501 | |
| 502 | sage: -(T1+T2) |
| 503 | -T1 - T2 |
| 504 | |
| 505 | sage: 1-T1 |
| 506 | -T1 + 1 |
| 507 | |
| 508 | sage: T1.parent() |
| 509 | The Iwahori Hecke Algebra of Type A2 in 1,-1 over Integer Ring and prefix T |
| 510 | """ |
| 511 | |
| 512 | def inverse(self): |
| 513 | """ |
| 514 | If the element is a basis element, that is, an element of the |
| 515 | form self(w) with w in the Weyl group, this method computes |
| 516 | its inverse. The base ring must be a field or Laurent |
| 517 | polynomial ring. Other elements of the ring have inverses but |
| 518 | the inverse method is only implemented for the basis elements. |
| 519 | |
| 520 | EXAMPLES:: |
| 521 | |
| 522 | sage: R.<q>=LaurentPolynomialRing(QQ) |
| 523 | sage: H = IwahoriHeckeAlgebraT("A2",q) |
| 524 | sage: [T1,T2]=H.algebra_generators() |
| 525 | sage: x = (T1*T2).inverse(); x |
| 526 | (q^-2)*T2*T1 + (-q^-1+q^-2)*T1 + (-q^-1+q^-2)*T2 + (1-2*q^-1+q^-2) |
| 527 | sage: x*T1*T2 |
| 528 | 1 |
| 529 | |
| 530 | """ |
| 531 | if len(self) != 1: |
| 532 | raise NotImplementedError, "inverse only implemented for basis elements (monomials in the generators)"%self |
| 533 | H = self.parent() |
| 534 | w = self.support_of_monomial() |
| 535 | |
| 536 | return H.prod(H.inverse_generator(i) for i in reversed(w.reduced_word())) |