#----------------------------------------- # BABYLON.PY - The Babylonian algorithm # for finding square roots # #-------------------------------------- from visual.graph import * a = 2 # number we want to find the root of x = 1.0 # initial guess oldx=-1 while x != oldx: print "estimate:",x,"error:",a-x*x oldx = x x = (x + a/x)/2