commit 1eb4724c7e3ae3e569226f925b7dab9e207c4180
parent 06a021b429651ec671f0fad7cd26e412bb115502
Author: Bakar Chargeishvili <bakar@bcharge.de>
Date: Mon, 20 Jun 2022 18:17:25 +0200
Simplification rules for gg
Diffstat:
M | f2m.sh | | | 38 | +++++++++++++++++++++++++++++++------- |
1 file changed, 31 insertions(+), 7 deletions(-)
diff --git a/f2m.sh b/f2m.sh
@@ -60,6 +60,7 @@ cat <<EOF >> simp.py
var = list()
pi = sy.pi
a = sy.Symbol('alpha_s')
+Nc = sy.Symbol('N_c')
EOF
echo "$add_vars" >> simp.py
cat <<EOF >> simp.py
@@ -68,16 +69,39 @@ for v in var:
#expr = sy.fraction(sy.sympify(v[0]).simplify())
expr = (sy.sympify(v[0]).expand()*2*pi).simplify()
#expr = sy.fraction(2*sy.sympify(v[0]).collect(pi))
- expr = sy.sympify(runFORM(expr))
- g=re.sub('G(\d+)x(\d+)',r"\\\\Gamma_{\1,\2}",v[1])
+ expr = sy.sympify(runFORM(expr)).simplify()
+ expr = sy.fraction(expr)
+ num = expr[0]
+ for i in range(10):
+ num=sy.collect(num,Nc**2-i)
+ num=sy.collect(num,Nc-i)
+ num=sy.collect(num,Nc+i)
+ num=sy.collect(num,-Nc*(Nc-1)+2)
+ num=sy.collect(num,Nc*(Nc+1)-2)
+ if(len(num.args)==2):
+ pre = sy.latex(num.args[0]/expr[1])
+ num = num.args[1]
+ elif(expr[1] != 1):
+ pre = sy.latex(1/expr[1])
+ else:
+ pre = ''
+ g=re.sub('G(\d+)x(\d+)',r"\\\\Gamma^{(1)}_{\1,\2}",v[1])
prefact = sy.latex(a/(2*pi))
- rhs = prefact+'&\\\\breaktowidth{0.9\\\\linewidth}{\\\\delimiterswithbreaks{[}{]}{'
- rhs += sy.latex(expr)
- rhs += '}}'
- if expr == 0:
+ prefact = ''
+ if(pre!=''):
+ rhs = prefact+pre+'\\\\breaktowidth{0.9\\\\linewidth}{\\\\delimiterswithbreaks{[}{]}{'
+ else:
+ rhs = '\\\\breaktowidth{0.9\\\\linewidth}{'
+ #rhs += re.sub(r"\\\\left\\((.*)\\\\right\\)",r"\\\\delimiterswithbreaks{(}{)}{\1}",sy.latex(num))
+ rhs += sy.latex(num)
+ if(pre!=''):
+ rhs += '}}'
+ else:
+ rhs += '}'
+ if num == 0:
rhs = 0
- print("{0}={1}\\\\nonumber \\\\\\\\".format(g,rhs))
+ print("{0}=&{1}\\\\nonumber \\\\\\\\".format(g,rhs))
EOF
ipython simp.py > result.txt