JuliaMath / HypergeometricFunctions.jl

A Julia package for calculating hypergeometric functions

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Numerical instability of pFq((1, 1, 1), (2, 2), x) in HypergeometricFunctions 0.3.17

Expander opened this issue · comments

Dear HypergeometricFunctions developers,

I was comparing the function x*pFq((1, 1, 1), (2, 2), x) with the dilogarithm and noticed multiple numerical instabilities in version 0.3.17.

To reproduce:

using HypergeometricFunctions, Plots

dilog(x) = real(x * pFq((1, 1, 1), (2, 2), x))

plot(range(-1e3, 1e4, length = 1000), dilog)

Please find the output plot below. The shown function has multiple (pseudo-)poles, which should not be there (the real part of the dilogarithm is continuous for arguments greater than 1).

dilog

Evaluating a {q+1}F_q right on the branch cut (1, infinity) would require something different: right now, the code uses rational approximations that place the poles on the branch cut, so convergence there is quite tricky (and honestly unexpected).