Skip to content

Commit

Permalink
Correct checksol: add quick is_nonzero test
Browse files Browse the repository at this point in the history
Fixes sympy/sympy#10391

checksol: use is_nonzero
  • Loading branch information
skirpichev committed Jan 15, 2016
1 parent 9a26aed commit 1d56ea8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions sympy/solvers/solvers.py
Expand Up @@ -289,6 +289,8 @@ def checksol(f, symbol, sol=None, **flags):
continue
elif val.is_Rational:
return val == 0
elif val.is_nonzero:
return False
if numerical and not val.free_symbols:
return bool(abs(val.n(18).n(12, chop=True)) < 1e-9)
was = val
Expand Down
4 changes: 4 additions & 0 deletions sympy/solvers/tests/test_solvers.py
Expand Up @@ -1748,3 +1748,7 @@ def test_issue_8828():

p, q, r = [{tuple(i.evalf(2) for i in j) for j in R} for R in [A, B, C]]
assert p == q == r


def test_issue_10391():
assert solve((2*x + 8)*exp(-6*x), x) == [-4]

0 comments on commit 1d56ea8

Please sign in to comment.