Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #12037 > unrolled thread

How to simplify hypergeometrics

Started by"Dr. Wolfgang Hintze" <weh@snafu.de>
First post2012-10-11 06:14 +0000
Last post2012-10-17 02:50 +0000
Articles 5 — 2 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  How to simplify hypergeometrics "Dr. Wolfgang Hintze" <weh@snafu.de> - 2012-10-11 06:14 +0000
    Re: How to simplify hypergeometrics Roland Franzius <roland.franzius@uos.de> - 2012-10-12 04:32 +0000
      Re: How to simplify hypergeometrics "Dr. Wolfgang Hintze" <weh@snafu.de> - 2012-10-13 05:06 +0000
      Re: How to simplify hypergeometrics Roland Franzius <roland.franzius@uos.de> - 2012-10-15 03:48 +0000
        Re: How to simplify hypergeometrics "Dr. Wolfgang Hintze" <weh@snafu.de> - 2012-10-17 02:50 +0000

#12037 — How to simplify hypergeometrics

From"Dr. Wolfgang Hintze" <weh@snafu.de>
Date2012-10-11 06:14 +0000
SubjectHow to simplify hypergeometrics
Message-ID<k55o3n$e7q$1@smc.vnet.net>
Consider the probability function

p[n_, a_, b_, k_] :=
 Binomial[k - 1, a - 1]*(Binomial[n - k, b - a]/Binomial[n, b]) /; {0
<= a <=
    b, n >= a}

In[68]:= p[n, a, b, k]

Out[68]= (Binomial[-1 + k, -1 + a]*Binomial[-k + n, -a + b])/
Binomial[n, b]

Now let's look for the zeroeth moment k^0 (for the higher ones the
situation is similar)

In[69]:= k0 = Sum[p[n, a, b, k], {k, 1, n}]

Out[69]= ((-Binomial[-1, -a + b])*Binomial[n, -1 + a]*
    Hypergeometric2F1[1 - a + b, 1 + n, 2 - a + n, 1] +
   Binomial[0, -1 + a]*Binomial[-1 + n, -a + b]*
    HypergeometricPFQ[{1, 1, 1 - a + b - n}, {2 - a, 1 - n}, 1])/
 Binomial[n, b]

This should give 1, but it looks clumsy.

Simplifying simply gives

In[71]:= FullSimplify[k0]

Out[71]= ComplexInfinity

but also a qualified Simplify does not help, because in this case
Mathematica makes slight cosmetic changes but the result is still far
from being recognized as 1:

In[73]:= FullSimplify[k0, {Element[{a, b, n}, Integers], 0 <= a <= b,
n >= a}]

Out[73]= ((-(-1)^(a + b))*Binomial[n, -1 + a]*
    Hypergeometric2F1[1 - a + b, 1 + n, 2 - a + n, 1] +
   Binomial[0, -1 + a]*Binomial[-1 + n, -a + b]*
    HypergeometricPFQ[{1, 1, 1 - a + b - n}, {2 - a, 1 - n}, 1])/
 Binomial[n, b]

Any help would be greatly appreciated.

Best regards,
Wolfgang

[toc] | [next] | [standalone]


#12051

FromRoland Franzius <roland.franzius@uos.de>
Date2012-10-12 04:32 +0000
Message-ID<k586hh$is3$1@smc.vnet.net>
In reply to#12037
Am 11.10.2012 08:14, schrieb Dr. Wolfgang Hintze:
> Consider the probability function
>
> p[n_, a_, b_, k_] :=
>   Binomial[k - 1, a - 1]*(Binomial[n - k, b - a]/Binomial[n, b]) /; {0
> <= a <=
>      b, n >= a}
>
> In[68]:= p[n, a, b, k]
>
> Out[68]= (Binomial[-1 + k, -1 + a]*Binomial[-k + n, -a + b])/
> Binomial[n, b]
>
> Now let's look for the zeroeth moment k^0 (for the higher ones the
> situation is similar)
>
> In[69]:= k0 = Sum[p[n, a, b, k], {k, 1, n}]
>
> Out[69]= ((-Binomial[-1, -a + b])*Binomial[n, -1 + a]*
>      Hypergeometric2F1[1 - a + b, 1 + n, 2 - a + n, 1] +
>     Binomial[0, -1 + a]*Binomial[-1 + n, -a + b]*
>      HypergeometricPFQ[{1, 1, 1 - a + b - n}, {2 - a, 1 - n}, 1])/
>   Binomial[n, b]
>
> This should give 1, but it looks clumsy.

All general expression with HypergeometricPFQ generally will be wrong 
for integer parameters in the numerator parameters.

One has to regularize by extracting and cancelling infinite Gamma 
factors at negative integers but that means to have control of the 
evaluation by understanding the limit formulas.

Contrary to your assumption of a normalized ditribution the direct 
conversion

Binomial[n_,k_]:> Pochhammer[n-k+1,k]/k! leaves you with the expression

  p[n_, a_, b_, k_]:=(b! Pochhammer[1 - a + k, -1 + a] Pochhammer[
   1 + a - b - k + n, -a + b])/((-1 + a)! (-a + b)! Pochhammer[
   1 - b + n, b])


Simplify[Sum[p[6, a, b, k], {k, 0, n}]] /. {n->6 ,a -> 1, b -> 3}

is not independent of a,b,n


Perhaps a normalization constant is missing? In any binomial 
distribution the normalized distribution has to contain n-th powers of 
the parameters


-- 

Roland Franzius

[toc] | [prev] | [next] | [standalone]


#12060

From"Dr. Wolfgang Hintze" <weh@snafu.de>
Date2012-10-13 05:06 +0000
Message-ID<k5ast0$nos$1@smc.vnet.net>
In reply to#12051
On 12 Okt., 06:34, Roland Franzius <roland.franz...@uos.de> wrote:
> Am 11.10.2012 08:14, schrieb Dr. Wolfgang Hintze:
>
>
>
>
>
> > Consider the probability function
>
> > p[n_, a_, b_, k_] :=
> >   Binomial[k - 1, a - 1]*(Binomial[n - k, b - a]/Binomial[n, b]) /; {0
> > <= a <=
> >      b, n >= a}
>
> > In[68]:= p[n, a, b, k]
>
> > Out[68]= (Binomial[-1 + k, -1 + a]*Binomial[-k + n, -a + b])/
> > Binomial[n, b]
>
> > Now let's look for the zeroeth moment k^0 (for the higher ones the
> > situation is similar)
>
> > In[69]:= k0 = Sum[p[n, a, b, k], {k, 1, n}]
>
> > Out[69]= ((-Binomial[-1, -a + b])*Binomial[n, -1 + a]*
> >      Hypergeometric2F1[1 - a + b, 1 + n, 2 - a + n, 1] +
> >     Binomial[0, -1 + a]*Binomial[-1 + n, -a + b]*
> >      HypergeometricPFQ[{1, 1, 1 - a + b - n}, {2 - a, 1 - n}, 1])/
> >   Binomial[n, b]
>
> > This should give 1, but it looks clumsy.
>
> All general expression with HypergeometricPFQ generally will be wrong
> for integer parameters in the numerator parameters.
>
> One has to regularize by extracting and cancelling infinite Gamma
> factors at negative integers but that means to have control of the
> evaluation by understanding the limit formulas.
>
> Contrary to your assumption of a normalized ditribution the direct
> conversion
>
> Binomial[n_,k_]:> Pochhammer[n-k+1,k]/k! leaves you with the expression
>
>   p[n_, a_, b_, k_]:=(b! Pochhammer[1 - a + k, -1 + a] Pochhammer[
>    1 + a - b - k + n, -a + b])/((-1 + a)! (-a + b)! Pochhammer[
>    1 - b + n, b])
>
> Simplify[Sum[p[6, a, b, k], {k, 0, n}]] /. {n->6 ,a -> 1, b -> 3}
>
> is not independent of a,b,n
>
> Perhaps a normalization constant is missing? In any binomial
> distribution the normalized distribution has to contain n-th powers of
> the parameters
>
> --
>
> Roland Franzius

