[SciPy-user] hyp2f1

Anne Archibald peridot.faceted at gmail.com
Mon May 28 04:18:51 EDT 2007


Hi,

I'm writing some code to do something rather complicated, one part of
which involves evaluating the hypergeometric 2F1 function. I was very
pleased to discover that scipy implements it (as
scipy.special.hyp2f1). I was not so pleased to discover that scipy's
implementation appears to contain a bug, which DM Cooke has kindly
fixed. (http://projects.scipy.org/scipy/scipy/changeset/3043) However,
I am encountering some bad numerical behaviour and I'm wondering if
this function can be blamed.

More specifically, I worked around the bug, as did DM Cooke, by
averaging points either side of the problem point. Since the function
is fairly smooth, this should not be too problematic. However I am in
the unfortunate situation of feeding the output of this function into
a calculation that does some very delicate cancellations (calculating
the covariance matrix of high-order detrending filters), and the
matrix that results is not positive definite, though it should be.

Is it likely that transformation of the function near these values is
causing problems? Are there other options for transforming the
hypergeometric function that would improve accuracy? For what values
of the arguments is scipy's current implementation most accurate?

Thanks,
Anne



More information about the SciPy-User mailing list