Skip to content

polylog: z to positive infinity should return nan#1034

Merged
skirpichev merged 1 commit into
mpmath:masterfrom
cbm755:polylog_inf
Feb 20, 2026
Merged

polylog: z to positive infinity should return nan#1034
skirpichev merged 1 commit into
mpmath:masterfrom
cbm755:polylog_inf

Conversation

@cbm755

@cbm755 cbm755 commented Feb 20, 2026

Copy link
Copy Markdown
Contributor

Fixes #1033.

@skirpichev skirpichev self-requested a review February 20, 2026 06:53

@skirpichev skirpichev left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM as a quick fix.

But I think that a correct answer should be rather -inf+nanj (see mentioned identity).

BTW, WolframEngine 14.3 shows -Infinity even for PolyLog[1,Infinity].

Comment thread mpmath/functions/zeta.py
if n < 0:
return z*0
if ctx._is_real_type(z) and ctx.isinf(z) and n > 0:
if ctx._is_real_type(z) and ctx.isinf(z) and n > 0 and z < 0:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@skirpichev skirpichev merged commit dc20727 into mpmath:master Feb 20, 2026
14 checks passed
@skirpichev skirpichev added this to the 1.4 milestone Feb 20, 2026
@cbm755 cbm755 deleted the polylog_inf branch February 20, 2026 22:00
@cbm755

cbm755 commented Feb 20, 2026

Copy link
Copy Markdown
Contributor Author

But I think that a correct answer should be rather -inf+nanj (see mentioned identity).

I agree. Happily the unit test added here would still be acceptable b/c isnan(...) should be true for -inf + nanj as well.

@skirpichev

Copy link
Copy Markdown
Collaborator

Happily the unit test added here would still be acceptable b/c isnan(...) should be true for -inf + nanj as well.

That's why I not asked you to remove/rewrite tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants