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((2*x + 8)*exp(-6*x), x) can't find any solution #10391

Open
wxgeo opened this Issue Jan 14, 2016 · 6 comments

Comments

Projects
None yet
4 participants
@wxgeo
Copy link
Contributor

wxgeo commented Jan 14, 2016

>>> solve((2*x + 8)*exp(-6*x), x)
[]

Obvious answer is -4.

(Tested in sympy live : Python console for SymPy 0.7.6 (Python 2.7.5))

@kshitij10496

This comment has been minimized.

Copy link
Member

kshitij10496 commented Jan 14, 2016

Use solveset instead of solve

In [ ]: x = symbols('x')
In [ ]: solveset((2*x+8)*exp(-6*x), x)
Out[ ]: {-4}
@wxgeo

This comment has been minimized.

Copy link
Contributor

wxgeo commented Jan 14, 2016

Thanks !
Is solve() deprecated ?

skirpichev added a commit to diofant/diofant that referenced this issue Jan 14, 2016

@kshitij10496

This comment has been minimized.

Copy link
Member

kshitij10496 commented Jan 15, 2016

Its not deprecated formally yet.
You can read about it here.

skirpichev added a commit to diofant/diofant that referenced this issue Jan 15, 2016

skirpichev added a commit to diofant/diofant that referenced this issue Jan 15, 2016

@smichr

This comment has been minimized.

Copy link
Member

smichr commented Jan 16, 2016

If you set check=False when calling solve, the solution will be given. The reason it is not otherwise given is because the denominator is close to zero and gives a false positive for the denominator being zero test. checksol needs to be improved.

@wxgeo

This comment has been minimized.

Copy link
Contributor

wxgeo commented Aug 26, 2018

The patch given by Sergey Kirpichev above obviously solves the issue.
Is it possible to merge it ?

@smichr

This comment has been minimized.

Copy link
Member

smichr commented Aug 27, 2018

checksol should not be using a hard-coded value to see if a number is close to zero or not.

is_zero or is_nonzero can be used if the expr.is_number and I believe they each check numerical solutions and only return a non-None answer when the evaluated expression evaluates with significance.

If those are both indeterminate, then I think it would be better to return the solution and let the user check it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment