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 symbolic elementary functions #2094

Merged
merged 3 commits into from
Jul 4, 2023

Conversation

anutosh491
Copy link
Collaborator

This Pr implements 5 elementary symbolic functions (sin, cos, exp, log, Abs) through a macro create_symbolic_unary_macro as all of these functions take in a single argument . Hence something like the following can be accomplished.

(lf) anutosh491@spbhat68:~/lpython/lpython$ cat examples/expr2.py 
from sympy import Symbol, Abs, sin, pi, log, exp
def main0():
    x: S = Symbol('x')
    y: S = Symbol('y')
    z: S = exp(x**S(2) + pi)
    print(z)
    print(sin(z))
    print(log(z + Abs(S(-10))))

main0()

(lf) anutosh491@spbhat68:~/lpython/lpython$ lpython --backend=c --enable-symengine examples/expr2.py 
exp(x**2 + pi)
sin(exp(x**2 + pi))
log(10 + exp(x**2 + pi))

@anutosh491 anutosh491 mentioned this pull request Jul 4, 2023
9 tasks
@anutosh491
Copy link
Collaborator Author

Hello @certik , This would finish the first set of TODO's related to the C backend as mentioned in the issue #1987 . I've updated the issue and pasted relevant PR's in front of each of the TODO .

Copy link
Contributor

@certik certik left a comment

Choose a reason for hiding this comment

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

I think this looks great!

Excellent progress, thank you.

@certik
Copy link
Contributor

certik commented Jul 4, 2023

I rebased it just in case.

@certik certik enabled auto-merge July 4, 2023 11:51
@anutosh491
Copy link
Collaborator Author

Thanks a lot for the quick review Ondřej.

@certik certik merged commit 39e1a26 into lcompilers:main Jul 4, 2023
@anutosh491 anutosh491 deleted the GSoC_PR6 branch July 4, 2023 12:14
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.

2 participants