from math import sqrt N=60 eps=10**(-15) i=0 xpp=0.1 xp=z=1.0 abserr=abs(z) def f(x): return x**12-2 while i<=N and abserr>=eps*abs(z): z=xp-f(xp)*(xp-xpp)/(f(xp)-f(xpp)) abserr=abs(z-xp) xpp=xp xp=z i=i+1 print i,xp,abserr/abs(z),abs((xp-2**(1.0/12))/2**(1.0/12))