## "Fossies" - the Fresh Open Source Software Archive

### Source code changes of the file "mpmath/calculus/extrapolation.py" betweenmpmath-0.19.tar.gz and mpmath-1.0.0.tar.gz

About: mpmath is a Python library for arbitrary-precision floating-point arithmetic.

extrapolation.py  (mpmath-0.19):extrapolation.py  (mpmath-1.0.0)
skipping to change at line 719 skipping to change at line 719
self.run(self.s,self.last_s,x) self.run(self.s,self.last_s,x)
self.last_s=x self.last_s=x
value=self.A[0]/self.B[0] value=self.A[0]/self.B[0]
err=abs(value-self.last) err=abs(value-self.last)
self.last=value self.last=value
return value,err return value,err
def levin(ctx, method = "levin", variant = "u"): def levin(ctx, method = "levin", variant = "u"):
L = levin_class(method = method, variant = variant) L = levin_class(method = method, variant = variant)
L.ctx = ctx L.ctx = ctx
return L return L
levin.__doc__ = levin_class.__doc__ levin.__doc__ = levin_class.__doc__
defun(levin) defun(levin)
class cohen_alt_class: class cohen_alt_class:
# cohen_alt: Copyright 2013 Timo Hartmann (thartmann15 at gmail.com) # cohen_alt: Copyright 2013 Timo Hartmann (thartmann15 at gmail.com)
""" """
This interface implements the convergence acceleration of alternating series This interface implements the convergence acceleration of alternating series
as described in H. Cohen, F.R. Villegas, D. Zagier - "Convergence Accelerati on as described in H. Cohen, F.R. Villegas, D. Zagier - "Convergence Accelerati on
of Alternating Series". This series transformation works only well if the of Alternating Series". This series transformation works only well if the
skipping to change at line 1215 skipping to change at line 1215
print("Ran out of precision for Shanks") print("Ran out of precision for Shanks")
TRY_SHANKS = False TRY_SHANKS = False
if shanks_error < error: if shanks_error < error:
error = shanks_error error = shanks_error
best = est1 best = est1
for L in summer: for L in summer:
est, lerror = L.update_psum(partial) est, lerror = L.update_psum(partial)
if verbose: if verbose:
print("%s error: %s" % (L.name, ctx.nstr(lerror))) print("%s error: %s" % (L.name, ctx.nstr(lerror)))
if lerror <= tol: if lerror <= tol:
return est return est
if lerror < error: if lerror < error:
error = lerror error = lerror
best = est best = est
if TRY_EULER_MACLAURIN: if TRY_EULER_MACLAURIN:
if ctx.mpc(ctx.sign(partial[-1]) / ctx.sign(partial[-2])).ae(-1) : if ctx.mpc(ctx.sign(partial[-1]) / ctx.sign(partial[-2])).ae(-1) :
if verbose: if verbose:
print ("NOT using Euler-Maclaurin: the series appears" print ("NOT using Euler-Maclaurin: the series appears"
" to be alternating, so numerical\n quadrature" " to be alternating, so numerical\n quadrature"
" will most likely fail") " will most likely fail")
TRY_EULER_MACLAURIN = False TRY_EULER_MACLAURIN = False
End of changes. 2 change blocks.
4 lines changed or deleted 4 lines changed or added