Skip to content

Commit

Permalink
Added tests
Browse files Browse the repository at this point in the history
  • Loading branch information
anutosh491 committed May 4, 2024
1 parent d1625f2 commit 780b1a1
Showing 1 changed file with 36 additions and 5 deletions.
41 changes: 36 additions & 5 deletions integration_tests/symbolics_12.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
from sympy import Symbol, E, log, exp
from sympy import Symbol, E, log, exp, oo
from lpython import S

def main0():
# Testing out symbolic constants like E, oo etc

# Define symbolic variables
x: S = Symbol('x')
y: S = Symbol('y')
Expand Down Expand Up @@ -30,10 +32,39 @@ def main0():
assert expr2 == E ** S(1)

# Print the results
print("x =", x)
print("z =", z)
print("log(E) =", expr1)
print("exp(1) =", expr2)
print("x = ", x)
print("z = ", z)
print("log(E) = ", expr1)
print("exp(1) = ", expr2)

# Test symbolic infinity constant
inf: S = oo

# Check if inf is equal to oo
assert inf == oo

# Perform some symbolic operations with oo
z = x + inf

# Check if z is equal to x + oo
assert z == x + oo

# Check if x is not equal to 2 * oo + y
assert x != S(2) * oo + y

# Evaluate some mathematical expressions with oo
expr1 = log(oo)
expr2 = exp(oo)

# Check the results
assert expr1 == oo
assert expr2 == oo

# Print the results
print("inf = ", inf)
print("z = ", z)
print("log(oo) = ", expr1)
print("exp(oo) = ", expr2)


main0()

0 comments on commit 780b1a1

Please sign in to comment.