Skip to content

Checking whether a given expression is polynomialΒ #492

Description

@dominikgeissler

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!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions