You might try
def distinct_intervals(p): P=Poly(p) iv = P.intervals() print(iv) for i in 
range(len(iv)-1): (lo,hi),n=iv[i] (LO,HI),N=iv[i+1] while hi==LO: if 
lo!=hi: (lo,hi),n=iv[i]=P.refine_root(lo,hi,(hi-lo)/2),n else: assert 
LO!=HI (LO,HI),N=iv[i+1]=P.refine_root(LO,HI,(HI-LO)/2),N return iv >>> 
distinct_intervals(Poly(x**6 + 19/5*x**5 + 131/50*x**4 - x**2 - 19/5*x - 131
/50, x, domain='QQ')) [((-3, -2), 1), ((-1, -1), 1), ((-10/11, -9/10), 1), 
((1, 1), 1)] 

/c
​
On Tuesday, May 21, 2024 at 7:18:07 PM UTC-5 Oscar wrote:

> On Wed, 22 May 2024 at 01:10, Ani J <[email protected]> wrote:
> >
> > Thank you for the quick response.
> >
> > Yes, it looks like refine_root() does the job more efficiently. Thank 
> you for the note.
> >
> > I am facing issues in getting _find_poly_sign_univariate function to 
> work.
> > When I run from sympy import find_poly_sign, I get the following error:
> >
> > ImportError: cannot import name 'find_poly_sign' from 'sympy' 
> (/path_to_python/python3.8/site-packages/sympy/__init__.py)
> >
> > The documentation of SymPy here does not seem to have this function. 
> Would be great to get some pointers on how to import
> > the function in the code.
>
> The function is not part of SymPy. The code for the function is in the
> issue I linked:
> https://github.com/sympy/sympy/issues/26177
>
> You would have to copy the code from there to use it.
>
> -- 
> Oscar
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/1cb72014-0512-4e3b-ad5d-7a6ad622f2f5n%40googlegroups.com.

Reply via email to