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
solveset.py "ValueError: list.remove(x): x not in list" #15422
Comments
I have debugged the code with the previous code. I have found that at some point, the value of res is: res = {} while result is: result = <class 'list'>: [{_X35: 1/2 + sqrt(5)/2}, {_X35: -sqrt(5)/2 + 1/2}] As a result, res cannot be removed from result. I have also verified that the code in line 2550 is not reached. |
I think the following could be changed to sympy/sympy/solvers/solveset.py Line 2708 in 27b9951
The case of no res is already guarded with an if res in the preceding instance of result.remove(res) .
Note: this is now at line 3048 (see this SO). |
I have made some more checks, and it seems that the problem is that The easy solution would be to include an |
The present issue seems to be a symptom of an interesting problem: I have been digging in this issue on commit ae883bf. I have applied the proposed solution: if delete_res and res in result: to line 3178 of solveset. I have found a new issue on the result = p.degree(gen)
return Integer(result) if result is int else result I have found a new issue on a = sp.Add(sp.Integer(1), sp.S.Complexes) It gives the error:
Any ideas to make |
It seems the possibility of making and Add with non-expressions has been deprecated (see #19445) but it is still alive in |
Where exactly does that happen in solveset? |
I do not know exactly, but using it with the Riccati expression generates this |
Can you show the full traceback? |
The traceback:
|
I can't reproduce that traceback. |
You have to make the modifications indicated previously on |
The line here replaces a symbol with a set: sympy/sympy/solvers/solveset.py Line 3165 in 5799291
|
The Set |
Using the nonlinsolve solver in simply version 1.3, python 3.6, I get the error:
sympy/solvers/solveset.py:2635: ValueError: list.remove(x): x not in list
I have checked the code, and it seems that the value can be removed twice, as there is the same code in line 2550. There is a simple solution just checking if the value is still in the list, but as the code is quite complex, I do not know if this is a good idea.
For test purposes, the call is:
Thanks in advance,
Jose M.
The text was updated successfully, but these errors were encountered: