

def step(self, x):
    '\n        This routine applies the convergence acceleration to the individual terms.\n\n        A = sum(a_k, k = 0..infinity)\n\n        v, e = ...step(a_k)\n\n        output:\n          v      current estimate of the series A\n          e      an error estimate which is simply the difference between the current\n                 estimate and the last estimate.\n        '
    if (self.variant != 'v'):
        if (self.n == 0):
            self.s = x
            self.run(self.s, x)
        else:
            self.s += x
            self.run(self.s, x)
    else:
        if isinstance(self.last_s, bool):
            self.last_s = x
            self.s = 0
            self.last = 0
            return (x, abs(x))
        self.s += self.last_s
        self.run(self.s, self.last_s, x)
        self.last_s = x
    value = (self.A[0] / self.B[0])
    err = abs((value - self.last))
    self.last = value
    return (value, err)

dataset/ETHPy150Open fredrik-johansson/mpmath/mpmath/calculus/extrapolation.py levin_class.step/original