def Newton(f, x, dfdx, epsilon=1.0E-7, N=100):
    """
    Uses Newtons method to approximate the location of a root in f(x),
    given the derivative dfdx and number of steps N, and the margin of error
    epsilon. returns a 3-tuple of x, n, and f(x)
    """
    n = 0
    f_value = f(x)
    while abs(f_value) > epsilon and n <=N:
        x = x - f_value/float(dfdx(x))
        n += 1
        f_value = f(x)
    return x, n, f(x)