/
alatc.wl
7350 lines (5821 loc) · 252 KB
/
alatc.wl
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
(* ::Package:: *)
(* ::Section:: *)
(*Begin Package*)
BeginPackage["alatc`"];
(* ::Subsection::Closed:: *)
(*Usage*)
initialize::usage =
"initialize[\"x\",r] initializes the type of affine Lie algebra, of type \"x\" and rank r, \
subject to the constraints displayed when the package was loaded.\n\
initialize[\"x\",r,level] initializes the type of affine Lie algebra, its rank and level.\n\
initialize[\"x\",r,level,rootfactor] initializes the type of affine Lie algebra, its rank, the level \
and the rootfactor, which sets the root of unity."
initializelz::usage =
"initialize[\"x\", r, l, z] initializes the type of affine Lie algebra, its rank, and the \
root of unity as q = e^(2 Pi I z / l)."
initializelevel::usage =
"initializelevel[k] intializes the level to k."
setprecision::usage =
"setprecision[prec] sets the precision to prec. Should be run before \
setrootofunity[rootfactor]. The default value is prec=100, which should be \
sufficient for most cases. If mathematica complains about ill-conditioned \
matrices, or if the fusion rules are inconsistent, etc., one can try to \
increase the precision."
initializerootofunity::usage =
"initializerootofunity[rootfactor] sets the value of q to \
e^(2 \[Pi] i rootfactor/(tmax (k+g))), \
where k is the level, g the dual coxeter number of the affine Lie algebra, and \
tmax = 1 for the simply laced cases, tmax = 3 for g_2 and tmax = 2 for the other \
non-simply laced cases (g and tmax are set when intialize[\"x\",r] is run)."
setrootofunity::usage =
"setrootofunity[rootfactor] sets the value of q to e^(2 \[Pi] i rootfactor/(tmax (k+g))), \
where k is the level, g the dual coxeter number of the affine Lie algebra, and \
tmax = 1 for the simply laced cases, tmax = 3 for g_2 and tmax = 2 for the other \
non-simply laced cases (g and tmax are set when intialize[\"x\",r] is run). Identical to \
initializerootofunity[rootfactor], but kept for backwards compatibility."
possiblerootfactors::usage =
"possiblerootfactors[\"x\",rank,level] gives the possible rootfactors \
for the selected type, rank and level. A list containing the lists with the possible rootfactors \
for the uniform and non-uniform cases is returned. The list for non-uniform cases might be empty."
calculatefsymbols::usage =
"calculatefsymbols[] calculates the F-symbols, after the type of algebra, rank, \
level and root of unity have been selected. The calculation is done in several steps. Most \
importantly, the q-CG coefficients are constructed first. The pentagon equations are \
verified, as well as some properties of the F-matrices."
calculatersymbols::usage =
"calculatersymbols[] calculates the R-symbols, after the F-symbols have been \
calculated. The hexagon equations are verified, as well as some properties of \
the R-matrices."
calculatemodulardata::usage =
"calculatemodulardata[] calculates the modular data, once the F- and R-symbols are \
calculated: pivotal structure, Frodenius-Schur indicators, Frobenius-Perron \
dimensions, quantum dimensions, scaling dimensions, central charge adn the S-matrix. \
calculatemodulardata[pivotalstructure] calculates the modular data, but with the selected \
pivotal structure (which has to be spherical) instead."
diagonalizermatrices::usage =
"diagonalizermatrices[] diagonalizes the R-matrices, if they are not diagonal already. \
This will change both F- and R-symbols, so the pentagon and hexagon equations will be \
re-checked for security."
undiagonalizermatrices::usage =
"undiagonalizermatrices[] reverts the process of diagonalizing the R-matrices. \
This will revert both F- and R-symbols back to their original values. This is necessary \
if one after diagonalizing the R-matrices, wants to obtain the exact representation of the
F-symbols. Diagonalizing the R-matrices can lead to values for the F-symbols that can not \
be described in terms of the general numberfield that is used to describe the F- and R-symbols."
(*
donotcheckpentagon::usage =
"Run donotcheckpentagon[] (after the type of algebra, rank and level have been initialized) \
if you do not want the pentagon equations to be checked. \
Though it is of course safer to check the pentagon equations, checking the pentagon equations \
can take a long time (though typically not as long as calculating the F-symbols in the first place). \
By running donotcheckpentagon[], the \
pentagon equations will not be checked. It is recommended to generate the R-symbols as well, so \
that at least the hexagon equations can be checked. If these hold, it is likely that the \
pentagon equations are also satisfied."
*)
(*
docheckpentagon::usage =
"Run docheckpentagon[] (before calculating the F-symbols) if you ran donotcheckpentagon[] \
accidentally, but still want to check the pentagon equations."
*)
displayinfo::usage =
"displayinfo[] displays some general information and basic instructions on how \
to use the package."
qCG::usage =
"qcg[j1,{m1,n1},j2,{m2,n2},j3,{m3,n3},v1] gives the q-CG coefficient. \
The j's (highest weights) and m's (weights) are list of length 'rank'. \
The n's are integers distinguishing the weights (due to weight multiplicities) and \
v1 is an integer labeling which j3 in the tensor product of j1 and j2 one is considering \
(due to fusion multiplicity)."
Fsym::usage =
"Fsym[a,b,c,d,e,f,{v1,v2,v3,v4}] gives the F-symbol. The a,b,...,f label the particles \
(lists of length 'rank'), while the v's (integers) label the four vertices."
Fsymexact::usage =
"Fsymexact[a,b,c,d,e,f,{v1,v2,v3,v4}] gives the exact representation of the F-symbol. \
The exact form of the F-symbols is \
Exp[Pi I \[Alpha]] Sqrt[Sum[a[i] Cos[2 Pi z / l]^i, {i, 0, EulerPhi[l]/2 - 1}]], \
where \[Alpha] and a[i] are rational. Typically, \[Alpha] \[Element] {0,1/2,1,-1/2} \
(if one does not diagonalize the R-matrices). The exact F-symbols are given in terms of \
\[Alpha] and a[i] as {\[Alpha], {a[0], a[1], ... }}."
Fmat::usage =
"Fmat[a,b,c,d] gives the F-matrix. a,b,c,d label the particles \
(lists of length 'rank')."
Rsym::usage =
"Rsym[a,b,c,{v1,v2}] gives the R-symbol. a,b,c label the particles \
(lists of length 'rank'), while the v's (integers) label the two vertices."
Rsyminv::usage =
"Rsyminv[a,b,c,{v1,v2}] gives the inverse R-symbol, calculated by taking the \
approriate elements of the inverse of the R-matrix. a,b,c label the particles \
(lists of length 'rank'), while the v's (integers) label the two vertices."
Rsymexact::usage =
"Rsymexact[a,b,c,{v1,v2}] gives the exact representation of the R-symbol. \
The exact form of the R-symbols is \
Exp[Pi I \[Alpha]] Sqrt[Sum[a[i] Cos[2 Pi z / l]^i, {i, 0, EulerPhi[l]/2 - 1}]], \
where \[Alpha] and a[i] are rational. \
For the R-symbols corresponding to diagonal R-matrices, the R-symbol is a pure phase, so that
the square root factor equals one. \
The exact R-symbols are given in terms of \[Alpha] and a[i] as {\[Alpha], {a[0], a[1], ... }}."
Rsyminvexact::usage =
"Rsyminvexact[a,b,c,{v1,v2}] gives the exact representation of the inverse R-symbol. \
For the format, see the documentation in the accompanying notebook."
Rmat::usage =
"Rmat[a,b,c,d] gives the R-matrix. a,b,c label the particles \
(lists of length 'rank')."
Nmat::usage =
"Nmat[a] gives the fusion matrix for fusion with particle type a."
Nvertex::usage =
"Nvertex[a,b,c] gives the number of vertices of type (a,b,c)."
Fusion::usage =
"Fusion[a,b] gives the possible fusion outcomes of a x b, that is, without(!) \
taking fusion multiplicities into account. Use Nvertex[a,b,c] to obtain the number \
of vertices of type (a,b,c)."
possiblepivotalstructures::usage =
"possiblepivotalstructures[] calculates the solutions to the pivotal equations. \
Note that only one these solutions is actually realized by the selected quantum group!"
possiblesphericalpivotalstructures::usage =
"possiblesphericalpivotalstructures[] calculates the solutions to the pivotal equations, \
but only returns the spherical ones (i.e., all coefficients equal to either +1 or -1). \
Note that only one these solutions is actually realized by the selected quantum group!"
findexactfsymbols::usage =
"findexactfsymbols[] takes the numerical values of the F-symbols, and converts them \
into an exact representation. If q = Exp[2 Pi I z / l], it is assumed that the F-symbols \
take the form \
Exp[Pi I \[Alpha]] Sqrt[Sum[a[i] Cos[2 Pi z / l]^i, {i, 0, EulerPhi[l]/2 - 1}]], \
where \[Alpha] and a[i] are rational. Typically, \[Alpha] \[Element] {0,1/2,1,-1/2} \
(if one does not diagonalize the R-matrices). The exact F-symbols are given in terms of \
\[Alpha] and a[i] as {\[Alpha], {a[0], a[1], ... }}."
findexactrsymbols::usage =
"findexactrsymbols[] takes the numerical values of the R-symbols, and converts them \
into an exact representation. If q = Exp[2 Pi I z / l], it is assumed that the R-symbols \
take the form \
Exp[Pi I \[Alpha]] Sqrt[Sum[a[i] Cos[2 Pi z / l]^i, {i, 0, EulerPhi[l]/2 - 1}]], \
where \[Alpha] and a[i] are rational. \
For the R-symbols corresponding to diagonal R-matrices, the R-symbol is a pure phase, so that
the square root factor equals one. \
The exact R-symbols are given in terms of \[Alpha] and a[i] as {\[Alpha], {a[0], a[1], ... }}."
findexactmodulardata::usage =
"findexactmodulardata[] converts the numerical modular data into an exact representation."
(*
checkpentagonalgebraically::usage =
"checkpentagonexactformalgebraically[] checks the pentagon equations algebraically, using \
the exact form of the F-symbols. Note that this is much slower than checking the pentagon \
equations for the exact form of the F-symbols numercially with high precision (say 200 digits)!"
*)
(*
checkhexagonalgebraically::usage =
"checkhexagonexactformalgebraically[] checks the hexagon equations algebraically, using \
the exact form of the F- and R-symbols. Note that this is much slower than checking the hexagon \
equations for the exact form of the F- and R-symbols numercially with high precision (say 200 digits)!"
*)
(*
checkmodulardataalgebraically::usage =
"checkmodulardataalgebraically[] checks the exact form of the modular data algebraically using \
the exact form of the F- and R-symbols. Note that this is much slower than the standard check of \
the exact form of the modular data, which is done numerically with high (i.e., 200 digit) precision."
*)
checkpentagonexactformnumerically::usage =
"checkpentagonexactformnumerically[] numerically checks the pentagon equations, using the exact \
form of the F-symbols. The precision used is 200 digits."
checkhexagonexactformnumerically::usage =
"checkhexagonexactformnumerically[] numerically checks the hexagon equations, using the exact \
form of the F- and R-symbols. The precision used is 200 digits."
savecurrentdata::usage =
"savecurrentdata[] saves the (exact form of the) F-symbols, R-symbols, the modular data \
and some additional information, such that it can be loaded at later stage."
loaddata::usage =
"loaddata[type, rank, level, rootfactor] loads the F-symbols, R-symbols and the modular data \
and initializes the system, such that it is in the same state as if one just had calculated this \
data (and its exact form). The exception is that most of the Lie algebra data and qCG coefficients \
are not loaded (this data is not stored)."
loaddatalz::usage =
"loaddata[type, rank, l, z] loads the F-symbols, R-symbols and the modular data \
and initializes the system using the l-z notation (parametrizing the root of unity as \
q = e^(2 Pi I z / l) ), such that it is in the same state as if one just had calculated this \
data (and its exact form). The exception is that most of the Lie algebra data and qCG coefficients \
are not loaded (this data is not stored)."
doitall::usage =
"doitall[] assumes that the system is correctly initialized, and calculates the \
F-symbols, the R-symbols, the modular data, the exact form of the F-symbols, \
the exact form of the R-symbols and finally the exact form of the modular data."
(* ::Section:: *)
(*Begin `Private` Context*)
Begin["`Private`"];
(* ::Subsection::Closed:: *)
(*General functions*)
displayinfo[] := With[{},
textStyle =
Style[ #, FontSize -> 15, FontFamily -> "Source Sans Pro" ] &;
textStyleBold =
Style[ #, FontSize -> 15, FontFamily -> "Source Sans Pro", Bold] &;
codeStyle =
Style[ #, FontSize -> 14, FontFamily -> "Source Code Pro" ] &;
Print[Sequence @@
{
Style[ "affine-lie-algebra-tensor-category (alatc) package\n" , FontSize -> 36,
FontFamily -> "Source Sans Pro"],
Style[ "Authors: Eddy Ardonne\n" , FontSize -> 15,
FontFamily -> "Source Sans Pro", Bold],
Style[ "Many thanks to: Fran\[CCedilla]ois Brunault, Achim Krause, Eric Rowell, \
Steve Simon, Joost Slingerland, Gert Vercleyen\n" ,
FontSize -> 15, FontFamily -> "Source Sans Pro", Bold],
Style[
"License: GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007\n\
" , FontSize -> 15, FontFamily -> "Source Sans Pro", Bold],
Style[
"Last revision: 2022-06-28\n\
" , FontSize -> 15, FontFamily -> "Source Sans Pro", Bold],
textStyle["\nThis package is based on the paper:\n"],
Style[
"Clebsch-Gordan and 6j-coefficients for rank two quantum \
groups,\n" , FontSize -> 15, FontFamily -> "Source Sans Pro", Italic],
textStyle["Eddy Ardonne, Joost Slingerland\n"],
textStyle["J. Phys. A 43, 395205 (2010)\n"],
textStyle["https://doi.org/10.1088/1751-8113/43/39/395205\n"],
textStyle["https://arxiv.org/abs/1004.5456\n"],
textStyle[
"\n Quantum groups based on non-twisted affine Lie algebras \
give rise to tensor categories. With this package, one can, \
numerically, calculate the associated F- and R-symbols, as well as \
the modular data. One can subsequently convert the numerical results to an \
exact representation.\n"],
textStyle[
"The types of non-twisted affine Lie algebras possible are:\n"],
TextGrid[{
{"type", "rank", "tmax", "g", "note"},
{"\"a\"", "r \[GreaterEqual] 1", "1", "r+1", "su(r+1)"},
{"\"b\"", "r \[GreaterEqual] 3", "2", "2r-1",
"so(2r+1), so(5) is implemented as sp(4)"},
{"\"c\"", "r \[GreaterEqual] 2", "2", "r+1", "sp(2r)"},
{"\"d\"", "r \[GreaterEqual] 4", "1", "2r-2", "so(2r)"},
{"\"e\"", "r \[Element] {6,7,8}", "1", "{12,18,30}"},
{"\"f\"", "r == 4", "2", "9"},
{"\"g\"", "r == 2", "3", "4"}
}],
textStyle[
"\n One starts by selecting the type of affine Lie algebra and \
its rank by running "],
codeStyle["initialize[\"x\",rank]"],
textStyle[" where "],
codeStyle["x \[Element] {a,b,c,d,e,f,g}"],
textStyle[
" and the rank satisfies the appropriate constraint form \
above. Subsequently, one selects the level, which has to be a \
positive integer, by running "],
codeStyle["initializelevel[k]"],
textStyle[
".\n Once the type of algebra, rank and level are set, the \
possible values of the deformation parameter q are fixed. q can take \
the values\n\
q = e^(2 \[Pi] i rootfactor/(tmax (k + g))) ,\n where k is the level, \
g the dual coxeter number of the \
algebra, and tmax is the ratio of the length of the long and short \
roots, if any (see the table above for the values of g and tmax). \
For the standard, uniform cases, rootfactor should be relative prime \
with tmax(k+g). See the section `More detailed information' of the \
accompanying notebook alatc-info-examples.nb for more information on \
the non-uniform cases. The value of q is set by running "],
codeStyle["initializerootofunity[rootfactor]"],
textStyle[" .\n"],
textStyle[
"After the type of algebra, rank, level and rootfactor are \
set, one can proceed by calculating the F- and R-symbols, as well as \
the modular data, by running the commands (in this order)\n"],
codeStyle["calculatefsymbols[]\n"],
codeStyle["calculatersymbols[]\n"],
codeStyle["calculatemodulardata[]\n"],
textStyle[
"If the R-matrices are not diagonal, they can be diagonalized \
using "],
codeStyle["diagonalizermatrices[]"],
textStyle[
".\nInformation on how to access the F- and R-symbols, can be \
found in the accompanying notebook, which contains some examples as \
well.\n"],
textStyle["This information can be displayed by running "],
codeStyle["displayinfo[]"],
textStyle[".\n"],
textStyle["\nSome technical notes.\n"],
textStyle["\nIf Mathematica complains about \
ill-conditioned matrices, or if the fusion rules are inconsistent etc., \
one can try to increase the precision (which is standard set to 100, \
so pretty high already) by running "],
codeStyle["setprecision[precision]"],
textStyle[" where precision should be an integer > 100. "],
codeStyle["setprecision[precision]"],
textStyle[" should be run "],
textStyleBold["before"],
textStyle[" running "],
codeStyle["initializerootofunity[rootfactor]"],
textStyle[". Warnings are generated if the deviation is bigger than 10^(-20). \
Otherwise, the maximum deviation is given, to give a sense of the accuracy. Typically, \
the accuracy is much better than 10^(-20).\n"],
textStyle["\nWhen loading the package, the recusion limit is set to 10000.\n"],
textStyle["\nThe gauge choices made during the calculation follow, to a \
large extend, the ones described in the paper above."]
}
];
];
Clear[nq];
nq[0,t_]:=0;
nq[1,t_]:=1;
nq[n_/;n<0,t_]:=-nq[-n,t];
Off[Solve::svars];
qnn[n_]:=(q^(n)-q^(-n))/(q^(1)-q^(-1));
qnnser[n_/;n==0]:=0;
qnnser[n_/;n>0]:=Sum[q^(j/2),{j,-(n-1),n-1,2}];
qnnser[n_/;n<0]:=Sum[-q^(j/2),{j,-(-n-1),-n-1,2}];
qnnser[n_/;n>0,t_]:=Sum[q^(j*t/(2)),{j,-(n-1),n-1,2}];
qnnser[n_/;n<0,t_]:=Sum[-q^(j*t/(2)),{j,-(-n-1),-n-1,2}];
nq[n_,t_]:=qnnser[n,t];
zeromatrix[dim_Integer]:= Table[0,{i1,1,dim},{i2,1,dim}];
precision=100;
typerankinitok=False;
typeranklevelinitok=False;
typeranklevelrootinitok=False;
fsymbolscalculated=False;
rsymbolscalculated=False;
modulardatacalculated=False;
pentagontobechecked=True;
recheck=False;
typerankinfo=True;
levelinfo=True;
rootfacinfo=True;
initfromlz=False;
fsymbolsexactfound=False;
rsymbolsexactfound=False;
modulardataexactfound=False;
rmatricesdiagonalized=False;
(* ::Subsection::Closed:: *)
(*Functions to access the data*)
qCG[j1_,m1x_,j2_,m2x_,j3_,m3x_,v_]:=qcg[j1,m1x,j2,m2x,j3,m3x,v];
Fsym[a_,b_,c_,d_,e_,f_,vvec_]:=fsym[a,b,c,d,e,f,vvec];
Fsymexact[a_,b_,c_,d_,e_,f_,vvec_]:=fsymexact[a,b,c,d,e,f,vvec];
Fmat[a_,b_,c_,d_]:=fmat[a,b,c,d];
Rsym[a_,b_,c_,vvec_]:=rsym[a,b,c,vvec];
Rsyminv[a_,b_,c_,vvec_]:=rsyminv[a,b,c,vvec];
Rsymexact[a_,b_,c_,vvec_]:=rsymexact[a,b,c,vvec];
Rsyminvexact[a_,b_,c_,vvec_]:=rsyminvexact[a,b,c,vvec];
Rmat[a_,b_,c_]:=rmat[a,b,c];
Nmat[a_]:=nmat[a];
Nvertex[a_,b_,c_]:= nv[a,b,c];
Fusion[a_,b_]:= fusion[a,b];
pivotalequations[]:=
Module[{value,valueok},
valueok=True;
Flatten[
Table[
value =
Sum[
fsym[ir1, ir2, dual[ir3], irreps[[1]], ir3, dual[ir1], {v1, 1, v2, 1}]*
fsym[ir2, dual[ir3], ir1, irreps[[1]], dual[ir1], dual[ir2], {v2, 1, v3, 1}]*
fsym[dual[ir3], ir1, ir2, irreps[[1]], dual[ir2], ir3, {v3, 1, v1, 1}]
,{v2, 1, nv[ir2, dual[ir3], dual[ir1]]},{v3, 1, nv[dual[ir3], ir1, dual[ir2]]}];
If[Chop[value-Round[value],10^(-20)]==0,
value=Round[value],
If[valueok,
Print["The numerical value appering in the pivotal equation is not equal to +1 or -1, \
as should be the case for this fusion category."];
valueok=False;
];
];
pivotvar[ir1] * pivotvar[ir2] / pivotvar[ir3]==value
,{ir1, irreps},{ir2, irreps},{ir3, fusion[ir1, ir2]},{v1, 1, nv[ir1, ir2, ir3]}],3]
];
possiblepivotalstructures[]:=Module[{piveqns,pivsols,allpivotalstructures},
If[Not[typeranklevelrootinitok],
Print["The type of algebra, rank, level and/or rootfactor were not \
(correctly) initialized, please do so first, followed by calculating \
the F-symbols, before calculating the possible pivotal structures."];
];
If[typeranklevelrootinitok && Not[fsymbolscalculated],
Print["The F-symbols were not calculated. Please do so first, before \
calculating the possible pivotal structures."];
];
If[typeranklevelrootinitok && fsymbolscalculated,
piveqns=pivotalequations[]//Union;
pivsols=Solve[piveqns];
If[Length[pivsols] != numofsimplecurrents,
Print["The number of solutions of the pivotal equations is not equal to the number of simple currents! Better check."];
];
allpivotalstructures=pivsols[[All,All,2]];
allpivotalstructures=Abs[#]Exp[I Arg[#]]&/@allpivotalstructures;
allpivotalstructures
]
];
possiblesphericalpivotalstructures[]:=Module[{allpivotalstructures,allsphericalpivotalstructures},
If[Not[typeranklevelrootinitok],
Print["The type of algebra, rank, level and/or rootfactor were not \
(correctly) initialized, please do so first, followed by calculating \
the F-symbols, before calculating the possible spherical pivotal structures."];
];
If[typeranklevelrootinitok && Not[fsymbolscalculated],
Print["The F-symbols were not calculated. Please do so first, before \
calculating the possible spherical pivotal structures."];
];
If[typeranklevelrootinitok && fsymbolscalculated,
allpivotalstructures = possiblepivotalstructures[];
allsphericalpivotalstructures = Cases[allpivotalstructures, x_/;ContainsOnly[x,{1,-1}]];
allsphericalpivotalstructures
]
];
(* ::Subsection::Closed:: *)
(*General initialization*)
$RecursionLimit=10000;
dualcoxeter[type_, rank_] :=
Piecewise[
{
{rank + 1, type == "a" && rank >= 1},
{2 rank - 1, type == "b" && rank >= 3},
{rank + 1, type == "c" && rank >= 2},
{2 rank - 2, type == "d" && rank >= 4},
{12, type == "e" && rank == 6},
{18, type == "e" && rank == 7},
{30, type == "e" && rank == 8},
{9, type == "f" && rank == 4},
{4, type == "g" && rank == 2}
}
];
thvecshort[type_, rank_] :=
Piecewise[
{
{{2}, type == "a" && rank == 1},
{Table[If[i == 1 || i == rank, 1, 0], {i, 1, rank}], type == "a" && rank > 1},
{Table[If[i == 1, 1, 0], {i, 1, rank}], type == "b" && rank >= 3},
{Table[If[i == 2, 1, 0], {i, 1, rank}], type == "c" && rank >= 2},
{Table[If[i == 2, 1, 0], {i, 1, rank}], type == "d" && rank >= 4},
{{0, 0, 0, 0, 0, 1}, type == "e" && rank == 6},
{{1, 0, 0, 0, 0, 0, 0}, type == "e" && rank == 7},
{{1, 0, 0, 0, 0, 0, 0, 0}, type == "e" && rank == 8},
{{0, 0, 0, 1}, type == "f" && rank == 4},
{{0, 1}, type == "g" && rank == 2}
}
];
thveclong[type_, rank_] :=
Piecewise[
{
{{2}, type == "a" && rank == 1},
{Table[If[i == 1 || i == rank, 1, 0], {i, 1, rank}], type == "a" && rank > 1},
{Table[If[i == 2, 1, 0], {i, 1, rank}], type == "b" && rank >= 3},
{Table[If[i == 1, 2, 0], {i, 1, rank}], type == "c" && rank >= 2},
{Table[If[i == 2, 1, 0], {i, 1, rank}], type == "d" && rank >= 4},
{{0, 0, 0, 0, 0, 1}, type == "e" && rank == 6},
{{1, 0, 0, 0, 0, 0, 0}, type == "e" && rank == 7},
{{1, 0, 0, 0, 0, 0, 0, 0}, type == "e" && rank == 8},
{{1, 0, 0, 0}, type == "f" && rank == 4},
{{1, 0}, type == "g" && rank == 2}
}
];
cartanmatrix[type_, rank_] :=
Piecewise[
{
{SparseArray[{{i_, i_} -> 2, {i_, j_} /; Abs[i - j] == 1 -> -1}, {rank, rank}] // Normal, type == "a"},
{SparseArray[{{i_, i_} -> 2, {i_, j_} /; Abs[i - j] == 1 && j < rank -> -1, {rank - 1, rank} -> -2}, {rank, rank}] // Normal, type == "b" && rank >= 3},
{SparseArray[{{i_, i_} -> 2, {i_, j_} /; Abs[i - j] == 1 && i < rank -> -1, {rank, rank - 1} -> -2}, {rank, rank}] // Normal, type == "c" && rank >= 2},
{SparseArray[{{i_, i_} -> 2, {i_, j_} /; Abs[i - j] == 1 && i < rank && j < rank -> -1, {rank - 2, rank} -> -1, {rank, rank - 2} -> -1}, {rank, rank}] // Normal, type == "d" && rank >= 4},
{SparseArray[{{i_, i_} -> 2, {i_, j_} /; Abs[i - j] == 1 && i < rank && j < rank -> -1, {3, 6} -> -1, {6, 3} -> -1}, {rank, rank}] // Normal, type == "e" && rank == 6},
{SparseArray[{{i_, i_} -> 2, {i_, j_} /; Abs[i - j] == 1 && i < rank && j < rank -> -1, {3, 7} -> -1, {7, 3} -> -1}, {rank, rank}] // Normal, type == "e" && rank == 7},
{SparseArray[{{i_, i_} -> 2, {i_, j_} /; Abs[i - j] == 1 && i < rank && j < rank -> -1, {5, 8} -> -1, {8, 5} -> -1}, {rank, rank}] // Normal, type == "e" && rank == 8},
{SparseArray[{{i_, i_} -> 2, {i_, j_} /; Abs[i - j] == 1 && {i, j} != {2, 3} -> -1, {2, 3} -> -2}, {rank, rank}] // Normal, type == "f" && rank == 4},
{{{2, -3}, {-1, 2}}, type == "g" && rank == 2}
}
];
qfmatrix[type_, rank_] :=
With[
{ict = Transpose[Inverse[cartanmatrix[type, rank]]],
rlfs = rootlengthfactors[type, rank]},
Table[1/rlfs[[i]] ict[[i]], {i, 1, rank}]
];
tmaxvalue[type_] :=
Piecewise[
{
{1, type == "a" || type == "d" || type == "e"},
{2, type == "b" || type == "c" || type == "f"},
{3, type == "g"}
}
];
rootlengthfactors[type_, rank_] :=
Piecewise[
{
{Table[1, {i, 1, rank}], (type == "a" && rank >= 1) || (type == "d" && rank >= 4) || (type == "e" && 6 <= rank <= 8)},
{Table[If[i < rank, 1, 2], {i, 1, rank}], type == "b" && rank >= 3},
{Table[If[i < rank, 2, 1], {i, 1, rank}], type == "c" && rank >= 2},
{{1, 1, 2, 2}, type == "f" && rank == 4},
{{1, 3}, type == "g" && rank == 2}
}
];
rootlengthfactorsinverted[type_, rank_] :=
tmaxvalue[type] * Table[1/rlf ,{rlf, rootlengthfactors[type, rank]}];
rangeok[type_,rank_]:=
Piecewise[
{
{True,rank\[Element]Integers&&type=="a"&&rank>=1},
{True,rank\[Element]Integers&&type=="b"&&rank>=3},
{True,rank\[Element]Integers&&type=="c"&&rank>=2},
{True,rank\[Element]Integers&&type=="d"&&rank>=4},
{True,rank\[Element]Integers&&type=="e"&&6<=rank<=8},
{True,rank\[Element]Integers&&type=="f"&&rank==4},
{True,rank\[Element]Integers&&type=="g"&&rank==2}
},
False
];
doitall[] := With[{},
calculatefsymbols[];
calculatersymbols[];
calculatemodulardata[];
findexactfsymbols[];
findexactrsymbols[];
findexactmodulardata[];
];
(* ::Subsection::Closed:: *)
(*Routines to initialization of the current algebra, rank, level and root of unity*)
initialize[atype_, rr_] :=
Module[{},
If[rangeok[atype, rr],
(* General initialization *)
typerankinitok = False; (* Will be set to True once we're done *)
typeranklevelinitok = False;
typeranklevelrootinitok = False;
fsymbolscalculated = False;
rsymbolscalculated = False;
fsymbolsexactfound = False;
rsymbolsexactfound = False;
modulardatacalculated = False;
modulardataexactfound = False;
pentagontobechecked = True;
recheck = False;
rmatricesdiagonalized = False;
clearvariables[];
clearglobalvariables[];
type = atype;
rank = rr;
th = thveclong[type, rank];
g = dualcoxeter[type, rank];
cartan = cartanmatrix[type, rank];
icartan = Inverse[cartan];
qfm = qfmatrix[type, rank];
tmax = tmaxvalue[type];
tvec = rootlengthfactorsinverted[type, rank];
rho = Table[1, {j, 1, rank}];
a = icartan . rho;
(* Generate the roots of the algebra *)
pos = 1;
roots = {th};
While[pos <= Dimensions[roots][[1]],
For[
i = 1, i <= rank, i++,
If[roots[[pos, i]] > 0,
Do[If[Not[MemberQ[roots, roots[[pos]] - j cartan[[i]]]],
roots = Append[roots, roots[[pos]] - j cartan[[i]]]], {j, roots[[pos, i]]}]]
];
pos = pos + 1
];
roots =
Sort[roots,
Sum[(#1 . icartan)[[j]] a[[j]], {j, 1, rank}] >= Sum[(#2 . icartan)[[j]] a[[j]], {j, 1, rank}] &];
na = Dimensions[roots][[1]];
If[typerankinfo,
Print["The type of algebra and rank have been set to ", {type,rank}];
];
typerankinitok=True;
,
If[typerankinfo,
Print["The type of algebra and the rank are not compatible!"];
Print["Run initialize[\"x\",r] again to set the type of algebra and its rank."];
];
,
If[typerankinfo,
Print["The type of algebra and the rank are not compatible!"];
Print["Run initialize[\"x\",r] again to set the type of algebra and its rank."];
];
];
];
initializelevel[lev_] :=
Module[{n},
If[typerankinitok,
If[IntegerQ[lev] && lev >= 0,
typeranklevelinitok = False; (* will be set to True once we're done *)
typeranklevelrootinitok = False;
fsymbolscalculated = False;
rsymbolscalculated = False;
fsymbolsexactfound = False;
rsymbolsexactfound = False;
modulardatacalculated = False;
modulardataexactfound = False;
pentagontobechecked = True;
rmatricesdiagonalized = False;
recheck = False;
level = lev;
rootofunity = 1/(g + level);
canbenonuniform = nonuniformpossible[type, rank, level];
rootfactorsuniform = possiblerootfactorsuniform[type, rank, level];
If[canbenonuniform,
fraclevel = (level + g)/tmax - g;
rootfactorsnonuniform = possiblerootfactorsnonuniform[type, rank, level];,
rootfactorsnonuniform = {};
];
rootfactors = Union[rootfactorsuniform, rootfactorsnonuniform];
typeranklevelinitok = True;
If[levelinfo,
Print["The level has been set to ",level];
If[canbenonuniform,
Print["The possible roots of unity are ",
Exp[2 Pi I "rootfactor" rootofunity/(tmax)] // TraditionalForm,
",\n with rootfactor an element of the set: ", rootfactorsuniform, " for the uniform cases, or \n\
with rootfactor an element of the set: ", rootfactorsnonuniform, " for the non-uniform cases. The non-uniform cases have \
an associated fractional level: ", fraclevel, "."];,
Print["The possible roots of unity are ",
Exp[2 Pi I "rootfactor" rootofunity/(tmax)] // TraditionalForm,
",\n with rootfactor an element of the set: ", rootfactorsuniform, " for the uniform cases.\n There are no non-uniform cases."];
];
];
,
If[levelinfo,
Print["The level has to be a positive integer!"];
Print["Run initializelevel[level] again to set the level."];
];
,
If[levelinfo,
Print["The level has to be a positive integer!"];
Print["Run initializelevel[level] again to set the level."];
];
];
,
Print["The type of algebra and rank are not correctly initialized, please do so first!"];
];
];
setrootofunity[rootfac_]:= initializerootofunity[rootfac];
initializerootofunity[rootfac_] := Piecewise[{
{
If[MemberQ[rootfactors, rootfac],
rootfactor = rootfac;
q = N[Exp[2 Pi I rootfactor rootofunity/tmax], precision];
If[MemberQ[rootfactorsuniform, rootfac], uniform = True;, uniform = False;];
If[uniform,
cosdenominator = 1/rootofunity*tmax;
cosnumerator = rootfactor;,
cosdenominator = 1/rootofunity;
cosnumerator = rootfactor/tmax;
];
If[uniform, irreps = irrepsuniform[type, rank, level];, irreps = irrepsnonuniform[type, rank, level];];
numofirreps = Length[irreps];
If[rootfacinfo,
Print["The rootfactor has been set to ", rootfactor];
];
If[uniform && Not[initfromlz],
Print["The type of algebra, rank, level and rootfactor are initialized, and set to ", {type, rank, level, rootfactor}, ". This is a uniform case."];
];
If[uniform && initfromlz,
Print["The type of algebra, rank, l and z are initialized, and set to ", {type, rank, lval, zval}, ". This is a uniform case, with level: ", level, "."];
];
If[Not[uniform] && Not[initfromlz],
Print["The type of algebra, rank, level and rootfactor are initialized, and set to ", {type, rank, level, rootfactor}, ". This is a non-uniform case, \
with an associated fractional level: ", fraclevel, "."];
];
If[Not[uniform] && initfromlz,
Print["The type of algebra, rank, l and z are initialized, and set to ", {type, rank, lval, zval}, ". This is a non-uniform case, \
with an associated fractional level: ", fraclevel, "."];
];
typeranklevelrootinitok = True;
fsymbolscalculated = False;
rsymbolscalculated = False;
fsymbolsexactfound = False;
rsymbolsexactfound = False;
modulardatacalculated = False;
modulardataexactfound = False;
rmatricesdiagonalized = False;
recheck = False;
Print["You can proceed to calculate the F-symbols :-)"];
,
typeranklevelrootinitok = False;
If[canbenonuniform,
Print["The possible roots of unity are ",
Exp[2 Pi I "rootfactor" rootofunity/(tmax)] // TraditionalForm,
",\n\
with rootfactor an element of the set: ", rootfactorsuniform, " for the uniform cases, or \n\
with rootfactor an element of the set: ", rootfactorsnonuniform, " for the non-uniform cases. \
The non-uniform cases have an associated fractional level: ", fraclevel, "."];,
Print["The possible roots of unity are ",
Exp[2 Pi I "rootfactor" rootofunity/(tmax)] // TraditionalForm,
",\n\
with rootfactor an element of the set: ", rootfactorsuniform, " for the uniform cases.\n\
There are no non-uniform cases."];
];
Print["Run initializerootofunity[rootfactor] again to select a valid rootfactor."];
,
typeranklevelrootinitok = False;
If[canbenonuniform,
Print["The possible roots of unity are ",
Exp[2 Pi I "rootfactor" rootofunity/(tmax)] // TraditionalForm,
",\n\
with rootfactor an element of the set: ", rootfactorsuniform, " for the uniform cases, or \n\
with rootfactor an element of the set: ", rootfactorsnonuniform, " for the non-uniform cases. \
The non-uniform cases have an associated fractional level: ", fraclevel, "."];,
Print["The possible roots of unity are ",
Exp[2 Pi I "rootfactor" rootofunity/(tmax)] // TraditionalForm,
",\n\
with rootfactor an element of the set: ", rootfactorsuniform, " for the uniform cases.\n\
There are no non-uniform cases."];
];
Print["Run initializerootofunity[rootfactor] again to select a valid rootfactor."];
];
, typeranklevelinitok},
{Print["The type of algebra and rank are not correctly initialized, please do so first!"];
, Not[typerankinitok]},
{Print["The level is not correctly initialized, please do so first!"];
, typerankinitok && Not[typeranklevelinitok]}
}];
initialize[type_, rank_, level_] :=
Module[{typerangeok, levelok},
If[Not[rangeok[type, rank]],
typerangeok = False;
Print["The type of algebra and the rank are not compatible!"];,
typerangeok = True;,
typerangeok = False;
Print["The type of algebra and the rank are not compatible!"];
];
If[IntegerQ[level] && level > 0,
levelok = True,
Print["The level is not a positive integer!"];
levelok = False;,
Print["The level is not a positive integer!"];
levelok = False;
];
If[typerangeok && levelok,
typerankinfo = False;
levelinfo = False;
initialize[type, rank];
initializelevel[level];
Print["The type of algebra, rank, and level are initialized, and set to ",{type, rank, level}];
If[canbenonuniform,
Print["The possible roots of unity are ",
Exp[2 Pi I "rootfactor" rootofunity/(tmax)] // TraditionalForm,
",\n\
with rootfactor an element of the set: ", rootfactorsuniform, " for the uniform cases, or \n\
with rootfactor an element of the set: ", rootfactorsnonuniform, " for the non-uniform cases. The non-uniform cases have \
an associated fractional level: ", fraclevel, "."];,
Print["The possible roots of unity are ",
Exp[2 Pi I "rootfactor" rootofunity/(tmax)] // TraditionalForm,
",\n\
with rootfactor an element of the set: ", rootfactorsuniform, " for the uniform cases.\n\
There are no non-uniform cases."];
];
typerankinfo = True;
levelinfo = True;
,
Print["No initialization was done!"];
];
];
initialize[type_, rank_, level_, rootfac_] :=
Module[{typerangeok, levelok, rootfacok, posrootfacsall, posrootfacsuniform, posrootfacsnonuniform, canbenonuniform},
If[Not[rangeok[type, rank]],
typerangeok = False;
Print["The type of algebra and the rank are not compatible!"];,
typerangeok = True;,
typerangeok = False;
Print["The type of algebra and the rank are not compatible!"];
];
If[IntegerQ[level] && level > 0,
levelok = True,
Print["The level is not a positive integer!"];
levelok = False;,
Print["The level is not a positive integer!"];
levelok = False;
];
If[typerangeok && levelok,
canbenonuniform = nonuniformpossible[type, rank, level];
posrootfacsuniform = possiblerootfactorsuniform[type, rank, level];
If[canbenonuniform,
posrootfacsnonuniform = possiblerootfactorsnonuniform[type, rank, level];,
posrootfacsnonuniform = {};
];
posrootfacsall = Union[posrootfacsuniform, posrootfacsnonuniform];
If[MemberQ[posrootfacsall, rootfac],
rootfacok = True;,
If[canbenonuniform,
Print["The rootfactor should be a member of the set ", posrootfacsuniform," for the uniform cases, or of the set ",
posrootfacsnonuniform," for the non-uniform cases. \
The non-uniform cases have an associated fractional level: ", fraclevel, "."];,
Print["The rootfactor should be a member of the set ", posrootfacsuniform," for the uniform cases. There are no non-uniform cases."];
];
rootfacok = False;,
If[canbenonuniform,
Print["The rootfactor should be a member of the set ", posrootfacsuniform," for the uniform cases, or of the set ",
posrootfacsnonuniform," for the non-uniform cases. \
The non-uniform cases have an associated fractional level: ", fraclevel, "."];,
Print["The rootfactor should be a member of the set ", posrootfacsuniform," for the uniform cases. There are no non-uniform cases."];
];
rootfacok = False;
];
];
If[typerangeok && levelok && rootfacok,
typerankinfo = False;
levelinfo = False;
rootfacinfo = False;
initialize[type, rank];
initializelevel[level];
initializerootofunity[rootfac];
typerankinfo = True;
levelinfo = True;
rootfacinfo = True;
,
Print["No initialization was done!"];
];
];
initializelz[type_, rank_, lvalue_, zvalue_]:=
Module[{typerangeok, currentlvalueok, currentzvalueok, currentlzvaluesok, lzlevel, lzrootfac},
If[Not[rangeok[type, rank]],
typerangeok = False;
Print["The type of algebra and the rank are not compatible!"];,
typerangeok = True;
,
typerangeok = False;
Print["The type of algebra and the rank are not compatible!"];
];
If[typerangeok,
If[Not[lvalueok[type, rank, lvalue]],
currentlvalueok = False;
Print["The value of l is not compatible with the type of algebra and its rank."];
lvaluespossible[type, rank];,
currentlvalueok = True;,
currentlvalueok = False;
Print["The value of l is not compatible with the type of algebra and its rank."];
lvaluespossible[type, rank];
];
];
If[typerangeok && currentlvalueok,
If[Not[zvalueok[lvalue,zvalue]],