[SciPy-dev] scipy.special.hyp2f1 bug?

Skipper Seabold jsseabold@gmail....
Wed Sep 16 20:22:20 CDT 2009


On Wed, Sep 16, 2009 at 9:15 PM,  <josef.pktd@gmail.com> wrote:
> On Wed, Sep 16, 2009 at 9:02 PM, Skipper Seabold <jsseabold@gmail.com> wrote:
>> Since y'all are looking at the distributions vs. mpmath, it reminded
>> me of this.  I haven't filed a bug report yet, but I don't think one
>> existed when I found this.
>>
>> I was working with the connection between the incomplete beta function
>> and the hypergeometric2f1 function in scipy.special for GLM in
>> statsmodels and I came across this blog post on mpmath about some
>> corner cases for the hypergeometric2f1.
>>
>> <http://fredrik-j.blogspot.com/2009/06/hypergeometric-2f1-incomplete-beta.html>
>>
>> Two examples of discrepancies.
>>
>> In [1]: import mpmath
>>
>> In [2]: from scipy import special
>>
>> In [3]: mpmath.hyp2f1(3,-1,-1,0.5)
>> Out[3]: mpf('2.5')
>>
>> In [4]: special.hyp2f1(3,-1,-1,.5)
>> Out[4]: 8.0
>>
>> In [5]: mpmath.hyp2f1(1,1,4,3+4j)
>> Out[5]: mpc(real='0.49234384000963544', imag='0.60513406166123973')
>>
>> In [6]: special.hyp2f1(1,1,4,3+4j)
>> Out[6]: (0.65925460474847919+1.3277887264473263j)
>>
>> I will file a bug report shortly, if we think mpmath is correct vs. scipy.
>
> there is a ticket for special.hyp2f1  for values that are used in rdist:
>
> http://projects.scipy.org/scipy/ticket/759
>
> but the parameter values in your case look different.
>
> Josef
>

Ah, ok.  I don't think I saw that one.  I will just piggyback there then.

Skipper


More information about the Scipy-dev mailing list