def findroot (a, x, acc):
nextx = (a/x + x) / 2.0
if abs(x-nextx) < acc*x:
return(nextx)
else:
return(findroot (a, nextx, acc))
def sqroot(a):
return(findroot (a, 1.0, 1.0E-10))
print(sqroot(10000))
def findroot (a, x, acc):
nextx = (a/x + x) / 2.0
if abs(x-nextx) < acc*x:
return(nextx)
else:
return(findroot (a, nextx, acc))
def sqroot(a):
return(findroot (a, 1.0, 1.0E-10))
print(sqroot(10000))