Re: [sympy] Possible bug in method 'refine_root()' of class sympy.polys.polytools.Poly

2013-06-19 Thread Heiner Kirchhoffer
Hi Mateusz and all, refine_root() doesn't work with non-squarefree polynomials. Unfortunately it's not written in the documentation. Remove root multiplicities with sqf() and then proceed with your original approach, e.g.: In [8]: sqf_list(f) Out[8]: ⎛ ⎡⎛ 2 ⎞⎤⎞ ⎝1, ⎣⎝x -

Re: [sympy] Possible bug in method 'refine_root()' of class sympy.polys.polytools.Poly

2013-06-18 Thread Heiner Kirchhoffer
Hi smichr and all, Thank you for your quick response. Does that mean that the method 'refine_root()' of class 'Poly' is not capable of finding isolation intervals for all real roots of an arbitrary polynomial? If so, this would, unfortunately, render the method 'refine_root()' useless for my

Re: [sympy] Possible bug in method 'refine_root()' of class sympy.polys.polytools.Poly

2013-06-18 Thread Mateusz Paprocki
Hi, On 18 June 2013 09:35, Heiner Kirchhoffer heiner.kirchhof...@gmail.comwrote: Hi smichr and all, Thank you for your quick response. Does that mean that the method 'refine_root()' of class 'Poly' is not capable of finding isolation intervals for all real roots of an arbitrary polynomial?

Re: [sympy] Possible bug in method 'refine_root()' of class sympy.polys.polytools.Poly

2013-06-18 Thread Chris Smith
There is still a potential problem here: Consider an unfactorable polynomial eq = x**5-x**3+1 factor(_) x**5 - x**3 + 1 find where it has zeros df = eq.diff(x) solve(df) [0, -sqrt(15)/5, sqrt(15)/5] shift the polynomial to put one of the zeros on the x axis eq.subs(x,_[1])

Re: [sympy] Possible bug in method 'refine_root()' of class sympy.polys.polytools.Poly

2013-06-18 Thread Mateusz Paprocki
Hi, On 18 June 2013 12:26, Chris Smith smi...@gmail.com wrote: There is still a potential problem here: Consider an unfactorable polynomial eq = x**5-x**3+1 factor(_) x**5 - x**3 + 1 find where it has zeros df = eq.diff(x) solve(df) [0, -sqrt(15)/5, sqrt(15)/5] shift the

[sympy] Possible bug in method 'refine_root()' of class sympy.polys.polytools.Poly

2013-06-17 Thread Heiner Kirchhoffer
Hello, method 'refine_root()' of class 'Poly' seems to unexpectedly raise an exception. The following code produces the exception: x = Symbol( x ) p = Poly( x**4 - 6*x**3 + 11*x**2 - 6*x + 1 ) p.refine_root( 0, 1 ) # raises: sympy.polys.polyerrors.RefinementFailed: there should be exactly one

Re: [sympy] Possible bug in method 'refine_root()' of class sympy.polys.polytools.Poly

2013-06-17 Thread Chris Smith
I suppose this could be called a feature since the routine will fail if you comment out the error since it needs a sign change to find the root. But perhaps the refine_root could check return the evaluated root in that range if it can be found explicitly. Perhaps it would be better to evaluate