Hello Roland,

thank you for your reply.

1) I extract your idea to use Pochhammer to convert the original
distribution (which IS normalized, contrary to your statement)

p[n_, a_, b_, k_] :=
 Binomial[k - 1, a - 1]*(Binomial[n - k, b - a]/Binomial[n, b])

to this form

pp[n_, a_, b_,
  k_] := (b!*Pochhammer[1 - a + k, -1 + a]*
    Pochhammer[1 + a - b - k + n, -a + b])/
     ((-1 + a)!*(-a + b)!*Pochhammer[1 - b + n, b])

Comparing the two expressions for concrete values, also checking the
nomalization:

Table[p[10, 3, 4, k], {k, 1, 10}]
Plus @@ %

{0, 0, 1/30, 3/35, 1/7, 4/21, 3/14, 1/5, 2/15, 0}

1

Table[pp[10, 3, 4, k], {k, 1, 10}]
Plus @@ %

{0, 0, 1/30, 3/35, 1/7, 4/21, 3/14, 1/5, 2/15, 0}

1

2a) Ok, so now we calculate again the zeroeth moment of k (which
should give 1, of course).
But, the result does not contain 2F1 anymore but is something
(DifferenceRoot) which I have never seen before, and is not easily
recognized as being = 1

k0 = Sum[pp[n, a, b, k], {k, 1, n}]

(1/(Gamma[a]*Gamma[1 - a + b]*Gamma[1 + n]))*(Gamma[1 + b]*Gamma[1 - b
+ n]*
      DifferenceRoot[
     Function[{\[FormalY], \[FormalN]}, {(-\[FormalN])*(-\[FormalN] +
a - b +
            n)*\[FormalY][\[FormalN]] + (-\[FormalN] - 2*\[FormalN]^2
+
            2*\[FormalN]*a - \[FormalN]*b + n + 2*\[FormalN]*n - a*n)*
                    \[FormalY][
           1 + \[FormalN]] + (-1 - \[FormalN] + a)*(-\[FormalN] +
            n)*\[FormalY][2 + \[FormalN]] == 0, \[FormalY][1] == 0,
              \[FormalY][2] == Gamma[n]/(Gamma[2 - a]*Gamma[a - b +
n])}]][
    1 + n])

2b) Trying now to simplify with all information about the parameters
gives ...

FullSimplify[k0, {Element[{n, a, b}, Integers],
  Inequality[0, Less, a, LessEqual, b], n >= a}]

FullSimplify::infd:Expression Gamma[1+b] Gamma[1-b+n]
DifferenceRoot[Function[{\[FormalY],\[FormalN]},{-\[FormalN]
Plus[<<4>>] \[FormalY][<<1>>]+Plus[<<7>>] \[FormalY][<<1>>]
+Plus[<<3>>] Plus[<<2>>] \[FormalY][<<1>>]==0,\[FormalY][1]==0,\
[FormalY][2]==Gamma[n]/(Gamma[<<1>>] Gamma[<<1>>])}]][1+n] simplified
to Indeterminate. >>

FullSimplify::infd:Expression (1/(Gamma[a] Gamma[1-a+b]
Gamma[1+n]))Gamma[1+b] Gamma[1-b+n] DifferenceRoot[Function[{\
[FormalY],\[FormalN]},{-\[FormalN] Plus[<<4>>] \[FormalY][<<1>>]
+Plus[<<7>>] \[FormalY][<<1>>]+Plus[<<3>>] Plus[<<2>>] \[FormalY]
[<<1>>]==0,\[FormalY][1]==0,\[FormalY][2]==Gamma[n]/(Gamma[<<1>>]
Gamma[<<1>>])}]][1+n] simplified to Indeterminate. >>

