'Compute isolating intervals for roots of ``f``.
For real roots the Vincent-Akritas-Strzebonski (VAS) continued fractions method is used.
References:
1. Alkiviadis G. Akritas and Adam W. Strzebonski: A Comparative Study of Two Real Root
Isolation Methods . Nonlinear Analysis: Modelling and Control, Vol. 10, No. 4, 297-304, 2005.
2. Alkiviadis G. Akritas, Adam W. Strzebonski and Panagiotis S. Vigklas: Improving the
Performance of the Continued Fractions Method Using new Bounds of Positive Roots. Nonlinear
Analysis: Modelling and Control, Vol. 13, No. 3, 265-279, 2008.
Examples
>>> from sympy import Poly
>>> from sympy.abc import x
>>> Poly(x**2 - 3, x).intervals()
[((-2, -1), 1), ((1, 2), 1)]
>>> Poly(x**2 - 3, x).intervals(eps=1e-2)
[((-26/15, -19/11), 1), ((19/11, 26/15), 1)]'

def intervals(f, all=False, eps=None, inf=None, sup=None, fast=False, sqf=False):

    if (eps is not None):
        eps = QQ.convert(eps)
        if (eps <= 0):
            raise ValueError("'eps'    must    be    a    positive    rational")
    if (inf is not None):
        inf = QQ.convert(inf)
    if (sup is not None):
        sup = QQ.convert(sup)
    if hasattr(f.rep, 'intervals'):
        result = f.rep.intervals(all=all, eps=eps, inf=inf, sup=sup, fast=fast, sqf=sqf)
    else:
        raise OperationNotSupported(f, 'intervals')
    if sqf:
        def _real(interval):
            (s, t) = interval
            return (QQ.to_sympy(s), QQ.to_sympy(t))
        if (not all):
            return list(map(_real, result))
        def _complex(rectangle):
            ((u, v), (s, t)) = rectangle
            return ((QQ.to_sympy(u) + (I * QQ.to_sympy(v))), (QQ.to_sympy(s) + (I * QQ.to_sympy(t))))
        (real_part, complex_part) = result
        return (list(map(_real, real_part)), list(map(_complex, complex_part)))
    else:
        def _real(interval):
            ((s, t), k) = interval
            return ((QQ.to_sympy(s), QQ.to_sympy(t)), k)
        if (not all):
            return list(map(_real, result))
        def _complex(rectangle):
            (((u, v), (s, t)), k) = rectangle
            return (((QQ.to_sympy(u) + (I * QQ.to_sympy(v))), (QQ.to_sympy(s) + (I * QQ.to_sympy(t)))), k)
        (real_part, complex_part) = result
        return (list(map(_real, real_part)), list(map(_complex, complex_part)))
