fork download
  1. eps = 0.001
  2. a = 8
  3. p = 3
  4. count = 0
  5. x_n = a
  6. x_n1 = 0
  7. while abs(x_n1 - x_n) > eps:
  8. x_n1 = (1/p) * ((p-1)*x_n + (a/(x_n**(p-1))))
  9. count += 1
  10. x_n = x_n1
  11. #if abs(x_n1 - x_n) < eps:
  12. # break
  13.  
  14. print(f"Result: {x_n1}")
  15. print(f"Iteration Count: {count}")# your code goes here
Success #stdin #stdout 0.13s 14176KB
stdin
Standard input is empty
stdout
Result: 5.375
Iteration Count: 1