Indeterminate

3a) So telling Mathematica in advance everything known about the
parameters, gives no evaluation at all

Assuming[{Element[{n, a, b, k}, Integers],
  Inequality[0, Less, a, LessEqual, b], n >= a, 1 <= k <= n},
   k0 = Sum[pp[n, a, b, k], {k, 1, n}]]

Sum[(b!*Pochhammer[1 - a + k, -1 + a]*
    Pochhammer[1 + a - b - k + n, -a + b])/((-1 + a)!*(-a + b)!*
    Pochhammer[1 - b + n, b]), {k, 1, n}]

3b) Putting Assuming under the sum

k0 = Sum[Assuming[{Element[{n, a, b, k}, Integers],
    Inequality[0, Less, a, LessEqual, b], n >= a, 1 <= k <= n},
   pp[n, a, b, k]],
     {k, 1, n}]

(1/(Gamma[a]*Gamma[1 - a + b]*Gamma[1 + n]))*(Gamma[1 + b]*Gamma[1 - b
+ n]*
      DifferenceRoot[
     Function[{\[FormalY], \[FormalN]}, {(-\[FormalN])*(-\[FormalN] +
a - b +
            n)*\[FormalY][\[FormalN]] + (-\[FormalN] - 2*\[FormalN]^2
+
            2*\[FormalN]*a - \[FormalN]*b + n + 2*\[FormalN]*n - a*n)*
                    \[FormalY][
           1 + \[FormalN]] + (-1 - \[FormalN] + a)*(-\[FormalN] +
            n)*\[FormalY][2 + \[FormalN]] == 0, \[FormalY][1] == 0,
              \[FormalY][2] == Gamma[n]/(Gamma[2 - a]*Gamma[a - b +
n])}]][
    1 + n])

gives us back the expression of attempt 2a).

4) Fixing n in advance results in a funny thing like this one

FullSimplify[
 With[{n = 10},
  Assuming[{Element[{n, a, b, k}, Integers],
    Inequality[0, Less, a, LessEqual, b], n >= a, 1 <= k <= n},
       k0 = Sum[pp[n, a, b, k], {k, 1, n}]]]]

(1440*b!*((28*(19 + 8*a - 9*b))/(Gamma[11 - a]*Gamma[2 + a - b]) +
(214 +
        3*a^2 + a*(5 - 4*b) + b*(-41 + 3*b))/
           (Gamma[8 - a]*
        Gamma[6 + a -
          b]) + (7/((-8 + a)*(-7 + a)*(-6 + a)*(-5 + a)*Gamma[3 + a -
b]) +
              (12600 + a*(-7435 + (2305 - 228*a)*a) - 1385*b -
           23*(-5 + a)*a*b + 2*(50 + a)*b^2 - 3*b^3)/Gamma[10 + a -
b])/
      Gamma[5 - a]))/
   ((-a + b)!*Gamma[a]*Pochhammer[11 - b, b])

In summary:
I didn't get the desired result and need more help.

Regards,
Wolfgang

[toc] | [prev] | [next] | [standalone]


#12074

