-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
multiple generators [exp(-x), exp(-x**2)] when trying to solve(exp(-x - x ** 2), x) #17949
Comments
I've bisected this to 4bd14a7 from #16666. There was a major change to the old assumptions system to ensure that real numbers are always considered finite. Note though that your example shows the problem without using real=True: In [1]: x = Symbol('x')
In [2]: solve(exp(-x - x ** 2), x)
---------------------------------------------------------------------------
NotImplementedError |
The code takes a different path here: sympy/sympy/solvers/solvers.py Lines 2856 to 2865 in d1cd822
Here In [1]: x = Symbol('x')
In [2]: lhs = -x-x**2; rhs = zoo
In [3]: lhs - rhs
Out[3]:
2
- x - x + zoo
In [4]: posify(lhs - rhs)[0]
Out[4]: zoo Whereas in 1.4 we have In [4]: posify(lhs - rhs)[0]
Out[4]:
2
- x - x + zoo This is because posify makes symbols "positive" and the meaning of positive changed in #16666. Previously positive included So now the effect of posifying the symbols is that they become finite which means that This isn't something I particularly thought about in #16666. I'm not sure what posify should do. For example it could make symbols extended positive instead of positive. That would solve this issue but this issue can also be solved by changing the linked code in |
I'm adding the 1.5 milestone because this could be viewed as a regression. The question is what to do though. Should posify make symbols |
Thanks for quick response! I'm not sure it's relevant, but there's a difference between 1.4 and 1.6.dev before we do
Also, |
This is what I get on master: In [1]: x = Symbol('x')
In [2]: lhs = -x-x**2; rhs = zoo
In [3]: lhs - rhs
Out[3]:
2
- x - x + zoo
In [4]: posify(lhs-rhs)
Out[4]: (zoo, {x: x}) How is |
Aha, I have
|
I've opened #17971 which fixes this in 1.5 |
Closing as merged into 1.5. |
I'm trying to solve equation e^{-x-x^2}=0, which does not have roots in real numbers. In sympy1.4 I get an empty list of solutions, as expected. In current sympy1.6.dev I have an error.
At the same time, similar equation e^{x+x^2} is solved (no roots, as expected):
The text was updated successfully, but these errors were encountered: