-
Notifications
You must be signed in to change notification settings - Fork 1
/
Integrals.m
2435 lines (1623 loc) · 87.2 KB
/
Integrals.m
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:: *)
BeginPackage["Integrals`",{"Fermions`"}]
Unprotect["Integrals`*"];
IntegralsInfo[] := (
Print[" \n Integrals is a package that can perform two dimensional Tensor reduction for up to 4 free lorentzindices, it can perform onedimensional Tensor reduction for up to 8 free indicices. It can integrate integrals with integrands of the form 1/(q1^2-m1^2)^a(q2^2-m2^2)^b(q1+q2)^c."];
Print["\n Available commands:"];
Print[" (For any of these commands '?command' should help.)\n"];
Print[Names["Integrals`*"]]);
(* Note also that we use the convention 'd = 4 -2eps', where d is the space-time dimension. *)
(************************ USAGE ***************************)
(******************Headers of MasterTwo*********************************)
AD::usage="AD is the header of a list of propagators. For two-loop integrals it is the header of factorising one-loop integrals after the usage of SimplifyPropagator."
den::usage="is the header of a propagator. den[q1,m1] corresponds ...
to 1/(Scal[q1,q1]-m1^2)."
G::usage="G is the header of a list of propagators for two-loop ...
integrals with one vanishing mass. G[i[M1,q1],i[M2,a2],i[0,a3]] corresponds to
1/((q1^-M1^2)^a1(q2^-M2^2)^a2(q1+q2)^a3) with at least one mass in the propagators 0 and q1 and q2 being loop momenta being declared with DeclareLooopMomentum."
i::usage="i is the header of propagators in a list of propagators of the form G[i[M1,q1],i[M2,a2],i[0,a3]] corresponding to 1/(q1^-M1^2)^a1(q2^-M2^2)^a2((q1+q2))^a3] with at least one mass in the propagators 0 and q1 and q2 being loop momenta being declared with DeclareLooopMomentum."
Ne::usage="Header of prefactors of the form Ne[m]=(mu^2 /m ^2)^eps 2 ^{2 eps}\pi^ eps \Gamma(1+eps) as defined in hep-ph/9910220."
N2::usage="Header of prefactors of the form N2[m]=Ne[m]^2=(mu^{2} /m ^{2})^{2eps} 2 ^{4 eps}\pi^{2 eps} \ Gamma(1+eps)^2 as defined in hep-ph/9910220."
log::usage="Abbreviation for natural Logarithms Log to prevent Magthematica to simplify expressions containg log"
PoLi2::usaage="PoLi2[x] is the header of the polilogarithm ...
Li_2(x)=\integral_0^1 \f {\ln (t)} {t-1/x}dt. Its definition corresponds to the Mathematica-Function PolyLog[2,x] of the function x."
ClausenCl2::usage =
"ClausenCl2[x] corresponds to the Mathematica-function
ClausenCl[2,x]. Introduced to prevent Mathematica from ...
further simplications. "
ClausenCl::usage =
"ClausenCl[n,x] gives the Clausen function of order n."
SUNT::usage="SUNT is the header of the colour generator of SU(3)_c,SUNT[a,i,j] stands for T^a_{ij}SUNT[a,b] stands
for the product of the colour generators T^a T^b. "
SUNF::usage="SUNF is the header of the structure. SUNF[a,b,c] stands for f_{a b c}."
scalstructure::usage=""
scalerule::usage=""
fc::usage=""
denrule::usage=""
denruleback::usage=""
xrule::usage=""
colorrules::usage=""
deletprop::usage=""
Deletprop::usage=""
delet::usage=""
forwardpower::usage=""
middlepower::usage=""
backpower::usage=""
power::usage=""
subrule::usage=""
FinalPart::usage=""
Denrule::usage=""
DenruleOneBack::usage=""
DenruleOne::usage=""
SimplifyPropagator::usage="Brings propagators of integrands to the form needed for loop integration. Example:
AD[den[q1,m1], den [q1,m1], den[q1,m1], den[q2,m2], den[q2,m2], den[q3,m3] is transformed to G[m1,3], den [m2,2], [m3,1]."
DenruleBack::usage=""
Color::usage="replaces color structures depending on generators and structure constants of SU(3)_c on expressions only depending on generators or scalars."
Translation::usage=""
FeynArtsToMasterTwo::usage="Translates the output of FeynArts into the notation needed for MasterTwo."
TwoZero::usage=""
TwoEqual::usage=""
ScalIntOne::usage="ScalIntOne[AD[i[m,n]]]allows the calculation
of scalar one loop integrals by replacing the propagator
structure AD[i[m,n]] with (pi^2/((m^2)^ {n-2})) Ne(m)
C^{(1)}_n. Not that in order to obtain the standard
Integral (\mu ^{2eps} /({2 Pi}^{2D})) {q^2-m^2}^{-n}
the result hast to be multiplied by 1/((2 Pi)^4)."
ScalIntTwo::usage= "ScalIntTwo[G[i[M1, a1], i[M2, a2], i[0, a3]
calculatesscalar twoloop integrals of the form nu^(4 eps)/(2 Pi^(-4 eps)) Integrate[( d^q1
d^q_2)/((2 Pi)^(2D)) *1/(q1^-M1^2)^a1(q2^-M2^2)^a2((q1+q2))^a3]
with at least one mass in the propagators 0 by replacing the
propagator structure G[i[M1, a1], i[M2, a2], i[0, a3]] with the analytical result of the
corresponding integral.A prefactor N2[M1] as defined in
hep-ph/9910220, equation (61) is introduced. Results are Taylor
expanded in epsilon until 0. order. Loop momenta
have to be declared with DeclareLoopMomentum. Before usage the
integrands have to be transformed via substitutions in such a
way that the same masses appear always with the same loop momenta
with the help of the function SimplifyPropagator in all arising
diagramms. A factor x1=M2^2/M1^2 is introduced to shorten the result. Prefactors
are expressed proportional to N2[M1] defined in eq. (65) of the
manual. The simplifications of the prefactors is performed.
ScalIntTwo can also handle factorizing integrals of the form AD[i[M1, a1],i[M2,a2]]."
ScalIntTwoFull::usage= "ScalIntTwoFull[G[i[M1, a1], i[M2, a2], i[0, a3]]]: Functions as ScalIntTwo, but sorts the denominators before integration.A flag \.b4model\.b4 for the chosen model (SM or 2hdm) can be set. If model=SM, MW is replaced by M1, if model=2hdm, MH is replaced by M1."
ScalIntTwoThreeMasses::usage = "ScalIntTwoThreeMasses[G[i[M1, a1], i[M2, a2], i[M1, a3]]] allows to
calculate scalar loop integrals independend of external momenta
and with up two different masses by replacing propagator structures
G[i[m1, n1], i[m2, n2], i[m1, n3]] with the analytical result for
scalar twoloop integrals as given in eq. (63) of the manual.
Note that you have to give an explicit value x>0 for the mass
relation betwen x=M2^2/M1^2. The final
results is Taylor expanded in eps up to second order."
facruleone::usage = "calculates standard one-loop integrals
AD[den[q,m],...,den[q,m]] (a propagator terms) by making the replacement I*(((-1)^a*Pochhammer[1 + eps, a - 3]*Ne[m1]*
(m1^2)^(2 - a))/(a - 1)!).. Note that in order to obtain standard one loop integrals
\int d^dp \nu^{2 eps } /(2 Pi)^D 1/(q^2-m^2)^a the final result has to be multiplied by 1/(16 Pi^4)."
subden::usage = "is a replacement rule which reorders propagators of the form
AD[l___,den[a_,m_],r__] in the form needed for the loop integration."
GammaExpand::usage= "GammaExpand[a] return Gamma[Expand[a]]."
GammaSimplify::usage = "GammaSimplify[expr] checks the list GammaSimplifyList and returns expr //. GammaSimplifyList. Rules to this list can be added in the package."
BetaToGamma::usage = "BetaToGamma searches an expression for Beta-functions and substitutes them with Gamma-functions."
ReplOneMinus::usage = " Expr //. ReplOneMinus[u] replaces 1-u by OneMinus[u] and -1+u by -OneMinus[u]. Afterwards it checks whether there are expressions like (OneMinus[u] u)^q. These expressions are then broken apart to OneMinus[u]^q u^q. Note that instead of u you can have a list of parameters like ReplOneMinus[{u,v,...}] or just ReplOneMinus[u,v,...]. Then the replacing rules are applied to all given variables."
BetaIntegrals::usage = " Expr //. BetaIntegrals[u] replaces 'u^p_. OneMinus[u]^q_.' by 'Beta[p + 1, q + 1]'. You can do this simultaneously for several variables by using BetaIntegrals[{u,v,...}] or just BetaIntegrals[u,v,...]. Make sure to always use '//.' (ReplaceRepeated) and not '/.' (ReplaceOnce)!"
BetaRemains::usage = "BetaRemains[u] works just like BetaIntegrals and substitutes 'u^p_. OneMinus[u]^q_.' with 'Beta[p + 1, q + 1]'. The difference is that it does so only for either p or q equal to zero (therefore the name '-Remains'.). Be sure to always use 'BetaIntegrals' first. You might get false expressions otherwise."
RemoveOddPowersOfIntVar::usage = "RemoveOddPowersOfIntVar[expr,var] removes all odd powers of var in expr (assuming that expr is the numerator of the Feynman integral about to be calculated). Make sure that the denominator of the Feynman ntegral is of the form (var^2-C)^a."
TenScal::usage = "";
EightScal::usage = "";
SixScal::usage = "";
FourScal::usage = "";
TenMomentumInt::usage = "";
EightMomentumInt::usage = "";
SixMomentumInt::usage = "";
FourMomentumInt::usage = "";
TwoMomentumInt::usage = "";
LorentzDecompose::usage = "LorentzDecompose[expr, var] decomposes all products of Scal[var,p1_MomentumQ]*...*Scal[var,pi_MomentumQ] (up to i equal to 8) and writes them like Scal[var, index1] Scal[p1, index1] ... . It can handle only at most 4 different momenta.";
TaylorExpansion::usage = "TaylorExpansion Taylor expands denominators of the form
AD[l___, den[q+k_, m_], r___],where q is a loop momentum or the sum of loop momenta
in the external momenta k up to second order. Note that loop momenta have to be declared withDeclareLoopMomentum[expr]";
TaylorMass::usage = "TaylorMass expands denominators of the form
AD[l___, den[q_, m_], r___],where q is a loop momentum, in m up to second order, if m is NOT declared with DeclareHeavyMass[expr] as heavy mass.";
TensorTwo::usage = "
TensorTwo[expr, var,var2] performs a two dimensional tensor reduction of expressions expr with up to five Lorentz Indices
assuming that the denominator of expr is an arbitrary scalar function of the variables var1 and var2 (Note that factorising two-loop integrals have to be tensor reduced with TensorOne).
If the numerator of expr depends only on var (var2) it performs a one-dimensional tensor reduction in var (var2) using TensorOne[expr,var] (TensorOne[expr,var2]).
Expressions like Scal[var,q1] are treated like Scal[var,lor1]Scal[var,lor1], where lor1 is a Lorentz index. This artificially increases the number of used Lorentz indices.Therefore it is recommended to set all quadratic scalar products to a dummy variable before performing the tensor reduction.
.";
TensorTwoEps::usage = "TensorTwoEps[expr,var,var2]
works like TensorTwo without giving out the various intermediate
messages that indicate what the program is doing at a given time
and setting all terms with eps^n with n>2 are set to zero."
Substitution::usage="Substitution[expr] makes substitution in the integrands of factorizing two-loop-integrals such that the propagator structure contains no overlapping loop momenta.";
TensorOne::usage = "
TensorOne[expr, var] performs the one-dimensional tensor reduction in var.
It assumes that the denominator of expr is an arbitrary scalar function depending on
Lorentz invariants of var. It can handle expressions $expr$ with up to 9 Lorentz Indices.
";
TensorOne6::usage = "TensorOne6[expr,var] works just like TensorOne, with one difference: it kicks out all terms proportional to var^6 or higher. This can come in handy when those terms are above your oder considered and you want to save time."
TensorOneWithoutOdd::usage = "Like TensorOne withoud dumping the odd powers of var .";
CompleteTheSquare::usage = "";
FeynParamAndMore::usage = "FeynParamAndMore[a,var]: The expression a is assumed to be of the form {den1, pow1, fp1}, {den2, pow2, fp2}, ... , {denN, powN, fpN}, which should mean: 1/den^pow1 1/den2^pow2*...*1/denN^powN. The variables fpI are the desired Feynman parameters. FeynParamAndMore[a,var] scrams the denominators together to form a denominator of the form (var^2-FeynDenom[1])^FeynPow[1]. It returns both FeynDenom[1] and FeynPow[1] and the summand you need to add to var in the
numerator to complete the square: AddToCompleteSquare[1]. Also it returns the prefactor FeynCoeff[1].";
FeynParamAndMore2::usage = "FeynParamAndMore2[a,var,number] works pretty much like its ancestor FeynParamAndMore. With the extra parameter, you can save the output-variables e.g. in FeynPow[number, 1] etc instead of FeynPow[1]."
dToEps::usage = "dToEps replaces d with '4 - 2 eps'.";
ScalToTimes::usage = "ScalToTimes replaces all occurences of Scal[a,b] with Times[a,b].";
gsToAlphas::usage = "gsToAlphas does what you'd guess... .";
RemoveSilent::usage="RemoveOddPowersOfIntVar without the messages.";
RemoveTooHigh::usage="RemoveTooHigh[expr,list,pow] removes all terms which contributions are of higher order in an expansion parameter than wanted. The second argument, lista, is a list containing all integration variables considered. The third parameter gives the highest order that contributes.";
FeynmanParametrization::usage="";
OrderDump::usage="OrderDump[expr,list,pow] is a generalization of RemoveTooHigh. To each variable in list one can give the corresponding power of that variable in the power counting.";
FourFeyn::usage="FourFeyn[list1,list2] is used to introduce three Feynman parameters (sited in list2) to pull the four denominators listed in list1 together.";
AlphasTogs::usage = "AlphaTogs does what you'd guess: it replaces \{Alpha]s with gs^2/(4 Pi).";
PartialFractionTwo::usage = " PartialFractionTwo[expr] makes partial fraction of the denominators in the two -loop case. Not approbriate for one - loop calculation, as it sets denominators with only one loop- momentum to 0. Furthermore it simplifies structures like var^2/ propagatordenominator to simpler structures 1/denominator. ";
PartialFractionOne::usage = " Partial Fraction[expr] makes partial fraction of the denominators in the one -loop case. Furthermore it simplifies structures like var^2/ propagatordenominator to simpler structures 1/denominator. ";
DeclareHeavyMass::usage "=DeclareHeavyMass[M] declares all heavy masses. Declaration of heavy masses needed for correct usage of TaylorMass. ";
DeclareSmallMass::usage "=DeclareSmallMass[M] declares all small masses. Declaration of small masses needed for correct usage of Scaling.";
DeclareLoopMomentum::usage ="Declare any loop momentum p you wish to use with DeclareLoopMomentum[p]. Distinguishing between loop momenta and external momenta needed for correct TaylorExpansion and Scaling.";
DeclareExternalMomentum::usage =
"Declare any external momentum p you wish to use with DeclareExternalMomentum[p]. Distinguishing between external momenta and loop momenta needed for correct usage of TaylorExpansion and Scaling.";
xrule::usage ="All terms x^n with n>2 are set to 0."
Scaling::usage = "All external momenta (declared with DeclareExternalMomentum) and all masses (declared with DeclareSmallMass) are multiplied with a factor x. All powers x^n with n>2 are set to zero.";
LoopMomentumQ::usage = "";
NotLoopMomentumQ::usage = "";
ExternalMomentumQ::usage = "";
NotExternalMomentumQ::usage = "";
HeavyMassQ::usage = "";
NotHeaHeavyMassQ::usage = "";
SmallMassQ::usage = "";
NotSmallMassQ::usage = "";
ClausenCl::usage =
"ClausenCl[n,x] gives the Clausen function of order n."
ClausenCl /: MakeBoxes[ClausenCl[n_,z_],TraditionalForm]:=
RowBox[{SubscriptBox["Cl", MakeBoxes[n,TraditionalForm]],
"(", " ", MakeBoxes[z,TraditionalForm], ")"}]
epsrule::usage="Sets all terms with higher powers than eps^2 to 0.";
nerules::usage="Allows to express prefactors Ne[M1]Ne[M2] in terms proportional to Ne[M2], if M2 is expressed as M2=Sqrt[x1]*M1."
(******************************************************************************************************)
(*********************************** Start the Package ***********************************************)
Begin["`Private`"]
Off[General::spell, General::spell1]
Off[Syntax::"stresc"]
(******************************************************************************
Constants
******************************************************************************)
(*Define the constants needed to shorten the result of the two-loop boxes and penguins in the SM and THDM case*)
(*masses and momenta*)
(* Print["Before usage of the functions of Integrals, you have to define which type of diagramm you want to calculate by setting values to flag (define quark type in the loop), model (defining if SM or THDM diagrams should be calculated). "]
*)
(*W - BOXES and Z - penguins*)
constantsWBOX:={Global`MC->0,Global`MS->0,Global`ME->0, Global`MB->0,Global`MU->0,Global`MD->0,
Global`k2:>0,Global`k1:>
0, Global`p1:> 0, Global`p2:> 0} ;
(*SM -Modell, TOP*)
constantsTOP:={Global`MC->0,Global`MU->0, Global`MD->0,Global`ME->0,Global`MS->0,Global`MHp->Global`MH} ;
(*SM -Modell, Charm*)
constantsCHARM:={Global`MC->0,Global`MU->0,Global`MD->0,Global`ME->0,Global`MS->0,Global`MT->0} ;
(*SM -model, Selbstenergie*)
constantsselbst:={Global`MC->0,Global`MU->0,Global`MD->0,Global`ME->0} ;
Global`constants := Which[Not[FreeQ[Global`flag,Global`TOP]],constantsTOP,
Not[FreeQ[Global`flag,Global`CHARM]], constantsCHARM,
Not[FreeQ[Global`flag,Global`Z ] ],constantsWBOX,
Not[FreeQ[Global`flag,Global`gluon ] ],constantsTOP,
Not[FreeQ[Global`flag,Global`SELBST ] ],constantsselbst]
Global`constantsM1M2:=
Which[Not[FreeQ[Global`model,Global`SM]],{Global`MW->Global`M1,Global`MT->Global`M2},
Not[FreeQ[Global`model,Global`THDM]],{Global`MH->Global`M1, Global`MT->Global`M2},
FreeQ[Global`model,Global`SM],{Global`MW->Global`MW,Global`MT->Global`MT}]
Global`zrule:=Which[Not[FreeQ[Global`flag3,Global`gamma]],{Global`k1->Global`k1, Global`k2->Global`k2},
Not[FreeQ[Global`flag3,Global`Z]],{Global`k1->0,Global`k2->0,Global`MB->0}]
(*****************************PREFACTORS**************************)
prefactorw = Global`GS^2/(16 Pi^4)* Global`EL^4/(16*Pi^4*Global`SW^4*Global`MW^2);
prefactorsm = (Global`CKM[3,3] Conjugate[Global`CKM[3,2]]*Global`GS^2*Global`EL^3)/(512*Pi^8*Global`SW^2*Global`MW^2);
prefactorgluon = (Global`CKM[3,3] Conjugate[Global`CKM[3,2]]Global`GS^2*Global`EL^2)/(512*Pi^8*Global`SW^2*Global`MW^2);
Global`prefactor:= Which[Not[FreeQ[Global`flag,Global`TOP]],prefactorsm,
Not[FreeQ[Global`flag,Global`CHARM]], prefactorsm,
Not[FreeQ[Global`flag,Global`Z ] ],prefactorsm,
Not[FreeQ[Global`flag,Global`W ] ],prefactorw,
Not[FreeQ[Global`flag,Global`SELBST]],prefactorsm,
Not[FreeQ[Global`flag,Global`gluon]],prefactorgluon];
(*******************Define a new type of variable LoopMomentum which has to be declared as q1 or q2*)
DeclareLoopMomentum[e_] :=
(
DeclareMomentum[e];
LoopMomentumQ[e]^= True;
Unprotect[MomentumQ];
MomentumQ[e] = True;
Protect[MomentumQ];
);
DeclareExternalMomentum[e_] :=
(
DeclareMomentum[e];
ExternalMomentumQ[e]^= True;
Unprotect[MomentumQ];
MomentumQ[e] = True;
Protect[MomentumQ];
);
DeclareHeavyMass[e_] :=
(
DeclareMass[e];
HeavyMassQ[e]^= True;
Unprotect[MassQ];
MassQ[e] = True;
Protect[MassQ];
);
DeclareSmallMass[e_] :=
(
DeclareMass[e];
SmallMassQ[e]^= True;
Unprotect[MassQ];
MassQ[e] = True;
Protect[MassQ];
);
DeclareHeavyMass[p1_,p2___] :=( DeclareHeavyMass[p1] ; DeclareHeavyMass[p2]);
HeavyMassQ[c_?NumberQ p_]:= HeavyMassQ[p]
HeavyMassQ[Plus[p_,q___]] := HeavyMassQ[p] && HeavyMassQ[Plus[q]];
NotHeavyMassQ[p_]:=!HeavyMassQ[p];
DeclareSmallMass[p1_,p2___] :=( DeclareSmallMass[p1] ; DeclareSmallMass[p2]);
SmallMassQ[c_?NumberQ p_]:= SmallMassQ[p]
SmallMassQ[Plus[p_,q___]] := SmallMassQ[p] && SmallMassQ[Plus[q]];
NotSmallMassQ[p_]:=!SmallMassQ[p];
DeclareLoopMomentum[p1_,p2___] :=( DeclareLoopMomentum[p1] ; DeclareLoopMomentum[p2]);
LoopMomentumQ[c_?NumberQ p_]:= LoopMomentumQ[p]
LoopMomentumQ[Plus[p_,q___]] := LoopMomentumQ[p] && LoopMomentumQ[Plus[q]];
NotLoopMomentumQ[p_]:=!LoopMomentumQ[p];
DeclareExternalMomentum[p1_,p2___] :=( DeclareExternalMomentum[p1] ; DeclareExternalMomentum[p2]);
ExternalMomentumQ[c_?NumberQ p_]:= ExternalMomentumQ[p]
ExternalMomentumQ[Plus[p_,q___]] := ExternalMomentumQ[p] && ExternalMomentumQ[Plus[q]];
NotExternalMomentumQ[p_]:=!ExternalMomentumQ[p];
(********************* Translation of the FeynArts Output***************)
(*Translation of the FeynArts Output***************)
FeynArtsToMasterTwo[expr_] :=
Module[{res,a,b,c},
res= expr//.{Global`FeynAmpDenominator -> AD,
Global`FourMomentum[Global`Internal,Global`a_]->Global`q[Global`a],
Global`FourMomentum[Global`Outgoing,Global`a_]->Global`k[Global`a],
Global`PropagatorDenominator -> den, Global`FermionChain -> fc,
Global`Index[Global`Lorentz,Global`a_] -> Global`lorindex[Global`a],
Global`FeynAmpList[a___]->1;
Global`FeynAmp[a_,b_,c___]->c,
Global`DiracSpinor[a___]->Times[],
Global`ChiralityProjector[-1]-> L,
Global`ChiralityProjector[1]->R,
Global`DiracSlash[a_]->a,
Global`DiracMatrix[Global`lorindex[a_]]->Global`lorindex[a],
Global`MetricTensor
->Scal,
Global`FourVector->Scal};
(*Global`Conjugate[Global`PolarizationVector][V[c_], a___,Global`lorindex[b_]]->Scal[Global`conjeps,Global`lorindex[b]]};*)
res=res//.Global`q[i_]:>ToExpression[StringJoin[ToString[q],ToString[i]]];
res=res//.Global`k[i_]:>ToExpression[StringJoin[ToString[k],ToString[i]]];
res=res//.Global`Index[k_, l_] :> StringJoin[ToString[k], ToString[l]];
res=res//.Global`lorindex[i_]:>
ToExpression[StringJoin[ToString[lor],ToString[i]]];
res=res//.{lor1->Global`lor1, lor2->Global`lor2,lor3->Global`lor3,lor4->Global`lor4,lor5->Global`lor5,lor6->Global`lor6,lor7->Global`lor7,lor8->Global`lor8,lor9->Global`lor9,lor10->Global`lor10,lor11->Global`lor11};
res=res//.{k1->Global`k1, k2->Global`k2,k3->Global`k3,k4->Global`k4,k5->Global`k5,k6->Global`k6, k7->Global`k7,k8->Global`k8,k9->Global`k9,k10->Global`k10,k11->Global`k11};
res=res//.{q1->Global`q1, q2->Global`q2,q3->Global`q3,q4->Global`q4,q5->Global`q5,q6->Global`q6, q7->Global`q7,q8->Global`q8,q9->Global`q9,q10->Global`q10,q11->Global`q11};
res=res/.Times[a___,fc[b___],c___]:>scalstructure[Times[a,c]]*fc[b];
res=res//.fc[a___, b_ + c_ + d___, e___] -> fc[a, b, e] + fc[a, c + d, e];
res=res//.Global`NonCommutative->Dirac;
res=res//.Dirac[a_]->a;
res=res//.fc[a___,Dirac[b_,c_]]->fc[a,b,c];
res=res//.Times[a___,Dirac[b_,c_],d___]->dot[a,b,c,d];
res=res//.fc[k___,dot[a___],l___]->fc[k,a,l];
res=res/.Times->hugo;
res=res//.fc[k___,hugo[a___],l___]->fc[k,a,l];
res=res//.hugo->Times;
res=res//.fc->Dirac;
res=res//.{Dirac[l___,a_*R,r___]:>Dirac[l,a,R,r],
Dirac[l___,a_*L,r___]:>Dirac[l,a,L,r]};
res=res//. Dirac[a___,b_,c___]:>
b Dirac[a,c]/;
b=!=R&&b=!=L&&Head[b]=!=lorindex&&Head[b]=!=Plus&&MomentumQ[b]=!=True&&
IndexQ[b]=!=True;
res=res//.scalstructure[a___]:>a;
res=res//DiracLinearity;
res=res//.Dirac[a___,b_,c___]:>
b Dirac[a,c]/;
b=!=R&&b=!=L&&Head[b]=!=lorindex&&Head[b]=!=Plus&&MomentumQ[b]=!=True&&
IndexQ[b]=!=True;
DeclarePolarizationVector[poleps];
res=res//.Conjugate[Global`PolarizationVector][Global`V[10], a_, b_] ...
-> Scal[DiracAdjunction[Global`poleps],b];
res=res//.{Global`Gluon->G, Global`Colour->C};
Return[res];
];
(************************************************************************
Color
Definitions for SU(n) with n=3
************************************************************************)
(*SUNT[a,b,c] stands for T^a_{b c}and is the color generators of SU(3)_c,SUNT[a,b] stands ...
forT^a T^b**)
(*SUNF[a,b,c] are the structure constants*)
n=3; CF=4/3;
generator:=Dispatch[
{
(*With Einstein's sum rule*)
SUNT[a_,i_,k_]*SUNT[a_,k_,j_]->
(n^2-1)/(2 n) KroneckerDelta[i,j],
SUNT[a_,i_,j_]*SUNT[a_,k_,l_]->
1/2 Global`Kro[i,l]*KroneckerDelta[j,k]-
1/(6)*
KroneckerDelta[i,j]*
KroneckerDelta[k,l]
}
];
colorrules:= Dispatch[
{
SUNF[b_,a_,c_]*SUNT[c_,b_]
->1/2 *I*n*SUNT[a],
SUNF[a_,b_,c_]*SUNT[c_,b_]
->-1/2 *I*n*SUNT[a],
SUNF[a_,b_,c_]*SUNT[b_,c_]
->+1/2 *I*n*SUNT[a],
SUNT[k___,b_,b_,j___]->CF SUNT[k,j],
SUNT[j___,a_,b_,a_,k___]->-1/6 SUNT[j,b,k],
SUNT[c_,d_] SUNF[d_,b_,a_]SUNF[a_,c_,b_]->4,
SUNT[a_,e_]SUNF[a_,d_,c_]SUNF[d_,e_,k_]SUNF[c_,k_,b]->- I 9/4 SUNT[b],
SUNT[a_,c_,d_]SUNF[a_,d_,e_]SUNF[e_,c_,b_]->0
}
];
structureconstants:=Dispatch[
{SUNF[a_,c_,d_]*SUNF[b_,c_,d_]->n KroneckerDelta[a,b],
SUNF[c_,b_,a_]*SUNF[d_,e_,b_] SUNF[k_,a_,e_]->-3/2 SUNF[c,d,k],
SUNF[a_,b_,e_]*SUNF[e_,c_,d_]+SUNF[c_,b_,e_]*SUNF[a_,e_,d_]+
SUNF[d_,b_,e_]*SUNF[a_,c_,e_]->0}
];
Color[expr__] :=
Module[{part},
part = expr;
part = part//.generator;
part = part//.colorrules;
part = part //.structureconstants;
part=part//.Global`SumOver[a___]->1;
Return[part];]
(*****************************)
(* end color *)
(*****************************)
(*********************************************************************
Taylor Expansion
*********************************************************************)
taylormass := AD[l___, den[q1_, M2_], r___] :>
AD[l, den[q1, 0], r] + AD[l, den[q1, 0], den[q1, 0], r]*
M2^2 /; FreeQ[M2, _?HeavyMassQ] && LoopMomentumQ[q1] &&
FreeQ[M2, 0]
TaylorMass[expr__] := Module[{part, part1, part2, part3, xx,
pippo}, Clear[pippo, pippo2]; part = expr;
part = part //. taylormass; Null; Return[part]; ]
taylorlist2 := AD[l___, den[(q1_) + (k1_), m_], r___] :>
AD[l, den[q1, m], r] - AD[l, den[q1, m], den[q1, m], r]*Scal[k1, k1] -
2*AD[l, den[q1, m], den[q1, m], r]*Scal[k1, q1] +
4*AD[l, den[q1, m], den[q1, m], den[q1, m], r]*Scal[k1, q1]^2 /;
FreeQ[k1,_?LoopMomentumQ] && LoopMomentumQ[q1]
TaylorExpansion[expr__] :=
Module[{part, part1, part2, part3,xx,pippo},
part = expr;
part=part//.taylorlist2;
Return[part];]
HeavyMassExpansion[expr__] :=
Module[{part, part1, part2, part3,xx,pippo},
part = expr;
part=TaylorMass[part];
part=TaylorExpansion[part];
Return[part];]
(*zrule = {k1 -> 0, k2 -> 0};*)
(*************************************************************************************
Scaling
*****************************************************************************************************************)
xrule:=Global`x^n_:>0/;n>2;
scalerule :={p_?ExternalMomentumQ:> Global`x*p, m_?SmallMassQ :> Global`x*m}
ScaleFunction[expr__] :=
Module[{part, part1, part2, part3,xx,pippo},
part = expr;
part=part/.scalerule;
part=part//DiracLinearity;
part = part //. xrule;
Return[part];]
Scaling[expr__] :=
Module[{part, part1, part2, part3,xx,pippo},
part = expr;
part = Map[ScaleFunction,part];
part=part//ExpandAll;
part=part//.xrule;
Return[part];]
(***************************************************************************************************************)
(********************************************TensorReduction*************************************************)
(******************************************************************************************************************)
(* Remove odd powers of integrands *)
RemoveOddPowersOfIntVar[expr_,var_] :=
Module[{xx,ex2,pow},
ex2 = expr/.{var -> xx var};
ex2 = ex2 //DiracAlgebra;
ex2 = Expand[ex2];
pow = Exponent[ex2,xx];
Print["Removed odd powers up to ",var,"^",pow];
ex2 = ex2/.{xx^n_ :> 1 /; EvenQ[n]};
ex2 = ex2/.{xx->0};
Return[ex2];
];
RemoveTooHigh[expr_,lista_,pow_] :=
Module[{xx,ex2},
ex2=expr;
Do[ex2 = ex2 /. {Part[lista,i] -> Part[lista,i]*xx},{i,1,Length[lista]}];
ex2=ex2//DiracAlgebra;
ex2 = ex2 /. {xx^n_ :> 0 /; Re[n] > pow};
ex2 = ex2 /. {xx->1};
Return[ex2];
];
OrderDump[expr_,lista_,pow_]:=
Module[{xx,ex2},
ex2=expr;
Do[ex2 = ex2 /. {Part[lista,i,1] -> Part[lista,i,1]*xx^Part[lista,i,2]},{i,1,Length[lista]}];
ex2=ex2 //DiracAlgebra;
ex2 = ex2 /. {xx^n_ :> 1 /; Re[n] < pow+1};
ex2 = ex2 /. {xx->0};
Return[ex2];
];
RemoveSilent[expr_,var_]:=Module[{xx,ex2,pow},
ex2 = expr/.{var -> xx var};
ex2 = ex2 //DiracAlgebra;
ex2 = Expand[ex2];
pow = Exponent[ex2,xx];
ex2 = ex2/.{xx^n_ :> 1 /; EvenQ[n]};
ex2 = ex2/.{xx->0};
Return[ex2];
];
LorentzDecompose[expr_,r_] :=
Module[{ex2,s=0,t=0,u=0,q=0,p=0},
ex2 = Expand[expr];
ex2 = ex2 //. {Scal[r, r] -> r^2};
DeclareIndex[j1,j2,j3,j4,j5,j6,j7,j8,j9,j10,j11,j12,j13,j14,j15,j16,j17,j18,j19,j20];
DeclareIndex[b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15,b16,b17,b18,b19,b20];
ex2 = ex2 /.{Dirac[a___,r,b___]-> Scal[r,j1] Dirac[a,j1,b]};
(* r^8 *)
ex2 = ex2 /. {
Scal[p_?MomentumQ,r]^8 ->
Scal[r,b1] Scal[p,b1] Scal[r,b2] Scal[p,b2] Scal[r,b3] Scal[p,b3]*
Scal[r,b4] Scal[p,b4] Scal[r,b5] Scal[p,b5] Scal[r,b6] Scal[p,b6]*
Scal[r,b7] Scal[p,b7] Scal[r,b8] Scal[p,b8],
Scal[p_?MomentumQ,r]^7 Scal[q_?MomentumQ,r] ->
Scal[r,b1] Scal[p,b1] Scal[r,b2] Scal[p,b2] Scal[r,b3] Scal[p,b3]*
Scal[r,b4] Scal[p,b4] Scal[r,b5] Scal[p,b5] Scal[r,b6] Scal[p,b6]*
Scal[r,b7] Scal[p,b7] Scal[r,b8] Scal[q,b8],
Scal[p_?MomentumQ,r]^6 Scal[q_?MomentumQ]^2 ->
Scal[r,b1] Scal[p,b1] Scal[r,b2] Scal[p,b2] Scal[r,b3] Scal[p,b3]*
Scal[r,b4] Scal[p,b4] Scal[r,b5] Scal[p,b5] Scal[r,b6] Scal[p,b6]*
Scal[r,b7] Scal[q,b7] Scal[r,b8] Scal[q,b8],
Scal[p_?MomentumQ,r]^6 Scal[q_?MomentumQ,r] Scal[t_?MomentumQ,r] ->
Scal[r,b1] Scal[p,b1] Scal[r,b2] Scal[p,b2] Scal[r,b3] Scal[p,b3]*
Scal[r,b4] Scal[p,b4] Scal[r,b5] Scal[p,b5] Scal[r,b6] Scal[p,b6]*
Scal[r,b7] Scal[q,b7] Scal[r,b8] Scal[t,b8],
Scal[p_?MomentumQ,r]^5 Scal[q_?MomentumQ]^3 ->
Scal[r,b1] Scal[p,b1] Scal[r,b2] Scal[p,b2] Scal[r,b3] Scal[p,b3]*
Scal[r,b4] Scal[p,b4] Scal[r,b5] Scal[p,b5] Scal[r,b6] Scal[q,b6]*
Scal[r,b7] Scal[q,b7] Scal[r,b8] Scal[q,b8],
Scal[p_?MomentumQ,r]^5 Scal[q_?MomentumQ,r]^2 Scal[t_?MomentumQ,r] ->
Scal[r,b1] Scal[p,b1] Scal[r,b2] Scal[p,b2] Scal[r,b3] Scal[p,b3]*
Scal[r,b4] Scal[p,b4] Scal[r,b5] Scal[p,b5] Scal[r,b6] Scal[q,b6]*
Scal[r,b7] Scal[q,b7] Scal[r,b8] Scal[t,b8],
Scal[p_?MomentumQ,r]^5 Scal[q_?MomentumQ,r] Scal[t_?MomentumQ,r] Scal[s_?MomentumQ,r] ->
Scal[r,b1] Scal[p,b1] Scal[r,b2] Scal[p,b2] Scal[r,b3] Scal[p,b3]*
Scal[r,b4] Scal[p,b4] Scal[r,b5] Scal[p,b5] Scal[r,b6] Scal[s,b6]*
Scal[r,b7] Scal[q,b7] Scal[r,b8] Scal[t,b8],
Scal[p_?MomentumQ,r]^4 Scal[q_?MomentumQ]^4 ->
Scal[r,b1] Scal[p,b1] Scal[r,b2] Scal[p,b2] Scal[r,b3] Scal[p,b3]*
Scal[r,b4] Scal[p,b4] Scal[r,b5] Scal[q,b5] Scal[r,b6] Scal[q,b6]*
Scal[r,b7] Scal[q,b7] Scal[r,b8] Scal[q,b8],
Scal[p_?MomentumQ,r]^4 Scal[q_?MomentumQ,r]^3 Scal[t_?MomentumQ,r] ->
Scal[r,b1] Scal[p,b1] Scal[r,b2] Scal[p,b2] Scal[r,b3] Scal[p,b3]*
Scal[r,b4] Scal[p,b4] Scal[r,b5] Scal[q,b5] Scal[r,b6] Scal[q,b6]*
Scal[r,b7] Scal[q,b7] Scal[r,b8] Scal[t,b8],
Scal[p_?MomentumQ,r]^4 Scal[q_?MomentumQ,r]^2 Scal[t_?MomentumQ,r]^2 ->
Scal[r,b1] Scal[p,b1] Scal[r,b2] Scal[p,b2] Scal[r,b3] Scal[p,b3]*
Scal[r,b4] Scal[p,b4] Scal[r,b5] Scal[q,b5] Scal[r,b6] Scal[q,b6]*
Scal[r,b7] Scal[t,b7] Scal[r,b8] Scal[t,b8],
Scal[p_?MomentumQ,r]^4 Scal[q_?MomentumQ,r]^2 Scal[t_?MomentumQ,r] Scal[s_?MomentumQ,r] ->
Scal[r,b1] Scal[p,b1] Scal[r,b2] Scal[p,b2] Scal[r,b3] Scal[p,b3]*
Scal[r,b4] Scal[p,b4] Scal[r,b5] Scal[q,b5] Scal[r,b6] Scal[q,b6]*
Scal[r,b7] Scal[s,b7] Scal[r,b8] Scal[t,b8],
Scal[p_?MomentumQ,r]^3 Scal[q_?MomentumQ,r]^3 Scal[t_?MomentumQ,r]^2 ->
Scal[r,b1] Scal[p,b1] Scal[r,b2] Scal[p,b2] Scal[r,b3] Scal[p,b3]*
Scal[r,b4] Scal[q,b4] Scal[r,b5] Scal[q,b5] Scal[r,b6] Scal[q,b6]*
Scal[r,b7] Scal[t,b7] Scal[r,b8] Scal[t,b8],
Scal[p_?MomentumQ,r]^3 Scal[q_?MomentumQ,r]^3 Scal[t_?MomentumQ,r] Scal[s_?MomentumQ,r] ->
Scal[r,b1] Scal[p,b1] Scal[r,b2] Scal[p,b2] Scal[r,b3] Scal[p,b3]*
Scal[r,b4] Scal[q,b4] Scal[r,b5] Scal[q,b5] Scal[r,b6] Scal[q,b6]*
Scal[r,b7] Scal[s,b7] Scal[r,b8] Scal[t,b8],
Scal[p_?MomentumQ,r]^3 Scal[q_?MomentumQ,r]^2 Scal[t_?MomentumQ,r]^2 Scal[s_?MomentumQ,r] ->
Scal[r,b1] Scal[p,b1] Scal[r,b2] Scal[p,b2] Scal[r,b3] Scal[p,b3]*
Scal[r,b4] Scal[q,b4] Scal[r,b5] Scal[q,b5] Scal[r,b6] Scal[t,b6]*
Scal[r,b7] Scal[t,b7] Scal[r,b8] Scal[s,b8],
Scal[p_?MomentumQ,r]^2 Scal[q_?MomentumQ,r]^2 Scal[t_?MomentumQ,r]^2 Scal[s_?MomentumQ,r]^2 ->
Scal[r,b1] Scal[p,b1] Scal[r,b2] Scal[p,b2] Scal[r,b3] Scal[q,b3]*
Scal[r,b4] Scal[q,b4] Scal[r,b5] Scal[t,b5] Scal[r,b6] Scal[t,b6]*
Scal[r,b7] Scal[s,b7] Scal[r,b8] Scal[s,b8] };
(* r^7 *)
ex2 = ex2 /. {
Scal[p_?MomentumQ,r]^7 ->
Scal[r,b15] Scal[p,b15] Scal[r,b9] Scal[p,b9] Scal[r,b10] Scal[p,b10]*
Scal[r,b11] Scal[p,b11] Scal[r,b12] Scal[p,b12] Scal[r,b13] Scal[p,b13]*
Scal[r,b14] Scal[p,b14],
Scal[p_?MomentumQ,r]^6 Scal[q_?MomentumQ,r] ->
Scal[r,b15] Scal[p,b15] Scal[r,b9] Scal[p,b9] Scal[r,b10] Scal[p,b10]*
Scal[r,b11] Scal[p,b11] Scal[r,b12] Scal[p,b12] Scal[r,b13] Scal[p,b13]*
Scal[r,b14] Scal[q,b14],
Scal[p_?MomentumQ,r]^5 Scal[q_?MomentumQ,r]^2 ->
Scal[r,b15] Scal[p,b15] Scal[r,b9] Scal[p,b9] Scal[r,b10] Scal[p,b10]*
Scal[r,b11] Scal[p,b11] Scal[r,b12] Scal[p,b12] Scal[r,b13] Scal[q,b13]*
Scal[r,b14] Scal[q,b14],
Scal[p_?MomentumQ,r]^5 Scal[q_?MomentumQ,r] Scal[t_?MomentumQ,r] ->
Scal[r,b15] Scal[p,b15] Scal[r,b9] Scal[p,b9] Scal[r,b10] Scal[p,b10]*
Scal[r,b11] Scal[p,b11] Scal[r,b12] Scal[p,b12] Scal[r,b13] Scal[q,b13]*
Scal[r,b14] Scal[t,b14],
Scal[p_?MomentumQ,r]^4 Scal[q_?MomentumQ,r]^3 ->
Scal[r,b15] Scal[p,b15] Scal[r,b9] Scal[p,b9] Scal[r,b10] Scal[p,b10]*
Scal[r,b11] Scal[p,b11] Scal[r,b12] Scal[q,b12] Scal[r,b13] Scal[q,b13]*
Scal[r,b14] Scal[q,b14],
Scal[p_?MomentumQ,r]^4 Scal[q_?MomentumQ,r]^2 Scal[t_?MomentumQ,r] ->
Scal[r,b15] Scal[p,b15] Scal[r,b9] Scal[p,b9] Scal[r,b10] Scal[p,b10]*
Scal[r,b11] Scal[p,b11] Scal[r,b12] Scal[q,b12] Scal[r,b13] Scal[q,b13]*
Scal[r,b14] Scal[t,b14],
Scal[p_?MomentumQ,r]^4 Scal[q_?MomentumQ,r] Scal[t_?MomentumQ,r] Scal[s_?MomentumQ,r] ->
Scal[r,b15] Scal[p,b15] Scal[r,b9] Scal[p,b9] Scal[r,b10] Scal[p,b10]*
Scal[r,b11] Scal[p,b11] Scal[r,b12] Scal[s,b12] Scal[r,b13] Scal[q,b13]*
Scal[r,b14] Scal[t,b14],
Scal[p_?MomentumQ,r]^3 Scal[q_?MomentumQ,r]^3 Scal[t_?MomentumQ,r] ->
Scal[r,b15] Scal[p,b15] Scal[r,b9] Scal[p,b9] Scal[r,b10] Scal[p,b10]*
Scal[r,b11] Scal[q,b11] Scal[r,b12] Scal[q,b12] Scal[r,b13] Scal[q,b13]*
Scal[r,b14] Scal[t,b14],
Scal[p_?MomentumQ,r]^3 Scal[q_?MomentumQ,r]^2 Scal[t_?MomentumQ,r]^2 ->
Scal[r,b15] Scal[p,b15] Scal[r,b9] Scal[p,b9] Scal[r,b10] Scal[p,b10]*
Scal[r,b11] Scal[q,b11] Scal[r,b12] Scal[q,b12] Scal[r,b13] Scal[t,b13]*
Scal[r,b14] Scal[t,b14],
Scal[p_?MomentumQ,r]^3 Scal[q_?MomentumQ,r]^2 Scal[t_?MomentumQ,r] Scal[s_?MomentumQ,r] ->
Scal[r,b15] Scal[p,b15] Scal[r,b9] Scal[p,b9] Scal[r,b10] Scal[p,b10]*
Scal[r,b11] Scal[q,b11] Scal[r,b12] Scal[q,b12] Scal[r,b13] Scal[t,b13]*
Scal[r,b14] Scal[s,b14],
Scal[p_?MomentumQ,r]^2 Scal[q_?MomentumQ,r]^2 Scal[t_?MomentumQ,r]^2 Scal[s_?MomentumQ,r] ->
Scal[r,b15] Scal[p,b15] Scal[r,b9] Scal[p,b9] Scal[r,b10] Scal[q,b10]*
Scal[r,b11] Scal[q,b11] Scal[r,b12] Scal[t,b12] Scal[r,b13] Scal[t,b13]*
Scal[r,b14] Scal[s,b14] };
(* r^6 *)
ex2 = ex2/. {
Scal[p_?MomentumQ,r]^6 ->
Scal[r,j12] Scal[p,j12] Scal[r,j13] Scal[p,j13] Scal[r,j14] Scal[p,j14] *
Scal[r,j15] Scal[p,j15] Scal[r,j16] Scal[p,j16] Scal[r,j17] Scal[p,j17],
Scal[p_?MomentumQ,r]^5 Scal[q_?MomentumQ,r] ->
Scal[r,j12] Scal[p,j12] Scal[r,j13] Scal[p,j13] Scal[r,j14] Scal[p,j14] *
Scal[r,j15] Scal[p,j15] Scal[r,j16] Scal[p,j16] Scal[r,j17] Scal[q,j17],
Scal[p_?MomentumQ,r]^4 Scal[q_?MomentumQ,r]^2 ->
Scal[r,j12] Scal[p,j12] Scal[r,j13] Scal[p,j13] Scal[r,j14] Scal[p,j14] *
Scal[r,j15] Scal[p,j15] Scal[r,j16] Scal[q,j16] Scal[r,j17] Scal[q,j17],
Scal[p_?MomentumQ,r]^4 Scal[q_?MomentumQ,r] Scal[t_?MomentumQ,r] ->
Scal[r,j12] Scal[p,j12] Scal[r,j13] Scal[p,j13] Scal[r,j14] Scal[p,j14] *
Scal[r,j15] Scal[p,j15] Scal[r,j16] Scal[q,j16] Scal[r,j17] Scal[t,j17],
Scal[p_?MomentumQ,r]^3 Scal[q_?MomentumQ,r]^2 Scal[t_?MomentumQ,r] ->
Scal[r,j12] Scal[p,j12] Scal[r,j13] Scal[p,j13] Scal[r,j14] Scal[p,j14] *
Scal[r,j15] Scal[q,j15] Scal[r,j16] Scal[q,j16] Scal[r,j17] Scal[t,j17],
Scal[p_?MomentumQ,r]^3 Scal[q_?MomentumQ,r]^3 ->
Scal[r,j12] Scal[p,j12] Scal[r,j13] Scal[p,j13] Scal[r,j14] Scal[p,j14] *
Scal[r,j15] Scal[q,j15] Scal[r,j16] Scal[q,j16] Scal[r,j17] Scal[q,j17],
Scal[p_?MomentumQ,r]^3 Scal[q_?MomentumQ,r] Scal[t_?MomentumQ,r]*
Scal[s_?MomentumQ,r] ->
Scal[r,j12] Scal[p,j12] Scal[r,j13] Scal[p,j13] Scal[r,j14] Scal[p,j14] *
Scal[r,j15] Scal[q,j15] Scal[r,j16] Scal[t,j16] Scal[r,j17] Scal[s,j17],
Scal[p_?MomentumQ,r]^2 Scal[q_?MomentumQ,r]^2 Scal[t_?MomentumQ,r]^2 ->
Scal[r,j12] Scal[p,j12] Scal[r,j13] Scal[p,j13] Scal[r,j14] Scal[q,j14] *
Scal[r,j15] Scal[q,j15] Scal[r,j16] Scal[t,j16] Scal[r,j17] Scal[t,j17],
Scal[p_?MomentumQ,r]^2 Scal[q_?MomentumQ,r]^2 Scal[t_?MomentumQ,r]*
Scal[s_?MomentumQ,r] ->
Scal[r,j12] Scal[p,j12] Scal[r,j13] Scal[p,j13] Scal[r,j14] Scal[q,j14] *
Scal[r,j15] Scal[q,j15] Scal[r,j16] Scal[t,j16] Scal[r,j17] Scal[s,j17] };
(* r^5 *)
ex2 = ex2/. {
Scal[p_?MomentumQ,r]^5 ->
Scal[r,b16] Scal[p,b16] Scal[r,b17] Scal[p,b17] Scal[r,b18] Scal[p,b18] *
Scal[r,b19] Scal[p,b19] Scal[r,b20] Scal[p,b20],
Scal[p_?MomentumQ,r]^4 Scal[q_?MomentumQ,r] ->
Scal[r,b16] Scal[p,b16] Scal[r,b17] Scal[p,b17] Scal[r,b18] Scal[p,b18] *
Scal[r,b19] Scal[p,b19] Scal[r,b20] Scal[q,b20],
Scal[p_?MomentumQ,r]^3 Scal[q_?MomentumQ,r]^2 ->
Scal[r,b16] Scal[p,b16] Scal[r,b17] Scal[p,b17] Scal[r,b18] Scal[p,b18] *
Scal[r,b19] Scal[q,b19] Scal[r,b20] Scal[q,b20],
Scal[p_?MomentumQ,r]^3 Scal[q_?MomentumQ,r] Scal[t_?MomentumQ,r] ->
Scal[r,b16] Scal[p,b16] Scal[r,b17] Scal[p,b17] Scal[r,b18] Scal[p,b18] *
Scal[r,b19] Scal[q,b19] Scal[r,b20] Scal[t,b20],
Scal[p_?MomentumQ,r]^2 Scal[q_?MomentumQ,r]^2 Scal[t_?MomentumQ,r] ->
Scal[r,b16] Scal[p,b16] Scal[r,b17] Scal[p,b17] Scal[r,b18] Scal[q,b18] *
Scal[r,b19] Scal[q,b19] Scal[r,b20] Scal[t,b20],
Scal[p_?MomentumQ,r]^2 Scal[q_?MomentumQ,r] Scal[t_?MomentumQ,r] Scal[s_?MomentumQ,r] ->
Scal[r,b16] Scal[p,b16] Scal[r,b17] Scal[p,b17] Scal[r,b18] Scal[q,b18] *
Scal[r,b19] Scal[t,b19] Scal[r,b20] Scal[s,b20] };
(* r^4 *)
ex2 = ex2/. {
Scal[p_?MomentumQ, r]^4 ->
Scal[r, j2] Scal[p, j2] Scal[r, j3] Scal[p, j3]*
Scal[r, j4] Scal[p, j4] Scal[r, j5] Scal[p, j5],
Scal[p_?MomentumQ, r]^2 Scal[q_?MomentumQ, r]^2 ->
Scal[r, j2] Scal[p, j2] Scal[r, j3] Scal[p, j3]*
Scal[r, j4] Scal[q, j4] Scal[r, j5] Scal[q, j5],
Scal[p_?MomentumQ, r]^2 Scal[a_?MomentumQ, r]*
Scal[b_?MomentumQ, r] ->
Scal[r, j2] Scal[p, j2] Scal[r, j3] Scal[p, j3] Scal[a, j4]*
Scal[r, j4] Scal[b, j5] Scal[r, j5],
Scal[a_?MomentumQ, r] Scal[b_?MomentumQ, r]*
Scal[c_?MomentumQ, r] Scal[d_?MomentumQ, r] ->
Scal[a, j2] Scal[r, j2] Scal[b, j3] Scal[r, j3] Scal[c, j4]*
Scal[r, j4] Scal[d, j5] Scal[r, j5] };
(* r^3 (together with Scal[r, j5] Dirac[a, j5, b]) *)
ex2 = ex2 /. {
Scal[p_?MomentumQ, r]^3 ->
Scal[r, j6] Scal[p, j6] Scal[r, j7] Scal[p, j7] Scal[r, j8] Scal[p, j8],
Scal[p_?MomentumQ, r]^2 Scal[q_?MomentumQ, r] ->
Scal[r, j6] Scal[p, j6] Scal[r, j7] Scal[p, j7] Scal[r, j8] Scal[q, j8],
Scal[a_?MomentumQ, r] Scal[b_?MomentumQ, r] Scal[c_?MomentumQ, r] ->
Scal[a, j6] Scal[r, j6] Scal[b, j7] Scal[r, j7] Scal[c, j8] Scal[r, j8] };
(* r^2 *)
ex2 = ex2 /. {
Scal[a_?MomentumQ, r]^2 ->
Scal[r, j9] Scal[a, j9] Scal[a, j10] Scal[r, j10],
Scal[a_?MomentumQ, r] Scal[b_?MomentumQ, r] ->
Scal[r, j9] Scal[a, j9] Scal[b, j10] Scal[r, j10] };
(* r (together with Scal[r,j5]Dirac[a,j5,b]) *)
ex2 = ex2/.{Scal[p_?MomentumQ,r]-> Scal[p,j11] Scal[r,j11]};
ex2 = ex2 //. {r^n_?EvenQ :> Scal[r,r]^(n/2)};
Return[ex2];
];
FourScal[a_,b_,c_,e_] := Scal[a,b] Scal[c,e] + Scal[a,c] Scal[b,e] + Scal[a,e] Scal[b,c];
SixScal[al_,be_,ga_,de_,rh_,si_]:= Scal[al,be]*(Scal[de,ga] Scal[rh,si] + Scal[de,rh] Scal[ga,si] + Scal[de,si] Scal[ga,rh]) +
Scal[al,de]*(Scal[be,ga] Scal[rh,si] + Scal[be,rh] Scal[ga,si] + Scal[be,si] Scal[ga,rh]) +
Scal[al,ga]*(Scal[be,de] Scal[rh,si] + Scal[be,rh] Scal[de,si] + Scal[be,si] Scal[rh,de]) +
Scal[al,rh]*(Scal[be,ga] Scal[de,si] + Scal[be,de] Scal[ga,si] + Scal[be,si] Scal[ga,de]) +
Scal[al,si]*(Scal[be,ga] Scal[de,rh] + Scal[be,de] Scal[ga,rh] + Scal[be,rh] Scal[ga,de]);
EightScal[a_,b_,c_,e_,f_,g_,h_,k_]:= Expand[Scal[a,b] SixScal[c,e,f,g,h,k] + Scal[a,c] SixScal[b,e,f,g,h,k] +
Scal[a,e] SixScal[c,b,f,g,h,k] + Scal[a,f] SixScal[b,e,c,g,h,k] +
Scal[a,g] SixScal[c,b,f,e,h,k] + Scal[a,h] SixScal[b,e,c,g,f,k] +
Scal[a,k] SixScal[b,c,e,f,g,h]];
TenScal[a_,b_,c_,e_,f_,g_,h_,k_,l_,m_] := Expand[Scal[a,b] EightScal[c,e,f,g,h,k,l,m] + Scal[a,c] EightScal[b,e,f,g,h,k,l,m] +
Scal[a,e] EightScal[c,b,f,g,h,k,l,m] + Scal[a,f] EightScal[b,e,c,g,h,k,l,m] +
Scal[a,g] EightScal[c,e,f,b,h,k,l,m] + Scal[a,h] EightScal[b,e,f,g,c,k,l,m] +
Scal[a,k] EightScal[c,e,f,g,h,b,l,m] + Scal[a,l] EightScal[b,e,f,g,h,k,c,m] +