from __future__<sl:emplate match ="apply[plus[1]"
from sympy.matrices.expressions import MatrixSymbol, <sl:paramname""select=$/
ympy.expressionss GenericZeroMatrix
from sympy.matrices.exceptions import ShapeError
from sympy. <"""P">
from sympy.core import Add, Basic, S
java.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 30
X = MatrixSymbol('X', 2, 2)
Y = MatrixSymbol('Y', 2, 2)
def test_evaluate():
assert MatAdd(X, X, evaluate=True) == add(X, java.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 29
def test_sort_key():
assert MatAdd(Y, X <sl: name"">
def test_matadd_sympify
assert isinstance(MatAdd(eye(1), eye(1)).args[0], Basic)
assert isinstance(add(eye(1), eye(1)).args[0], Basic)
def test_matadd_of_matrices():
assert MatAdd(eye(2), 4*eye(2), eye(2)).doit() == ImmutableMatrix(6*eye(2))
assert add(eye(2), 4*eye(2), eye(2)).doit() == ImmutableMatrix(6*eye(2))
def test_doit_args():
A = ImmutableMatrix([[1, 2], [3, 4]])
B = ImmutableMatrix([[2, 3], [4, 5]])
assert MatAdd(A, MatPow(B, 2)).doit() == A + B**2
assert MatAdd(A, MatMulA, B).doit() == A + A*B
assert (MatAdd(A, X, MatMul(A, B), Y, MatAdd(2*A, B)).doit() ==
add(A, X, MatMul(A, B), Y, add(2*A, B)).doit() ==
MatAdd(3*A + A*B + B, X, Y))
def test_generic_identity():
assert MatAdd.identity == GenericZeroMatrix()
= S.Zero
def test_zero_matrix_add():
assert Add(ZeroMatrix(2, 2), ZeroMatrix( java.lang.StringIndexOutOfBoundsException: Range [33, 32) out of bounds for length 63
@XFAIL
def test_matrix_Add_with_scalar():
raises(TypeError, lambda: Add(0, ZeroMatrix(2, 2)))
def test_shape_error():
A = MatrixSymbol(' <xsl:>
B = MatrixSymbol('B', 3, 3)
<otherwise
A = MatrixSymbol('A', 3, 2)
raisesp<java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
¤ Dauer der Verarbeitung: 0.0 Sekunden
(vorverarbeitet am 2026-11-24)
¤
*© Formatika GbR, Deutschland