From the same web page source, this one converges faster than Halley's looks like. def if1(P,n,d=10,x=1.0): if d>1: newx = (((2.0*n-1)*P*x**n + P**2) / ((x**(2*n-1))+(2*n-1)*P*x**(n-1))) return if1(P,n,d-1,newx) else: return x For computing the nth root of P, as in >>> if1(500,2) # 2nd root of 500 22.360679775 >>> 500 ** 0.5 22.360679775 Kirby