6
$\begingroup$

I have trouble evaluating the following generalised hypergeometric function:

HypergeometricPFQRegularized[{1/2, 1, n/2}, {1 - m, 1 + m}, x]

at certain values of $n,m,x$.

Attempting to evaluate:

HypergeometricPFQRegularized[{1/2, 1, 1/2}, {1 - 1.5, 1 + 1.5}, 0.9]

and Mathematica says that it encounters infinite $1/0$ expressions. This seems to occur for all values of $m$ greater than $1$! Remarkably, for any other $x$, this precise error does not seem to occur anymore!?

Specifically, trying to evaluate it at a slightly different value of $x$,

HypergeometricPFQRegularized[{1/2, 1, 1/2}, {1 - 1.5, 1 + 1.5}, 0.901]

and Mathematica calculates for a long time (I let it run for a minute before aborting). This also occurs for larger $0.9 < x < 1$, but strangely, there is no problem for $x < 0.9$ to instantly obtain a (finite) result!?

Alternatively, trying to perturb $m$ a little bit:

HypergeometricPFQRegularized[{1/2, 1, 1/2}, {1 - 1.5001, 1 + 1.5001}, 0.9]

and I get a strange warning sign that Mathematica is dealing with very small numbers, below machine number.

Are there simply workarounds to compute the above values for which Mathematica has trouble with? The above mentioned messages are warning messages and Mathematica does output some (finite) value, but how safe are they?

$\endgroup$
1
  • $\begingroup$ Using precise values seems to work - N[HypergeometricPFQRegularized[{1/2,1,1/2},{1-3/2,1+3/2},9/10]]. $\endgroup$ Commented Jul 11, 2022 at 19:05

1 Answer 1

5
$\begingroup$

You can either use bignums in the input:

HypergeometricPFQRegularized[{1/2,1,1/2},{1-1.5`10,1+1.5`10},0.9`10]

0.076742358

Or you can use exact input, and numericize later:

N @ HypergeometricPFQRegularized[{1/2,1,1/2},{1-3/2,1+3/2},9/10]

0.0767424

The problem with your original input is that internal computations are carried out with machine numbers, and when the internal machine numbers underflow, you get errors. Using bignums avoids underflow, and using exact input allows Mathematica to use the setting for $MaxExtraPrecision to carry out internal computations at a higher precision.

$\endgroup$
2
  • $\begingroup$ This is great. However, the first solution (using bignums) does not seem to work if $x$ is closer to 1 (say, try with $x=0.99`10$), while with exact inputs, it still is quick. Is there a reason for this behaviour? Is it possible to make the first method work for $x$ close to 1? $\endgroup$
    – Patrick.B
    Commented Jul 15, 2022 at 9:44
  • $\begingroup$ So, this seems to work if I use a substitution rule: HypergeometricPFQRegularized[{1/2, 1, 1/2}, {1 - 3/2, 1 + 3/2}, x] /. x -> 0.99'10. Is this normal behaviour? $\endgroup$
    – Patrick.B
    Commented Jul 15, 2022 at 9:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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