Trailing-Edge
-
PDP-10 Archives
-
decuslib20-01
-
decus/20-0020/binorm.prb
There are 2 other files named binorm.prb in the archive. Click here to see a list.
100' NAME--BINORM
110'
120' DESCRIPTION--COMPUTES PR(A<=X<=B), WHERE X IS THE NUMBER OF
130' SUCCESSES IN N TRIALS WITH PROBABILITY P OF SUCCESS IN EACH
140' TRIAL, USING THE NORMAL APPROXIMATION.
150'
160' SOURCE--UNKNOWN
170'
180' INSTRUCTIONS--USER SUPPLIES AS DATA IN 900
190' AND FOLLOWING:N,P,A,B
200'
210'
220' * * * * * * * MAIN PROGRAM * * * * * * * * * * *
230'
240 READ N,P,H,K
250 LET M=N*P
260 LET S=SQR(M*(1-P))
270 PRINT "N="N,"P="P,
280 LET A=(H-.5-M)/S
290 LET B=(K+.5-M)/S
300 LET C=1/SQR(2)
310 LET A1=.14112821
320 LET A2=.08864027
330 LET A3=.02743349
340 LET A4=-.00039446
350 LET A5=.00328975
360 DEF FNO(X)=1-1/(1+A1*X+A2*X^2+A3*X^3+A4*X^4+A5*X^5)^8
370 IF A<0 THEN 400
380 LET F=.5+.5*FNO(A*C)
390 GO TO 410
400 LET F=.5-.5*FNO(-A*C)
410 IF B<0 THEN 440
420 LET G=.5+.5*FNO(B*C)
430 GO TO 450
440 LET G=.5-.5*FNO(-B*C)
450 LET L=1E-4*INT(1E4*(G-F)+.5)
460 PRINT "PR( "H"<= X <= "K")="L
470 GO TO 240
900 DATA 1000,.5,0,520
999 END