示例#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 == zero(4)
    assert gamma0 * gamma0 == one(4) * minkowski_tensor[0,0]
    assert gamma2 * gamma2 != one(4) * minkowski_tensor[0,0]
    assert gamma2 * gamma2 == one(4) * minkowski_tensor[2,2]

    assert mgamma(5,True) == \
        mgamma(0,True)*mgamma(1,True)*mgamma(2,True)*mgamma(3,True)*I
示例#2
0
文件: ddd.py 项目: sfgorky/pycircuit
def DDD_of_matrix(A):
    """Create DDD of a Sympy matrix
    @param A:  Input matrix
    @type A:   sympy.Matrix

    >>> a,b,c,d,e,f,g,h,i,j=sympy.symbols('abcdefghij')
    >>> A = sympy.Matrix((a,b,0,0),(c,d,e,0),(0,f,g,h),(0,0,i,j))
    >>> DDD_matrix(A)
    
    """
    print A
    if A == sympy.zero(1):
        return VertexZero
    if A == sympy.one(1):
        return VertexOne

    # Select row, column
    i = 0; j = 0
    D0 = copy(A)
    D0[i,j] = 0
    return DDD(A[i,j],
               D1 = DDD_of_matrix(A.minorMatrix(i,j)),
               D0 = D0)    
示例#3
0
def DDD_of_matrix(A):
    """Create DDD of a Sympy matrix
    @param A:  Input matrix
    @type A:   sympy.Matrix

    >>> a,b,c,d,e,f,g,h,i,j=sympy.symbols('abcdefghij')
    >>> A = sympy.Matrix((a,b,0,0),(c,d,e,0),(0,f,g,h),(0,0,i,j))
    >>> DDD_matrix(A)
    
    """
    print A
    if A == sympy.zero(1):
        return VertexZero
    if A == sympy.one(1):
        return VertexOne

    # Select row, column
    i = 0; j = 0
    D0 = copy(A)
    D0[i,j] = 0
    return DDD(A[i,j],
               D1 = DDD_of_matrix(A.minorMatrix(i,j)),
               D0 = D0)