4
$\begingroup$

I have very long symbolic expressions, which I have to evaluate numerically later on. They contain the AppellF1 function, which stays unevaluated for the specific numerical arguments I need. So for example:

AppellF1[0.75,2.,2.,1.75,-1.,-1.]

does produce an actual output, but not for -- say --

AppellF1[0.75,2.,2.,1.75,-1.,-0.9]

To this end I have implemented the integral representation of this guy:

NumAppell[a_, b1_, b2_, c_, x_?NumericQ, y_?NumericQ] := 
 NumAppell[a, b1, b2, c, x, y] = 
  Gamma[c]/(Gamma[a] Gamma[c - a]) NIntegrate[
    t^(a - 1) (1 - t)^(c - a - 1) (1 - x t)^-b1 (1 - t y)^-b2, {t, 0, 
     1}, Method -> {Automatic, "SymbolicProcessing" -> False}]

This does evaluate fairly quickly:

NumAppell[0.75,2.,2.,1.75.,-1.,-0.9]//AbsoluteTiming
(*{0.012481, 0.374778}*)

As you can see, on my machine it takes around $10^{-2} s$. Yet even this is too slow for me.

Can you suggest an other way which is at least an order of magnitude faster than this? Or even an external integrator package for this sort of problem?

$\endgroup$
3
  • 8
    $\begingroup$ Does this answer your question? Possible bug in hypergeometric function AppellF1 $\endgroup$
    – xzczd
    Jun 23, 2020 at 9:39
  • $\begingroup$ It is a very neat solution. I have implemented this in my program but (i) it was not faster than the numerical integration and (ii) for some arguments it returned indeterminate as a result. :( $\endgroup$
    – dzsoga
    Jun 23, 2020 at 12:41
  • $\begingroup$ This now works in 13.3.0, it is 0.374778, and is as fast, 0.0683 seconds vs 0.069. $\endgroup$ Jul 1, 2023 at 7:31

0