MathGroup Archive 1994

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

Search the Archive

Re: Hypergeometric Function

  • To: mathgroup at christensen.Cybernetics.NET
  • Subject: [mg208] Re: [mg189] Hypergeometric Function
  • From: bob Hanlon <hanlon at pafosu2.hq.af.mil>
  • Date: Sun, 20 Nov 1994 20:48:20 (EDT)

>  Message-Id: <9411180713.AA03873 at christensen.cybernetics.net.>
>  Date: 17 Nov 1994 13:55:12 -0500
>  From: Joel Storch <Joel_Storch at qmlink.draper.com>
>  Subject: [mg189] Hypergeometric Function
>  To: 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 Wolframs text does not contain any 
>  reference to the Generalized Hypergeometric Function).
>  

The generalized hypergeometric function HypergeometricPFQ (3F2 in this
case) even with unit argument is not handled very effectively by
Mathematica.  Cases for which closed forms exist are not reduced; and
often those that do reduce are left containing multiple Gamma functions
that should reduce further.  For example,

In[1]:=
example1 = (a*Pi*Gamma[1 + b] 
	HypergeometricPFQ[{1/2, (1 + b)/2, 1 + b/2}, 
		{(3 - a + b)/2, (3 + a + b)/2}, 1])/
	(4*2^b*Gamma[3/2 - a/2 + b/2]*Gamma[3/2 + a/2 + b/2]) /. 
	{a -> 1/2, b -> 1} // Simplify

Out[1]=
                      1     3    7  9
Pi HypergeometricPFQ[{-, 1, -}, {-, -}, 1]
                      2     2    4  4
------------------------------------------
                    7        9
           16 Gamma[-] Gamma[-]
                    4        4

It is shown below that this has the value  2(-1 + Sqrt[2])/3.

In[2]:=
example2 = (a*Pi*Gamma[1 + b] 
	HypergeometricPFQ[{1/2, (1 + b)/2, 1 + b/2}, 
		{(3 - a + b)/2, (3 + a + b)/2}, 1])/
	(4*2^b*Gamma[3/2 - a/2 + b/2]*Gamma[3/2 + a/2 + b/2]) /. 
	{a -> 1} // Simplify
			

Out[2]=
    Sqrt[Pi] Gamma[1 + b]
------------------------------
   b           b        3 + b
2 2  Gamma[1 + -] Gamma[-----]
               2          2

This can be reduced significantly by using the duplication formula for
Gamma functions:

In[3]:=
example2 //. {Gamma[1 +  b] -> Gamma[2 + b] / (1 + b),
	Gamma[2 + b] -> 
		2^(b + 3/2) Gamma[1 + b/2] Gamma[(3 + b)/2] / Sqrt[2Pi] }

Out[3]=
  1
-----
1 + b

The method for handling the definite integral of interest is to use known 
results for special cases and use numerical integration whenever necessary.

In[4]:=
simplifyCos = {
	Cos[(((n_ /; EvenQ[n]) + x_) Pi)/2] -> (-1)^(n/2) Cos[x Pi/2],
	Cos[((n_ + x_) Pi)/2] -> (-1)^((n+1)/2) Sin[x Pi/2] };

In[5]:=
g::usage = "g[a, b] is the definite integral of (Sin[a x] Cos[x]^b)
	on the interval {0, Pi/2}.";

g[a_ /; N[a] == 0, b_] := 0;

g[a_, b_ /; N[b] == 0] := (1 - Cos[a Pi/2])/a //. simplifyCos;

g[a_, b_] := (1 + b g[a - 1, b -1])/(a + b) /; 
	IntegerQ[a] && a > 0 || IntegerQ[b] && b > 0;
	(*  Gradshteyn & Ryzhik, 2.537.1  *)

g[a_Integer, b_] := -g[-a, b];

g[a_, b_] := 
	Module[{n = (a - b - 2)/2},
		(-1)^n Sum[Binomial[n, i] (-1)^i 2^i / (b + i + 1), {i, 0, n}]
	] /; EvenQ[a - b] && a - b >= 2;  
	(*  Gradshteyn & Ryzhik, 3.632.3  *)

g[a_, b_] := 
	Module[{
		intgrl = (a*Pi*Gamma[1 + b] 
			HypergeometricPFQ[{1/2, (1 + b)/2, 1 + b/2}, 
				{(3 - a + b)/2, (3 + a + b)/2}, 1])/
			(4*2^b*Gamma[3/2 - a/2 + b/2]*Gamma[3/2 + a/2 + b/2])
	},
	If[ NumberQ[a] && NumberQ[b] && !NumberQ[N[intgrl]], 
		intgrl  = NIntegrate[Sin[a x] Cos[x]^b, {x, 0, Pi/2}]
		];
	intgrl
	];

Examples:

In[14]:=
Table[StringForm["g[``, b]  =  ``", n, g[n, b] // Simplify], 
	{n, 0, 3}] // TableForm

Out[14]//TableForm=
g[0, b]  =  0

              1
g[1, b]  =  -----
            1 + b

              2
g[2, b]  =  -----
            2 + b

                 2 b
            1 + -----
                1 + b
g[3, b]  =  ---------
              3 + b

In[15]:=
Table[StringForm["g[``, b]  =  ``", b + 2n, g[b + 2n, b] // Simplify], 
	{n, 3}] // TableForm

Out[15]//TableForm=
                  1
g[2 + b, b]  =  -----
                1 + b

                     b
g[4 + b, b]  =  ------------
                           2
                2 + 3 b + b

                  1       4       4
g[6 + b, b]  =  ----- - ----- + -----
                1 + b   2 + b   3 + b

In[16]:=
Table[StringForm["g[a, ``]  =  ``", n, g[a, n] // Simplify], 
	{n, 0, 3}] // TableForm

Out[16]//TableForm=
                  a Pi 2
            2 Sin[----]
                   4
g[a, 0]  =  ------------
                 a

                    a Pi
            a + Sin[----]
                     2
g[a, 1]  =  -------------
                     2
               -1 + a

                  2         a Pi
            -2 + a  + 2 Cos[----]
                             2
g[a, 2]  =  ---------------------
                          3
                  -4 a + a

                   3         a Pi
            7 a - a  + 6 Sin[----]
                              2
g[a, 3]  =  ----------------------
                        2    4
               -9 + 10 a  - a

For the first example above (example1):

In[17]:=
g[1/2, 1] // Simplify

Out[17]=
2 (-1 + Sqrt[2])
----------------
       3

When necessary, the numerical integration is applied:

In[18]:=
g[3.4, 2.1]

Out[18]=
0.416192

------------------------

Bob Hanlon
hanlon at pafosu2.hq.af.mil








  • Prev by Date: Re: Hypergeometric Function
  • Next by Date: Simple command to strip Notebook
  • Previous by thread: Re: Hypergeometric Function
  • Next by thread: Re: Hypergeometric Function