Skip to content

Commit b209fde

Browse files
committed
tests: Add tests for differentiation
This ensures that the zero-th derivative returns the correct answer. The sympy python library returns the 'correct' answer. There are still some other deviations which are documented further in the next commit. Signed-off-by: Garming Sam <[email protected]>
1 parent d025f57 commit b209fde

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

symengine/tests/test_functions.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ def test_derivative():
6262
assert f.diff(y) == 0
6363
assert f.diff(x).args == (f, x)
6464
assert f.diff(x).diff(x).args == (f, x, x)
65+
assert f.diff(x, 0) == f
66+
assert f.diff(x, 0) == Derivative(function_symbol("f", x), x, 0)
6567

6668
g = function_symbol("f", y)
6769
assert g.diff(x) == 0
@@ -84,6 +86,17 @@ def test_derivative():
8486
assert g == fxy.diff(y, 1, x, 2)
8587
assert g == fxy.diff(y, x, 2)
8688

89+
h = Derivative(Function("f")(x, y), x, 0, y, 1)
90+
assert h == fxy.diff(x, 0, y)
91+
assert h == fxy.diff(y, x, 0)
92+
93+
i = Derivative(Function("f")(x, y), x, 0, y, 1, x, 1)
94+
assert i == fxy.diff(x, 0, y, x, 1)
95+
assert i == fxy.diff(x, 0, y, x)
96+
assert i == fxy.diff(y, x)
97+
assert i == fxy.diff(y, 1, x, 1)
98+
assert i == fxy.diff(y, 1, x)
99+
87100

88101
def test_abs():
89102
x = Symbol("x")

0 commit comments

Comments
 (0)