sympy / sympy

A computer algebra system written in pure Python

Home Page:https://sympy.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Wrong translation of lerchphi into Mathematica

rogerbalsach opened this issue · comments

The lerchphi function is currently translated to Mathematica as follows:

from sympy import lerchphi, mathematica_code
from sympy.abc import z, s, a

expr = lerchphi(z, s, a)
print(mathematica_code(expr))  # Out: LerchPhi[z, s, a]

However in Mathematica there are two different functions: LerchPhi and HurwitzLerchPhi.
Sympy's implementation of lerchphi corresponds to the second one. This can be seen by evaluating lerchphi(0.5, I, I - 1):

from sympy import lerchphi

print(lerchphi(0.5, 1j, 1j-1).evalf())  # Out: 13.0159323472912 - 4.06716554582987*I

Which should be compared with
LerchPhi: LerchPhi[0.5, I, I-1] = 3.52136 -0.638198 i
HurwitzLerchPhi: HurwitzLerchPhi[0.5, I, I-1] = 13.0159 -4.06717 i

commented

Thank you @rogerbalsach for reporting this, I don't know how many of the current developers have access to mathematica, so any help in fixing that printer is most welcome. It looks like printing of lerchphi was added in this commit:
b231d6a

Maybe there are even other errors hiding?

Anyhow, a pull request by someone with access to mathematica (who can verify correctness) would be most welcome.

@bjodah Ok, I only checked with WolframAlpha, I though the mathematical functions were the same. I will try with Mathematica and see if I see the same behavior.

I confirm that the same behavior occurs in Mathematica 13.1

Screenshot from 2024-06-14 21-38-38