diff --git a/pde/tools/expressions.py b/pde/tools/expressions.py index bae80ee7..c8a3c26d 100644 --- a/pde/tools/expressions.py +++ b/pde/tools/expressions.py @@ -282,11 +282,11 @@ def __eq__(self, other): return False # compare the expressions themselves by checking their difference - diff = sympy.simplify(self._sympy_expr - other._sympy_expr) + difference = sympy.simplify(self._sympy_expr - other._sympy_expr) if isinstance(self._sympy_expr, sympy.NDimArray): - return diff == sympy.Array(np.zeros(self._sympy_expr.shape)) + return difference == sympy.Array(np.zeros(self._sympy_expr.shape, int)) else: - return diff == 0 + return difference == 0 @property def _free_symbols(self) -> set: diff --git a/tests/tools/test_expressions.py b/tests/tools/test_expressions.py index 9cccdffa..ba583eb3 100644 --- a/tests/tools/test_expressions.py +++ b/tests/tools/test_expressions.py @@ -218,7 +218,7 @@ def test_tensor_expression(): assert e.constant np.testing.assert_allclose(e.get_compiled_array()(), [[0, 1], [2, 3]]) np.testing.assert_allclose(e.get_compiled_array()(tuple()), [[0, 1], [2, 3]]) - assert e.differentiate("a") == TensorExpression("[[0., 0.], [0., 0.]]") + assert e.differentiate("a") == TensorExpression("[[0, 0], [0, 0]]") np.testing.assert_allclose(e.value, np.arange(4).reshape(2, 2)) e = TensorExpression("[a, 2*a]")