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

Empty list of solutions returned for equation with cubic roots #21167

Closed
step135 opened this issue Mar 25, 2021 · 4 comments
Closed

Empty list of solutions returned for equation with cubic roots #21167

step135 opened this issue Mar 25, 2021 · 4 comments

Comments

@step135
Copy link

step135 commented Mar 25, 2021

>>> from sympy import *
>>> x=S("x")
>>> solve(cbrt(x-1)+cbrt(x)+cbrt(x+1))
[]

Due to symmetry, this equation has only one root in complex numbers. It is 0. We don't need to compute it considering the symmetry or directly seeing the algebraic solution and knowing that in case of symmetry there is only one solution. Antisymmetric cases when a ≠ b have three roots, mostly one real and two complex.

Algorithmic solution consists of cubing the equation and doing substitution using the original equation and finding roots of either linear (symmetric case) equation or cubic equation.

@oscarbenjamin
Copy link
Contributor

I think this a duplicate of #21026

@smichr
Copy link
Member

smichr commented Mar 25, 2021

Yes, this is a problem with checking the solution. Disabling checking will give the solution:

>>> eq = cbrt(x-1)+cbrt(x)+cbrt(x+1); solve(eq, check=0)
[0]

@oscarbenjamin
Copy link
Contributor

Here 0 is not a solution:

In [1]: eq = cbrt(x-1)+cbrt(x)+cbrt(x+1)

In [2]: eq
Out[2]: 
3 ___   3 _______   3 _______
╲╱ x  + ╲╱ x - 1  + ╲╱ x + 1 

In [3]: eq.subs(x, 0)
Out[3]: 
    3 ____
1 + ╲╱ -1 

In [4]: eq.subs(x, 0).n()
Out[4]: 1.5 + 0.866025403784439

As discussed in the other issue that's because in sympy cbrt means the principal root which is not real in the case of negative numbers. If you meant the real root then you need to use real_root.

skirpichev added a commit to skirpichev/diofant that referenced this issue Mar 28, 2021
@oscarbenjamin
Copy link
Contributor

Closing as a duplicate of #21026 (the issue described here is invalid as is the OP in the other issue but the other issue also highlights some things that should work but don't so it's better to keep that one open).

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

3 participants