Skip to content

Commit

Permalink
Added tests for the changes
Browse files Browse the repository at this point in the history
  • Loading branch information
anutosh491 committed Sep 26, 2023
1 parent 78ec79f commit a4e8f9c
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion integration_tests/symbolics_05.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from sympy import Symbol, expand, diff
from sympy import Symbol, expand, diff, sin, cos, exp, pi
from lpython import S

def test_operations():
Expand All @@ -21,4 +21,16 @@ def test_operations():
print(a.diff(x))
print(diff(b, x))

# test diff 2
c:S = sin(x)
d:S = cos(x)
assert(sin(Symbol("x")).diff(x) == d)
assert(sin(x).diff(Symbol("x")) == d)
assert(sin(x).diff(x) == d)
assert(sin(x).diff(x).diff(x) == S(-1)*c)
assert(sin(x).expand().diff(x).diff(x) == S(-1)*c)
assert((sin(x) + cos(x)).diff(x) == S(-1)*c + d)
assert((sin(x) + cos(x) + exp(x) + pi).diff(x).expand().diff(x) == exp(x) + S(-1)*c + S(-1)*d)


test_operations()

0 comments on commit a4e8f9c

Please sign in to comment.