diff --git a/sympy/solvers/solveset.py b/sympy/solvers/solveset.py index 316911ef6422..e4d85260b4db 100644 --- a/sympy/solvers/solveset.py +++ b/sympy/solvers/solveset.py @@ -880,6 +880,7 @@ def linear_eq_to_matrix(equations, *symbols): [f]]) """ + from sympy.simplify.radsimp import collect if not symbols: raise ValueError('Symbols must be given, for which coefficients \ @@ -894,7 +895,7 @@ def linear_eq_to_matrix(equations, *symbols): row_no = 1 for equation in equations: - f = sympify(equation) + f = collect(equation.expand() ,symbols) if isinstance(f, Equality): f = f.lhs - f.rhs diff --git a/sympy/solvers/tests/test_solveset.py b/sympy/solvers/tests/test_solveset.py index ee49f9cc720a..2bc1cef2f264 100644 --- a/sympy/solvers/tests/test_solveset.py +++ b/sympy/solvers/tests/test_solveset.py @@ -1101,3 +1101,14 @@ def test_issue_8715(): (Interval.open(-2, oo) - FiniteSet(0)) assert solveset(eq.subs(x,log(x)), x, S.Reals) == \ Interval.open(exp(-2), oo) - FiniteSet(1) + +def test_issue_10568(): + e = [z-1 , m*(x+3*y)+8*z-3 , y-5] + soln = FiniteSet((-15 - 5/m, 5, 1)) + assert linsolve(e, [x,y,z]) == soln + +@XFAIL +def test_issue_10568_not_fixed(): + e = [z-1 , m*(x+3*y)+8*z-3 , y-5] + soln = FiniteSet((-15 - 5/m, 5)) + assert linsolve(e, [x,y]) == soln