1
$\begingroup$

I am using two hypergeomtric functions with MATLAB:

$_2F_1(a, b, a+1, d)$ and $_2F_1(a+1, b, a+2, d)$, where $d$ is from the open interval $(0,1)$ and $a > 0$, $b < 0$, all real numbers

However, evaluation in Matlab is extremely slow. Are there ways I can formulate this into another function that is much faster. Or, if there is any relationship between the 1st and 2nd hypergeometric functions? I would like to be able to reduce computation time by half possibly.

$\endgroup$
  • $\begingroup$ See my answer here. Depending on the nature of your problem you may be able to use my hypergeom2F1 function or my optimized version of Matlab's hypergeom. Be sure to confirm that your results are consistent to the degree of accuracy you require. $\endgroup$ – horchler Mar 10 '17 at 18:08
  • $\begingroup$ You can find a large number of alternate forms for the Gauss hypergeometric function $_2F_1$ at Wolfram's functions site. $\endgroup$ – horchler Mar 10 '17 at 18:11
  • 1
    $\begingroup$ Thank you very much. I came across this response yesterday and implemented the hypergeomq function. The improvement in computation time is drastic! An order of magnitude difference. Solves my issue. $\endgroup$ – user424072 Mar 11 '17 at 13:09
0
$\begingroup$

Since the time of computation depends on an algorithm unknown to the user, one cannot give a definitive answer.

I suggest to compare the times of computation for the hypergeometric function and the incomplete Beta function : $$_2F_1(a,b,a+1,x)=a\:x^{-a}B_x(a,1-b)$$ $$_2F_1(a+1,b,a+2,x)=a\:x^{-(a+1)}B_x(a+1,1-b)$$ Also, compare with the direct numerical integration method. See equation (1) in : http://mathworld.wolfram.com/IncompleteBetaFunction.html $$_2F_1(a,b,a+1,x)=a\:x^{-a}\int_0^x \frac{t^{a-1}}{(1-t)^b}dt$$ $$_2F_1(a+1,b,a+2,x)=(a+1)\:x^{-(a+1)}\int_0^x \frac{t^{a}}{(1-t)^b}dt$$

Note : For $x=\epsilon$ close to $0$ the integral reduces to $\int_0^\epsilon \frac{t^{a-1}}{(1-t)^b}dt\simeq a^{-1}\epsilon^a$.

$\endgroup$
  • $\begingroup$ $1-x$ should be $1-t$ in the integrand. $\endgroup$ – WimC Mar 10 '17 at 18:33
  • $\begingroup$ Of course, there was a typo (now corrected). Thank you for the remark. $\endgroup$ – JJacquelin Mar 10 '17 at 22:52
  • $\begingroup$ Thank you for the response. I did not know about the incomplete beta function. Will check this out. $\endgroup$ – user424072 Mar 11 '17 at 13:11
  • $\begingroup$ As a follow up to the question I posted and the response I received here, will the first identity given here relating the hypergeometric function with incomplete beta function also hold the same when a<0, a+1>0,b>0? $\endgroup$ – user424072 Dec 5 '17 at 17:03
  • $\begingroup$ If one use the integral definition for the Incomplete Beta function, the Integral is non longer convergent. Outside the range of convergence, one have to consider the analytic continuation in order to extend the definition of the fonction. In this context and as far as I know, the above relationship between Hypergeometric and Incomplete Beta functions continue to be valid. But this would require bibliographic search of references. $\endgroup$ – JJacquelin Dec 5 '17 at 18:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.