class_docstr: Quadrature rules are implemented using this class, in order to
  simplify the code and provide a common infrastructure
  for tasks such as error estimation and node caching.
  
  You can implement a custom quadrature rule by subclassing
  :class:`QuadratureRule` and implementing the appropriate
  methods. The subclass can then be used by :func:`~mpmath.quad` by
  passing it as the *method* argument.
  
  :class:`QuadratureRule` instances are supposed to be singletons.
  :class:`QuadratureRule` therefore implements instance caching
  in :func:`~mpmath.__new__`.
class_docstr_tok: ["Quadrature","rules","are","implemented","using","this","class",",","in","order","to","simplify","the","code","and","provide","a","common","infrastructure","for","tasks","such","as","error","estimation","and","node","caching",".","You","can","implement","a","custom","quadrature","rule","by","subclassing",":","class",":","`","QuadratureRule","`","and","implementing","the","appropriate","methods",".","The","subclass","can","then","be","used","by",":","func",":","`","~mpmath.quad","`","by","passing","it","as","the","*","method","*","argument",".",":","class",":","`","QuadratureRule","`","instances","are","supposed","to","be","singletons",".",":","class",":","`","QuadratureRule","`","therefore","implements","instance","caching","in",":","func",":","`","~mpmath.__new__","`","."]
docstr: Main integration function. Computes the 1D integral over
  the interval specified by *points*. For each subinterval,
  performs quadrature of degree from 1 up to *max_degree*
  until :func:`~mpmath.estimate_error` signals convergence.
  
  :func:`~mpmath.summation` transforms each subintegration to
  the standard interval and then calls :func:`~mpmath.sum_next`.
docstr_tok: ["Main","integration","function",".","Computes","the","1D","integral","over","the","interval","specified","by","*","points","*",".","For","each","subinterval",",","performs","quadrature","of","degree","from","1","up","to","*","max_degree","*","until",":","func",":","`","~mpmath.estimate_error","`","signals","convergence",".",":","func",":","`","~mpmath.summation","`","transforms","each","subintegration","to","the","standard","interval","and","then","calls",":","func",":","`","~mpmath.sum_next","`","."]
code: def summation(
      self, f, points, prec, epsilon, max_degree, verbose=False
  ):
      """
      Main integration function. Computes the 1D integral over
      the interval specified by *points*. For each subinterval,
      performs quadrature of degree from 1 up to *max_degree*
      until :func:`~mpmath.estimate_error` signals convergence.
  
      :func:`~mpmath.summation` transforms each subintegration to
      the standard interval and then calls :func:`~mpmath.sum_next`.
      """
      ctx = self.ctx
      I = total_err = ctx.zero
      for i in xrange(len(points) - 1):
          a, b = points[i], points[i + 1]
          if a == b:
              continue
          # XXX: we could use a single variable transformation,
          # but this is not good in practice. We get better accuracy
          # by having 0 as an endpoint.
          if (a, b) == (ctx.ninf, ctx.inf):
              _f = f
              f = lambda x: _f(-x) + _f(x)
              a, b = (ctx.zero, ctx.inf)
          results = []
          err = ctx.zero
          for degree in xrange(1, max_degree + 1):
              nodes = self.get_nodes(a, b, degree, prec, verbose)
              if verbose:
                  print(
                      "Integrating from %s to %s (degree %s of %s)"
                      % (ctx.nstr(a), ctx.nstr(b), degree, max_degree)
                  )
              result = self.sum_next(
                  f, nodes, degree, prec, results, verbose
              )
              results.append(result)
              if degree > 1:
                  err = self.estimate_error(results, prec, epsilon)
                  if verbose:
                      print(
                          "Estimated error:",
                          ctx.nstr(err),
                          " epsilon:",
                          ctx.nstr(epsilon),
                          " result: ",
                          ctx.nstr(result),
                      )
                  if err <= epsilon:
                      break
          I += results[-1]
          total_err += err
      if total_err > epsilon:
          if verbose:
              print(
                  "Failed to reach full accuracy. Estimated error:",
                  ctx.nstr(total_err),
              )
      return I, total_err
  
imports: import math
  from ..libmp.backend import xrange
label_desc: Use image node_id 8 for calling the QuadratureRule obj's underlying member method code with example usage: obj.summation(f, points, prec, epsilon, max_degree, verbose) and returns: I,  total_err