Example #1
0
def test_Dirac():
    gamma0 = mgamma(0)
    gamma1 = mgamma(1)
    gamma2 = mgamma(2)
    gamma3 = mgamma(3)
    gamma5 = mgamma(5)

    # gamma*I -> I*gamma    (see #354)
    assert gamma5 == gamma0 * gamma1 * gamma2 * gamma3 * I
    assert gamma1 * gamma2 + gamma2 * gamma1 == zeros(4)
    assert gamma0 * gamma0 == eye(4) * minkowski_tensor[0, 0]
    assert gamma2 * gamma2 != eye(4) * minkowski_tensor[0, 0]
    assert gamma2 * gamma2 == eye(4) * minkowski_tensor[2, 2]

    assert mgamma(5, True) == \
        mgamma(0, True)*mgamma(1, True)*mgamma(2, True)*mgamma(3, True)*I
def test_Dirac():
    gamma0 = mgamma(0)
    gamma1 = mgamma(1)
    gamma2 = mgamma(2)
    gamma3 = mgamma(3)
    gamma5 = mgamma(5)

    # gamma*I -> I*gamma    (see #354)
    assert gamma5 == gamma0 * gamma1 * gamma2 * gamma3 * I
    assert gamma1 * gamma2 + gamma2 * gamma1 == zeros(4)
    assert gamma0 * gamma0 == eye(4) * minkowski_tensor[0, 0]
    assert gamma2 * gamma2 != eye(4) * minkowski_tensor[0, 0]
    assert gamma2 * gamma2 == eye(4) * minkowski_tensor[2, 2]

    assert mgamma(5, True) == \
        mgamma(0, True)*mgamma(1, True)*mgamma(2, True)*mgamma(3, True)*I
Example #3
0
    def __getattr__(self, name):
        """
        >>> from sympy import *
        >>> m=Matrix(((1,2+I),(3,4)))
        >>> m  #doctest: +NORMALIZE_WHITESPACE
        1 2 + I
        3 4
        >>> m.T #doctest: +NORMALIZE_WHITESPACE
        1 3
        2 + I 4
        >>> m.H #doctest: +NORMALIZE_WHITESPACE
        1 3
        2 - I 4

        """
        if name == "T":
            # transposition
            out = Matrix(self.cols, self.lines, lambda i, j: self[j, i])
            return out
        if name == "C":
            # by-element conjugation
            out = Matrix(self.lines, self.cols, lambda i, j: self[i, j].conjugate())
            return out
        if name == "H":
            # hermite conjugation
            out = self.T.C
            return out
        if name == "D":
            # dirac conjugation
            from sympy.physics.matrices import mgamma

            out = self.H * mgamma(0)
            return out
        raise AttributeError("'%s' object has no attribute '%s'" % (self.__class__.__name__, name))
Example #4
0
from sympy.physics.paulialgebra import Pauli, evaluate_pauli_product
from sympy.physics.matrices import mdft, mgamma, msigma, pat_matrix


mdft(4) # expression of discrete Fourier transform as a matrix multiplication
mgamma(2) # Dirac gamma matrix in the Dirac representation
msigma(2) #  Pauli matrix with (1,2,3)
pat_matrix(3, 1, 0, 0) #  computer Parallel Axis Theorem matrix to translate the inertia matrix a distance of dx, dy, dz for a body of mass m.
					   

evaluate_pauli_product(4*x*Pauli(3)*Pauli(2)) 
from sympy.physics.paulialgebra import Pauli, evaluate_pauli_product
from sympy.physics.matrices import mdft, mgamma, msigma, pat_matrix

mdft(4)  # expression of discrete Fourier transform as a matrix multiplication
mgamma(2)  # Dirac gamma matrix in the Dirac representation
msigma(2)  #  Pauli matrix with (1,2,3)
pat_matrix(
    3, 1, 0, 0
)  #  computer Parallel Axis Theorem matrix to translate the inertia matrix a distance of dx, dy, dz for a body of mass m.

evaluate_pauli_product(4 * x * Pauli(3) * Pauli(2))