On Jan 9, 2013, at 10:23 AM, Shriramana Sharma <[email protected]> wrote:

> Please observe. The durand-kerner module is my own home-built version
> based on some C++ code I saw on the net.
>
> In [1]: from durandkerner_1 import durandkerner
>   ...: from sympy import solve
>   ...: from sympy . abc import x
>   ...: from mpmath import polyroots, nprint
>   ...:
>
> In [2]: solve ( x ** 6 + 4 * x ** 3 + x )
> Out[2]: [0]
>
> In [3]: durandkerner ( 1, 0, 0, 4, 0, 1, 0 )
> Out[3]:
> [-1.6353959317932223,
> (-0.0077598192291164995-0.49945660613957j),
> (-0.0077598192291164995+0.49945660613957j),
> 0.0,
> (0.8254577851257278-1.330129240061128j),
> (0.8254577851257278+1.330129240061128j)]
>
> In [4]: nprint ( polyroots ( [ 1, 0, 0, 4, 0, 1, 0 ] ) )
> [-1.6354, 7.34684e-40, (-0.00775982 + 0.499457j), (-0.00775982 -
> 0.499457j), (0.825458 + 1.33013j), (0.825458 - 1.33013j)]
>
> In [5]: solve ( x ** 5 + 4 * x ** 2 + 1 )
> Out[5]:
> [RootOf(x**5 + 4*x**2 + 1, 0),
> RootOf(x**5 + 4*x**2 + 1, 1),
> RootOf(x**5 + 4*x**2 + 1, 2),
> RootOf(x**5 + 4*x**2 + 1, 3),
> RootOf(x**5 + 4*x**2 + 1, 4)]
>
> In [6]: durandkerner ( 1, 0, 0, 4, 0, 1 )
> Out[6]:
> [-1.6353959317932223,
> (-0.0077598192291165+0.49945660613957j),
> (-0.007759819229116499-0.49945660613957j),
> (0.8254577851257276-1.330129240061128j),
> (0.8254577851257276+1.330129240061128j)]
>
> In [7]: nprint ( polyroots ( [ 1, 0, 0, 4, 0, 1 ] ) )
> [-1.6354, (-0.00775982 - 0.499457j), (-0.00775982 + 0.499457j),
> (0.825458 - 1.33013j), (0.825458 + 1.33013j)]
>
> I wonder why SymPy (0.7.2) is unable to solve the polynomial equation
> when the underlying mpmath (installed separately: v0.17.2) and my
> durandkerner implementation are able to do it. Should I report this as
> as bug?

solve() only returns symbolic solutions. If you want numeric
solutions, you should use nsolve(). It should give RootOfs in both
cases, though. That is a bug.

Aaron Meurer

>
> --
> Shriramana Sharma
>
> --
> You received this message because you are subscribed to the Google Groups 
> "sympy" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/sympy?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sympy?hl=en.

Reply via email to