FromRoland Franzius <roland.franzius@uos.de>
Date2012-10-15 03:48 +0000
Message-ID<k5g11t$3oi$1@smc.vnet.net>
In reply to#12051
Am 12.10.2012 06:32, schrieb Roland Franzius:
> Am 11.10.2012 08:14, schrieb Dr. Wolfgang Hintze:
>> Consider the probability function
>>
>> p[n_, a_, b_, k_] :=
>>    Binomial[k - 1, a - 1]*(Binomial[n - k, b - a]/Binomial[n, b]) /; {0
>> <= a <=
>>       b, n >= a}
>>
>> In[68]:= p[n, a, b, k]
>>
>> Out[68]= (Binomial[-1 + k, -1 + a]*Binomial[-k + n, -a + b])/
>> Binomial[n, b]
>>
>> Now let's look for the zeroeth moment k^0 (for the higher ones the
>> situation is similar)
>>
>> In[69]:= k0 = Sum[p[n, a, b, k], {k, 1, n}]
>>
>> Out[69]= ((-Binomial[-1, -a + b])*Binomial[n, -1 + a]*
>>       Hypergeometric2F1[1 - a + b, 1 + n, 2 - a + n, 1] +
>>      Binomial[0, -1 + a]*Binomial[-1 + n, -a + b]*
>>       HypergeometricPFQ[{1, 1, 1 - a + b - n}, {2 - a, 1 - n}, 1])/
>>    Binomial[n, b]
>>
>> This should give 1, but it looks clumsy.
>
> All general expression with HypergeometricPFQ generally will be wrong
> for integer parameters in the numerator parameters.
>
> One has to regularize by extracting and cancelling infinite Gamma
> factors at negative integers but that means to have control of the
> evaluation by understanding the limit formulas.
>
> Contrary to your assumption of a normalized ditribution the direct
> conversion
>
> Binomial[n_,k_]:> Pochhammer[n-k+1,k]/k! leaves you with the expression
>
>    p[n_, a_, b_, k_]:=(b! Pochhammer[1 - a + k, -1 + a] Pochhammer[
>     1 + a - b - k + n, -a + b])/((-1 + a)! (-a + b)! Pochhammer[
>     1 - b + n, b])
>
>
> Simplify[Sum[p[6, a, b, k], {k, 0, n}]] /. {n->6 ,a -> 1, b -> 3}
>
> is not independent of a,b,n
>
>
> Perhaps a normalization constant is missing? In any binomial
> distribution the normalized distribution has to contain n-th powers of
> the parameters


So, at least, I found some material related to your problem.

On the internet:

http://www.math.uah.edu/stat/index.html

Especially

http://www.math.uah.edu/stat/urn/OrderStatistics.html


Mathematica 8 knows about OrderStatistics.


In: Assuming[{{k, n, m, i} \[Element] Integers,
           1 <= m, 1 <= i <= n <= m},
  FunctionExpand[
   Sum[ Binomial[k - 1, i - 1] Binomial[m - k,
       n - i] /. {Binomial[a_, b_] :> a!/b!/(a - b)!}, {k, i,
     m - n + i}]]]

Out: Gamma[1 + m]/(Gamma[1 + m - n] Gamma[1 + n])


In the Mathematica Help  for "OrderDistribution" you will find an 
example, adapted here to the discrete case

In: \[ScriptCapitalD] =
  OrderDistribution[{DiscreteUniformDistribution[{1, n}], a}, b];

In: CDF[\[ScriptCapitalD], x]

Out:
	
\[Piecewise]	
-BetaRegularized[-(1/n)+k/n,b,1+a-b]+
     BetaRegularized[k/n,b,1+a-b]	k>=1&&k-n<0
1-BetaRegularized[1-1/n,b,1+a-b]	k>=1&&k-n==0
-BetaRegularized[-(1/n),b,1+a-b]	k>=1&&k-n<=0
0	True

Perhaps it helps.

-- 

Roland Franzius









[toc] | [prev] | [next] | [standalone]


#12088

