def fixed_point_of_transform(g, transform, guess): return fixed_point(transform(g), guess)
def newtons_method(g, guess): return fixed_point(newton_transform(g), guess)
def n_sqrt(x, n): def log2(x): return log(x) / log(2) return fixed_point(repeated(average_damp, floor(log2(n)))(lambda y: x / pow(y, n - 1)), 1.0)
def cube_root(x): return fixed_point(average_damp(lambda y: x / square(y)), 1.0)
def sqrt(x): return fixed_point(average_damp(lambda y: x / y), 1.0)
from util import fixed_point print(fixed_point(lambda x: 1 + 1 / x, 1.0))