Example #1
0
def test_simple_trace_cases_symbolic_dim():
    from sympy import symbols
    D = symbols('D')
    G = GammaMatrixHead(dim=D)

    m0, m1, m2, m3 = tensor_indices('m0:4', G.LorentzIndex)
    g = G.LorentzIndex.metric

    t = G(m0) * G(m1)
    t1 = G._trace_single_line(t)
    assert _is_tensor_eq(t1, 4 * G.LorentzIndex.metric(m0, m1))

    t = G(m0) * G(m1) * G(m2) * G(m3)
    t1 = G._trace_single_line(t)
    t2 = -4 * g(m0, m2) * g(m1, m3) + 4 * g(m0, m1) * g(m2, m3) + 4 * g(
        m0, m3) * g(m1, m2)
    assert _is_tensor_eq(t1, t2)
Example #2
0
def test_simple_trace_cases_symbolic_dim():
    from sympy import symbols
    D = symbols('D')
    G = GammaMatrixHead(dim=D)

    m0, m1, m2, m3 = tensor_indices('m0:4', G.Lorentz)
    g = G.Lorentz.metric

    t = G(m0) * G(m1)
    t1 = G.trace_tens(t)
    assert t1 == 4 * G.Lorentz.metric(m0, m1)

    t = G(m0) * G(m1) * G(m2) * G(m3)
    t1 = G.trace_tens(t)
    t2 = -4 * g(m0, m2) * g(m1, m3) + 4 * g(m0, m1) * g(m2, m3) + 4 * g(
        m0, m3) * g(m1, m2)
    assert t1 == t2
Example #3
0
 def tfunc(e):
     return GammaMatrixHead._simplify_single_line(e)
Example #4
0
 def tfunc(e):
     return GammaMatrixHead._simplify_single_line(e)
Example #5
0
 def tfunc(e):
     coeff, list_new_tids = GammaMatrixHead.kahane_simplify(e.coeff, e._tids)
     return TensAdd(*[TensMul.from_TIDS(coeff, ti) for ti in list_new_tids])
Example #6
0
 def tfunc(e):
     coeff, list_new_tids = GammaMatrixHead.kahane_simplify(
         e.coeff, e._tids)
     return TensAdd(*[TensMul.from_TIDS(coeff, ti) for ti in list_new_tids])
from sympy.physics.hep.gamma_matrices import GammaMatrixHead
from sympy.physics.hep.gamma_matrices import GammaMatrix as GM
from sympy.tensor.tensor import tensor_indices, tensorhead
GMH = GammaMatrixHead()
index1 = tensor_indices('index1', G.LorentzIndex)
GMH(index1)

index1 = tensor_indices('index1', GammaMatrix.LorentzIndex)
GM(index1)

GammaMatrix.LorentzIndex.metric




p, q = tensorhead('p, q', [G.LorentzIndex], [[1]])
index0,index1,index2,index3,index4,index5 = tensor_indices('index0:6', G.LorentzIndex)
ps = p(index0)*GM(-index0)
qs = q(index0)*GM(-index0)
GM.gamma_trace(GM(index0)*GM(index1))
GM.gamma_trace(ps*ps) - 4*p(index0)*p(-index0)
GM.gamma_trace(ps*qs + ps*ps) - 4*p(index0)*p(-index0) - 4*p(index0)*q(-index0)

p, q = tensorhead('p, q', [GM.LorentzIndex], [[1]])
index0,index1,index2,index3,index4,index5 = tensor_indices('index0:6', G.LorentzIndex)
ps = p(index0)*G(-index0)
qs = q(index0)*G(-index0)
GM.simplify_gpgp(ps*qs*qs)

index0,index1,index2,index3,index4,index5 = tensor_indices('index0:6', GammaMatrix.LorentzIndex)
spinorindex0,spinorindex1,spinorindex2,spinorindex3,spinorindex4,spinorindex5,spinorindex6,spinorindex7 = tensor_indices('spinorindex0:8', DiracSpinorIndex)