(F, all=False, eps=None, inf=None, sup=None, strict=False, fast=False, sqf=False)
Compute isolating intervals for roots of ``f``.

    Examples
    ========

    >>> from sympy import intervals
    >>> from sympy.abc import x

    >>> intervals(x**2 - 3)
    [((-2, -1), 1), ((1, 2), 1)]
    >>> intervals(x**2 - 3, eps=1e-2)
    [((-26/15, -19/11), 1), ((19/11, 26/15), 1)]
Compute isolating intervals for roots of ``f``.
Compute isolating intervals for roots of f .
def intervals(F, all=False, eps=None, inf=None, sup=None, strict=False, fast=False, sqf=False):
    """
    Compute isolating intervals for roots of ``f``.

    Examples
    ========

    >>> from sympy import intervals
    >>> from sympy.abc import x

    >>> intervals(x**2 - 3)
    [((-2, -1), 1), ((1, 2), 1)]
    >>> intervals(x**2 - 3, eps=1e-2)
    [((-26/15, -19/11), 1), ((19/11, 26/15), 1)]

    """
    if not hasattr(F, '__iter__'):
        try:
            F = Poly(F)
        except GeneratorsNeeded:
            return []

        return F.intervals(all=all, eps=eps, inf=inf, sup=sup, fast=fast, sqf=sqf)
    else:
        polys, opt = parallel_poly_from_expr(F, domain='QQ')

        if len(opt.gens) > 1:
            raise MultivariatePolynomialError

        for i, poly in enumerate(polys):
            polys[i] = poly.rep.rep

        if eps is not None:
            eps = opt.domain.convert(eps)

            if eps <= 0:
                raise ValueError("'eps' must be a positive rational")

        if inf is not None:
            inf = opt.domain.convert(inf)
        if sup is not None:
            sup = opt.domain.convert(sup)

        intervals = dup_isolate_real_roots_list(polys, opt.domain,
            eps=eps, inf=inf, sup=sup, strict=strict, fast=fast)

        result = []

        for (s, t), indices in intervals:
            s, t = opt.domain.to_sympy(s), opt.domain.to_sympy(t)
            result.append(((s, t), indices))

        return result
def intervals ( F , all = False , eps = None , inf = None , sup = None , strict = False , fast = False , sqf = False ) : if not hasattr ( F , '__iter__' ) : try : F = Poly ( F ) except GeneratorsNeeded : return [ ] return F . intervals ( all = all , eps = eps , inf = inf , sup = sup , fast = fast , sqf = sqf ) else : polys , opt = parallel_poly_from_expr ( F , domain = 'QQ' ) if len ( opt . gens ) > 1 : raise MultivariatePolynomialError for i , poly in enumerate ( polys ) : polys [ i ] = poly . rep . rep if eps is not None : eps = opt . domain . convert ( eps ) if eps <= 0 : raise ValueError ( "'eps' must be a positive rational" ) if inf is not None : inf = opt . domain . convert ( inf ) if sup is not None : sup = opt . domain . convert ( sup ) intervals = dup_isolate_real_roots_list ( polys , opt . domain , eps = eps , inf = inf , sup = sup , strict = strict , fast = fast ) result = [ ] for ( s , t ) , indices in intervals : s , t = opt . domain . to_sympy ( s ) , opt . domain . to_sympy ( t ) result . append ( ( ( s , t ) , indices ) ) return result