Tuesday, May 3, 2022

HP 32S and HP 32SII Week: Hypergeometric Distribution

 HP 32S and HP 32SII Week:  Hypergeometric Distribution





What are the Odds?


The hypergeometric probably function deals with taking samples without replacement.  The trials are not independent.  The probability formula is:


G(S; N, T, M) =

1 ÷ nCr(N, M) * nCr(T, S) * nCr(N-T, M-S)


S = number of successes

N = main population size

T = target's population size

M = sample size


nCr(x, y) = x! ÷ ( y! * (x - y)!)


HP 32S/32SII Program:  Hypergeometric Distribution Probability

Size: 30 bytes


H01 LBL H

H02 INPUT S

H03 INPUT N

H04 INPUT T

H05 INPUT M

H06 RCL N

H07 RCL M

H08 Cn,r

H09 1/x

H10 RCL T

H11 RCL S

H12 Cn,r

H13 ×

H14 RCL N

H15 RCL- T

H16 RCL M

H17 RCL-S

H18 Cn,r

H19 ×

H20 STOP


Examples:


What are the odds that four hearts are dealt out of a five card hand?  Assume a standard, 52 card deck.


S = 4 (4 hearts)

N = 52 (52 cards)

T = 13 (13 hearts)

M = 5 (5 card hand)


Result:  1.07292917E-2 (≈1.07%)


What are the odds that a pair of Kings are dealt out of a five card hand?  Assume a standard, 52 card deck.


S = 2 (2 Kings)

N = 52 (52 cards)

T = 13 (13 hearts)

M = 5 (5 card hand)


Result:  3.99298181E-2 (≈3.99%)


Source:


"Hypergeometric Distribution"  Texas Instruments Programmable Slide-Rule SR-56 Applications Library  pp. 58-59 Texas Instruments, 1976


Download the document here, with gratitude to Datamath:

http://www.datamath.net/Manuals/SR-56_AL_US.pdf


Eddie



All original content copyright, © 2011-2022.  Edward Shore.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author. 


Casio fx-CG50: Sparse Matrix Builder

Casio fx-CG50: Sparse Matrix Builder Introduction The programs can create a sparse matrix, a matrix where most of the entries have zero valu...