probability icon indicating copy to clipboard operation
probability copied to clipboard

hypergeometric series unreliable for simple values

Open maciejskorski opened this issue 1 year ago • 0 comments

The current implementation of hyp2f1 outputs wrong results for certain basic values, for example:

import tensorflow_probability as tfp

hyp2f1 = tfp.math.hypergeometric.hyp2f1_small_argument
H = 1
hyp2f1(1.0, 0.5 - H, H + 1.5, 9/10) # NaN

This happens under tensorflow_probability==0.24.0 and tensorflow==2.17.1 (e.g. under the current image used by Colab)

The correct result is

from scipy import special
hyp2f1 = special.hyp2f1
hyp2f1(1.0, 0.5 - H, H + 1.5, 9/10) # 0.7836799547024426

maciejskorski avatar Nov 16 '24 19:11 maciejskorski