From"Dr. Wolfgang Hintze" <weh@snafu.de>
Date2012-10-17 02:50 +0000
Message-ID<k5l6eb$cnb$1@smc.vnet.net>
In reply to#12074
On 15 Okt., 05:49, Roland Franzius <roland.franz...@uos.de> wrote:
> Am 12.10.2012 06:32, schrieb Roland Franzius:
>
>
>
>
>
> > Am 11.10.2012 08:14, schrieb Dr. Wolfgang Hintze:
> >> Consider the probability function
>
> >> p[n_, a_, b_, k_] :=
> >>    Binomial[k - 1, a - 1]*(Binomial[n - k, b - a]/Binomial[n, b]) =
/; {0
> >> <= a <=
> >>       b, n >= a}
>
> >> In[68]:= p[n, a, b, k]
>
> >> Out[68]= (Binomial[-1 + k, -1 + a]*Binomial[-k + n, -a + b])/
> >> Binomial[n, b]
>
> >> Now let's look for the zeroeth moment k^0 (for the higher ones the
> >> situation is similar)
>
> >> In[69]:= k0 = Sum[p[n, a, b, k], {k, 1, n}]
>
> >> Out[69]= ((-Binomial[-1, -a + b])*Binomial[n, -1 + a]*
> >>       Hypergeometric2F1[1 - a + b, 1 + n, 2 - a + n, 1] +
> >>      Binomial[0, -1 + a]*Binomial[-1 + n, -a + b]*
> >>       HypergeometricPFQ[{1, 1, 1 - a + b - n}, {2 - a, 1 - n}, 1=
])/
> >>    Binomial[n, b]
>
> >> This should give 1, but it looks clumsy.
>
> > All general expression with HypergeometricPFQ generally will be wrong
> > for integer parameters in the numerator parameters.
>
> > One has to regularize by extracting and cancelling infinite Gamma
> > factors at negative integers but that means to have control of the
> > evaluation by understanding the limit formulas.
>
> > Contrary to your assumption of a normalized ditribution the direct
> > conversion
>
> > Binomial[n_,k_]:> Pochhammer[n-k+1,k]/k! leaves you with the expression
>
> >    p[n_, a_, b_, k_]:=(b! Pochhammer[1 - a + k, -1 + a] Pochhamme=
r[
> >     1 + a - b - k + n, -a + b])/((-1 + a)! (-a + b)! Pochhammer[
> >     1 - b + n, b])
>
> > Simplify[Sum[p[6, a, b, k], {k, 0, n}]] /. {n->6 ,a -> 1, b -> 3}
>
> > is not independent of a,b,n
>
> > Perhaps a normalization constant is missing? In any binomial
> > distribution the normalized distribution has to contain n-th powers of
> > the parameters
>
> So, at least, I found some material related to your problem.
>
> On the internet:
>
> http://www.math.uah.edu/stat/index.html
>
> Especially
>
> http://www.math.uah.edu/stat/urn/OrderStatistics.html
>
> Mathematica 8 knows about OrderStatistics.
>
> In: Assuming[{{k, n, m, i} \[Element] Integers,
>            1 <= m, 1 <= i <= n <= m},
>   FunctionExpand[
>    Sum[ Binomial[k - 1, i - 1] Binomial[m - k,
>        n - i] /. {Binomial[a_, b_] :> a!/b!/(a - b)!}, {k, i,
>      m - n + i}]]]
>
> Out: Gamma[1 + m]/(Gamma[1 + m - n] Gamma[1 + n])
>
> In the Mathematica Help  for "OrderDistribution" you will find an
> example, adapted here to the discrete case
>
> In: \[ScriptCapitalD] =
>   OrderDistribution[{DiscreteUniformDistribution[{1, n}], a}, b];
>
> In: CDF[\[ScriptCapitalD], x]
>
> Out:
>
> \[Piecewise]
> -BetaRegularized[-(1/n)+k/n,b,1+a-b]+
>      BetaRegularized[k/n,b,1+a-b]       k>=1&&k-n<0
> 1-BetaRegularized[1-1/n,b,1+a-b]        k>=1&&k-n==0
> -BetaRegularized[-(1/n),b,1+a-b]        k>=1&&k-n<=0
> 0       True
>
> Perhaps it helps.
>
> --
>
> Roland Franzius

Thank you for your hints.
Unfortunately your sum is different from the one I'm looking for.
I still need to consider your interesting remark on the
OrderDistribution.

Regards,
Wolfgang

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web