class_docstr: 1d-solver generating pairs of approximative root and error.
  
  Needs a starting point x0 close to the root.
  Uses Halley's method with cubic convergence rate.
  
  Pro:
  
  * converges even faster the Newton's method
  * useful when computing with *many* digits
  
  Contra:
  
  * needs first and second derivative of f
  * 3 function evaluations per iteration
  * converges slowly for multiple roots
class_docstr_tok: ["1d-solver","generating","pairs","of","approximative","root","and","error",".","Needs","a","starting","point","x0","close","to","the","root",".","Uses","Halley","'s","method","with","cubic","convergence","rate",".","Pro",":","*","converges","even","faster","the","Newton","'s","method","*","useful","when","computing","with","*","many","*","digits","Contra",":","*","needs","first","and","second","derivative","of","f","*","3","function","evaluations","per","iteration","*","converges","slowly","for","multiple","roots"]
code: def __init__(self, ctx, f, x0, **kwargs):
      self.ctx = ctx
      if not len(x0) == 1:
          raise ValueError(
              "expected 1 starting point, got %i" % len(x0)
          )
      self.x0 = x0[0]
      self.f = f
      if not "df" in kwargs:
  
          def df(x):
              return self.ctx.diff(f, x)
  
      else:
          df = kwargs["df"]
      self.df = df
      if not "d2f" in kwargs:
  
          def d2f(x):
              return self.ctx.diff(df, x)
  
      else:
          d2f = kwargs["df"]
      self.d2f = d2f
  
imports: from __future__ import print_function
  from copy import copy
  from ..libmp.backend import xrange
label_desc: Use image node_id 1 to create a new Halley object  with example: obj = Halley(ctx, f, x0)