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

### Source code changes of the file "mpmath/functions/zeta.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.

zeta.py  (mpmath-0.19):zeta.py  (mpmath-1.0.0)
skipping to change at line 538 skipping to change at line 538
d = int(derivative) d = int(derivative)
if a == 1 and not (d or method): if a == 1 and not (d or method):
try: try:
return ctx._zeta(s, **kwargs) return ctx._zeta(s, **kwargs)
except NotImplementedError: except NotImplementedError:
pass pass
s = ctx.convert(s) s = ctx.convert(s)
prec = ctx.prec prec = ctx.prec
method = kwargs.get('method') method = kwargs.get('method')
verbose = kwargs.get('verbose') verbose = kwargs.get('verbose')
if (not s) and (not derivative):
return ctx.mpf(0.5) - ctx._convert_param(a)[0]
if a == 1 and method != 'euler-maclaurin': if a == 1 and method != 'euler-maclaurin':
im = abs(ctx._im(s)) im = abs(ctx._im(s))
re = abs(ctx._re(s)) re = abs(ctx._re(s))
#if (im < prec or method == 'borwein') and not derivative: #if (im < prec or method == 'borwein') and not derivative:
# try: # try:
# if verbose: # if verbose:
# print "zeta: Attempting to use the Borwein algorithm" # print "zeta: Attempting to use the Borwein algorithm"
# return ctx._zeta(s, **kwargs) # return ctx._zeta(s, **kwargs)
# except NotImplementedError: # except NotImplementedError:
# if verbose: # if verbose:
skipping to change at line 1097 skipping to change at line 1099
(1.142423447120257137774002 + 0.2118232380980201350495795j) (1.142423447120257137774002 + 0.2118232380980201350495795j)
(1.142423447120257137774002 + 0.2118232380980201350495795j) (1.142423447120257137774002 + 0.2118232380980201350495795j)
Evaluation works for complex arguments and `|z| \ge 1`:: Evaluation works for complex arguments and `|z| \ge 1`::
>>> lerchphi(1+2j, 3-j, 4+2j) >>> lerchphi(1+2j, 3-j, 4+2j)
(0.002025009957009908600539469 + 0.003327897536813558807438089j) (0.002025009957009908600539469 + 0.003327897536813558807438089j)
>>> lerchphi(-2,2,-2.5) >>> lerchphi(-2,2,-2.5)
-12.28676272353094275265944 -12.28676272353094275265944
>>> lerchphi(10,10,10) >>> lerchphi(10,10,10)
(-4.462130727102185701817349e-11 1.575172198981096218823481e-12j) (-4.462130727102185701817349e-11 - 1.575172198981096218823481e-12j)
>>> lerchphi(10,10,-10.5) >>> lerchphi(10,10,-10.5)
(112658784011940.5605789002 498113185.5756221777743631j) (112658784011940.5605789002 - 498113185.5756221777743631j)
Some degenerate cases:: Some degenerate cases::
>>> lerchphi(0,1,2) >>> lerchphi(0,1,2)
0.5 0.5
>>> lerchphi(0,1,-2) >>> lerchphi(0,1,-2)
-0.5 -0.5
Reduction to simpler functions:: Reduction to simpler functions::
skipping to change at line 1121 skipping to change at line 1123
(1.044674457556746668033975 - 0.04674508654012658932271226j) (1.044674457556746668033975 - 0.04674508654012658932271226j)
>>> zeta(4.25+1j) >>> zeta(4.25+1j)
(1.044674457556746668033975 - 0.04674508654012658932271226j) (1.044674457556746668033975 - 0.04674508654012658932271226j)
>>> lerchphi(1 - 0.5**10, 4.25+1j, 1) >>> lerchphi(1 - 0.5**10, 4.25+1j, 1)
(1.044629338021507546737197 - 0.04667768813963388181708101j) (1.044629338021507546737197 - 0.04667768813963388181708101j)
>>> lerchphi(3, 4, 1) >>> lerchphi(3, 4, 1)
(1.249503297023366545192592 - 0.2314252413375664776474462j) (1.249503297023366545192592 - 0.2314252413375664776474462j)
>>> polylog(4, 3) / 3 >>> polylog(4, 3) / 3
(1.249503297023366545192592 - 0.2314252413375664776474462j) (1.249503297023366545192592 - 0.2314252413375664776474462j)
>>> lerchphi(3, 4, 1 - 0.5**10) >>> lerchphi(3, 4, 1 - 0.5**10)
(1.253978063946663945672674 0.2316736622836535468765376j) (1.253978063946663945672674 - 0.2316736622836535468765376j)
**References** **References**
1. [DLMF]_ section 25.14 1. [DLMF]_ section 25.14
""" """
if z == 0: if z == 0:
return a ** (-s) return a ** (-s)
# Faster, but these cases are useful for testing right now # Faster, but these cases are useful for testing right now
if z == 1: if z == 1:
End of changes. 4 change blocks.
3 lines changed or deleted 5 lines changed or added