

def update_psum(self, S):
    '\n        This routine applies the convergence acceleration to the list of partial sums.\n\n        A   = sum(a_k, k = 0..infinity)\n        s_n = sum(a_k ,k = 0..n)\n\n        v, e = ...update_psum([s_0, s_1,..., s_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        '
    n = len(S)
    d = ((3 + self.ctx.sqrt(8)) ** n)
    d = ((d + (1 / d)) / 2)
    b = self.ctx.one
    s = 0
    for k in xrange(n):
        b = ((((2 * (n + k)) * (n - b)) * b) / (((2 * k) + 1) * (k + self.ctx.one)))
        s += (b * S[k])
    value = (s / d)
    err = abs((value - self.last))
    self.last = value
    return (value, err)

dataset/ETHPy150Open fredrik-johansson/mpmath/mpmath/calculus/extrapolation.py cohen_alt_class.update_psum/VarMisuse@96/271 `k`->`b`