From fcc7e53362bc45fe372df4ac775e11678bd3f67d Mon Sep 17 00:00:00 2001 From: fredrik Date: Mon, 14 Feb 2022 11:34:07 +0100 Subject: [PATCH] polylog: fix for integer-valued parameter with complex type --- mpmath/functions/zeta.py | 4 ++-- mpmath/tests/test_gammazeta.py | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/mpmath/functions/zeta.py b/mpmath/functions/zeta.py index 8380f5a7..d7ede50d 100644 --- a/mpmath/functions/zeta.py +++ b/mpmath/functions/zeta.py @@ -481,9 +481,9 @@ def polylog(ctx, s, z): if abs(z) <= 0.75 or (not ctx.isint(s) and abs(z) < 0.9): return polylog_series(ctx, s, z) if abs(z) >= 1.4 and ctx.isint(s): - return (-1)**(s+1)*polylog_series(ctx, s, 1/z) + polylog_continuation(ctx, s, z) + return (-1)**(s+1)*polylog_series(ctx, s, 1/z) + polylog_continuation(ctx, int(ctx.re(s)), z) if ctx.isint(s): - return polylog_unitcircle(ctx, int(s), z) + return polylog_unitcircle(ctx, int(ctx.re(s)), z) return polylog_general(ctx, s, z) @defun_wrapped diff --git a/mpmath/tests/test_gammazeta.py b/mpmath/tests/test_gammazeta.py index 99adf66b..6a18a796 100644 --- a/mpmath/tests/test_gammazeta.py +++ b/mpmath/tests/test_gammazeta.py @@ -591,6 +591,8 @@ def test_polylog(): # issue 390 assert polylog(1.5, -48.910886523731889).ae(-6.272992229311817) assert polylog(1.5, 200).ae(-8.349608319033686529 - 8.159694826434266042j) + assert polylog(-2+0j, -2).ae(mpf(1)/13.5) + assert polylog(-2+0j, 1.25).ae(-180) def test_bell_polyexp(): mp.dps = 15