High energy physics

class sympy.physics.hep.gamma_matrices._LorentzContainer[source]

Helper to collect LorentzIndex indices in various dimensions.

It collects LorentzIndex TensorIndexType that have been implemented in the code, and stores them in a dict()

class sympy.physics.hep.gamma_matrices.GammaMatrixHead[source]

Class to wrap a TensorHead for gamma matrices.

dim dimension of the gamma matrix. eps_dim correction for dimensional regularization, use None if not needed.

Examples

>>> from sympy.physics.hep.gamma_matrices import GammaMatrixHead
>>> from sympy.tensor.tensor import tensor_indices
>>> G = GammaMatrixHead()
>>> i = tensor_indices('i', G.LorentzIndex)
>>> G(i)
gamma(i, auto_left, -auto_right)

Note that there is already an instance of GammaMatrixHead in four dimensions: GammaMatrix, which is simply declare as

GammaMatrix = GammaMatrixHead()

>>> from sympy.physics.hep.gamma_matrices import GammaMatrix
>>> from sympy.tensor.tensor import tensor_indices
>>> i = tensor_indices('i', GammaMatrix.LorentzIndex)
>>> GammaMatrix(i)
gamma(i, auto_left, -auto_right)

To access the metric tensor

>>> GammaMatrix.LorentzIndex.metric
metric(LorentzIndex,LorentzIndex)
static extract_type_tens(expression)[source]

Extract from a TensExpr all elements of this type.

Returns two tensor expressions:

  • the first contains all TensorHead of this type.
  • the second contains all remaining.
gamma_trace(t)[source]

trace of a single line of gamma matrices

Examples

>>> from sympy.physics.hep.gamma_matrices import GammaMatrix as G
>>> from sympy.tensor.tensor import tensor_indices, tensorhead
>>> p, q = tensorhead('p, q', [G.LorentzIndex], [[1]])
>>> i0,i1,i2,i3,i4,i5 = tensor_indices('i0:6', G.LorentzIndex)
>>> ps = p(i0)*G(-i0)
>>> qs = q(i0)*G(-i0)
>>> G.gamma_trace(G(i0)*G(i1))
4*metric(i0, i1)
>>> G.gamma_trace(ps*ps) - 4*p(i0)*p(-i0)
0
>>> G.gamma_trace(ps*qs + ps*ps) - 4*p(i0)*p(-i0) - 4*p(i0)*q(-i0)
0
static simplify_gpgp(ex, sort=True)[source]

simplify products G(i)*p(-i)*G(j)*p(-j) -> p(i)*p(-i)

Examples

>>> from sympy.physics.hep.gamma_matrices import GammaMatrix as G
>>> from sympy.tensor.tensor import tensor_indices, tensorhead
>>> p, q = tensorhead('p, q', [G.LorentzIndex], [[1]])
>>> i0,i1,i2,i3,i4,i5 = tensor_indices('i0:6', G.LorentzIndex)
>>> ps = p(i0)*G(-i0)
>>> qs = q(i0)*G(-i0)
>>> G.simplify_gpgp(ps*qs*qs)
gamma(-L_0, auto_left, -auto_right)*p(L_0)*q(L_1)*q(-L_1)
static simplify_lines(ex)[source]

simplify a product of gamma matrices

Examples

>>> from sympy.physics.hep.gamma_matrices import GammaMatrix, DiracSpinorIndex
>>> from sympy.tensor.tensor import tensor_indices
>>> i0,i1,i2,i3,i4,i5 = tensor_indices('i0:6', GammaMatrix.LorentzIndex)
>>> s0,s1,s2,s3,s4,s5,s6,s7 = tensor_indices('s0:8', DiracSpinorIndex)
>>> G = GammaMatrix
>>> t = G(i1,s1,-s2)*G(i4,s7,-s6)*G(i2,s2,-s3)*G(i3,s4,-s5)*G(i5,s6,-s7)
>>> G.simplify_lines(t)
4*gamma(i3, s4, -s5)*gamma(i1, s1, -S_0)*gamma(i2, S_0, -s3)*metric(i4, i5)