Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix digamma integral #26563

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
4 changes: 4 additions & 0 deletions sympy/functions/special/tests/test_zeta_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,10 @@ def test_lerchphi_expansion():

def test_lerchphi_finite():
assert lerchphi(1, 1, a).is_finite is False
assert lerchphi(0, -3, 0).is_finite is True
assert lerchphi(2, s, 0).is_finite is False
assert lerchphi(z, s, -1).is_finite is False
assert lerchphi(z, s, -5).is_finite is False


def test_lerchphi_leadterm():
Expand Down
10 changes: 10 additions & 0 deletions sympy/functions/special/zeta_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,16 @@ def _eval_rewrite_as_zeta(self, z, s, a, **kwargs):
def _eval_rewrite_as_polylog(self, z, s, a, **kwargs):
return self._eval_rewrite_helper(polylog)

def _eval_is_finite(self):
z, s, a = self.args
if z == 0 or a == 0:
return z.is_zero and a.is_zero and s.is_nonpositive
Copy link
Collaborator

Choose a reason for hiding this comment

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

What should happen here if any of the is_ checks gives None?

https://docs.sympy.org/latest/guides/booleans.html

Copy link
Author

Choose a reason for hiding this comment

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

Hi @oscarbenjamin , thanks for taking a look and the information about the booleans.
I thought python and was compatible with the fuzzy logic but it is indeed not. I will use the fuzzy_and function, this should handle correctly the None cases.
Also, I am not sure what is the convention when the function evaluates to NaN, should the is_finite be None?

Copy link
Collaborator

Choose a reason for hiding this comment

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

what is the convention when the function evaluates to NaN, should the is_finite be None?

Probably. What case evaluates to nan that you are thinking of?

Copy link
Author

Choose a reason for hiding this comment

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

It is because a lot of situations where the function is infinite is because one has $0^{-s}$. The previous check s.is_nonpositive gives False when s is not real. I have added a check for s to be real, when s is complex the expression is undefined so now the function should return None.

if z == 1:
# Let zeta handle this case
return self._eval_expand_func().is_finite
if a.is_integer and a.is_nonpositive:
return False

###############################################################################
###################### POLYLOGARITHM ##########################################
###############################################################################
Expand Down
Loading