I submitted https://github.com/sympy/sympy/pull/2470 to fix this.
On Wednesday, September 11, 2013 12:36:56 PM UTC+2, Thilina Rathnayake wrote: > > Hi All, > > I am trying to implement the solutions for cubic Thue equation and to do > that > I have to solve cubic equations. I use `solve()` to do this. But I am > having a little > trouble filtering out real solutions from the solution list returned by > `solve()`. > > I tried the following. > > In [5]: from sympy.abc import x >> In [6]: solutions = solve(2*x**3 - 3*x**2 - 3*x - 1) >> > In [8]: for s in solutions: >> ...: print(sympify(s).is_real) >> ...: >> None >> None >> None >> > > But one of the solutions in this equation is real. See below: > http://www.wolframalpha.com/input/?i=2*x**3+-+3*x**2+-+3*x+-+1 > > That is also included in the list returned by `solve()` > > In [9]: solutions[0] >> Out[9]: 1/2 - (-3)**(1/3)/2 + (-3)**(2/3)/2 >> > > But, Interestingly, > > In [10]: for s in solutions: >> ....: print(im(s)) >> ....: >> -3**(5/6)/4 + 3*3**(1/6)/4 >> im((-3)**(2/3)/(-1/2 + sqrt(3)*I/2))/2 - im((-3)**(1/3)*(-1/2 + >> sqrt(3)*I/2))/2 >> im((-3)**(2/3)/(-1/2 - sqrt(3)*I/2))/2 - im((-3)**(1/3)*(-1/2 - >> sqrt(3)*I/2))/2 >> > > `im()` of `solutions[0]` should be zero. Am I doing something wrong here > or is this a bug? > Are there any other methods to find whether a number is purely real or not? > > Thank you in advance. > > Regards, > Thilina. > > -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sympy. For more options, visit https://groups.google.com/groups/opt_out.
