Did I find the right examples for you? yes no      Crawl my project      Python Jobs

# sympy.matrices.expressions.trace

All Samples(86)  |  Call(74)  |  Derive(0)  |  Import(12)

```
assert transpose(Trace(A)) == Trace(A)

```

```
assert transpose(Trace(A)) == Trace(A)

```

```    assert trace(Matrix(3, 3, [1, 2, 3, 4, 5, 6, 7, 8, 9])) == 15

assert transpose(Trace(A)) == Trace(A)
```

```def test_Trace():
assert isinstance(Trace(A), Trace)
assert not isinstance(Trace(A), MatrixExpr)
raises(ShapeError, lambda: Trace(C))
assert trace(eye(3)) == 3
assert trace(Matrix(3, 3, [1, 2, 3, 4, 5, 6, 7, 8, 9])) == 15
```

```    assert trace(Matrix(3, 3, [1, 2, 3, 4, 5, 6, 7, 8, 9])) == 15

assert transpose(Trace(A)) == Trace(A)
```

```def test_Trace():
assert isinstance(Trace(A), Trace)
assert not isinstance(Trace(A), MatrixExpr)
raises(ShapeError, lambda: Trace(C))
assert trace(eye(3)) == 3
assert trace(Matrix(3, 3, [1, 2, 3, 4, 5, 6, 7, 8, 9])) == 15
```

```
# Some easy simplifications
assert trace(Identity(5)) == 5
assert trace(ZeroMatrix(5, 5)) == 0
assert trace(2*A*B) == 2 * trace(A*B)
assert trace(A.T) == trace(A)
```

```
# Some easy simplifications
assert trace(Identity(5)) == 5
assert trace(ZeroMatrix(5, 5)) == 0
assert trace(2*A*B) == 2 * trace(A*B)
assert trace(A.T) == trace(A)
```

```    assert Trace(A).arg is A

assert str(trace(A)) == str(Trace(A).doit(deep=True))

@XFAIL
```

```    assert Trace(A).arg is A