Trailing-Edge
-
PDP-10 Archives
-
decuslib20-04
-
decus/20-0113/cmod55.bas
There are 2 other files named cmod55.bas in the archive. Click here to see a list.
00020REM*****************************************************************
00030REM CMOD55 CMOD55 POISSON CMOD55 CMOD55
00040REM*****************************************************************
00050FILES RFILE1,RFILE2,RFILE3,RF4,RF5,RF6,RF7,RF8,RF9
00060X=0
00070G1=0
00110RESTORE#1
00111 INPUT# 1,I1,I2,I3
00120SCRATCH#1
00121 PRINT # 1,55,I2,I3
00130PRINT L$
00140PRINT " EVALUATION OF POISSON DISTRIBUTION"
00150PRINT
00160PRINT "THIS MODULE WILL HELP YOU EXAMINE THE CHARACTERISTICS OF A"
00170PRINT "POISSON DISTRIBUTION."
00180PRINT
00190PRINT "INPUT THE PARAMETERS OF THE POISSON DISTRIBUTION YOU WANT TO"
00200PRINT "EXAMINE."
00210PRINT
00220PRINT "INPUT THE PROBABILITY OF SUCCESS, P";
00230GOSUB 9000
00240P=O1
00250IF P>0 THEN 280
00260PRINT "REENTER. P MUST BE BETWEEN 0 AND 1."
00270GOTO 230
00280IF P >= 1 THEN 260
00290PRINT
00300PRINT "INPUT THE SIZE PARAMETER N.";
00310GOSUB 9000
00320IF INT(O1) <= 0 THEN 340
00330IF INT(O1) <= 2000 THEN 360
00340PRINT "REENTER. N MUST BE BETWEEN 1 AND 2000."
00350GOTO 310
00360N=O1
00370PRINT L$
00380PRINT "TYPE THE NUMBER OF THE OPTION YOU WANT."
00390PRINT " 1. PROBABILITIES THAT THE NUMBER OF SUCCESSES WILL BE"
00400PRINT " LESS THAN X, EQUAL TO X, AND GREATER THAN X."
00410PRINT " 2. PROBABILITY THAT THE NUMBER OF SUCCESSES WILL BE"
00420PRINT " AT LEAST X1 BUT NOT MORE THAN X2."
00430PRINT " 3. EXIT MODULE."
00440GOSUB 9000
00450IF O1=3 THEN 500
00460IF O1=1 THEN 510
00470IF O1=2 THEN 810
00480PRINT "REENTER. INPUT MUST BE NUMBER OF AVAILABLE OPTION."
00490GOTO 440
00500CHAIN "RSTRT"
00510PRINT L$
00520PRINT " OPTION 1: PROBABILITIES THAT THE NUMBER OF SUCCESSES (S)"
00530PRINT " WILL BE LESS THAN X, EQUAL TO X, AND MORE THAN X."
00540PRINT
00550PRINT "TO EXIT ROUTINE TYPE '-1' WHEN ASKED TO INPUT X."
00560GOSUB 1240
00570REM
00580PRINT" X P(S<X) P(S=X) P(S>X)"
00590PRINT "INPUT X.";
00600GOSUB 9000
00610IF O1=-1 THEN 1130
00620IF O1 >= 0 THEN 670
00630PRINT "REENTER. X MUST BE"
00640PRINT "AT LEAST 0 BUT NOT"
00650PRINT "GREATER THAN N."
00660GOTO 600
00670IF O1>N THEN 630
00680X=O1
00690G1=0
00700I=X
00710K1=X-1
00720GOSUB 1320
00730P2=G2
00740G2=0
00750GOSUB 1380
00760G2=P2
00770G3=1-G2-G1
00780: ##### ##.## ##.## ##.##
00790PRINT USING 780,O1,G1,G2,G3
00800GOTO 590
00810PRINT L$
00820PRINT " OPTION 2: PROBABILITY THAT THE NUMBER OF SUCCESSES (S)"
00830PRINT " WILL BE AT LEAST X1 BUT NOT MORE THAN X2."
00840PRINT
00850PRINT "TO EXIT ROUTINE TYPE '-1' WHEN ASKED FOR INPUT."
00860GOSUB 1240
00870PRINT "INPUT X1 AND X2.";
00880GOSUB 9050
00890IF O1 <> -1 THEN 920
00900IF O2=-1 THEN 1130
00910GOTO 1010
00920X1=O1
00930X2=O2
00940IF X2>X1 THEN 970
00950PRINT "REENTER. INPUT THE SMALLER (X1) FIRST."
00960GOTO 880
00970IF X2 <= N THEN 1000
00980PRINT "REENTER. X'S MUST BE NO LARGER THAN N."
00990GOTO 880
01000IF X1 >= 0 THEN 1030
01010PRINT "REENTER. X'S MUST BE AT LEAST 0."
01020GOTO 880
01030X=X1
01040T7=0
01050FOR I=X1 TO X2
01060GOSUB 1330
01070T7=T7+G2
01080NEXT I
01100: PROB(#####<= X <=##### ) =##.##
01110PRINT USING 1100,X1,X2,T7
01120GOTO 870
01130PRINT L$
01140PRINT "TYPE THE NUMBER OF THE OPTION YOU WANT."
01150PRINT " 1. FURTHER EVALUATE THIS POISSON DISTRIBUTION."
01160PRINT " 2. EVALUATE ANOTHER POISSON DISTRIBUTION."
01170PRINT " 3. EXIT MODULE."
01180GOSUB 9000
01190IF O1=3 THEN 500
01200IF O1=1 THEN 370
01210IF O1=2 THEN 1220
01220PRINT L$
01230GOTO 190
01240PRINT "---------------------------------------------------------------"
01250PRINT " POISSON DISTRIBUTION"
01260:SIZE PARAMETER N =##### MEAN =#####.##
01270PRINT USING 1260,N,N*P
01280:PROCESS PARAMETER P=##.## STANDARD DEVIATION =#####.##
01290PRINT USING 1280,P,SQR(P*N)
01300PRINT "---------------------------------------------------------------"
01310RETURN
01320REM COM DENISTY
01330G9=I+1
01340GOSUB 5860
01350G2=I*LOG(N*P)-(N*P)-G0
01360G2=EXP(G2)
01370RETURN
01380FOR I=0 TO K1
01390GOSUB 1330
01400IF G2<0 THEN 1420
01410G1=G1+G2
01420NEXT I
01430RETURN
05850REM ****************************************************
05852REM LOG GAMMA ROUTINE
05853REM INPUT G9
05854REM OUTPUT G0
05860G5=G9
05863IF G9 <= 1.E+30 THEN 5872
05866G0=1.E+38
05869RETURN
05872IF G9>1.E-09 THEN 5881
05875G0=0
05878RETURN
05881IF G9<1.E+10 THEN 5890
05884G0=G9*(LOG(G9)-1)
05887RETURN
05890G6=1
05893IF 18<G5 THEN 5905
05896G6=G6*G5
05899G5=G5+1
05902GOTO 5893
05905R8=1/G5**2
05908G0=(G5-.5)*LOG(G5)-G5+.918939-LOG(G6)
05911C1=8.33333E-02
05914C2=2.77778E-03
05917C3=7.93651E-04
05920C4=5.95238E-04
05923G0=G0+1/G5*(C1-(R8*(C2+(R8*(C3-(R8*(C4)))))))
05926RETURN
05927REM END OF LOG GAMMA ROUTINE
05928REM ****************************************************
09000REM--SUBROUTINE THAT DETERMINES IF RESTART HAS BEEN REQUESTED.
09005INPUT O1
09015IF O1=-9999 THEN 9025
09020RETURN
09025CHAIN "RSTRT"
09035REM*************END ROUTINE
09050REM--SUBROUTINE THAT DETERMINES IF RESTART HAS BEEN REQUESTED. 2 INPUTS
09055INPUT O1,O2
09065IF O1=-9999 THEN 9080
09070IF O2=-9999 THEN 9080
09075RETURN
09080CHAIN "RSTRT"
09090REM*************END ROUTINE
09400 REM
09999END