def rootsearch(f, a, b, dx):
    """ x1,x2 = rootsearch(f,a,b,dx).
    Searches the interval (a,b) in increments dx for
    the bounds (x1,x2) of the smallest root of f(x).
    Returns x1 = x2 = None if no roots were detected.
    """
    x1 = a
    f1 = f(a)
    x2 = a + dx
    f2 = f(x2)
    #
    while f1*f2 > 0.0:
        if x1 >= b: 
            return None, None
        x1 = x2
        f1 = f2
        #x2 = x1 + dx
        x2 += dx
        f2 = f(x2)
    return x1, x2