class_docstr: EXPERIMENTAL 1d-solver generating pairs of approximative root and error.
  
  Uses Newton's method modified to use Steffensens method when convergence is
  slow. (I.e. for multiple roots.)
class_docstr_tok: ["EXPERIMENTAL","1d-solver","generating","pairs","of","approximative","root","and","error",".","Uses","Newton","'s","method","modified","to","use","Steffensens","method","when","convergence","is","slow",".","(","I.e",".","for","multiple","roots",".",")"]
code: def __iter__(self):
      x0 = self.x0
      f = self.f
      df = self.df
      phi = self.phi
      error = 0
      counter = 0
      while True:
          prevx = x0
          try:
              x0 = phi(x0)
          except ZeroDivisionError:
              if self.verbose:
                  print("ZeroDivisionError: canceled with x =", x0)
              break
          preverror = error
          error = abs(prevx - x0)
          # TODO: decide not to use convergence acceleration
          if error and abs(error - preverror) / error < 1:
              if self.verbose:
                  print("converging slowly")
              counter += 1
          if counter >= 3:
              # accelerate convergence
              phi = steffensen(phi)
              counter = 0
              if self.verbose:
                  print("accelerating convergence")
          yield x0, error
  
imports: from __future__ import print_function
  from copy import copy
  from ..libmp.backend import xrange
label_desc: Use image node_id 2 for calling the ANewton obj's underlying member method code with example usage: obj.__iter__() without return types