JuliaMath / SpecialFunctions.jl

Special mathematical functions in Julia

Home Page:https://specialfunctions.juliamath.org/stable/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

zeta(s) flips signs in some regions

quytelda opened this issue · comments

For some input regions, zeta(s) actually returns $-\zeta(s)$. I think this behavior first appears after 6e49782.

Example:

julia> zeta(-2 + 13im) # Should be -0.3001901987726141 - 5.55836268854879im
0.3001901987726141 + 5.55836268854879im

zeta(s,z) and eta(s) are also affected.

Version Information:
Julia 1.8.3
SpecialFunctions v2.1.7

The problematic regions seem to be a series of vertical strips which start around |Im(s)| > 12 on the left side of the complex plane. This is visible on a domain coloring plot (using Makie here); the problem strips along the top and bottom are sharply discontinuous with the rest of the function.

using CairoMakie
using SpecialFunctions

xs = range(-16, 0, length=256)
ys = range(-16, 16, length=512)
zs = [complex(x,y) for x in xs, y in ys]

ws = zeta.(zs)
heatmap(xs, ys, angle.(ws),
    colorrange = (-π,π),
    colormap = :hsv,
    figure = (resolution=(256,512),),
    axis   = (xlabel="Re", ylabel="Im")
)

zeta

For reference, here's the same plot using zeta(s) from before 6e49782: https://user-images.githubusercontent.com/5448053/209590145-0aa54746-1ebb-49a5-beaf-79bfe9fe0cbd.png