Re: Hypergeometric Function
- To: Joel Storch <Joel_Storch at qmlink.draper.com>
- Subject: [mg211] Re: [mg189] Hypergeometric Function
- From: wmm at chem.wayne.edu (Martin McClain)
- Date: Mon, 21 Nov 94 12:01:30 EST
- Cc: mathgroup at christensen.cybernetics.net
> Subject: Time:1:54 PM > OFFICE MEMO Hypergeometric Function Date:11/17/94 > >When performing the definite integral: Integrate[Sin[a x]*(Cos[x])^b,{x,0,Pi/2}] , Mathematica returned a result involving the generalized Hypergeometric function - "HyperGeometricpFq". >When I tried to evaluate the result numerically (for specified a,b), it returned the symbolic form i.e. it did not produce a numerical value. What additional steps must be performed to enable a numerical evaluation ? (Incidently, the second edition of W o >lframs text does not contain any reference to the Generalized Hypergeometric Function). Dear Joel: Some time ago I asked this very question, and got a reply from Stephen Wolfram himself. Here it is: Date: Sun, 7 Jun 1992 18:19:18 -0700 "... There is an undocumented function HypergeometricPFQ in Version 2.0 and above which should give values for 2F2. (Get details with ?HypergeometricPFQ.) The reason this function is undocumented, however, is that it has not yet been tested and analysed for all choices of arguments. Jerry Keiper (keiper at wri.com) is the person who wrote it, and he should be able to help you make sure it gives valid results for the cases you need. ... " Later Jerry Keiper also answered: "Date: Tue, 9 Jun 92 10:35:11 CDT From: keiper at wri.com To: wmm at chem.wayne.edu Subject: Hypergeometric2F2 Versions 2.0 and 2.1 of Mathematica provide for numerical evaluation of general hypergeometric pFq functions. Convergence is assumed when two successive partial sums are found to be equal so it is very possible to trick this test and get a wrong result. It is also possible to get completely wrong results due to very ill-conditioned sums as in HypergeometricPFQ[{1.000001, 1.000002}, {1.000003, 1.000004}, -50] where massive cancelation of digits occurs (the correct result would be about 8.1667992944 10^-8). The code used is: HypergeometricPFQ[a_List, b_List, z_] := Module[{an = a, bn = Append[b, 1], oldsum = 0, sum = 1, term = 1}, While[oldsum != sum, term *= Apply[Times, an++] z/Apply[Times, bn++]; oldsum = sum; sum += term]; sum ] /; (Apply[And, Map[NumberQ, a]] && Apply[And, Map[NumberQ, b]] && NumberQ[z] && Precision[{a, b, z}] < Infinity && (Length[a] - Length[b] < 1 || (Length[a] - Length[b] == 1 && Abs[z] < 1))) It would probably be considerably faster to evaluate 2F2 if you wrote your own function hyper2F2[a,b,c,d,z] that didn't have to verify that each of its arguments was in fact a number and that didn't try to do any symbolic simplifications before hand. If you need to evaluate it 1000s of times you might want to consider writing a small routine in C and connecting to Mathematica with MathLink. Jerry B. Keiper keiper at wri.com" Keiper's function, undocumented but present and waiting right there inside in Mma, worked fine for 2F2 over a wide range, including the range we were interested in. But we were able to push it into an area where it failed to converge and gave wrong answers. Regards- Martin McClain, Chemistry, Wayne State University, Deetroit