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

is_constant incorrectly reports False #19584

Open
smichr opened this issue Jun 18, 2020 · 0 comments
Open

is_constant incorrectly reports False #19584

smichr opened this issue Jun 18, 2020 · 0 comments
Labels

Comments

@smichr
Copy link
Member

smichr commented Jun 18, 2020

From #19576,

>>> expr = (9*x + sqrt(3))/(3*sqrt(3)*x + 1)
>>> expr.is_constant
False

but

s = solve(minpoly(expr), x)
v = set([expr.subs(x, i) for i in s])
if len(v) == 1:
    print (v.pop().is_constant)
else:
    print (False)

gives True. Using the extension=True option to cancel also reduces this to a constant:

>>> cancel(expr,extension=True)
sqrt(3)

I'm not sure if there would be cases where the expression could be constant but the extension=True would fail.

I suspect that the false conclusion comes after evaluating expr._random() and comparing this float to the value obtained when using an integer for x.

@friyaz friyaz added the polys label Jun 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants