-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathERGE.nb
5444 lines (5345 loc) · 231 KB
/
ERGE.nb
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
(* Content-type: application/vnd.wolfram.mathematica *)
(*** Wolfram Notebook File ***)
(* http://www.wolfram.com/nb *)
(* CreatedBy='Mathematica 10.1' *)
(*CacheID: 234*)
(* Internal cache information:
NotebookFileLineBreakTest
NotebookFileLineBreakTest
NotebookDataPosition[ 158, 7]
NotebookDataLength[ 236451, 5435]
NotebookOptionsPosition[ 232310, 5299]
NotebookOutlinePosition[ 232676, 5315]
CellTagsIndexPosition[ 232633, 5312]
WindowFrame->Normal*)
(* Beginning of Notebook Content *)
Notebook[{
Cell[CellGroupData[{
Cell["ERGE v2", "Title",
CellChangeTimes->{{3.6441463777826633`*^9, 3.6441463877389917`*^9}, {
3.6903007235425577`*^9, 3.690300725415166*^9}}],
Cell[CellGroupData[{
Cell["Begin", "Section",
CellChangeTimes->{{3.6441465192652607`*^9, 3.6441465209075813`*^9}}],
Cell[BoxData[{
RowBox[{
RowBox[{"BeginPackage", "[", "\"\<ERGE`\>\"", "]"}],
"\[IndentingNewLine]"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"Unprotect", "@@",
RowBox[{"Names", "[", "\"\<ERGE`*\>\"", "]"}]}], ";"}], "\n",
RowBox[{
RowBox[{
RowBox[{"ClearAll", "@@",
RowBox[{"Names", "[", "\"\<ERGE`*\>\"", "]"}]}], ";"}],
"\[IndentingNewLine]"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"$ERGEMainVersion", "=", "0"}], ";"}], "\n",
RowBox[{
RowBox[{"$ERGEVersion", "=", "2"}], ";"}], "\n",
RowBox[{
RowBox[{
RowBox[{"$ERGEBuiltVersion", "=", "1"}], ";"}],
"\[IndentingNewLine]"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"$ERGEVersionNumber", "=",
RowBox[{
RowBox[{"ToString", "@", "$ERGEMainVersion"}], "~~", "\"\<.\>\"", "~~",
RowBox[{"ToString", "@", "$ERGEVersion"}], "~~", "\"\<.\>\"", "~~",
RowBox[{"ToString", "@", "$ERGEBuiltVersion"}]}]}], ";"}],
"\[IndentingNewLine]"}], "\[IndentingNewLine]",
RowBox[{"Print", "[",
RowBox[{
"\"\<\\nERGE package loaded.\\n\\nVersion \>\"", "<>", "$ERGEVersionNumber",
"<>", "\"\<.\\n\\nCopyright (C) 2016-2017, Nils Strodthoff.\\n\>\""}],
"]"}]}], "Input",
InitializationCell->True,
CellChangeTimes->{{3.644146534779478*^9, 3.644146631017542*^9}, {
3.644147075953807*^9, 3.6441470833967247`*^9}, {3.644147136985469*^9,
3.6441471431406107`*^9}, {3.6484693783598347`*^9, 3.648469378455214*^9},
3.6495819491172333`*^9, {3.689617664186219*^9, 3.68961767242721*^9}, {
3.690071862061296*^9, 3.690071862438898*^9}, {3.6903004876719027`*^9,
3.690300487683181*^9}, {3.690302726665925*^9, 3.6903027292872477`*^9}, {
3.6912302510884447`*^9, 3.691230251258252*^9}, {3.6933477040724087`*^9,
3.693347708650476*^9}}],
Cell[BoxData[{
RowBox[{
RowBox[{
RowBox[{"doEDSE", "::", "usage"}], "=",
"\"\<Derives the symbolic DSE for a given n-point function in a specified \
theory.\nParameters:\nfields: a list of the form {{bosons},{fermions}} which \
can/ have to contain again sublists of two elements in case of fermionic \
fields/complex fields. e.g. {{phi}{{psi,psib}}} for a Yukawa theory\n\
interactions: list of interaction terms to be considered (including \
non-diagonal propagators) permutations are automatically considered e.g. \
{{phi,phi,phi},{phi,phi,phi,phi},{phi,psi,psib}} for a Yukawa theory with \
cubic and quartic bosonic interactions.\nDerivatives: specifies the npt \
function for which the flow equation should be derived e.g. {phi,phi} for a \
bosonic propagator. All derivatives are understood as left derivatives with \
the rightmost entry acting first unless DoFunInput==True\n\nOptions:\n\
DoFunOutput->True/False convert to DoFun-compatible syntax and conventions \
(op function, vertex definition)\nDoFunInput->True/False derivatives in DoFun \
compatible form (left/right derivatives for afermions/fermions; leftmost \
derivative acts first)\nBareVertices->{} allows to pass a list of bare \
vertices (by default Interactions will be used)\>\""}], ";"}], "\n",
RowBox[{
RowBox[{
RowBox[{"doEMAGIC", "::", "usage"}], "=",
"\"\<Derives a generalized DSE using the given equation (and derivatives \
of it)\nfields: a list of the form {{bosons},{fermions}} which can/ have to \
contain again sublists of two elements in case of fermionic fields/complex \
fields. e.g. {{phi}{{psi,psib}}} for a Yukawa theory\ninteractions: list of \
interaction terms to be considered (including non-diagonal propagators) \
permutations are automatically considered e.g. \
{{phi,phi,phi},{phi,phi,phi,phi},{phi,psi,psib}} for a Yukawa theory with \
cubic and quartic bosonic interactions.\nDerivatives: specifies the npt \
function for which the flow equation should be derived e.g. {phi,phi} for a \
bosonic propagator. All derivatives are understood as left derivatives with \
the rightmost entry acting first\nEqn: generating equation; append x to \
fieldnames which should be substituted by G*der+phi e.g. phi->phix\nNotation \
for Eqn: TrMMA[...], allowed symbols: field[index], fieldx[index], \
Gamma0[field1[index1],...], Der[field[index]]; use iy1,iy2,... for dummy \
indices, external indices should be denoted by i1,i2,...\n\
DOEDSE->True/False:set to true if called from doEDSE (required for DoFun \
conversion)\n\>\""}], ";"}], "\n",
RowBox[{
RowBox[{
RowBox[{
RowBox[{"doERGE", "::", "usage"}], "=",
"\"\<Derives the symbolic flow equation for a given n-point function in a \
specified theory.\nParameters:\nfields: a list of the form \
{{bosons},{fermions}} which can/ have to contain again sublists of two \
elements in case of fermionic fields/complex fields. e.g. {{phi}{{psi,psib}}} \
for a Yukawa theory\ninteractions: list of interaction terms to be considered \
(including non-diagonal propagators) permutations are automatically \
considered e.g. {{phi,phi,phi},{phi,phi,phi,phi},{phi,psi,psib}} for a Yukawa \
theory with cubic and quartic bosonic interactions.\nDerivatives: specifies \
the npt function for which the flow equation should be derived e.g. {phi,phi} \
for a bosonic propagator. All derivatives are understood as left derivatives \
with the rightmost entry acting first unless DoFunInput==True\n\nOptions:\n\
DoFunOutput->True/False convert to DoFun-compatible syntax and conventions \
(op function, vertex definition)\nDoFunInput->True/False derivatives in DoFun \
compatible form (left/right derivatives for afermions/fermions; leftmost \
derivative acts first)\nOffDiagonalRegulators->True/False takes into account \
off-diagonal regulator terms (i.e. all explicitly specified propagators via \
interaction terms)\nMasterEqn->TrMMA[dtRMMMA,etaMMMA,GMMMA]\>\""}], ";"}],
"\[IndentingNewLine]"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"DefineFieldSpecificERGE", "::", "usage"}], "=",
"\"\<Prepares ERGE for call of getAEERGE\nParameter:\nlist of fields \
(possibly with sublists of two elements for fermions/ complex bosons for \
DoFun compatibility) where every entry is expected to be of the form \
field1[mom,index1,...,indexn] e.g. \
DefineFieldSpecificERGE[{{psi[mom,color],psib[mom,color]},phi[mom,flav]}]\>\"\
"}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{
RowBox[{"getAEERGE", "::", "usage"}], "=",
"\"\<Returns algebraic expression for a given symbolic expression\n\
Parameters:\nsymbolic_eq: output of doERGE/doEDSE/doEMAGIC\nfieldlist: list \
matching that of the corresponding call used to create the corresponding \
symbolic expression; every sublist is expected to be of the form \
{field,index_in_symbolic_eq,...}, where ... denotes all explicit field \
indices specified in DefineFieldSpecificERGE for that specific field type.\n\
e.g. getAEERGE[myres,{{psi,i1,p1,a1},{psib,i2,p2,a2}}]\>\""}], ";"}],
"\[IndentingNewLine]"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"DoFunOutput", "::", "usage"}], "=", "\"\<Option in doERGE\>\""}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"DoFunInput", "::", "usage"}], "=", "\"\<Option in doERGE\>\""}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"MasterEqn", "::", "usage"}], "=", "\"\<Option in doERGE\>\""}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"OffDiagonalRegulators", "::", "usage"}], "=",
"\"\<Option in doERGE\>\""}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"SetFieldsToZero", "::", "usage"}], "=",
"\"\<Option in doEMAGIC\>\""}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"DoEDSE", "::", "usage"}], "=", "\"\<Option in doEMAGIC\>\""}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"BareVertices", "::", "usage"}], "=",
"\"\<Option in do EDSE\>\""}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"SetExplicitTrue", "::", "usage"}], "=",
"\"\<adds explicit->True to result of getAEERGE\>\""}], \
"\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"mom", "::", "usage"}], "=",
"\"\<The first argument of any field in DefineFieldSpecificERGE always has \
to be of this type\>\""}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"deltamom", "::", "usage"}], "=",
"\"\<ERGE notation for momentum deltafunction\>\""}],
"\[IndentingNewLine]"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{
RowBox[{"explicitERGE", "::", "usage"}], "=",
"\"\<explicitERGE->True appended to propagators/vertices in ERGE mode of \
getAEERGE\>\""}], ";"}], "\[IndentingNewLine]",
RowBox[{"(*",
RowBox[{
RowBox[{
RowBox[{"G", "::", "usage"}], "=", "\"\<propagator symbol in ERGE\>\""}],
";", "\[IndentingNewLine]",
RowBox[{
RowBox[{"Gamman", "::", "usage"}], "=",
"\"\<vertex symbol in ERGE\>\""}], ";", "\[IndentingNewLine]",
RowBox[{
RowBox[{"Gamma0n", "::", "usage"}], "=",
"\"\<bare vertex symbol in ERGE\>\""}], ";", "\[IndentingNewLine]",
RowBox[{
RowBox[{"dtR", "::", "usage"}], "=",
"\"\<regulator symbol in ERGE\>\""}], ";"}], "*)"}],
"\[IndentingNewLine]", "\[IndentingNewLine]"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"doERGE", "::", "firstformscriptfailed"}], "=",
"\"\<Execution of the first FORM script failed. Aborting.\>\""}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"doERGE", "::", "secondformscriptfailed"}], "=",
"\"\<Execution of the second FORM script failed. Aborting.\>\""}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"doERGE", "::", "fieldsundefinedinteractions"}], "=", " ",
"\"\<The following fields specified in the interactions list were not \
defined in the fields list: `1`. Aborting.\>\""}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"doERGE", "::", "fieldsundefinedderivatives"}], "=", " ",
"\"\<The following fields specified in the derivative list were not \
defined in the fields list: `1`. Aborting.\>\""}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"doERGE", "::", "fieldspecificationinvalid"}], "=",
"\"\<The field argument has to contain two sublists, see ?doERGE\>\""}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"doERGE", "::", "sortfields"}], "=",
"\"\<DoFunInput==True requires a derivative list sorted into fermions, \
afermions and bosons. Aborting.\>\""}],
"\[IndentingNewLine]"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"doEDSE", "::", "noderivativesspecified"}], "=",
"\"\<DoEDSE requires a non-empty derivative argument. Aborting.\>\""}],
"\[IndentingNewLine]"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"DebuggingModeERGE", "::", "usage"}], "=",
"\"\<DebuggingMode[True/False] prints extra information if set to \
true.\>\""}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{
RowBox[{"DebuggingModeERGE", "::", "badarg"}], "=",
"\"\<DebuggingMode was called with an invalid argument. Argument must be \
True or False.\>\""}], ";"}], "\[IndentingNewLine]"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{
RowBox[{"DefineFormExecutableERGE", "::", "usage"}], "=",
"\"\<DefineFormExecutable[path] sets the path the Package looks for the \
FORM executable.\n\nYou can also use tform (a parallel version of FORM) by \
evaluating \\\"DefineFormExecutable[tform -wN]\\\", where you have to replace \
N with the number of worker threads you want to use.\>\""}], ";"}],
"\[IndentingNewLine]"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{
RowBox[{"DefineFormExecutableERGE", "::", "badarg"}], "=",
"\"\<DefineFormExecutable was called with an invalid argument. Argument \
must be a string.\>\""}], ";"}],
"\[IndentingNewLine]"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{
RowBox[{"DefineFormExecutableERGE", "::", "formnotfound"}], "=",
"\"\<The specified FORM executable could not be found.\>\""}], ";"}],
"\[IndentingNewLine]"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{
RowBox[{"DefineFormExecutableERGE", "::", "cygwin"}], "=",
"\"\<FORM exited with error code -1073741515. This hints at a problem \
with your Cygwin installation.\>\""}], ";"}],
"\[IndentingNewLine]"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"ERGE", "::", "directorynotfound"}], "=",
"\"\<The package could not locate the package folder in your Applications \
folder.\>\""}], ";"}]}], "Input",
InitializationCell->True,
CellChangeTimes->CompressedData["
1:eJxTTMoPSmViYGCQBmIQ7fYn/f2SxteOfHsvgOkV2/9/BtF3OYS/gGjRgtsn
vwLpH1Ump0B07ztXjW9Aes+Lp2BahzXSHERXn2m3AdF6jG8ivwPp0HbOWBC9
apWfR0PLa8ewHZO8QLTNnYwKED3ls3UniN6kzMTSCKST41vUQfQa8/bui0B6
l8fMXhDNxKd8FUSLM127D6K/ehalXAbSTWsYMkD0rv6Jk66A9NULzwPRVjfn
Nh5rB+qTl24D0Z1LfwQYdQPdZX07EET7C90JA9FBX7LDQXR6Xx17BpDmsGwG
01NYg08b9rx2LPogcg9EL1tW+t0USHMu/cBgBqQPlAgagugt60rA9MRV8Ykp
QPrl3z+pINrG18Cku++1o5lukzmI9vS+vOLZhteOXjzH1oDo3toLO0G0W9y/
YyDa/OKT0yD6eHH9PRCdG9bxCET/U2N9DqJfu894DaKnya/+AqIBnaLrzw==
"]],
Cell[BoxData[
RowBox[{
RowBox[{"Begin", "[", "\"\<`Private`\>\"", "]"}], ";"}]], "Input",
InitializationCell->True]
}, Open ]],
Cell[CellGroupData[{
Cell["Options and Definitions", "Section",
CellChangeTimes->{{3.6897168802773743`*^9, 3.689716888636754*^9}}],
Cell[BoxData[{
RowBox[{
RowBox[{
RowBox[{"packageName", "=", "\"\<ERGE\>\""}], ";"}], "\n",
RowBox[{"(*",
RowBox[{"determine", " ", "the", " ", "FormTracer", " ", "directory"}],
"*)"}]}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"packageDirectory", "=", " ",
RowBox[{"If", "[",
RowBox[{
RowBox[{"DirectoryQ", "[",
RowBox[{"FileNameJoin", "[",
RowBox[{"{",
RowBox[{
"$UserBaseDirectory", ",", "\"\<Applications\>\"", ",",
"packageName"}], "}"}], "]"}], "]"}], ",", "\[IndentingNewLine]",
RowBox[{"(*",
RowBox[{
"installed", " ", "in", " ", "the", " ", "user", " ", "directory"}],
"*)"}], "\[IndentingNewLine]",
RowBox[{"FileNameJoin", "[",
RowBox[{"{",
RowBox[{
"$UserBaseDirectory", ",", "\"\<Applications\>\"", ",",
"packageName"}], "}"}], "]"}], ",", "\[IndentingNewLine]",
RowBox[{"If", "[",
RowBox[{
RowBox[{"DirectoryQ", "[",
RowBox[{"FileNameJoin", "[",
RowBox[{"{",
RowBox[{
"$BaseDirectory", ",", "\"\<Applications\>\"", ",", "packageName"}],
"}"}], "]"}], "]"}], ",", "\[IndentingNewLine]",
RowBox[{"(*",
RowBox[{"installed", " ", "systemwide"}], "*)"}],
"\[IndentingNewLine]",
RowBox[{"FileNameJoin", "[",
RowBox[{"{",
RowBox[{
"$BaseDirectory", ",", "\"\<Applications\>\"", ",", "packageName"}],
"}"}], "]"}], ",", "\[IndentingNewLine]",
RowBox[{"(*",
RowBox[{
RowBox[{"Message", "[",
RowBox[{"ERGE", "::", "directorynotfound"}], "]"}], ";"}], "*)"}],
"\[IndentingNewLine]",
RowBox[{"FileNameJoin", "[",
RowBox[{"{",
RowBox[{
"$UserBaseDirectory", ",", "\"\<Applications\>\"", ",",
"packageName"}], "}"}], "]"}]}], "\[IndentingNewLine]", "]"}]}],
"\[IndentingNewLine]", "]"}]}], ";"}], "\n",
RowBox[{
RowBox[{"defaultFormExecutables", "=",
RowBox[{"{", "\[IndentingNewLine]",
RowBox[{
RowBox[{"FileNameJoin", "[",
RowBox[{"{",
RowBox[{"packageDirectory", ",",
RowBox[{"If", "[",
RowBox[{
RowBox[{"$OperatingSystem", "===", "\"\<Windows\>\""}], ",",
"\"\<form.exe\>\"", ",", "\"\<form\>\""}], "]"}]}], "}"}], "]"}],
RowBox[{"(*",
RowBox[{
"has", " ", "to", " ", "be", " ", "the", " ", "first", " ", "entry",
" ", "due", " ", "to", " ", "InstallFORM"}], "*)"}], ",",
"\[IndentingNewLine]", "\"\<form\>\"", ",",
RowBox[{"(*",
RowBox[{
"should", " ", "work", " ", "if", " ", "form", " ", "lies", " ", "in",
" ", "any", " ", "executable", " ", "path"}], "*)"}],
"\[IndentingNewLine]",
RowBox[{"FileNameJoin", "[",
RowBox[{"{",
RowBox[{
"$PathnameSeparator", ",", "\"\<usr\>\"", ",", "\"\<bin\>\"", ",",
"\"\<form\>\""}], "}"}], "]"}], ",", "\[IndentingNewLine]",
RowBox[{"FileNameJoin", "[",
RowBox[{"{",
RowBox[{
"$PathnameSeparator", ",", "\"\<usr\>\"", ",", "\"\<local\>\"", ",",
"\"\<bin\>\"", ",", "\"\<form\>\""}], "}"}], "]"}], ",",
"\[IndentingNewLine]",
RowBox[{"FileNameJoin", "[",
RowBox[{"{",
RowBox[{
"$PathnameSeparator", ",", "\"\<opt\>\"", ",", "\"\<bin\>\"", ",",
"\"\<form\>\""}], "}"}], "]"}], ",", "\[IndentingNewLine]",
RowBox[{"FileNameJoin", "[",
RowBox[{"Flatten", "@",
RowBox[{"{",
RowBox[{
"$UserBaseDirectory", ",", "\"\<Applications\>\"", ",",
"\"\<FormLink\>\"", ",", "\"\<bin\>\"", ",",
RowBox[{"Switch", "[",
RowBox[{"$OperatingSystem", ",", "\"\<Unix\>\"", ",",
RowBox[{"{",
RowBox[{"\"\<linux64\>\"", ",", "\"\<form\>\""}], "}"}], ",",
"\"\<MacOSX\>\"", ",",
RowBox[{"{",
RowBox[{"\"\<macosx64\>\"", ",", "\"\<form\>\""}], "}"}], ",",
"\"\<Windows\>\"", ",",
RowBox[{"{",
RowBox[{"\"\<windows\>\"", ",", "\"\<form.exe\>\""}], "}"}]}],
"]"}]}], "}"}]}], "]"}]}], "\[IndentingNewLine]", "}"}]}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"formExecutable", "=", "\"\<\>\""}], ";"}],
RowBox[{"(*", " ",
RowBox[{
RowBox[{"is", " ", "set", " ", "automatically", " ", "below"}], ",", " ",
RowBox[{"can", " ", "be", " ", "changed", " ", "by", " ",
RowBox[{"DefineFormExecutable", "[", "path", "]"}]}]}], "*)"}],
" "}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"formChecked", "=", "False"}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"formInfo", "=", "\"\<\>\""}], ";"}], "\n",
RowBox[{
RowBox[{"debuggingMode", "=", "False"}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"cacheFilesDirectory", "=", "\"\<ERGECache\>\""}], ";"}], "\n",
RowBox[{
RowBox[{
RowBox[{"DebuggingModeERGE", "[",
RowBox[{"yesno_", "/;",
RowBox[{"BooleanQ", "[", "yesno", "]"}]}], "]"}], ":=",
RowBox[{"Module", "[",
RowBox[{
RowBox[{"{", "}"}], ",", "\[IndentingNewLine]",
RowBox[{
RowBox[{"debuggingMode", "=", "yesno"}], ";", "\[IndentingNewLine]",
RowBox[{"Print", "[",
RowBox[{"\"\<Debugging mode \>\"", "<>",
RowBox[{"If", "[",
RowBox[{
"debuggingMode", ",", "\"\<enabled\>\"", ",", "\"\<disabled\>\""}],
"]"}], "<>", "\"\<.\>\""}], "]"}], ";"}]}], "\[IndentingNewLine]",
"]"}]}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{
RowBox[{"DebuggingModeERGE", "[", "___", "]"}], ":=",
RowBox[{"Message", "[",
RowBox[{"DebuggingModeERGE", "::", "badarg"}], "]"}]}], ";"}],
"\[IndentingNewLine]"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{
RowBox[{"checkFormExecutable", "[",
RowBox[{"quietMode_:", "False"}], "]"}], ":=",
RowBox[{"Module", "[",
RowBox[{
RowBox[{"{",
RowBox[{
"formProcessResult", ",", "formResponse", ",", "formExitCode"}], "}"}],
",", "\[IndentingNewLine]",
RowBox[{"(*",
RowBox[{
RowBox[{"Don", "'"}], "t", " ", "check", " ", "whether", " ", "FORM",
" ", "works", " ", "if", " ", "it", " ", "was", " ", "already", " ",
RowBox[{"checked", "."}]}], "*)"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"If", "[",
RowBox[{"formChecked", ",",
RowBox[{"Return", "[", "True",
RowBox[{"(*",
RowBox[{"=", "formChecked"}], "*)"}], "]"}]}], "]"}], ";",
"\[IndentingNewLine]",
RowBox[{"(*",
RowBox[{"Check", " ", "if", " ", "FORM", " ", "works"}], "*)"}],
"\[IndentingNewLine]",
RowBox[{"formProcessResult", "=",
RowBox[{"Quiet", "[",
RowBox[{"RunProcess", "[",
RowBox[{"{",
RowBox[{"formExecutable", ",", "\"\<-v\>\""}], "}"}], "]"}],
"]"}]}], ";", "\[IndentingNewLine]",
RowBox[{"formResponse", "=",
RowBox[{"formProcessResult", "[", "\"\<StandardOutput\>\"", "]"}]}],
";", "\[IndentingNewLine]",
RowBox[{"formExitCode", "=",
RowBox[{"formProcessResult", "[", "\"\<ExitCode\>\"", "]"}]}], ";",
"\[IndentingNewLine]",
RowBox[{"formChecked", "=",
RowBox[{"formExitCode", "===", "0"}]}], ";", "\[IndentingNewLine]",
RowBox[{"If", "[",
RowBox[{"formChecked", ",", "\[IndentingNewLine]",
RowBox[{
RowBox[{"formInfo", "=",
RowBox[{"StringTrim", "[",
RowBox[{"StringJoin", "[",
RowBox[{"Select", "[",
RowBox[{
RowBox[{"StringSplit", "[",
RowBox[{"formResponse", ",", "EndOfLine"}], "]"}], ",",
RowBox[{
RowBox[{"Not", "@",
RowBox[{"StringContainsQ", "[",
RowBox[{"#", ",", "\"\<out of\>\""}], "]"}]}], "&"}]}],
"]"}], "]"}], "]"}]}], ";"}], ",", "\[IndentingNewLine]",
RowBox[{
RowBox[{"formInfo", "=", "\"\<\>\""}], ";", "\[IndentingNewLine]",
RowBox[{"If", "[",
RowBox[{
RowBox[{"Not", "[", "quietMode", "]"}], ",",
"\[IndentingNewLine]",
RowBox[{
RowBox[{"Message", "[",
RowBox[{"DefineFormExecutableERGE", "::", "formnotfound"}],
"]"}], ";", "\[IndentingNewLine]",
RowBox[{"If", "[",
RowBox[{
RowBox[{
RowBox[{"formExitCode", "===",
RowBox[{"-", "1073741515"}]}], "&&",
RowBox[{"$OperatingSystem", "===", "\"\<Windows\>\""}]}], ",",
RowBox[{
RowBox[{"Message", "[",
RowBox[{"DefineFormExecutableERGE", "::", "cygwin"}], "]"}],
";"}]}], "]"}], ";"}]}], "\[IndentingNewLine]", "]"}],
";"}]}], "\[IndentingNewLine]", "]"}], ";", "\[IndentingNewLine]",
RowBox[{"Return", "[", "formChecked", "]"}], ";"}]}],
"\[IndentingNewLine]", "]"}]}], ";"}], "\[IndentingNewLine]",
"\[IndentingNewLine]",
RowBox[{"(*",
RowBox[{
"try", " ", "to", " ", "find", " ", "the", " ", "FORM", " ", "executable",
" ", "trying", " ", "all", " ", "commands", " ", "in", " ",
"defaultFormExecutables"}], " ", "*)"}]}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"If", "[",
RowBox[{
RowBox[{
RowBox[{"Catch", "[",
RowBox[{"Do", "[", "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"formExecutable", "=", "tmpFormExecutable"}], ";",
"\[IndentingNewLine]",
RowBox[{"If", "[",
RowBox[{
RowBox[{"checkFormExecutable", "[", "True", "]"}], ",",
RowBox[{"Throw", "[", "$Success", "]"}]}], "]"}]}],
"\[IndentingNewLine]", ",",
RowBox[{"{",
RowBox[{"tmpFormExecutable", ",", "defaultFormExecutables"}],
"}"}]}], "]"}], "]"}], "===", "$Success"}], ",",
"\[IndentingNewLine]",
RowBox[{
RowBox[{"Print", "[",
RowBox[{"\"\<Using \>\"", "<>", "formInfo", "<>", "\"\<.\>\""}], "]"}],
";"}], ",", "\[IndentingNewLine]",
RowBox[{
RowBox[{"Print", "[",
RowBox[{
"packageName", "<>",
"\"\< could not locate the FORM executable. Please install FORM via \
InstallFORM[].\nIf FORM is installed on your system, use \
DefineFormExecutableERGE[pathToExecutable] to specify the path. \nYou may \
also obtain FORM at http://www.nikhef.nl/~form or from \
https://github.com/vermaseren/form.\>\""}], "]"}], ";"}]}],
"\[IndentingNewLine]", "]"}], ";"}],
"\[IndentingNewLine]"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"DefineFormExecutableERGE", "[", "path_String", "]"}], ":=",
RowBox[{"Module", "[",
RowBox[{
RowBox[{"{", "}"}], ",", "\[IndentingNewLine]",
RowBox[{
RowBox[{"formExecutable", "=", "path"}], ";", "\[IndentingNewLine]",
RowBox[{"formChecked", "=", "False"}], ";", "\[IndentingNewLine]",
RowBox[{"If", "[",
RowBox[{
RowBox[{"checkFormExecutable", "[", "]"}], ",",
RowBox[{
RowBox[{"Print", "[", "formInfo", "]"}], ";"}]}], "]"}], ";"}]}],
"\[IndentingNewLine]", "]"}]}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{
RowBox[{"DefineFormExecutableERGE", "[", "___", "]"}], ":=",
RowBox[{"Message", "[",
RowBox[{"DefineFormExecutableERGE", "::", "badarg"}], "]"}]}], ";"}],
"\[IndentingNewLine]",
RowBox[{"(*",
RowBox[{"global", " ", "switch", " ", "to", " ", "order", " ",
RowBox[{"fermions", "/", "afermions"}], " ", "in", " ", "alphabetical",
" ", "order", " ", "for", " ", "DoFun", " ", "Plotting"}],
"*)"}]}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"reorderfermionic", "=", "True"}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"ERGEfieldsspecific", "=",
RowBox[{"{", "}"}]}], ";"}]}], "Input",
InitializationCell->True,
CellChangeTimes->{{3.690070816725325*^9, 3.690070847163357*^9},
3.690071036135392*^9, {3.690071077191691*^9, 3.690071096390129*^9}, {
3.69007257281669*^9, 3.6900725797246532`*^9}, {3.690300487640608*^9,
3.690300505494659*^9}, {3.690324843034074*^9, 3.6903248630092173`*^9}, {
3.69032513519243*^9, 3.6903251673967247`*^9}, {3.690325220402336*^9,
3.69032522122747*^9}, {3.690585211533283*^9, 3.690585242254902*^9}, {
3.690585312667243*^9, 3.6905853130692387`*^9}, {3.690866766491126*^9,
3.690866767520431*^9}, {3.690866905115726*^9, 3.6908669063872538`*^9}, {
3.696857518114759*^9, 3.696857526588202*^9}}]
}, Closed]],
Cell[CellGroupData[{
Cell["Aux. Functions", "Section",
InitializationCell->True,
CellChangeTimes->{{3.689382388775502*^9, 3.689382396695014*^9}}],
Cell[CellGroupData[{
Cell["Misc", "Subsection",
CellChangeTimes->{{3.690072145159528*^9, 3.690072151443429*^9}}],
Cell[BoxData[
RowBox[{
RowBox[{
RowBox[{"stringListJoin", "[", "x_", "]"}], ":=",
RowBox[{"Riffle", "[",
RowBox[{
RowBox[{
RowBox[{
RowBox[{"ToString", "[", "#", "]"}], "&"}], "/@", "x"}], ",",
"\"\<,\>\""}], "]"}]}], ";"}]], "Input",
InitializationCell->True,
CellChangeTimes->{{3.6893646523818913`*^9, 3.68936471046065*^9},
3.690071981570284*^9}],
Cell[BoxData[
RowBox[{
RowBox[{
RowBox[{"countinteraction", "[",
RowBox[{"x_", ",", "fields_"}], "]"}], ":=",
RowBox[{
RowBox[{
RowBox[{"Count", "[",
RowBox[{"x", ",", "#"}], "]"}], "&"}], "/@", "fields"}]}],
";"}]], "Input",
InitializationCell->True,
CellChangeTimes->{{3.689456629354731*^9, 3.6894566305137777`*^9}, {
3.689521099347069*^9, 3.689521101778482*^9}, {3.689521195327681*^9,
3.689521206512519*^9}, {3.689521317922287*^9, 3.6895213291654987`*^9}, {
3.689521393990493*^9, 3.689521394307295*^9}}],
Cell[BoxData[
RowBox[{
RowBox[{
RowBox[{"countinteractions", "[",
RowBox[{"interactions_", ",", "fields_"}], "]"}], ":=",
RowBox[{"DeleteDuplicates", "[",
RowBox[{
RowBox[{
RowBox[{"countinteraction", "[",
RowBox[{"#", ",", "fields"}], "]"}], "&"}], "/@", "interactions"}],
"]"}]}], ";"}]], "Input",
InitializationCell->True,
CellChangeTimes->{{3.689521322324151*^9, 3.689521398732688*^9}, {
3.6920008853838387`*^9, 3.692000891634438*^9}}],
Cell[BoxData[
RowBox[{
RowBox[{
RowBox[{"selectinteractionspre", "[", "x_", "]"}], ":=",
RowBox[{"DeleteDuplicates", "[",
RowBox[{"Subsets", "[",
RowBox[{"x", ",",
RowBox[{"{",
RowBox[{
RowBox[{"Length", "[", "x", "]"}], "-", "2"}], "}"}]}], "]"}],
"]"}]}], ";"}]], "Input",
InitializationCell->True,
CellChangeTimes->{
3.693349800140279*^9, {3.6936016259505873`*^9, 3.6936016503014917`*^9}}],
Cell[BoxData[
RowBox[{
RowBox[{
RowBox[{"selectallprops", "[", "x_", "]"}], ":=",
RowBox[{"Module", "[",
RowBox[{
RowBox[{"{", "tmp", "}"}], ",",
RowBox[{
RowBox[{"tmp", "=",
RowBox[{"Subsets", "[",
RowBox[{"x", ",",
RowBox[{"{", "2", "}"}]}], "]"}]}], ";", " ",
RowBox[{"Union", "[",
RowBox[{"tmp", ",",
RowBox[{
RowBox[{
RowBox[{"{",
RowBox[{
RowBox[{"#", "[",
RowBox[{"[", "2", "]"}], "]"}], ",",
RowBox[{"#", "[",
RowBox[{"[", "1", "]"}], "]"}]}], "}"}], "&"}], "/@", "tmp"}]}],
"]"}]}]}], "]"}]}], ";", " ",
RowBox[{"(*",
RowBox[{
"all", " ", "props", " ", "that", " ", "might", " ", "lead", " ", "to",
" ", "valid", " ", "vertices", " ", "after", " ", "derivative"}],
"*)"}]}]], "Input",
InitializationCell->True,
CellChangeTimes->{{3.69360256902836*^9, 3.693602641359857*^9},
3.693602684071261*^9, {3.6936027367137127`*^9, 3.693602754238346*^9}, {
3.693603222960044*^9, 3.693603248444377*^9}}]
}, Closed]],
Cell[CellGroupData[{
Cell["Generating FORM snippets", "Subsection",
CellChangeTimes->{{3.690301566129188*^9, 3.690301573842801*^9}}],
Cell[BoxData[
RowBox[{
RowBox[{"setpropagatorstozero", "[", "x_", "]"}], ":=",
RowBox[{"\"\<id G(\>\"", "<>",
RowBox[{"ToString", "[",
RowBox[{"x", "[",
RowBox[{"[", "1", "]"}], "]"}], "]"}], "<>", "\"\<(ix1?),\>\"", "<>",
RowBox[{"ToString", "[",
RowBox[{"x", "[",
RowBox[{"[", "2", "]"}], "]"}], "]"}], "<>",
"\"\<(ix2?))=0;\>\""}]}]], "Input",
InitializationCell->True,
CellChangeTimes->{{3.693602078565452*^9, 3.693602162717557*^9}, {
3.693603831259015*^9, 3.6936038314775133`*^9}}],
Cell[BoxData[
RowBox[{
RowBox[{
RowBox[{"converttoformstring", "[", "x_", "]"}], ":=",
RowBox[{"StringReplace", "[",
RowBox[{
RowBox[{"ExportString", "[",
RowBox[{
RowBox[{
RowBox[{"x", "/.",
RowBox[{
RowBox[{"TrMMA", "[", "a__", "]"}], "\[Rule]",
RowBox[{"Global`TrMMA", "[", "a", "]"}]}]}], "/.",
RowBox[{
RowBox[{"Gamma0", "[", "a__", "]"}], "\[Rule]",
RowBox[{"Global`Gamma0", "[", "a", "]"}]}]}], ",", "\"\<Text\>\""}],
"]"}], ",",
RowBox[{"{",
RowBox[{
RowBox[{"\"\<[\>\"", "\[Rule]", "\"\<(\>\""}], ",",
RowBox[{"\"\<]\>\"", "\[Rule]", "\"\<)\>\""}], ",",
RowBox[{"\"\<MMA\>\"", "\[Rule]", "\"\<\>\""}]}], "}"}]}], "]"}]}],
";"}]], "Input",
InitializationCell->True,
CellChangeTimes->{{3.693344789179654*^9, 3.6933448023552113`*^9},
3.693344833717636*^9}],
Cell[BoxData[
RowBox[{
RowBox[{
RowBox[{"derivativestring", "[", "x_", "]"}], ":=",
RowBox[{
RowBox[{"If", "[",
RowBox[{
RowBox[{
RowBox[{"x", "[",
RowBox[{"[", "2", "]"}], "]"}], "\[Equal]",
RowBox[{"-", "1"}]}], ",", "\"\<-\>\"", ",", "\"\<\>\""}], "]"}], "<>",
RowBox[{"StringJoin", "[",
RowBox[{
RowBox[{
RowBox[{"\"\<Der(\>\"", "<>",
RowBox[{"ToString", "[",
RowBox[{"Head", "[", "#", "]"}], "]"}], "<>", "\"\<(i\>\"", "<>",
RowBox[{"ToString", "[",
RowBox[{"#", "[",
RowBox[{"[", "1", "]"}], "]"}], "]"}], "<>", "\"\<))*\>\""}], "&"}],
"/@",
RowBox[{"x", "[",
RowBox[{"[", "1", "]"}], "]"}]}], "]"}]}]}], ";"}]], "Input",
InitializationCell->True,
CellChangeTimes->{{3.689363824675486*^9, 3.6893638523967733`*^9}, {
3.689363890396262*^9, 3.689364011879468*^9}, {3.689364070028269*^9,
3.6893643377239323`*^9}, {3.689364381957472*^9, 3.689364413625211*^9},
3.689365249107869*^9, 3.6893654776455097`*^9, 3.690072002355476*^9, {
3.690300255783826*^9, 3.6903002597436953`*^9}, {3.691220983687469*^9,
3.691221045399911*^9}}],
Cell[BoxData[
RowBox[{
RowBox[{
RowBox[{"fieldargsymasymstring", "[",
RowBox[{"bosons_", ",", "fermions_"}], "]"}], ":=",
RowBox[{"\"\<Function \>\"", "<>",
RowBox[{"StringJoin", "[",
RowBox[{"Riffle", "[",
RowBox[{
RowBox[{"Join", "[",
RowBox[{
RowBox[{"Table", "[",
RowBox[{
RowBox[{
RowBox[{"ToString", "[",
RowBox[{"bosons", "[",
RowBox[{"[", "i", "]"}], "]"}], "]"}], "<>",
"\"\<arg(symmetric)\>\""}], ",",
RowBox[{"{",
RowBox[{"i", ",",
RowBox[{"Length", "[", "bosons", "]"}]}], "}"}]}], "]"}], ",",
RowBox[{"Table", "[",
RowBox[{
RowBox[{
RowBox[{"ToString", "[",
RowBox[{"fermions", "[",
RowBox[{"[", "i", "]"}], "]"}], "]"}], "<>",
"\"\<arg(antisymmetric)\>\""}], ",",
RowBox[{"{",
RowBox[{"i", ",",
RowBox[{"Length", "[", "fermions", "]"}]}], "}"}]}], "]"}]}],
"]"}], ",", "\"\<,\>\""}], "]"}], "]"}]}]}], ";"}]], "Input",
InitializationCell->True,
CellChangeTimes->{{3.689363824675486*^9, 3.6893638523967733`*^9}, {
3.689363890396262*^9, 3.689364011879468*^9}, {3.689364070028269*^9,
3.6893643377239323`*^9}, {3.689364381957472*^9, 3.689364413625211*^9},
3.689365249107869*^9, 3.6893654776455097`*^9, 3.690072002355476*^9}],
Cell[BoxData[
RowBox[{
RowBox[{
RowBox[{"gammakeepstring", "[",
RowBox[{"x_", ",", "y_"}], "]"}], ":=",
RowBox[{"\"\<id Gammakeep(\>\"", "<>",
RowBox[{"StringJoin", "[",
RowBox[{"Riffle", "[",
RowBox[{
RowBox[{"Table", "[",
RowBox[{
RowBox[{
RowBox[{"ToString", "[",
RowBox[{"x", "[",
RowBox[{"[", "i", "]"}], "]"}], "]"}], "<>", "\"\<(i\>\"", "<>",
RowBox[{"ToString", "[", "i", "]"}], "<>", "\"\<?)\>\""}], ",",
RowBox[{"{",
RowBox[{"i", ",",
RowBox[{"Length", "[", "x", "]"}]}], "}"}]}], "]"}], ",",
"\"\<,\>\""}], "]"}], "]"}], "<>", "\"\<)=\>\"", "<>",
RowBox[{"ToString", "[", "y", "]"}], "<>", "\"\<;\\n\>\""}]}],
";"}]], "Input",
InitializationCell->True,
CellChangeTimes->{{3.6893661939172163`*^9, 3.6893662536309013`*^9}, {
3.689366302685708*^9, 3.6893663083782377`*^9}, {3.6893663410466223`*^9,
3.6893664021861*^9}, {3.6893664408797703`*^9, 3.6893664818171177`*^9}, {
3.689366611252306*^9, 3.689366632031674*^9}, {3.689366998374083*^9,
3.689366998515656*^9}}],
Cell[BoxData[
RowBox[{
RowBox[{"xreplacement", "[",
RowBox[{"fieldindex_", ",", "props_", ",", "fields_"}], "]"}], ":=",
RowBox[{"\"\<id once \>\"", "<>",
RowBox[{"ToString", "[",
RowBox[{"fields", "[",
RowBox[{"[", "fieldindex", "]"}], "]"}], "]"}], "<>", "\"\<x(ix0?)=\>\"",
"<>",
RowBox[{"StringJoin", "@@",
RowBox[{"Riffle", "[",
RowBox[{
RowBox[{
RowBox[{
RowBox[{"\"\<G(\>\"", "<>",
RowBox[{"ToString", "[",
RowBox[{"#", "[",
RowBox[{"[", "1", "]"}], "]"}], "]"}], "<>", "\"\<(ix0),\>\"", "<>",
RowBox[{"ToString", "[",
RowBox[{"#", "[",
RowBox[{"[", "2", "]"}], "]"}], "]"}], "<>", "\"\<(ix\>\"", "<>",
RowBox[{"ToString", "[", "fieldindex", "]"}], "<>",
"\"\<))*Der(\>\"", "<>",
RowBox[{"ToString", "[",
RowBox[{"#", "[",
RowBox[{"[", "2", "]"}], "]"}], "]"}], "<>", "\"\<(ix\>\"", "<>",
RowBox[{"ToString", "[", "fieldindex", "]"}], "<>", "\"\<))\>\""}],
" ", "&"}], "/@",
RowBox[{"Select", "[",
RowBox[{"props", ",",
RowBox[{
RowBox[{
RowBox[{"#", "[",
RowBox[{"[", "1", "]"}], "]"}], "\[Equal]",
RowBox[{"fields", "[",
RowBox[{"[", "fieldindex", "]"}], "]"}]}], "&"}]}], "]"}]}], ",",
"\"\<+\>\""}], "]"}]}], "<>", "\"\<+\>\"", "<>",
RowBox[{"ToString", "[",
RowBox[{"fields", "[",
RowBox[{"[", "fieldindex", "]"}], "]"}], "]"}], "<>",
"\"\<(ix0);\\nSum ix\>\"", "<>",
RowBox[{"ToString", "[", "fieldindex", "]"}], "<>",
"\"\<;\>\""}]}]], "Input",
InitializationCell->True,
CellChangeTimes->{{3.691850219613962*^9, 3.6918502582538757`*^9}, {
3.691850315620079*^9, 3.691850363347383*^9}, {3.691850443715157*^9,
3.691850475873003*^9}, {3.691850730560006*^9, 3.691850847526682*^9}, {
3.691850882053104*^9, 3.6918509796799917`*^9}, {3.691851232575061*^9,
3.691851304653159*^9}, {3.691851458815277*^9, 3.691851463738166*^9}, {
3.6918515643773127`*^9, 3.691851591464703*^9}, {3.691851647841386*^9,
3.691851674905223*^9}, {3.6918517568591423`*^9, 3.69185191319589*^9}, {
3.691852008956193*^9, 3.691852058858082*^9}, {3.691852098835182*^9,
3.691852149126059*^9}, {3.691852232224806*^9, 3.6918522986788816`*^9}, {
3.691852352048955*^9, 3.691852428453517*^9}, {3.69185270587811*^9,
3.691852706037561*^9}, {3.692715859181848*^9, 3.692715865818644*^9},
3.6927159167897463`*^9, {3.6927159469031773`*^9, 3.692715990276312*^9},
3.6927182699981728`*^9}]
}, Closed]],
Cell[CellGroupData[{
Cell["Generating Matrices", "Subsection",
CellChangeTimes->{{3.69007207013843*^9, 3.690072089770173*^9}}],
Cell[BoxData[{
RowBox[{
RowBox[{
RowBox[{
RowBox[{"GMtr", "[",
RowBox[{
"i1_", ",", "i2_", ",", "fields_", ",", "props_", ",", "name_", ",",
"trindex_"}], "]"}], ":=",
RowBox[{"Table", "[",
RowBox[{
RowBox[{"If", "[",
RowBox[{
RowBox[{"MemberQ", "[",
RowBox[{"props", ",",
RowBox[{"{",
RowBox[{
RowBox[{"fields", "[",
RowBox[{"[", "i", "]"}], "]"}], ",",
RowBox[{"fields", "[",
RowBox[{"[", "j", "]"}], "]"}]}], "}"}]}], "]"}], ",",
RowBox[{"name", "[",
RowBox[{"trindex", ",",
RowBox[{
RowBox[{"fields", "[",
RowBox[{"[", "i", "]"}], "]"}], "[", "i1", "]"}], ",",
RowBox[{
RowBox[{"fields", "[",
RowBox[{"[", "j", "]"}], "]"}], "[", "i2", "]"}]}], "]"}], ",",
"0"}], "]"}], ",",
RowBox[{"{",
RowBox[{"i", ",", "1", ",",
RowBox[{"Length", "[", "fields", "]"}]}], "}"}], ",",
RowBox[{"{",
RowBox[{"j", ",", "1", ",",
RowBox[{"Length", "[", "fields", "]"}]}], "}"}]}], "]"}]}], ";"}],
"\[IndentingNewLine]"}], "\n",
RowBox[{
RowBox[{
RowBox[{
RowBox[{"GLtr", "[",
RowBox[{
"i1_", ",", "i2_", ",", "field1_", ",", "fields_", ",", "props_", ",",
"name_", ",", "trindex_"}], "]"}], ":=",
RowBox[{"Table", "[",
RowBox[{