Trailing-Edge
-
PDP-10 Archives
-
decuslib20-01
-
decus/20-0025/bindis.bas
There are 2 other files named bindis.bas in the archive. Click here to see a list.
00100 PRINT "DO YOU WANT INSTRUCTIONS (1=YES, 0=NO)";
00110 INPUT I8
00120 IF I8=0 THEN 320
00130 PRINT
00140 PRINT "THIS PROGRAM COMPUTES THE BINOMIAL DISTRIBUTION"
00150 PRINT "FUNCTION FOR PROBLEMS OF THE FORM:"
00155 PRINT
00160 PRINT " IN A SERIES OF N INDEPENDENT TRIALS, EACH WITH PROBABILITY"
00170 PRINT " OF SUCCESS P, WHAT IS THE PROBABILITY THAT THERE WILL"
00180 PRINT " BE EXACTLY X SUCCESSES?"
00190 PRINT
00200 PRINT "GIVEN P AND N, THE PROGRAM WILL SOLVE THIS PROBLEM FOR"
00210 PRINT "ALL VALUES OF X IN WHICH THE PROBABILITY IS SIGNIFICANTLY"
00220 PRINT "LARGE (UP TO ABOUT 7 STANDARD DEVIATIONS AWAY FROM P*N, THE"
00230 PRINT "EXPECTED NUMBER OF SUCCESSES)."
00240 PRINT
00250 PRINT "THE NUMBER M WHICH IS REQUESTED IS A MULTIPLIER OF THE"
00260 PRINT "BINOMIAL FUNCTION, SCALING IT TO A CONVENIENTLY GRAPHABLE"
00270 PRINT "RANGE. (DOES NOT AFFECT THE VALUES OF THE BINOMIAL"
00280 PRINT "FUNCTION, BUT IS MULTIPLIED AND PRINTED OUT IN A SEPARATE"
00290 PRINT "COLUMN. EACH VALUE OF B*M IS ROUNDED OFF TO THE NEAREST"
00300 PRINT "INTEGER.)"
00302 PRINT
00304 PRINT
00305 PRINT "TO TERMINATE PROGRAM TYPE STOP AT ANY REQUEST FOR"
00306 PRINT "INFORMATION"
00310 PRINT
00320 PRINT
00330 PRINT "WHAT ARE P,N,M";
00340 INPUT P,N,W
00342 PRINT
00344 PRINT
00350 PRINT "BINOMIAL DISTRIBUTION: N=";N;" P=";P
00352 PRINT
00360 PRINT " X", "X/N", "B(X,P,N)", "B*";W
00362 PRINT
00370 LET Q=1-P
00380 LET M=N*P
00390 LET S=SQR(N*P*Q)
00410 LET X1=M-7*S
00420 LET X2=M+7*S
00421 IF X1<=0 THEN 426
00423 IF P>.5 THEN 540
00426 LET B=Q^N
00430 LET X=0
00440 IF X1>0 THEN 460
00450 PRINT X,X/N,B,INT(B*W+.5)
00455 LET I2=N
00460 FOR I=1 TO I2
00470 LET B=B*(N-X)*P/((X+1)*Q)
00480 LET X=X+1
00490 IF (X-X1)*(X2-X)<0 THEN 510
00500 PRINT X,X/N,B,INT(B*W+.5)
00510 IF X>X2 THEN 310
00520 NEXT I
00530 GO TO 310
00540 LET X=N
00550 LET B=P^N
00560 LET B=B*X*Q/((N-X+1)*P)
00570 LET X=X-1
00580 IF X1<=X THEN 560
00590 LET I2=N-X
00600 GO TO 460
00999 END