Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for comparing symbolic expressions #2374

Merged
merged 3 commits into from
Oct 8, 2023

Conversation

anutosh491
Copy link
Collaborator

@anutosh491 anutosh491 commented Oct 8, 2023

While I was discussing comparsion of class types (Pow etc) with @Thirumalai-Shaktivel we realized that currently we aren't supporting comparing basic variables. Hence this is an implementation for that. Now we can do the following

(lf) anutosh491@spbhat68:~/lpython/lpython$ cat examples/expr2.py 
from lpython import S
from sympy import Symbol, pi, sin

def main0():
    x: S = pi
    y: S = pi
    print(x == pi)
    print(x == y)
    print(pi == y)
    print(pi == pi)
    print(x != sin(x))
    print(pi != sin(pi))
(lf) anutosh491@spbhat68:~/lpython/lpython$ lpython --enable-symengine examples/expr2.py 
True
True
True
True
True
True

This should essentially help us with the following (https://github.com/sympy/sympy/blob/368eb0f483f2b4cd84dc0de3edc7abdc876d3d46/sympy/series/gruntz.py#L257)

Copy link
Collaborator

@Thirumalai-Shaktivel Thirumalai-Shaktivel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect, let's add some tests.

@anutosh491
Copy link
Collaborator Author

I've added some simple tests in the file where we are testing out binary operators. Hopefully this works.

@anutosh491 anutosh491 requested a review from certik October 8, 2023 09:05
@certik certik merged commit 36fe6cf into lcompilers:main Oct 8, 2023
13 checks passed
@anutosh491 anutosh491 deleted the implementing_symbolic_comparison branch October 9, 2023 02:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants