class_docstr: 1d-solver generating pairs of approximative root and error.
  
  Uses Illinois method or similar to find a root of f in [a, b].
  Might fail for multiple roots (needs sign change).
  Combines bisect with secant (improved regula falsi).
  
  The only difference between the methods is the scaling factor m, which is
  used to ensure convergence (you can choose one using the 'method' keyword):
  
  Illinois method ('illinois'):
      m = 0.5
  
  Pegasus method ('pegasus'):
      m = fb/(fb + fz)
  
  Anderson-Bjoerk method ('anderson'):
      m = 1 - fz/fb if positive else 0.5
  
  Pro:
  
  * converges very fast
  
  Contra:
  
  * has problems with multiple roots
  * needs sign change
class_docstr_tok: ["1d-solver","generating","pairs","of","approximative","root","and","error",".","Uses","Illinois","method","or","similar","to","find","a","root","of","f","in","[","a",",","b","]",".","Might","fail","for","multiple","roots","(","needs","sign","change",")",".","Combines","bisect","with","secant","(","improved","regula","falsi",")",".","The","only","difference","between","the","methods","is","the","scaling","factor","m",",","which","is","used","to","ensure","convergence","(","you","can","choose","one","using","the","'method","'","keyword",")",":","Illinois","method","(","'illinois","'",")",":","m","=","0.5","Pegasus","method","(","'pegasus","'",")",":","m","=","fb\/","(","fb","+","fz",")","Anderson-Bjoerk","method","(","'anderson","'",")",":","m","=","1","-","fz\/fb","if","positive","else","0.5","Pro",":","*","converges","very","fast","Contra",":","*","has","problems","with","multiple","roots","*","needs","sign","change"]
code: def __iter__(self):
      method = self.method
      f = self.f
      a = self.a
      b = self.b
      fa = f(a)
      fb = f(b)
      m = None
      while True:
          l = b - a
          if l == 0:
              break
          s = (fb - fa) / l
          z = a - fa / s
          fz = f(z)
          if abs(fz) < self.tol:
              # TODO: better condition (when f is very flat)
              if self.verbose:
                  print("canceled with z =", z)
              yield z, l
              break
          if fz * fb < 0:  # root in [z, b]
              a = b
              fa = fb
              b = z
              fb = fz
          else:  # root in [a, z]
              m = self.getm(fz, fb)
              b = z
              fb = fz
              fa = m * fa  # scale down to ensure convergence
          if self.verbose and m and not method == "illinois":
              print("m:", m)
          yield (a + b) / 2, abs(l)
  
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 Illinois obj's underlying member method code with example usage: obj.__iter__() without return types