Possible issue with zeta function

I have noticed an issue when using the zeta function that is supplied by the SpecialFunctions package.

Specifically, it outputs a NaN for a certain range of imaginary values.

using SpecialFunctions
zeta1 = zeta(.4 + 452.0im)
zeta2 = zeta(.4 + 453.0im)
@show(zeta1, zeta2)

This yields the output below:

zeta1 = -0.3803486880569726 + 4.99926741483461im
zeta2 = NaN + NaN*im

I think that zeta2 should not be a NaN for the answer!

By way of reference WolframAlpha reports zeta2 as: 5.59563… + 4.99458…i

I am running Julia 1.0.1 on Windows 10.
This also happens on Julia 0.6.4, and on JuliaBox.

I have tried zeta on a multitude of cases with the real greater than 0.0 and less than 0.5. It each case it gave a NaN.

The answer is correct, if the real is greater than or equal to .5.

I checked the tests in SpecialFunctions, and did not see a test that covered this situation.

Why it stops working when the imaginary value reaches 453.0 is a mystery to me?


Thanks for the bug report. The problem is explained here: https://github.com/JuliaMath/SpecialFunctions.jl/issues/128

Should be fixed now in the master branch.

By the way, for what application do you need this?

1 Like

Pulled back from SpecialFunctions#master and everything now computes as expected. Thanks for the quick fix.

Only tried this on Verson 1.0.1.

I am tutoring my 12 year old Grandson who is just getting into infinite series in 7th grade math. As a way of motivating him I described the Clay Prize for the Riemann Hypothesis. The million dollar award piqued his interest. While using Julia’s Zeta function I ran into the error with large imaginary values.

BTW: I barely skim the surface with Julia in various areas in my retirement years: aerodynamics of an iceboat racer; physics of pickleball; Feynman Path Integrals; DNA analysis of telomeres in mice, etc. It is a perfect language to to sooth my poly math instincts.

Do you know Jeremy England at MIT? He really has his act together in investigating the statistical dynamics of life like processes. Don’t think his dept. uses Julia for analysis – they should.


1 Like