SM230 - Calculator programs for binomial, hypergeometric, Poisson and normal CDF's.

For the TI-81, 82, 83, 85, 92, HP-48G and Casio 7700


Last Revision: 2/25/97

John C. Turner

jct@nadn.navy.mil

Select your calculator. Then check your program against the test values.

TI-81

TI-82

TI-83

TI-85

TI-92

HP-48G

Casio 7700 (old)

Casio 7700 (new)

Test values


TI-81

TI-81 General notes

  1. Disp and Input are on the PRGM I/O menu
  2. If, End, Lbl, IS>( and Goto are on PRGM CTL menu
  3. > is on the TEST menu
  4. ! and nCr are on the Math Prb submenu
  5. The variable O (oh) is not used. These are zeros.
  6. STO means press the STO button, not type the three letters. When you press STO, it will display as an arrow, ->.
  7. If you have programs with the following 1 letter names, they will interfere with the SM230 programs, which use these memory locations: P,N,X,G,B,S,L,T,M,S. Rename the 1 letter programs, if possible.

TI-81 program for binomial CDF

PrgmB: BCDF
:Disp "P"
:Input P
:Disp "N"
:Input N
:Disp "X"
:Input X
:0 STO A
:0 STO M
:Lbl 1
:A+(N nCr M)*P^M*(1-P)^(N-M) STO A
:IS>(M,X)
:Goto 1
:Disp A

TI-81 program for hypergeometric CDF

PrgmB: HCDF
:Disp "G"
:Input G
:Disp "B"
:Input B
:Disp "S"
:Input S
:Disp "X"
:Input X
:0 STO A
:0 STO M
:Lbl 1
:A+(G nCr M)* (B nCr (S-M)) STO A
:IS>(M,X)
:Goto 1
:A/((G+B) nCr S) STO A
:Disp A

TI-81 program for Poisson CDF

PrgmB: PCDF
:Disp "L"
:Input L
:Disp "T"
:Input T
:Disp "X"
:Input X
:0 STO A
:0 STO M
:Lbl 1
:A+(L*T)^M/M! STO A
:IS>(M,X)
:Goto 1
:A/e^(L*T) STO A
:Disp A

TI-81 program for normal CDF

PrgmB: ZCDF
:Disp "M"
:Input M
:Disp "S"
:Input S
:Disp "X"
:Input X
:1/(1+.2316419*abs(X-M)/S) STO T
: e^(-((X-M)/S)^2/2)/sqrt(2*pi)*
(.31938153*T-.356563782*T^2+1.781477937*T^3- 1.821255978*T^4+1.330274429*T^5) STO A
:If X>M
:1-A STO A
:Disp A

TI82, 83, 85

TI-82, 83, 85 General notes

TI-82, 83 Notes

  1. Prompt and Disp are on the PRGM I/O menu
  2. SUM is on the 2nd LIST MATH menu
  3. seq is on the 2nd List menu
  4. ! and nCr are on the MATH PRB menu
  5. fnInt is on the Math menu
  6. The variable O (oh) is not used. These are zeros.
  7. STO means press the STO button, not type the three letters. When you press STO, it will display as an arrow, ->.
  8. If you have programs with the following 1 letter names, they will interfere with the SM230 programs, which use these memory locations: P,N,X,G,B,S,L,T,M,S. Rename the 1 letter programs, if possible.

TI-85 Notes

  1. Prompt and Disp are on the PRGM I/O menu
  2. SUM is on the MATH MISC menu
  3. seq is on the MATH MISC menu
  4. ! and nCr are on the MATH PRB menu
  5. fnInt is on the CALC menu
  6. If you have programs with the following 1 letter names, they will interfere with the SM230 programs, which use these memory locations: P,N,X,G,B,S,L,T,M,S. Rename the 1 letter programs, if possible.

TI-82 menu program

PROGRAM:A230

Lbl A

Menu("SM230","BCDF",B,"HCDF",H,"PCDF",P,"ZCDF",Z,"QUIT",Q)

Lbl B

prgmBCDF

Pause

Goto A

Lbl H

prgm HCDF

Pause

Goto A

Lbl P

prgm PCDF

Pause

Goto A

Lbl Z

prgm ZCDF

Pause

Goto A

Lbl Q

TI-85 menu program

PROGRAM:A230

Lbl A

Menu(1,"BCDF",B,2,"HCDF",H,3,"PCDF",P,4,"ZCDF",Z,5,"QUIT",Q)

Lbl B

BCDF

Goto A

Lbl H

HCDF

Goto A

Lbl P

PCDF

Goto A

Lbl Z

ZCDF

Goto A

Lbl Q

TI-82, 85 program for binomial CDF

PROGRAM:BCDF
:Prompt P,N,X
:sum seq(N nCr M*(1-P)^(N-M)*P^M,M,0,X,1) STO A
:Disp A

TI-82, 85 program for binomial CDF (faster)

PROGRAM:BBCDF
:Prompt P,N,X
:0 STO A
:(1-P)^N STO T
:For(M,0,X)
:A+T STO A
:T*P/(1-P)*(N-M)/(M+1) STO T
:End
:Disp A

TI-82, 85 program for hypergeometric CDF

PROGRAM:HCDF
:Prompt G,B,S,X
:sum seq((G nCr M)*(B nCr (S-M)),M,0,X,1) STO A
:A/((G+B) nCr S) STO A
:Disp A

TI-82, 85 program for Poisson CDF

PROGRAM:PCDF
:Prompt L,T,X
:sum seq((L*T)^M/M!,M,0,X,1) STO A
:A/e^(L*T) STO A
:Disp A

TI-82, 85 program for Poisson CDF (faster)

PROGRAM:PPCDF
:Prompt L,T,X
:0 STO A
:1/e^(L*T) STO S
:For(m,0,X)
:A+S STO A
:S*L*T/(M+1) STO S
:End
:A
:Disp A

TI-82, 85 program for normal CDF

PROGRAM:ZCDF
:Prompt M,S,X
:1/(1+.2316419*abs(X-M)/S) STO T
: e^(-((X-M)/S)^2/2)/sqrt(2*pi)*
(.31938153*T-.356563782*T^2+1.781477937*T^3- 1.821255978*T^4+1.330274429*T^5) STO A
:A+(1-2A)*(X>M) STO A
:Disp A

TI-92

TI-92 General notes

  1. Prompt and Disp are on the F3 I/O menu
  2. SUM( and SEQ( are spelled out
  3. ! and nCr( are on the MATH PRB menu
  4. The variable O (oh) is not used. These are zeros.
  5. STO means press the STO button, not type the three letters. When you press STO, it will display as an arrow, ->.
  6. If you have programs with the following 1 letter names, they will interfere with the SM230 programs, which use these memory locations: P,N,X,G,B,S,L,T,M,S. Rename the 1 letter programs, if possible.

TI-92 program for binomial CDF

:BCDF()
:Prgm
:Prompt P,N,X
:sum( seq(nCr(N,M)*(1-P)^(N-M)*P^M,M,0,X,1)) STO A
:Disp A
: EndPrgm

TI-92 program for hypergeometric CDF

:HCDF()
:Prgm
:Prompt G,B,S,X
:sum( seq((nCr(G,M))*(nCr(B,S-M)),M,0,X,1))/nCr(G+B,S) STO A
:Disp A

: EndPrgm

TI-92 program for Poisson CDF

:PCDF()

:Prgm
:Prompt L,T,X
:sum( seq((L*T)^M/M!,M,0,X,1))/e^(L*T) STO A
:Disp A

: EndPrgm

TI-92 program for normal CDF

:ZCDF()
:Prgm
:Prompt M,S,X
:1/(1+.2316419*abs(X-M)/S) STO T
: e^(0-((X-M)/S)^2/2)/sqrt(2*pi)*
(.31938153*T-.356563782*T^2+1.781477937*T^3- 1.821255978*T^4+1.330274429*T^5) STO A
:If X>M
:1-A STO A
:Disp A

: EndPrgm


HP-48

HP-48 General notes:

  1. To enter a program, first press <<>> (LeftShift minus)
  2. Type in the steps of the program.
  3. Press Enter.
  4. Press the alpha key and type the program name. Press Enter
  5. Press STO.
  6. In what follows, " " (pair of double quotes) and ' ' (pair of single quotes, or apostrohpes) are different. " " is RightShift minus. ' ' is the key between MTH and SIN.
  7. To edit a program, press the alpha key and type the program name. Press Enter.
  8. Press Edit (LeftShift +/-).
  9. After making changes, press Enter.
  10. To run a program, press VAR. If the program name does not appear on the bottom line of the display, press NXT until it does. Then press the key below the program name.
  11. All the programs prompt for input. A letter will appear in the upper left of the display. Enter the value and press CONT (LeftShift ON).
  12. All the programs leave their inputs on the stack, along with the cdf value. The cdf value is also stored in memory location A.
  13. If you re-run the program and want to keep a parameter the same as before, you may simply enter the letter.
  14. The variable O (oh) is not used. These are zeros.
  15. If you have programs with the following 1 letter names, they will interfere with the SM230 programs, which use these memory locations: P,N,X,G,B,S,L,T,M,S. Rename the 1 letter programs, if possible.

HP-48 program for binomial CDF

"P" PROMPT DUP 'P' STO

"N" PROMPT DUP 'N' STO

"X" PROMPT DUP 'X' STO

'sum (M=0,X,COMB(N,M)*P*M*(1-P)^(N-M))' ->NUM DUP 'A' STO

Notes:

  1. See General Notes for entering programs.
  2. sum is RightShift TAN
  3. ->NUM is LeftShift EVAL
  4. PROMPT is under PRG, NXT, IN, NXT

HP-48 program for hypergeometric CDF

"G" PROMPT DUP 'G' STO

"B" PROMPT DUP 'B' STO

"S" PROMPT DUP 'S' STO

"X" PROMPT DUP 'X' STO

'SUM(M=S-MIN(B,S),MIN(X,MIN(G,X)),COMB(G,M)*COMB(B,S-M)/COMB(G+B,S))'

->NUM DUP 'A' STO

Notes:

  1. See General Notes for entering programs.
  2. sum is RightShift TAN
  3. ->NUM is LeftShift EVAL
  4. PROMPT is under PRG, NXT, IN, NXT

HP-48 program for Poisson CDF

"L" PROMPT DUP 'L' STO

"T" PROMPT DUP 'T' STO

"X" PROMPT DUP 'X' STO

'sum(M=0,X,(L*T)^M/(M!*EXP(L*T)))' ->NUM DUP 'A' STO

Notes:

  1. See General Notes for entering programs.
  2. sum is RightShift TAN
  3. ! (factorial) is under MTH, NXT, PROB
  4. EXP is LeftShift 1/x
  5. ->NUM is LeftShift EVAL
  6. PROMPT is under PRG, NXT, IN, NXT

HP-48 program for normal CDF

"M" PROMPT DUP 'M' STO

"S" PROMPT DUP 'S' STO

"X" PROMPT DUP 'X' STO

(1+.2316419*ABS((X-M)/S)' ->NUM 'T' STO

'EXP(-((X-M)/S)^2/2)/(2*)*

(.31938153*T-.356563782*T^2+1.781477937*T^3- 1.821255978*T^4+1.330274429*T^4)' ->NUM 'A' STO

If 'X>M' THEN '1-A' ->NUM 'A' STO

ELSE A END

Notes:

  1. See General Notes for entering programs.
  2. PROMPT is under PRG, NXT, IN, NXT
  3. EXP is LeftShift 1/x
  4. ->NUM is LeftShift EVAL
  5. > is under PRG, TEST

Casio 7700

CASIO 7700 General notes

  1. See the manual to enter program editing mode and program run mode.
  2. To get double quote ("), press ALPHA and then pick off the screen.
  3. End each line with a "return" by typing SHIFT EXE.
  4. Get the equals sign by typing SHIFT PRGM, choosing REL and then choose = off the screen.
  5. To get Lbl, type SHIFT PRGM and choose JMP and then Lbl off the screen.
  6. To get Goto, type SHIFT PRGM and choose JMP and then Gto off the screen.
  7. The "store" symbol, ->, is a shift key.
  8. The binomial coefficient is denoted by C and is entered by typing SHIFT MATH and then choosing PRB and nCr off the screen.
  9. Exponentiation is denoted by ^ and is the xy button.
  10. Factorial (!) is entered by typing SHIFT MATH and then choosing PRB and x! from the screen.
  11. e^x is a button on the calculator. It is displayed as simply e, so that e-X represents e-X.
  12. If you have programs with the following 1 letter names, they will interfere with the SM230 programs, which use these memory locations: P,N,X,G,B,S,L,T,M,S. Rename the 1 letter programs, if possible.

CASIO 7700 program for binomial CDF

"P="? -> P
"N="? -> N
"X="? -> X
0 -> M
0 -> A
Lbl 1: M > X => Goto 3
Lbl 2: (N C M)*(P^M)*(1-P)^(N-M)+A -> A
(M+1) -> M
Goto 1
Lbl 3: A

CASIO 7700 program for hypergeometric CDF

"G="? -> G
"B="? -> B
"S="? -> S
"X="? -> X
0 -> M
B > S => Goto 4
S-B -> M
Lbl4: 0 -> A
Lbl 1: M > X => Goto 3
Lbl 2: (G C M)* (B C (S-M))/ ((G+B) C S) +A -> A
(M+1) -> M
Goto 1
Lbl 3: A

CASIO 7700 program for Poisson CDF

"L="? -> L
"T="? -> T
"X="? -> X
0 -> M
0 -> A
Lbl 1: M > X => Goto 3
Lbl 2: (L*T)^M *(e-(L*T))/(M!) +A -> A
(M+1) -> M
Goto 1
Lbl 3: A

CASIO 7700 program for normal CDF

"M="? -> M
"S="? -> S
"X="? -> X
1/(1+.2316419*abs(X-M)/S) -> T
(e-(((X-M)/S)^2/2))/sqrt(2*pi)*
(.31938153*T-.356563782*T^2+1.781477937*T^3- 1.821255978*T^4+1.330274429*T^5) -> A
X<M => Goto 1
1-A -> A
Lbl 1: A

Test Values

  1. BCDF:
 P     N   X   CDF
 0.6  10   5    0.3668967424
 0.35 22   6    0.302158381771




  1. HCDF:
 G   B   S   X   CDF
 10  8   6   4   0.880090497738
 17  11  7   4   0.58115942029



  1. PCDF:
 L     T    X    CDF
 2     3    4    0.285056500317
 3.1   1.8  5    0.515258759857




  1. ZCDF:
 M     S    X      CDF
 0     1    1.645  0.950015110159
 7.3   2.6  4.7    0.158655259563