Beispiel #1
0
def test_Identity():
    A = MatrixSymbol('A', n, m)
    i, j = symbols('i j')

    In = Identity(n)
    Im = Identity(m)

    assert A * Im == A
    assert In * A == A

    assert transpose(In) == In
    assert In.inverse() == In
    assert In.conjugate() == In

    assert In[i, j] != 0
    assert Sum(In[i, j], (i, 0, n - 1), (j, 0, n - 1)).subs(n, 3).doit() == 3
    assert Sum(Sum(In[i, j], (i, 0, n - 1)), (j, 0, n - 1)).subs(n,
                                                                 3).doit() == 3

    # If range exceeds the limit `(0, n-1)`, do not remove `Piecewise`:
    expr = Sum(In[i, j], (i, 0, n - 1))
    assert expr.doit() == 1
    expr = Sum(In[i, j], (i, 0, n - 2))
    assert expr.doit().dummy_eq(
        Piecewise((1, (j >= 0) & (j <= n - 2)), (0, True)))
    expr = Sum(In[i, j], (i, 1, n - 1))
    assert expr.doit().dummy_eq(
        Piecewise((1, (j >= 1) & (j <= n - 1)), (0, True)))
Beispiel #2
0
def test_Identity():
    A = MatrixSymbol('A', n, m)
    In = Identity(n)
    Im = Identity(m)

    assert A*Im == A
    assert In*A == A

    assert transpose(In) == In
    assert In.inverse() == In
    assert In.conjugate() == In
Beispiel #3
0
def test_Identity():
    A = MatrixSymbol('A', n, m)
    In = Identity(n)
    Im = Identity(m)

    assert A * Im == A
    assert In * A == A

    assert transpose(In) == In
    assert In.inverse() == In
    assert In.conjugate() == In
Beispiel #4
0
def test_Identity():
    A = MatrixSymbol('A', n, m)
    i, j = symbols('i j')

    In = Identity(n)
    Im = Identity(m)

    assert A*Im == A
    assert In*A == A

    assert transpose(In) == In
    assert In.inverse() == In
    assert In.conjugate() == In

    assert In[i, j] != 0
    assert Sum(In[i, j], (i, 0, n-1), (j, 0, n-1)).subs(n,3).doit() == 3
    assert Sum(Sum(In[i, j], (i, 0, n-1)), (j, 0, n-1)).subs(n,3).doit() == 3
Beispiel #5
0
def test_Identity():
    A = MatrixSymbol('A', n, m)
    i, j = symbols('i j')

    In = Identity(n)
    Im = Identity(m)

    assert A*Im == A
    assert In*A == A

    assert transpose(In) == In
    assert In.inverse() == In
    assert In.conjugate() == In

    assert In[i, j] != 0
    assert Sum(In[i, j], (i, 0, n-1), (j, 0, n-1)).subs(n,3).doit() == 3
    assert Sum(Sum(In[i, j], (i, 0, n-1)), (j, 0, n-1)).subs(n,3).doit() == 3