This repository has been archived by the owner on Jan 30, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
reflection_group_complex.py
2271 lines (1878 loc) · 95.2 KB
/
reflection_group_complex.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
r"""
Finite complex reflection groups
----------------------------------
Let `V` be a finite-dimensional complex vector space. A reflection of
`V` is an operator `r \in \operatorname{GL}(V)` that has finite order
and fixes pointwise a hyperplane in `V`.
For more definitions and classification types of finite complex
reflection groups, see :wikipedia:`Complex_reflection_group`.
The point of entry to work with reflection groups is :func:`~sage.combinat.root_system.reflection_group_real.ReflectionGroup`
which can be used with finite Cartan-Killing types::
sage: ReflectionGroup(['A',2]) # optional - gap3
Irreducible real reflection group of rank 2 and type A2
sage: ReflectionGroup(['F',4]) # optional - gap3
Irreducible real reflection group of rank 4 and type F4
sage: ReflectionGroup(['H',3]) # optional - gap3
Irreducible real reflection group of rank 3 and type H3
or with Shephard-Todd types::
sage: ReflectionGroup((1,1,3)) # optional - gap3
Irreducible real reflection group of rank 2 and type A2
sage: ReflectionGroup((2,1,3)) # optional - gap3
Irreducible real reflection group of rank 3 and type B3
sage: ReflectionGroup((3,1,3)) # optional - gap3
Irreducible complex reflection group of rank 3 and type G(3,1,3)
sage: ReflectionGroup((4,2,3)) # optional - gap3
Irreducible complex reflection group of rank 3 and type G(4,2,3)
sage: ReflectionGroup(4) # optional - gap3
Irreducible complex reflection group of rank 2 and type ST4
sage: ReflectionGroup(31) # optional - gap3
Irreducible complex reflection group of rank 4 and type ST31
Also reducible types are allowed using concatenation::
sage: ReflectionGroup(['A',3],(4,2,3)) # optional - gap3
Reducible complex reflection group of rank 6 and type A3 x G(4,2,3)
Some special cases also occur, among them are::
sage: W = ReflectionGroup((2,2,2)); W # optional - gap3
Reducible real reflection group of rank 2 and type A1 x A1
sage: W = ReflectionGroup((2,2,3)); W # optional - gap3
Irreducible real reflection group of rank 3 and type A3
.. WARNING:: Uses the GAP3 package *Chevie* which is available as an
experimental package (installed by ``sage -i gap3``) or to
download by hand from `Jean Michel's website <http://webusers.imj-prg.fr/~jean.michel/gap3/>`_.
A guided tour
-------------
We start with the example type `B_2`::
sage: W = ReflectionGroup(['B',2]); W # optional - gap3
Irreducible real reflection group of rank 2 and type B2
Most importantly, observe that the group elements are usually represented
by permutations of the roots::
sage: for w in W: print(w) # optional - gap3
()
(1,3)(2,6)(5,7)
(1,5)(2,4)(6,8)
(1,7,5,3)(2,4,6,8)
(1,3,5,7)(2,8,6,4)
(2,8)(3,7)(4,6)
(1,7)(3,5)(4,8)
(1,5)(2,6)(3,7)(4,8)
This has the drawback that one can hardly see anything. Usually, one
would look at elements with either of the following methods::
sage: for w in W: w.reduced_word() # optional - gap3
[]
[2]
[1]
[1, 2]
[2, 1]
[2, 1, 2]
[1, 2, 1]
[1, 2, 1, 2]
sage: for w in W: w.reduced_word_in_reflections() # optional - gap3
[]
[2]
[1]
[1, 2]
[1, 4]
[3]
[4]
[1, 3]
sage: for w in W: w.reduced_word(); w.to_matrix(); print("") # optional - gap3
[]
[1 0]
[0 1]
<BLANKLINE>
[2]
[ 1 1]
[ 0 -1]
<BLANKLINE>
[1]
[-1 0]
[ 2 1]
<BLANKLINE>
[1, 2]
[-1 -1]
[ 2 1]
<BLANKLINE>
[2, 1]
[ 1 1]
[-2 -1]
<BLANKLINE>
[2, 1, 2]
[ 1 0]
[-2 -1]
<BLANKLINE>
[1, 2, 1]
[-1 -1]
[ 0 1]
<BLANKLINE>
[1, 2, 1, 2]
[-1 0]
[ 0 -1]
<BLANKLINE>
The standard references for actions of complex reflection groups have
the matrices acting on the right, so::
sage: W.simple_reflection(1).to_matrix() # optional - gap3
[-1 0]
[ 2 1]
sends the simple root `\alpha_0`, or ``(1,0)`` in vector notation, to
its negative, while sending `\alpha_1` to `2\alpha_0+\alpha_1`.
.. TODO::
- properly provide root systems for real reflection groups
- element class should be unique to be able to work with large groups
without creating elements multiple times
- ``is_shephard_group``, ``is_generalized_coxeter_group``
- exponents and coexponents
- coinvariant ring:
* fake degrees from Torsten Hoge
* operation of linear characters on all characters
* harmonic polynomials
- linear forms for hyperplanes
- field of definition
- intersection lattice and characteristic polynomial::
X = [ alpha(t) for t in W.distinguished_reflections() ]
X = Matrix(CF,X).transpose()
Y = Matroid(X)
- linear characters
- permutation pi on irreducibles
- hyperplane orbits (76.13 in Gap Manual)
- improve invariant_form with a code similar to the one in
``reflection_group_real.py``
- add a method ``reflection_to_root`` or
``distinguished_reflection_to_positive_root``
- diagrams in ASCII-art (76.15)
- standard (BMR) presentations
- character table directly from Chevie
- ``GenericOrder`` (76.20), ``TorusOrder`` (76.21)
- correct fundamental invariants for `G_34`, check the others
- copy hardcoded data (degrees, invariants, braid relations...) into sage
- add other hardcoded data from the tables in chevie (location is
SAGEDIR/local/gap3/gap-jm5-2015-02-01/gap3/pkg/chevie/tbl):
basic derivations, discriminant, ...
- transfer code for ``reduced_word_in_reflections`` into Gap4 or Sage
- list of reduced words for an element
- list of reduced words in reflections for an element
- Hurwitz action?
- :meth:`is_crystallographic` should be hardcoded
AUTHORS:
- Christian Stump (2015): initial version
"""
#*****************************************************************************
# Copyright (C) 2011-2016 Christian Stump <christian.stump at gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
# http://www.gnu.org/licenses/
#*****************************************************************************
from __future__ import print_function
#from six.moves import range
from sage.misc.cachefunc import cached_method, cached_function
from sage.misc.misc_c import prod
from sage.categories.category import Category
from sage.categories.permutation_groups import PermutationGroups
from sage.categories.complex_reflection_groups import ComplexReflectionGroups
from sage.categories.coxeter_groups import CoxeterGroups
from sage.combinat.root_system.reflection_group_element import ComplexReflectionGroupElement, _gap_return
from sage.sets.family import Family
from sage.structure.unique_representation import UniqueRepresentation
from sage.groups.perm_gps.permgroup import PermutationGroup_generic
from sage.rings.all import ZZ, QQ
from sage.matrix.all import Matrix, identity_matrix
from sage.structure.element import is_Matrix
from sage.interfaces.gap3 import gap3
from sage.rings.universal_cyclotomic_field import E
from sage.modules.free_module_element import vector
from sage.combinat.root_system.cartan_matrix import CartanMatrix
from sage.rings.universal_cyclotomic_field import UniversalCyclotomicField
from sage.misc.sage_eval import sage_eval
class ComplexReflectionGroup(UniqueRepresentation, PermutationGroup_generic):
"""
A complex reflection group given as a permutation group.
.. SEEALSO::
:func:`ReflectionGroup`
"""
def __init__(self, W_types, index_set=None, hyperplane_index_set=None, reflection_index_set=None):
r"""
TESTS::
sage: from sage.categories.complex_reflection_groups import ComplexReflectionGroups
sage: W = ComplexReflectionGroups().example() # optional - gap3
sage: TestSuite(W).run() # optional - gap3
"""
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)
else:
if 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)
else:
if 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)
else:
if 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)
else:
if 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):
r"""
Return the string representation of an irreducible component
of ``self``.
TESTS::
sage: W = ReflectionGroup(25,[4,1,4],[1,1,4],[5,5,2]); W # optional - gap3
Reducible complex reflection group of rank 12 and type ST25 x G(4,1,4) x A3 x I2(5)
sage: for W_type in W._type: print(W._irrcomp_repr_(W_type)) # optional - gap3
ST25
G(4,1,4)
A3
I2(5)
"""
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):
r"""
Return the string representation of ``self``.
EXAMPLES::
sage: W = ReflectionGroup(25, [4,1,4],[1,1,4],[5,5,2]); W # optional - gap3
Reducible complex reflection group of rank 12 and type ST25 x G(4,1,4) x A3 x I2(5)
"""
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 __iter__(self):
r"""
Return an iterator going through all elements in ``self``.
EXAMPLES::
sage: W = ReflectionGroup((1,1,3)) # optional - gap3
sage: for w in W: w # optional - gap3
()
(1,3)(2,5)(4,6)
(1,4)(2,3)(5,6)
(1,6,2)(3,5,4)
(1,2,6)(3,4,5)
(1,5)(2,4)(3,6)
"""
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):
r"""
Return the index set of the simple reflections of ``self``.
EXAMPLES::
sage: W = ReflectionGroup((1,1,4)) # optional - gap3
sage: W.index_set() # optional - gap3
(1, 2, 3)
sage: W = ReflectionGroup((1,1,4), index_set=[1,3,'asdf']) # optional - gap3
sage: W.index_set() # optional - gap3
(1, 3, 'asdf')
sage: W = ReflectionGroup((1,1,4), index_set=('a', 'b', 'c')) # optional - gap3
sage: W.index_set() # optional - gap3
('a', 'b', 'c')
"""
return self._index_set
def simple_reflection(self, i):
r"""
Return the ``i``-th simple reflection of ``self``.
EXAMPLES::
sage: W = ReflectionGroup((1,1,3)) # optional - gap3
sage: W.simple_reflection(1) # optional - gap3
(1,4)(2,3)(5,6)
sage: W.simple_reflections() # optional - gap3
Finite family {1: (1,4)(2,3)(5,6), 2: (1,3)(2,5)(4,6)}
"""
return self.gens()[self._index_set_inverse[i]]
def series(self):
r"""
Return the series of the classification type to which ``self``
belongs.
For real reflection groups, these are the Cartan-Killing
classification types "A","B","C","D","E","F","G","H","I", and
for complx non-real reflection groups these are the
Shephard-Todd classification type "ST".
EXAMPLES::
sage: ReflectionGroup((1,1,3)).series() # optional - gap3
['A']
sage: ReflectionGroup((3,1,3)).series() # optional - gap3
['ST']
"""
return [self._type[i]['series'] for i in range(len(self._type))]
@cached_method
def hyperplane_index_set(self):
r"""
Return the index set of the hyperplanes of ``self``.
EXAMPLES::
sage: W = ReflectionGroup((1,1,4)) # optional - gap3
sage: W.hyperplane_index_set() # optional - gap3
(1, 2, 3, 4, 5, 6)
sage: W = ReflectionGroup((1,1,4), hyperplane_index_set=[1,3,'asdf',7,9,11]) # optional - gap3
sage: W.hyperplane_index_set() # optional - gap3
(1, 3, 'asdf', 7, 9, 11)
sage: W = ReflectionGroup((1,1,4),hyperplane_index_set=('a','b','c','d','e','f')) # optional - gap3
sage: W.hyperplane_index_set() # optional - gap3
('a', 'b', 'c', 'd', 'e', 'f')
"""
return self._hyperplane_index_set
@cached_method
def distinguished_reflections(self):
r"""
Return a finite family containing the distinguished reflections
of ``self`` indexed by :meth:`hyperplane_index_set`.
These are the reflections in ``self`` acting on the complement
of the fixed hyperplane `H` as `\operatorname{exp}(2 \pi i / n)`,
where `n` is the order of the reflection subgroup fixing `H`.
EXAMPLES::
sage: W = ReflectionGroup((1,1,3)) # optional - gap3
sage: W.distinguished_reflections() # optional - gap3
Finite family {1: (1,4)(2,3)(5,6), 2: (1,3)(2,5)(4,6), 3: (1,5)(2,4)(3,6)}
sage: W = ReflectionGroup((1,1,3),hyperplane_index_set=['a','b','c']) # optional - gap3
sage: W.distinguished_reflections() # optional - gap3
Finite family {'a': (1,4)(2,3)(5,6), 'c': (1,5)(2,4)(3,6), 'b': (1,3)(2,5)(4,6)}
sage: W = ReflectionGroup((3,1,1)) # optional - gap3
sage: W.distinguished_reflections() # optional - gap3
Finite family {1: (1,2,3)}
sage: W = ReflectionGroup((1,1,3),(3,1,2)) # optional - gap3
sage: W.distinguished_reflections() # optional - gap3
Finite family {1: (1,6)(2,5)(7,8), 2: (1,5)(2,7)(6,8),
3: (3,9,15)(4,10,16)(12,17,23)(14,18,24)(20,25,29)(21,22,26)(27,28,30),
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),
5: (1,7)(2,6)(5,8),
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),
7: (4,21,27)(10,22,28)(11,13,19)(12,14,20)(16,26,30)(17,18,25)(23,24,29),
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)}
"""
# makes sure that the simple reflections come first
gens = self.gens()
R = [t for t in gens]
# Then import all distinguished reflections from gap,
# the Set is used as every such appears multiple times.
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):
r"""
Return the ``i``-th distinguished reflection of ``self``.
These are the reflections in ``self`` acting on the complement
of the fixed hyperplane `H` as `\operatorname{exp}(2 \pi i / n)`,
where `n` is the order of the reflection subgroup fixing `H`.
EXAMPLES::
sage: W = ReflectionGroup((1,1,3)) # optional - gap3
sage: W.distinguished_reflection(1) # optional - gap3
(1,4)(2,3)(5,6)
sage: W.distinguished_reflection(2) # optional - gap3
(1,3)(2,5)(4,6)
sage: W.distinguished_reflection(3) # optional - gap3
(1,5)(2,4)(3,6)
sage: W = ReflectionGroup((3,1,1),hyperplane_index_set=['a']) # optional - gap3
sage: W.distinguished_reflection('a') # optional - gap3
(1,2,3)
sage: W = ReflectionGroup((1,1,3),(3,1,2)) # optional - gap3
sage: for i in range(W.number_of_reflection_hyperplanes()): # optional - gap3
....: W.distinguished_reflection(i+1) # optional - gap3
(1,6)(2,5)(7,8)
(1,5)(2,7)(6,8)
(3,9,15)(4,10,16)(12,17,23)(14,18,24)(20,25,29)(21,22,26)(27,28,30)
(3,11)(4,12)(9,13)(10,14)(15,19)(16,20)(17,21)(18,22)(23,27)(24,28)(25,26)(29,30)
(1,7)(2,6)(5,8)
(3,19)(4,25)(9,11)(10,17)(12,28)(13,15)(14,30)(16,18)(20,27)(21,29)(22,23)(24,26)
(4,21,27)(10,22,28)(11,13,19)(12,14,20)(16,26,30)(17,18,25)(23,24,29)
(3,13)(4,24)(9,19)(10,29)(11,15)(12,26)(14,21)(16,23)(17,30)(18,27)(20,22)(25,28)
"""
return self.distinguished_reflections()[i]
@cached_method
def reflection_hyperplanes(self, as_linear_functionals=False, with_order=False):
r"""
Return the list of all reflection hyperplanes of ``self``,
either as a codimension 1 space, or as its linear functional.
INPUT:
- ``as_linear_functionals`` -- (default:``False``) flag whether
to return the hyperplane or its linear functional in the basis
dual to the given root basis
EXAMPLES::
sage: W = ReflectionGroup((1,1,3)) # optional - gap3
sage: for H in W.reflection_hyperplanes(): H # optional - gap3
Vector space of degree 2 and dimension 1 over Rational Field
Basis matrix:
[1 2]
Vector space of degree 2 and dimension 1 over Rational Field
Basis matrix:
[ 1 1/2]
Vector space of degree 2 and dimension 1 over Rational Field
Basis matrix:
[ 1 -1]
sage: for H in W.reflection_hyperplanes(as_linear_functionals=True): H # optional - gap3
(1, -1/2)
(1, -2)
(1, 1)
sage: W = ReflectionGroup((2,1,2)) # optional - gap3
sage: for H in W.reflection_hyperplanes(): H # optional - gap3
Vector space of degree 2 and dimension 1 over Rational Field
Basis matrix:
[1 1]
Vector space of degree 2 and dimension 1 over Rational Field
Basis matrix:
[ 1 1/2]
Vector space of degree 2 and dimension 1 over Rational Field
Basis matrix:
[1 0]
Vector space of degree 2 and dimension 1 over Rational Field
Basis matrix:
[0 1]
sage: for H in W.reflection_hyperplanes(as_linear_functionals=True): H # optional - gap3
(1, -1)
(1, -2)
(0, 1)
(1, 0)
sage: for H in W.reflection_hyperplanes(as_linear_functionals=True, with_order=True): H # optional - gap3
((1, -1), 2)
((1, -2), 2)
((0, 1), 2)
((1, 0), 2)
"""
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):
r"""
Return the ``i``-th reflection hyperplane of ``self``.
The ``i``-th reflection hyperplane corresponds to the ``i``
distinguished reflection.
INPUT:
- ``i`` -- an index in the index set
- ``as_linear_functionals`` -- (default:``False``) flag whether
to return the hyperplane or its linear functional in the basis
dual to the given root basis
EXAMPLES::
sage: W = ReflectionGroup((2,1,2)) # optional - gap3
sage: W.reflection_hyperplane(3) # optional - gap3
Vector space of degree 2 and dimension 1 over Rational Field
Basis matrix:
[1 0]
One can ask for the result as a linear form::
sage: W.reflection_hyperplane(3, True) # optional - gap3
(0, 1)
"""
return self.reflection_hyperplanes(as_linear_functionals=as_linear_functional, with_order=with_order)[i]
@cached_method
def reflection_index_set(self):
r"""
Return the index set of the reflections of ``self``.
EXAMPLES::
sage: W = ReflectionGroup((1,1,4)) # optional - gap3
sage: W.reflection_index_set() # optional - gap3
(1, 2, 3, 4, 5, 6)
sage: W = ReflectionGroup((1,1,4), reflection_index_set=[1,3,'asdf',7,9,11]) # optional - gap3
sage: W.reflection_index_set() # optional - gap3
(1, 3, 'asdf', 7, 9, 11)
sage: W = ReflectionGroup((1,1,4), reflection_index_set=('a','b','c','d','e','f')) # optional - gap3
sage: W.reflection_index_set() # optional - gap3
('a', 'b', 'c', 'd', 'e', 'f')
"""
return self._reflection_index_set
@cached_method
def reflections(self):
r"""
Return a finite family containing the reflections of ``self``,
indexed by :meth:`self.reflection_index_set`.
EXAMPLES::
sage: W = ReflectionGroup((1,1,3)) # optional - gap3
sage: W.reflections() # optional - gap3
Finite family {1: (1,4)(2,3)(5,6), 2: (1,3)(2,5)(4,6), 3: (1,5)(2,4)(3,6)}
sage: W = ReflectionGroup((1,1,3),reflection_index_set=['a','b','c']) # optional - gap3
sage: W.reflections() # optional - gap3
Finite family {'a': (1,4)(2,3)(5,6), 'c': (1,5)(2,4)(3,6), 'b': (1,3)(2,5)(4,6)}
sage: W = ReflectionGroup((3,1,1)) # optional - gap3
sage: W.reflections() # optional - gap3
Finite family {1: (1,2,3), 2: (1,3,2)}
sage: W = ReflectionGroup((1,1,3),(3,1,2)) # optional - gap3
sage: W.reflections() # optional - gap3
Finite family {1: (1,6)(2,5)(7,8), 2: (1,5)(2,7)(6,8),
3: (3,9,15)(4,10,16)(12,17,23)(14,18,24)(20,25,29)(21,22,26)(27,28,30),
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),
5: (1,7)(2,6)(5,8),
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),
7: (4,21,27)(10,22,28)(11,13,19)(12,14,20)(16,26,30)(17,18,25)(23,24,29),
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),
9: (3,15,9)(4,16,10)(12,23,17)(14,24,18)(20,29,25)(21,26,22)(27,30,28),
10: (4,27,21)(10,28,22)(11,19,13)(12,20,14)(16,30,26)(17,25,18)(23,29,24)}
"""
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):
r"""
Return the ``i``-th reflection of ``self``.
EXAMPLES::
sage: W = ReflectionGroup((1,1,3)) # optional - gap3
sage: W.reflection(1) # optional - gap3
(1,4)(2,3)(5,6)
sage: W.reflection(2) # optional - gap3
(1,3)(2,5)(4,6)
sage: W.reflection(3) # optional - gap3
(1,5)(2,4)(3,6)
sage: W = ReflectionGroup((3,1,1),reflection_index_set=['a','b']) # optional - gap3
sage: W.reflection('a') # optional - gap3
(1,2,3)
sage: W.reflection('b') # optional - gap3
(1,3,2)
"""
return self.reflections()[i]
def reflection_character(self):
r"""
Return the reflection characters of ``self``.
EXAMPLES::
sage: W = ReflectionGroup((1,1,3)) # optional - gap3
sage: W.reflection_character() # optional - gap3
[2, 0, -1]
"""
return self._gap_group.ReflectionCharacter().sage()
@cached_method
def discriminant(self):
r"""
Return the discriminant of ``self`` in the polynomial ring on
which the group acts.
This is the product
.. MATH::
\prod_H \alpha_H^{e_H},
where `\alpha_H` is the linear form of the hyperplane `H` and
`e_H` is its stabilizer order.
EXAMPLES::
sage: W = ReflectionGroup(['A',2]) # optional - gap3
sage: W.discriminant() # optional - gap3
x0^6 - 3*x0^5*x1 - 3/4*x0^4*x1^2 + 13/2*x0^3*x1^3
- 3/4*x0^2*x1^4 - 3*x0*x1^5 + x1^6
sage: W = ReflectionGroup(['B',2]) # optional - gap3
sage: W.discriminant() # optional - gap3
x0^6*x1^2 - 6*x0^5*x1^3 + 13*x0^4*x1^4 - 12*x0^3*x1^5 + 4*x0^2*x1^6
"""
from sage.rings.polynomial.all 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):
r"""
Return the discriminant of ``self`` in the invariant ring.
This is the function `f` in the invariants such that
`f(F_1(x), \ldots, F_n(x))` is the discriminant.
EXAMPLES::
sage: W = ReflectionGroup(['A',3]) # optional - gap3
sage: W.discriminant_in_invariant_ring() # optional - gap3
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
sage: W = ReflectionGroup(['B',3]) # optional - gap3
sage: W.discriminant_in_invariant_ring() # optional - gap3
-t0^2*t1^2*t2 + 16*t0^3*t2^2 + 2*t1^3*t2 - 36*t0*t1*t2^2 + 108*t2^3
sage: W = ReflectionGroup(['H',3]) # optional - gap3
sage: W.discriminant_in_invariant_ring() # long time # optional - gap3
(-829*E(5) - 1658*E(5)^2 - 1658*E(5)^3 - 829*E(5)^4)*t0^15
+ (213700*E(5) + 427400*E(5)^2 + 427400*E(5)^3 + 213700*E(5)^4)*t0^12*t1
+ (-22233750*E(5) - 44467500*E(5)^2 - 44467500*E(5)^3 - 22233750*E(5)^4)*t0^9*t1^2
+ (438750*E(5) + 877500*E(5)^2 + 877500*E(5)^3 + 438750*E(5)^4)*t0^10*t2
+ (1162187500*E(5) + 2324375000*E(5)^2 + 2324375000*E(5)^3 + 1162187500*E(5)^4)*t0^6*t1^3
+ (-74250000*E(5) - 148500000*E(5)^2 - 148500000*E(5)^3 - 74250000*E(5)^4)*t0^7*t1*t2
+ (-28369140625*E(5) - 56738281250*E(5)^2 - 56738281250*E(5)^3 - 28369140625*E(5)^4)*t0^3*t1^4
+ (1371093750*E(5) + 2742187500*E(5)^2 + 2742187500*E(5)^3 + 1371093750*E(5)^4)*t0^4*t1^2*t2
+ (1191796875*E(5) + 2383593750*E(5)^2 + 2383593750*E(5)^3 + 1191796875*E(5)^4)*t0^5*t2^2
+ (175781250000*E(5) + 351562500000*E(5)^2 + 351562500000*E(5)^3 + 175781250000*E(5)^4)*t1^5
+ (131835937500*E(5) + 263671875000*E(5)^2 + 263671875000*E(5)^3 + 131835937500*E(5)^4)*t0*t1^3*t2
+ (-100195312500*E(5) - 200390625000*E(5)^2 - 200390625000*E(5)^3 - 100195312500*E(5)^4)*t0^2*t1*t2^2
+ (395507812500*E(5) + 791015625000*E(5)^2 + 791015625000*E(5)^3 + 395507812500*E(5)^4)*t2^3
"""
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()
# TODO: The rest of this could be split off as a general function
# to express a polynomial D as a polynomial in the polynomials Fs
# with coefficients in the ring R.
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)
# Cancel denominators
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):
r"""
Return ``True`` if self is crystallographic.
This is, if the field of definition is the rational field.
.. TODO::
Make this more robust and do not use the matrix
representation of the simple reflections.
EXAMPLES::
sage: W = ReflectionGroup((1,1,3)); W # optional - gap3
Irreducible real reflection group of rank 2 and type A2
sage: W.is_crystallographic() # optional - gap3
True
sage: W = ReflectionGroup((2,1,3)); W # optional - gap3
Irreducible real reflection group of rank 3 and type B3
sage: W.is_crystallographic() # optional - gap3
True
sage: W = ReflectionGroup(23); W # optional - gap3
Irreducible real reflection group of rank 3 and type H3
sage: W.is_crystallographic() # optional - gap3
False
sage: W = ReflectionGroup((3,1,3)); W # optional - gap3
Irreducible complex reflection group of rank 3 and type G(3,1,3)
sage: W.is_crystallographic() # optional - gap3
False
sage: W = ReflectionGroup((4,2,2)); W # optional - gap3
Irreducible complex reflection group of rank 2 and type G(4,2,2)
sage: W.is_crystallographic() # optional - gap3
False
"""
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):
r"""
Return the number of irreducible components of ``self``.
EXAMPLES::
sage: W = ReflectionGroup((1,1,3)) # optional - gap3
sage: W.number_of_irreducible_components() # optional - gap3
1
sage: W = ReflectionGroup((1,1,3),(2,1,3)) # optional - gap3
sage: W.number_of_irreducible_components() # optional - gap3
2
"""
return len(self._type)
def irreducible_components(self):
r"""
Return a list containing the irreducible components of ``self``
as finite reflection groups.
EXAMPLES::
sage: W = ReflectionGroup((1,1,3)) # optional - gap3
sage: W.irreducible_components() # optional - gap3
[Irreducible real reflection group of rank 2 and type A2]
sage: W = ReflectionGroup((1,1,3),(2,1,3)) # optional - gap3
sage: W.irreducible_components() # optional - gap3
[Irreducible real reflection group of rank 2 and type A2,
Irreducible real reflection group of rank 3 and type B3]
"""
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):
r"""
Return the shortest representatives of the conjugacy classes of
``self``.
EXAMPLES::
sage: W = ReflectionGroup((1,1,3)) # optional - gap3
sage: [w.reduced_word() for w in W.conjugacy_classes_representatives()] # optional - gap3
[[], [1], [1, 2]]
sage: W = ReflectionGroup((1,1,4)) # optional - gap3
sage: [w.reduced_word() for w in W.conjugacy_classes_representatives()] # optional - gap3
[[], [1], [1, 3], [1, 2], [1, 3, 2]]
sage: W = ReflectionGroup((3,1,2)) # optional - gap3
sage: [w.reduced_word() for w in W.conjugacy_classes_representatives()] # optional - gap3
[[], [1], [1, 1], [2, 1, 2, 1], [2, 1, 2, 1, 1],
[2, 1, 1, 2, 1, 1], [2], [1, 2], [1, 1, 2]]
sage: W = ReflectionGroup(23) # optional - gap3
sage: [w.reduced_word() for w in W.conjugacy_classes_representatives()] # optional - gap3
[[],
[1],
[1, 2],
[1, 3],
[2, 3],
[1, 2, 3],
[1, 2, 1, 2],
[1, 2, 1, 2, 3],
[1, 2, 1, 2, 3, 2, 1, 2, 3],
[1, 2, 1, 2, 1, 3, 2, 1, 2, 1, 3, 2, 1, 2, 3]]
"""
# This can be converted to usual GAP
S = str(gap3('List(ConjugacyClasses(%s),Representative)'%self._gap_group._name))
exec('_conjugacy_classes_representatives=' + _gap_return(S))
return _conjugacy_classes_representatives
def conjugacy_classes(self):
r"""
Return the conjugacy classes of ``self``.
EXAMPLES::
sage: W = ReflectionGroup((1,1,3)) # optional - gap3
sage: for C in W.conjugacy_classes(): sorted(C) # optional - gap3
[()]
[(1,3)(2,5)(4,6), (1,4)(2,3)(5,6), (1,5)(2,4)(3,6)]
[(1,2,6)(3,4,5), (1,6,2)(3,5,4)]
sage: W = ReflectionGroup((1,1,4)) # optional - gap3
sage: sum(len(C) for C in W.conjugacy_classes()) == W.cardinality() # optional - gap3
True
sage: W = ReflectionGroup((3,1,2)) # optional - gap3
sage: sum(len(C) for C in W.conjugacy_classes()) == W.cardinality() # optional - gap3
True
sage: W = ReflectionGroup(23) # optional - gap3
sage: sum(len(C) for C in W.conjugacy_classes()) == W.cardinality() # optional - gap3
True
"""
return Family(self.conjugacy_classes_representatives(),
lambda w: w.conjugacy_class())