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

solve breaks on certain repeated inputs #21766

Open
saliola opened this issue Jul 21, 2021 · 1 comment
Open

solve breaks on certain repeated inputs #21766

saliola opened this issue Jul 21, 2021 · 1 comment

Comments

@saliola
Copy link

saliola commented Jul 21, 2021

Hi everyone. Thanks for your work on sympy.

I came across an issue when trying to solve a system of equations, and I reduced it to the following example:

>>> solve([z + y/x, - (z + y/x)], [x, y, z])
Traceback (most recent call last):
...
NotImplementedError: no valid subset found

>>> solve([z + y/x, z + y/x], [x, y, z])
Traceback (most recent call last):
...
NotImplementedError: no valid subset found

I would have expected x == -y/z as an answer, and indeed, this is what sympy returns if the second (redundant) equation is removed:

>>> solve([z + y/x], [x, y, z])
[( -y/z, y, z )]

(I verified these tests on https://live.sympy.org/, but I came across them using sympy through sagemath.)

@oscarbenjamin
Copy link
Contributor

I can confirm this with latest sympy master:

In [1]: solve([z + y/x, - (z + y/x)], [x, y, z])
---------------------------------------------------------------------------
NotImplementedError                       Traceback (most recent call last)
<ipython-input-1-07dae630f90a> in <module>
----> 1 solve([z + y/x, - (z + y/x)], [x, y, z])

~/current/sympy/sympy/sympy/solvers/solvers.py in solve(f, *symbols, **flags)
   1095         solution = _solve(f[0], *symbols, **flags)
   1096     else:
-> 1097         solution = _solve_system(f, symbols, **flags)
   1098 
   1099     #

~/current/sympy/sympy/sympy/solvers/solvers.py in _solve_system(exprs, symbols, **flags)
   1866                     solved_syms = list(got_s)
   1867                 else:
-> 1868                     raise NotImplementedError('no valid subset found')
   1869             else:
   1870                 try:

NotImplementedError: no valid subset found

Not sure what that code in _solve_system is doing...

skirpichev added a commit to skirpichev/diofant that referenced this issue Jul 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants