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

Checking whether a given expression is polynomial #492

Open
dominikgeissler opened this issue Sep 26, 2024 · 1 comment
Open

Checking whether a given expression is polynomial #492

dominikgeissler opened this issue Sep 26, 2024 · 1 comment

Comments

@dominikgeissler
Copy link

dominikgeissler commented Sep 26, 2024

Hey!
Using symengine, I was trying to check whether a given expression is polynomial.

In the C++ documentation there exists a method is_polynomial() which would be exactly what I was looking for. This method however does not seem to exist in the python bindings (as of version 0.11.0).

Using the given is_finite propery sadly doesn't work and produces some interesting result when compared to SymPy

import symengine as se
import sympy as sp

expr = se.zoo

# 👇 Is this the way it should behave? If yes, why?
print(se.S(expr).is_finite)         # None
print(sp.S(expr).is_finite)         # False

expr = "x ** 5"

# As expected...
print(se.S(expr).is_finite)         # None
print(sp.S(expr).is_finite)         # None

# However, this behavior is what I want
print(sp.S(expr).is_polynomial())   # True

Are there any plans of making the function accessible? Is there a workaround (without simply using SymPy)?

Thanks in advance!

@bjodah
Copy link
Contributor

bjodah commented Sep 26, 2024

Assumptions are not yet implemented in SymEngine. So almost all .is_xxxxx methods will return None (which signifies "indeterminate").

Looks like is_polynomial would be useful in the python bindings. I think it's just a matter of someone finding the time / having the need to write a pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants