Skip to main content
added 4 characters in body; edited title
Source Link

Simplify HyperGeometric 2F1Hypergeometric2F1 that algebraically should cancel

I have a probability mass function that should sum to unity algebraically, but neither FullSimplifyFullSimplify nor FunctionExpandFunctionExpand can deal with the HyperGeometric2F1Hypergeometric2F1 therein.

myPMF[x_, p_, k_] := (   p^k *(1 - p)^(x - k) 
                      + (1 - p)^k * p^(x - k)  ) Binomial[ x - 1, k - 1] // Simplify    
(*  coin toss that ends when either k heads or k  tails appears ;
    x = total number of flips;
    k <= x <= 2 k  
*)

Assuming[ 0 < p < 1, Element[x | n, Integers]
   Sum[ myPMF[x, p, n], {x, n, 2 n - 1}] // FullSimplify 
 ]    (* expecting exact 1 like the numerical verification below ;
        FunctionExpand basically does nothing to HyperGeometric *)

start = 16; stop = 40; (* this takes maybe 6 seconds *)
Table[
       Sum[ myPMF[x, p, n], {x, n, 2 n - 1} ]
 , {n, start, stop} ] // Simplify

The exact sum can be done with partial numerical inputs as the code shows.

How do I carry out the algebraic sum and arrive at unity? Perhaps a different way of using FunctionExpandFunctionExpand?

Thank you.

Simplify HyperGeometric 2F1 that algebraically should cancel

I have a probability mass function that should sum to unity algebraically, but neither FullSimplify nor FunctionExpand can deal with the HyperGeometric2F1 therein.

myPMF[x_, p_, k_] := (   p^k *(1 - p)^(x - k) 
                      + (1 - p)^k * p^(x - k)  ) Binomial[ x - 1, k - 1] // Simplify    
(*  coin toss that ends when either k heads or k  tails appears ;
    x = total number of flips;
    k <= x <= 2 k  
*)

Assuming[ 0 < p < 1, Element[x | n, Integers]
   Sum[ myPMF[x, p, n], {x, n, 2 n - 1}] // FullSimplify 
 ]    (* expecting exact 1 like the numerical verification below ;
        FunctionExpand basically does nothing to HyperGeometric *)

start = 16; stop = 40; (* this takes maybe 6 seconds *)
Table[
       Sum[ myPMF[x, p, n], {x, n, 2 n - 1} ]
 , {n, start, stop} ] // Simplify

The exact sum can be done with partial numerical inputs as the code shows.

How do I carry out the algebraic sum and arrive at unity? Perhaps a different way of using FunctionExpand?

Thank you.

Simplify Hypergeometric2F1 that algebraically should cancel

I have a probability mass function that should sum to unity algebraically, but neither FullSimplify nor FunctionExpand can deal with the Hypergeometric2F1 therein.

myPMF[x_, p_, k_] := (   p^k *(1 - p)^(x - k) 
                      + (1 - p)^k * p^(x - k)  ) Binomial[ x - 1, k - 1] // Simplify    
(*  coin toss that ends when either k heads or k  tails appears ;
    x = total number of flips;
    k <= x <= 2 k  
*)

Assuming[ 0 < p < 1, Element[x | n, Integers]
   Sum[ myPMF[x, p, n], {x, n, 2 n - 1}] // FullSimplify 
 ]    (* expecting exact 1 like the numerical verification below ;
        FunctionExpand basically does nothing to HyperGeometric *)

start = 16; stop = 40; (* this takes maybe 6 seconds *)
Table[
       Sum[ myPMF[x, p, n], {x, n, 2 n - 1} ]
 , {n, start, stop} ] // Simplify

The exact sum can be done with partial numerical inputs as the code shows.

How do I carry out the algebraic sum and arrive at unity? Perhaps a different way of using FunctionExpand?

Thank you.

Tweeted twitter.com/StackMma/status/785110046359318528
edited tags
Link
Source Link

Simplify HyperGeometric 2F1 that algebraically should cancel

I have a probability mass function that should sum to unity algebraically, but neither FullSimplify nor FunctionExpand can deal with the HyperGeometric2F1 therein.

myPMF[x_, p_, k_] := (   p^k *(1 - p)^(x - k) 
                      + (1 - p)^k * p^(x - k)  ) Binomial[ x - 1, k - 1] // Simplify    
(*  coin toss that ends when either k heads or k  tails appears ;
    x = total number of flips;
    k <= x <= 2 k  
*)

Assuming[ 0 < p < 1, Element[x | n, Integers]
   Sum[ myPMF[x, p, n], {x, n, 2 n - 1}] // FullSimplify 
 ]    (* expecting exact 1 like the numerical verification below ;
        FunctionExpand basically does nothing to HyperGeometric *)

start = 16; stop = 40; (* this takes maybe 6 seconds *)
Table[
       Sum[ myPMF[x, p, n], {x, n, 2 n - 1} ]
 , {n, start, stop} ] // Simplify

The exact sum can be done with partial numerical inputs as the code shows.

How do I carry out the algebraic sum and arrive at unity? Perhaps a different way of using FunctionExpand?

Thank you.