Skip to content

polylog(s, +inf) returns nans for real and imaginary components #1033

Description

@cbm755

#904 fixed #473 (-inf input, correctly unit tested in #904). But I think it is wrong for the +inf case.

In [90]: mpmath.polylog(2, inf)
Out[90]: mpf('-inf')

But the limit looks more like -inf - infi to me:

In [87]: mpmath.polylog(2, 1e10)
Out[87]: mpc(real='-261.80503739032343', imag='-72.337844124154643')

In [88]: mpmath.polylog(2, 1e20)
Out[88]: mpc(real='-1057.0897539619832', imag='-144.67568824830929')

In [89]: mpmath.polylog(2, 1e100)
Out[89]: mpc(real='-26506.200684258292', imag='-723.37844124154651')

(I think normally that would be NaN).

Further evidence that NaN is appropriate: we see a sign flip when flipping the sign of a small imaginary input (with large real):

In [8]: mpmath.polylog(2, 1e20 + 1e-10j)
Out[8]: mpc(real='-1057.0897539619832', imag='144.67568824830929')

In [9]: mpmath.polylog(2, 1e20 - 1e-10j)
Out[9]: mpc(real='-1057.0897539619832', imag='-144.67568824830929')

(and Wikipedia mentions a branch cut along the positive real axes above 1).


Perhaps too minor to block Issue #1015, although it does seem to be a regression from 1.3:

In [11]: mpmath.__version__
Out[11]: '1.3.0'

In [12]: mpmath.polylog(2, inf)
Out[12]: mpc(real='nan', imag='nan')

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behavior

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions