apfloat icon indicating copy to clipboard operation
apfloat copied to clipboard

Is hypergeometricPFQ somewhere public available?

Open axkr opened this issue 2 years ago • 5 comments

Is the hypergeometricPFQ method also already available for calls from outside apfloat library?

  • https://github.com/mtommila/apfloat/blob/6e3088cd70dcc873e6df004f9646702570f24626/apfloat/src/main/java/org/apfloat/HypergeometricHelper.java#L447

HypergeometricHelper is package private.

axkr avatar Mar 09 '23 17:03 axkr

No.

I don't know any algorithm to calculate the case p = q + 1 when |z| >= 1. (All the interesting cases are of this type e.g. 3F2 or 7F6.)

If you can point me to an algorithm, I will consider it.

I don't know how Mathematica calculates it.

The hypergeometricPFQ() function in HypergeometricHelper does not converge when p = q + 1 and |z| >= 1 so calling it may just hang. With |z| close to 1 but less than 1 it may converge arbitrarily slowly. So I don't recommend calling it and I don't plan to add it to the public API.

mtommila avatar Mar 10 '23 19:03 mtommila

Did you already checked these references?

  • https://github.com/fredrik-johansson/arb/blob/master/acb_hypgeom/pfq.c

In mpmath they simply lists the restrictions for using the hyper() function. Maybe you can do it similarly:

  • https://mpmath.org/doc/current/functions/hypergeometric.html
  • https://github.com/mpmath/mpmath/blob/master/mpmath/functions/hypergeometric.py#L195

axkr avatar Mar 11 '23 09:03 axkr

I was able to find formulas for calculating some cases but not all.

  • https://functions.wolfram.com/HypergeometricFunctions/HypergeometricPFQ/06/01/05/02/0004/ when |z| ≫ 1
  • Analytic continuation when |z| ≈ 1 but not when z is close to 1
  • https://functions.wolfram.com/HypergeometricFunctions/HypergeometricPFQ/06/01/04/01/0002/ when z is 1 or close to 1 but only when Re(ai) > 0

I was planning on making a release now but if I wait until hypergeometricPFQ() is implemented it might take another several years.

mtommila avatar Mar 15 '23 21:03 mtommila

Ok, no problem. Go ahead and make a release.

axkr avatar Mar 16 '23 18:03 axkr

Another note is that also other types of pFq than p = q + 1 will converge very slowly and take practically forever to calculate when |z| is very large. A generic approach for this would be needed as well. For example 1F2(z) when |z| ≫ 1.

mtommila avatar Dec 11 '23 23:12 mtommila