fork download
  1. import numpy as np
  2. def f(x):
  3. if(abs(x*x - 3) < 0.01) :
  4. return x
  5. else:
  6. return f(x/2 + 1.5/x)
  7. for x in np.arange(1.726,1.74,0.002):
  8. print((x,f(x)))
  9. for x in np.arange(-1.74,-1.727,0.002):
  10. print((x,f(x)))
  11.  
Success #stdin #stdout 0.22s 26716KB
stdin
Standard input is empty
stdout
(1.726, 1.7320614136732329)
(1.728, 1.7320555555555557)
(1.73, 1.73)
(1.732, 1.732)
(1.734, 1.734)
(1.736, 1.7320552995391705)
(1.738, 1.7320609896432682)
(1.74, 1.7320689655172414)
(-1.74, -1.7320689655172414)
(-1.738, -1.7320609896432682)
(-1.736, -1.7320552995391705)
(-1.734, -1.734)
(-1.732, -1.732)
(-1.73, -1.73)
(-1.728, -1.7320555555555557)