hypergeometric 2F1 undefined for legitimate inputs
In my research on Gaussian Processes I needed hypergeometric function2F1 for small arguments (less than 1 in absolute value).
I have found that the current implementation of hyp2f1_small_argument is incomplete:
To reproduce, run this in Colab and compare against Scipy or Mathematica
import tensorflow_probability as tfp
hyp2f1 = tfp.math.hypergeometric.hyp2f1_small_argument
H = 1
a = tf.constant(1.0)
b = tf.constant(0.5 - H)
c = tf.constant(H + 1.5)
x = tf.constant(0.9901961)
hyp2f1(a,b,c,x) # nan, should be ~ 0.753603
Tested under tfp==0.25.0 and tf==2.18.0 on Google Colab.
Here is the problematic code: https://github.com/tensorflow/probability/blob/65f265c62bb1e2d15ef3e25104afb245a6d52429/tensorflow_probability/python/math/hypergeometric.py#L524-L681
The idea of the current implementation is to use one of many of hypergeometric identities to transform the params and argument into a more numerically-friendly regime. Perhaps one of those routes is broken.