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

solving inequality involving exp fails for large values #10268

Closed
smichr opened this Issue Dec 16, 2015 · 3 comments

Comments

Projects
None yet
3 participants
@smichr
Copy link
Member

smichr commented Dec 16, 2015

>>> solve(log(x)<100)
And(-oo < x, x < exp(100))
>>> solve(log(x)<1000)
False
@darkcoderrises

This comment has been minimized.

Copy link
Contributor

darkcoderrises commented Dec 16, 2015

It breaks on solve(log(x)<250)
I pinpointed the difference between solve(log(x)<250) and solve(log(x)<249), to the following function.
https://github.com/sympy/sympy/blob/master/sympy/solvers/inequalities.py#L427. This function when called with exp(250)-1 returns false, but with exp(249) -1 return true. Which then does not allow https://github.com/sympy/sympy/blob/master/sympy/solvers/inequalities.py#L457 to insert the solution

@megh1241

This comment has been minimized.

Copy link
Contributor

megh1241 commented Dec 16, 2015

I would like to add one more thing to that.
The return value of ' v = e.subs(gen, x)' in
https://github.com/sympy/sympy/blob/master/sympy/solvers/inequalities.py#L428.
is different in both the cases.

In the case of solve( log (x) < 100), some of the assumptions of v such as 'is_negative', 'is_nonnegative' have true/false values. However, in the case of solve(log(x) < 1000), these assumptions are of type None.

The function https://github.com/sympy/sympy/blob/master/sympy/solvers/inequalities.py#L430
will eventually call
https://github.com/sympy/sympy/blob/master/sympy/core/expr.py#L290.
The line here which seems to be different for both the cases is this if condition:
https://github.com/sympy/sympy/blob/master/sympy/core/expr.py#L304
The assumptions of 'dif' here depend on the assumptions of v, and in the case of solve(log(x) < 1000), these are of type None, so it enters the 'else' block even though it should satisfy the 'if' condition.

@smichr

This comment has been minimized.

Copy link
Member

smichr commented Dec 19, 2015

@meghana1995, thanks for your input. This is now resolved.

@smichr smichr closed this Dec 19, 2015

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