`zeta(0, x), zeta(s, -1)` gives wrong answer

Open
#496 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
julia
Domain
backend

Research direction

Reproduce the shown Julia calls for zeta(0, -n) and zeta(s, -1), then compare the results with the stated Hurwitz zeta and Wolfram references. Done means the negative-argument values match those references, including the listed special values, without introducing the current NaN or Inf results.

Written by the indexing model from the issue text.

Description

We have: zeta(0, x) = 0.5 - x
Ref: https://en.wikipedia.org/wiki/Hurwitz_zeta_function#Negative_integers

But SpecialFunctions v2.5.1 gives:

julia> [ zeta(0, n) for n in 1:3 ]  # look good
3-element Vector{Float64}:
 -0.5
 -1.5
 -2.5

julia> [ zeta(0, -n) for n in 1:3 ]
3-element Vector{Float64}:
 0.5
 1.5
 2.5

julia> [ 0.5+n for n in 1:3 ]
3-element Vector{Float64}:
 1.5
 2.5
 3.5

And Wolfram gives:

In[2]:= Zeta[0, -1]
Out[2]= 3/2
In[3]:= Zeta[0, -2]
Out[3]= 5/2
In[4]:= Zeta[0, -3]
Out[4]= 7/2

Special values

Test with: zeta(s, -1) == 1 + zeta(s)
ref: https://reference.wolfram.com/language/ref/Zeta.html#479430652

julia> zeta(-9, -1)
-1.0075757575757576

julia> zeta(-7, -1)
-0.9958333333333333

julia> zeta(-6, -1)
NaN

julia> zeta(2, -1)
Inf

Wolfram:

In[10]:= Zeta[-9, -1]
Out[10]= 131/132
In[11]:= Zeta[-7, -1]
Out[11]= 241/240
In[12]:= Zeta[-6, -1]
Out[12]= 1
In[13]:= Zeta[2, -1]
Out[13]= 1+\[Pi]^2/6
Dominant language
Julia
Stars
384
Forks
115
Avg merge
1d 13h
Merged PRs (30d)
5

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from JuliaMath/SpecialFunctions.jl

All issues in JuliaMath/SpecialFunctions.jl

Similar issues

More Julia issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.