Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Added tests
  • Loading branch information
anutosh491 committed May 4, 2024
commit 780b1a175e663cb854f015cd42dd02b6ff0f3aac
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()