Trailing-Edge
-
PDP-10 Archives
-
decuslib10-01
-
43,50110/binopo.prb
There are 2 other files named binopo.prb in the archive. Click here to see a list.
100' NAME--BINOPO
110'
120' DESCRIPTION--COMPARES THE EXACT BINOMIAL PROBABILITIES WITH THE
130' APPROXIMATE VALUES GIVEN BY THE NORMAL AND POISSON DISTRIBUTIONS.
140'
150' SOURCE--UNKNOWN
160'
170' INSTRUCTIONS--USER SUPPLIES N,P AS DATA IN 900
180'
190'
200' * * * * * * * * MAIN PROGRAM * * * * * * * *
210'
220 READ N,P
230 PRINT "N="N,"P="P
240 LET Y=0
250 PRINT
260 PRINT "J","EXACT","NORMAL","POISSON"
270 PRINT
280 LET M=N*P
290 LET S=SQR(M*(1-P))
300 LET R=(1-P)^N
310 LET V=EXP(-M)
320 FOR J=0 TO N
330 IF J=0 THEN 350
340 LET R =R*P*(N-J+1)/J/(1-P)
350 LET T=INT(R*1E4+.5)/1E4
360 LET H=(J-.5-M)/S
370 LET K=(J+.5-M)/S
380 LET C=1/SQR(2)
390 LET A1=.14112821
400 LET A2=.08864027
410 LET A3=.02743349
420 LET A4=-.00039446
430 LET A5=.00328975
440 DEF FNO(X)=1-1/(1+A1*X+A2*X^2+A3*X^3+A4*X^4+A5*X^5)^8
450 IF H<0 THEN 480
460 LET F=.5+.5*FNO(H*C)
470 GO TO 490
480 LET F=.5-.5*FNO(-H*C)
490 IF K<0 THEN 520
500 LET G=.5+.5*FNO(K*C)
510 GO TO 530
520 LET G=.5-.5*FNO(-K*C)
530 LET L=1E-4*INT(1E4*(G-F)+.5)
540 IF J=0 THEN 560
550 LET V=V*M/J
560 LET Q=1E-4*INT(1E4*V+.5)
570 IF T>0 THEN 630
580 IF L>0 THEN 630
590 IF Q>0 THEN 630
600 IF Y=0 THEN 680
610 PRINT J,T,L,Q
620 GO TO 999
630 IF J=0 THEN 660
640 IF Y=1 THEN 670
650 PRINT J-1,.0000,.0000,.0000
660 LET Y=1
670 PRINT J,T,L,Q
680 NEXT J
900 DATA 1000,.001
999 END