class_docstr: 1d-solver generating pairs of approximative root and error.
  
  Ridders' method to find a root of f in [a, b].
  Is told to perform as well as Brent's method while being simpler.
  
  Pro:
  
  * very fast
  * simpler than Brent's method
  
  Contra:
  
  * two function evaluations per step
  * has problems with multiple roots
  * needs sign change
  
  http://en.wikipedia.org/wiki/Ridders'_method
class_docstr_tok: ["1d-solver","generating","pairs","of","approximative","root","and","error",".","Ridders","'","method","to","find","a","root","of","f","in","[","a",",","b","]",".","Is","told","to","perform","as","well","as","Brent","'s","method","while","being","simpler",".","Pro",":","*","very","fast","*","simpler","than","Brent","'s","method","Contra",":","*","two","function","evaluations","per","step","*","has","problems","with","multiple","roots","*","needs","sign","change","http",":","\/\/en.wikipedia.org\/wiki\/Ridders'_method"]
code: def __iter__(self):
      ctx = self.ctx
      f = self.f
      x1 = self.x1
      fx1 = f(x1)
      x2 = self.x2
      fx2 = f(x2)
      while True:
          x3 = 0.5 * (x1 + x2)
          fx3 = f(x3)
          x4 = x3 + (x3 - x1) * ctx.sign(fx1 - fx2) * fx3 / ctx.sqrt(
              fx3**2 - fx1 * fx2
          )
          fx4 = f(x4)
          if abs(fx4) < self.tol:
              # TODO: better condition (when f is very flat)
              if self.verbose:
                  print("canceled with f(x4) =", fx4)
              yield x4, abs(x1 - x2)
              break
          if fx4 * fx2 < 0:  # root in [x4, x2]
              x1 = x4
              fx1 = fx4
          else:  # root in [x1, x4]
              x2 = x4
              fx2 = fx4
          error = abs(x1 - x2)
          yield (x1 + x2) / 2, 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 Ridder obj's underlying member method code with example usage: obj.__iter__() without return types