Skip to content

Checking whether a given expression is polynomial #492

@dominikgeissler

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions