Commit 209c1b15 by Silvan Kuttimalai

### splitting scritpt

parent d3ba9a44
 ... ... @@ -6,6 +6,10 @@ from lorentz_structures import mink_metric, gamma_0, Gamma, ProjP, ProjM, gamma_ from sympy import init_printing, simplify, pprint, mathematica_code, Symbol, sqrt, I from sympy.functions import conjugate as cgt from sympy.functions import Abs from sympy import N as evaluate from random import uniform class tensor1d(tensor): ... ... @@ -84,59 +88,61 @@ def dirac_op(p, return tensor1d([+p0,p1,p2,p3], 'mu')*mink_metric('mu','nu')*Gamma('nu', key_a, key_b) - four_identity(key_a, key_b)*M def epsilonplus(p0,p1,p2,p3, key, k0,k1,k2,k3): return 1/sqrt(2)*(uminusbar(k0,k1,k2,k3, 'a')*gamma(key,'a','b')*uminus(p0,p1,p2,p2,'b'))/(uminusbar(k0,k1,k2,k3, 'c')*uplus(p0,p1,p2,p2,'c')) return 1/sqrt(2)*(uminusbar(k0,k1,k2,k3, 'a')*Gamma(key,'a','b')*uminus(p0,p1,p2,p2,'b'))/(uminusbar(k0,k1,k2,k3, 'c')*uplus(p0,p1,p2,p2,'c')) def epsilonminus(p0,p1,p2,p3, key, k0,k1,k2,k3): return -1/sqrt(2)*(uplusbar(k0,k1,k2,k3, 'a')*gamma(key,'a','b')*uplus(p0,p1,p2,p2,'b'))/(uplusbar(k0,k1,k2,k3, 'c')*uminus(p0,p1,p2,p2,'c')) return -1/sqrt(2)*(uplusbar(k0,k1,k2,k3, 'a')*Gamma(key,'a','b')*uplus(p0,p1,p2,p2,'b'))/(uplusbar(k0,k1,k2,k3, 'c')*uminus(p0,p1,p2,p2,'c')) def test_spinors(): def test_bar(): p1 = Symbol('p1', real=True) p2 = Symbol('p2', real=True) p3 = Symbol('p3', real=True) M = 0 # Symbol('M', real=True) M = Symbol('M', real=True) p0 = sqrt(p1**2+p2**2+p3**2+M**2) u = uplus (p0,p1,p2,p3,'a') ub = uplusbar(p0,p1,p2,p3,'a') dct = {var:uniform(1.,100.) for var in [p1,p2,p3,M]} # Check normalization of spinors: u*ubar = +2M, v*vbar = -2M assert(evaluate((uminus(p0,p1,p2,p3,'a')*uminusbar(p0,p1,p2,p3,'a') )._array[0].subs(dct)) - 2.0*M.subs(dct) < 1.e-11) assert(evaluate((vminus(p0,p1,p2,p3,'a')*vminusbar(p0,p1,p2,p3,'a') )._array[0].subs(dct)) + 2.0*M.subs(dct) < 1.e-11) assert(evaluate((uplus (p0,p1,p2,p3,'a')*uplusbar (p0,p1,p2,p3,'a') )._array[0].subs(dct)) - 2.0*M.subs(dct) < 1.e-11) assert(evaluate((vplus (p0,p1,p2,p3,'a')*vplusbar (p0,p1,p2,p3,'a') )._array[0].subs(dct)) + 2.0*M.subs(dct) < 1.e-11) assert(u._array[0]._array[0] - cgt(ub._array[2]._array[0])==0) assert(u._array[1]._array[0] - cgt(ub._array[3]._array[0])==0) assert(u._array[2]._array[0] - cgt(ub._array[0]._array[0])==0) assert(u._array[3]._array[0] - cgt(ub._array[1]._array[0])==0) dop_u = dirac_op([p0,p1,p2,p3], +M, 'a', 'b') dop_v = dirac_op([p0,p1,p2,p3], -M, 'a', 'b') u = uminus (p0,p1,p2,p3,'a') ub = uminusbar(p0,p1,p2,p3,'a') d1 = dop_u *(uplus (p0,p1,p2,p3,'b')) d2 = dop_u *(uminus (p0,p1,p2,p3,'b')) d3 = dop_v *(vplus (p0,p1,p2,p3,'b')) d4 = dop_v *(vminus (p0,p1,p2,p3,'b')) assert(u._array[0]._array[0] - cgt(ub._array[2]._array[0])==0) assert(u._array[1]._array[0] - cgt(ub._array[3]._array[0])==0) assert(u._array[2]._array[0] - cgt(ub._array[0]._array[0])==0) assert(u._array[3]._array[0] - cgt(ub._array[1]._array[0])==0) for i in range(4): assert(Abs(evaluate(d1._array[i]._array[0].subs(dct))) < 1.e-11) assert(Abs(evaluate(d2._array[i]._array[0].subs(dct))) < 1.e-11) assert(Abs(evaluate(d3._array[i]._array[0].subs(dct))) < 1.e-11) assert(Abs(evaluate(d4._array[i]._array[0].subs(dct))) < 1.e-11) def test_spinors(massless=True): def test_polvecs(): # Outgoing gluon mom k1 = Symbol('k1', real=True) k2 = Symbol('k2', real=True) k3 = Symbol('k3', real=True) k0 = sqrt(k1**2+k2**2+k3**2) p1 = Symbol('p1', real=True) p2 = Symbol('p2', real=True) p3 = Symbol('p3', real=True) M = 0 if massless else Symbol('M', real=True) p0 = sqrt(p1**2+p2**2+p3**2+M**2) assert((uminus(p0,p1,p2,p3,'a')*uminusbar(p0,p1,p2,p3,'a') )._array[0] == 0) assert((vminus(p0,p1,p2,p3,'a')*vminusbar(p0,p1,p2,p3,'a') )._array[0] == 0) assert((uminus(p0,p1,p2,p3,'a')*vplusbar (p0,p1,p2,p3,'a') )._array[0] == 0) assert((uplus (p0,p1,p2,p3,'a')*vminusbar(p0,p1,p2,p3,'a') )._array[0] == 0) # Outgoing gluon reference mom g1 = Symbol('g1', real=True) g2 = Symbol('g2', real=True) g3 = Symbol('g3', real=True) g0 = sqrt(k1**2+k2**2+k3**2) dop = dirac_op([p0,p1,p2,p3], M, 'a', 'b') t = epsilonplus(k0,k1,k2,k3, 'mu', g0, g1, g2, g3)*conjugate_tensor1d(epsilonplus(k0,k1,k2,k3, 'nu', g0, g1, g2, g3)) + epsilonminus(k0,k1,k2,k3, 'mu', g0, g1, g2, g3)*conjugate_tensor1d(epsilonminus(k0,k1,k2,k3, 'nu', g0, g1, g2, g3)) d1 = dop *(uplus (p0,p1,p2,p3,'b')) d2 = dop *(uminus (p0,p1,p2,p3,'b')) d3 = dop *(vplus (p0,p1,p2,p3,'b')) d4 = dop *(vminus (p0,p1,p2,p3,'b')) s = -mink_metric('mu','nu') + (tensor1d([k0,k1,k2,k3],'mu')*tensor1d([g0,g1,g2,g3],'nu')+tensor1d([k0,k1,k2,k3],'nu')*tensor1d([g0,g1,g2,g3],'mu'))/(tensor1d([k0,k1,k2,k3],'nu')*mink_metric('mu','nu')*tensor1d([g0,g1,g2,g3],'mu')) for i in range(4): assert(d1._array[i]._array[0].simplify() == 0 ) assert(d2._array[i]._array[0].simplify() == 0 ) assert(d3._array[i]._array[0].simplify() == 0 ) assert(d4._array[i]._array[0].simplify() == 0 ) dct = {k:uniform(1.,100.) for k in [k1,k2,k3,g1,g2,g3]} print evaluate(t._array[0]._array[0]._array[0].subs(dct)) print evaluate(s._array[0]._array[0]._array[0].subs(dct)) def t0(): ... ... @@ -145,7 +151,6 @@ def t0(): t2 = Symbol('t2', real=True) t3 = Symbol('t3', real=True) t0 = sqrt(t1**2+t2**2+t3**2) # Outgoing quark mom p1 = Symbol('p1', real=True) p2 = Symbol('p2', real=True) ... ... @@ -164,10 +169,14 @@ def t0(): g3 = Symbol('g3', real=True) g0 = sqrt(k1**2+k2**2+k3**2) m2 = uplusbar(p0,p1,p2,p3,'a')*Gamma('mu','a','b')*uplus(k0,k1,k2,k3,'b')*mink_metric('mu','nu')*conjugate_tensor1d(epsilonplus(k0,k1,k2,k3, 'nu', g0,g1,g2,g3)) print m2._array[0].simplify() #test_bar() #test_spinors() test_spinors() #t0() #test_polvecs()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!