fork(3) download
  1. def f(x, a):
  2. return 2 * (x ** 3 - a * x) / (3 * x ** 2 + a)
  3.  
  4. x = 2
  5. for _ in range(11):
  6. x = f(x, 2)
  7. print(x)
  8.  
  9. print(2 ** .5)
Success #stdin #stdout 0.06s 9568KB
stdin
Standard input is empty
stdout
0.5714285714285714
-0.6418786692759295
0.6299692666329427
-0.6330679143931918
0.6323018808706036
-0.6324939098239215
0.6324459354029531
-0.6324579310548408
0.6324549322698535
-0.6324556819740982
0.6324554945485369
1.4142135623730951