Skip to content

hypergeometric series unreliable for simple values  #1861

@maciejskorski

Description

@maciejskorski

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions