MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Bug in HypergeometricPFQ[{}, {1/2, 3/4, 3/4}, x]]

  • To: mathgroup at smc.vnet.net
  • Subject: [mg96065] Re: Bug in HypergeometricPFQ[{}, {1/2, 3/4, 3/4}, x]]
  • From: sashap <pavlyk at gmail.com>
  • Date: Wed, 4 Feb 2009 05:18:35 -0500 (EST)
  • References: <gm9cjn$12j$1@smc.vnet.net>

On Feb 3, 6:16 am, Robert Berger <rberge... at sinh.us> wrote:
> Hello,
>
> it seems that the Linux versions 5.2, 6.0.3 as well as 7.0 (and maybe
> also the Windows and OSX versions) of Mathematica exhibit at nasty bug
> regarding the evaluation and simplification of HypergeometricPFQ[{},
> {1/2, 3/4, 3/4}, x]].

Dear group,

The symbolic expression to which
HypergeometricPFQ[{}, {1/2, 3/4, 3/4}, x]
evaluates symbolically is incorrect as can be
see via simple series expansion:

In[29]:= Series[
  Sum[x^k/k!/Pochhammer[1/2, k]/Pochhammer[3/4, k]^2, {k, 0, 4}] -
   HypergeometricPFQ[{}, {1/2, 3/4, 3/4}, x], {x, 0, 1}] // Normal

Out[29]= (64 x)/45

This bug affects all platforms.

It has been fixed in the sources. The fix will be included in
the next shipment of Mathematica.

Note that numerical evaluation of PFQ itself is accurate:

In[32]:= Sum[
  x^k/k!/Pochhammer[1/2, k]/Pochhammer[3/4, k]^2, {k, 0, 10}] /.
 x -> 1`20

Out[32]= 4.9494126523525217834

In[30]:= HypergeometricPFQ[{}, {1/2, 3/4, 3/4}, 1`20]

Out[30]= 4.9494126523525217834

In[31]:= HypergeometricPFQ[{}, {1/2, 3/4, 3/4}, x] /. x -> 1`20

Out[31]= 3.3166393377274780247

Therefore, modifying the definition of f[x] slightly as follows:

In[10]:= Clear[f];
f[x_?InexactNumberQ] := HypergeometricPFQ[{}, {1/2, 3/4, 3/4}, x];

yields the expected result

In[11]:= g[1`20]

Out[11]= 0.*10^-10

Another possible workaround is to introduce a dummy symbolic parameter
in the PFQ to prevent auto-evaluation:

In[14]:= g[x_] :=
 f[x] - (9/32)*f'[x] - (69/16)*x*f''[x] - 5*x^2*f'''[x] - x^3*f''''[x]

In[15]:= Clear[f]; f[x_] := HypergeometricPFQ[{}, {a/2, 3/4, 3/4}, x];

In[16]:= g[1`20] /. a -> 1

Out[16]= 0.*10^-20


Sorry for the inconvenience.

Sincerely,

Oleksandr Pavlyk
Special Functions Developer
Wolfram Research Inc.



>
> The bug can easily be reproduced by the following test:
>
> g[x_] := f[x] - (9/32)*f'[x] - (69/16)*x*f''[x] - 5*x^2*f'''[x] -
> x^3*f''''[x]
> f[x_] := HypergeometricPFQ[{}, {1/2, 3/4, 3/4}, x];
>
> By means of an auxiliary calculation, it can be shown that f[x] is one
> solution of g[x]==0. Therefore g[x] evaluated at any arbitrary point
> should be near zero.
>
> Mathematica 5.2: N[g[1]] is 0.902177 or N[g[0.5]] is 1.40725
> Mathematica 7.0: N[g[1]] is 0.902177 or N[g[0.5]] is 1.40725
> Mathematica 6.0.3: N[g[1]] is 1.94289*10^-16 or N[g[0.5]] is
> 1.94289*10^-16
>
> As one can see, Mathematica 6.0.3 yields the correct result.
>
> Also interesting is that if you replace
> f[x_] := FunctionExpand[HypergeometricPFQ[{}, {1/2, 3/4, 3/4}, x]];
> then Mathematica 6.0.3 yields also the wrong results N[g[1]]=0.902177
> and N[g[0.5]]=1.40725!
>
> It seems that the result of FunctionExpand[HypergeometricPFQ[{}, {1/2,
> 3/4, 3/4}, x]] which is "Sin[4 x^(1/4)]/(8 x^(1/4)) + Sinh[4
> x^(1/4)]/(8 x^(1/4))" is not (generally) valid.
>
> Any ideas how to get rid or workaround about that nasty bug?
>
> Kindly regards,
> Robert.



  • Prev by Date: Re: Taking sums across indices of a
  • Next by Date: Re: Re: Taking sums across indices of a SparseArray
  • Previous by thread: Bug in HypergeometricPFQ[{}, {1/2, 3/4, 3/4}, x]]
  • Next by thread: Problem with GUIKit