Web pdp-10.trailing-edge.com

Trailing-Edge - PDP-10 Archives - decuslib10-01 - 43,50110/hyperg.tuk
There are 2 other files named hyperg.tuk in the archive. Click here to see a list.
```10' NAME--HYPERG
20'
30' DESCRIPTION--PRINTS A TABLE OF HYPERGEOMETRIC PROBABILITES
40'
50' SOURCE--UNKNOWN
60'
70' INSTRUCTIONS--TYPE RUN TO USE
80'
90' THIS PROGRAM WAS WRITTEN FOR STUDENT USE AT AMOS TUCK SCHOOL
92' OF HANOVER, N.H., WHICH DOES NOT ASSUME RESPONSIBILITY FOR
94' ITS ACCURACY.
100'
110' * * * * * * * * * * MAIN PROGRAM * * * * * * * * * * * *
120'
130 PRINT "THIS PROGRAM PRINTS A TABLE OF HYPERGEOMETRIC PROBABILITIES"
140 PRINT "FOR A RANGE OF R (NUMBER OF 'DEFECTIVES' IN A SAMPLE OF"
150 PRINT "SIZE N), WHEN SAMPLING FROM A POPULATION OF T ITEMS, D OF"
160 PRINT "WHICH ARE DEFECTIVE."
170 PRINT
180 PRINT "T, N, D=";
190 INPUT T,N,D
200 PRINT
210 IF ABS(INT(T))<>T THEN 270
220 IF ABS(INT(N))<>N THEN 270
230  IF ABS(INT(D))<>D THEN 270
240 IF N>=T THEN 270
250 IF D>=T THEN 270
260 GO TO 290
270 PRINT "T, N AND D MUST BE POSITIVE INTEGERS.  N AND D MUST"
271 PRINT "BE LESS THAN T--TRY AGAIN."
280 GO TO 180
290 PRINT "GIVE THE LOWER AND UPPER R'S THAT INTEREST YOU";
300 INPUT R1,R2
310 PRINT
320 IF ABS(INT(R1))<>R1 THEN 360
330 IF ABS(INT(R2))<>R2 THEN 360
340 IF R1>R2 THEN 360
345 IF R2>D THEN 360
350 GO TO 390
360 PRINT "THE R'S MUST BE POSITIVE INTEGERS; THE FIRST NO"
365 PRINT "SMALLER THAN THE SECOND; THE SECOND LESS THAN D--"
366 PRINT "TRY AGAIN"
370 GO TO 290
380
390 PRINT
400 PRINT
410 PRINT "POPULATION OF" T "ITEMS"
420 PRINT "TOTAL NUMBER OF 'DEFECTIVES' IS" D
430 PRINT "SAMPLE SIZE IS" N
440 PRINT "TABLE FOR R =" R1 "THRU" R2
450 PRINT
460 PRINT
470 PRINT "R              P(#DEF.=R)    P(#DEF.<=R)   P(#DEF.>=R)"
480 PRINT"-              -----------   ------------  -----------"
490 PRINT
500 LET C1 = 0
510 LET C2 = 1
520 FOR I = 0 TO R1-1
530  GOSUB 1000
540  NEXT I
550 FOR I = R1 TO R2
560  GOSUB 1000
570 PRINT I,U,C1,C2+U
580 NEXT I
590 STOP
600
1000 LET U = 1
1010 FOR J = 1 TO N-I
1020  LET U = U*((T-D-J+1)/(T-J+1))
1030  NEXT J
1040 FOR J = N-I+1 TO N
1050  LET U = U/((T-J+1)/J)
1060  NEXT J
1070 FOR J = 1 TO I
1080  LET U = U*(D-J+1)/J
1090  NEXT J
1100 LET C1 = C1+U
1110 LET C2 = C2-U
1120 RETURN
1130
9000 END
```
```
```