[SciPy-User] problem with scipy.optimize

Pauli Virtanen pav at iki.fi
Wed Mar 23 11:19:55 EDT 2011


Wed, 23 Mar 2011 15:59:07 +0100, Géraldine huth wrote:
> I would like to optimize a function f, and the calcul of this function
> requires the use of the hypergeometric and beta function.
> 
> Scipy has his own hypergeometric and beta function (names hyp2f1 and
> beta) but, with my arguments, the calcul of for example
> hyp2f1(-400,9.0972,-788.90,1.0) returns "nan", while the mpmath
> hypergeometric function (also names hyp2f1) returns a number. (It's the
> same with the beta function)

Two options: 

(i) upgrade Scipy to >= 0.8.0 in which several issues in hyp2f1 were 
fixed, or 

(ii) use float(mpmath.hyp2f1(float(a), float(b), float(c), float(z))) 
to force ordinary floating point numbers in and out from the mpmath 
function.




More information about the SciPy-User mailing list