Google
 

Trailing-Edge - PDP-10 Archives - decus_20tap4_198111 - decus/20-0113/cmods.bas
There are 2 other files named cmods.bas in the archive. Click here to see a list.
00020REM *************************************************************
00030REM    CMODS     CMODS      CMODS     CMODS     CMODS    CMODS
00040REM****************************************************************
00050REM
00060REM        EXPECTED UTILITY USING NORMAL OGIVE UTILITY FUNCTION
00070REM
00080REM*****************************************************************
00090FILES RFILE1,RFILE2,RFILE3
00130RESTORE#1
00131  INPUT#  1,I1,I2,I3
00140SCRATCH #1
00141  PRINT #  1,28,I2,I3
00150RESTORE#3
00151  INPUT#  3,M1,S1
00160X=0
00170PRINT L$
00190PRINT "     EXPECTED UTILITY - NORMAL UTILITY FUNCTION"
00200PRINT
00210PRINT "THIS MODULE COMPUTES THE EXPECTED UTILITY WHEN THE UTILITY"
00220PRINT "FUNCTION IS A NORMAL OGIVE FUNCTION AND THE EXPECTATION IS "
00230PRINT "WITH RESPECT TO ANOTHER NORMAL DISTRIBUTION."
00240PRINT
00250IF S1 <> 0 THEN 390
00260PRINT
00270PRINT "INPUT THE MEAN OF THE NORMAL OGIVE UTILITY FUNCTION.";
00280GOSUB 9000
00290M1=O1
00300PRINT
00310PRINT "INPUT THE STANDARD DEVIATION.";
00320GOSUB 9000
00330IF O1>0 THEN 360
00340PRINT "REENTER.  STANDARD DEVIATION MUST BE POSITIVE."
00350GOTO 320
00360S1=O1
00370PRINT
00380GOTO 430
00390PRINT "NORMAL OGIVE UTILITY"
00400PRINT
00410PRINT "MEAN =";M1;"  STANDARD DEVIATION =";S1
00420PRINT
00430PRINT "INPUT THE MEAN OF THE DISTRIBUTION WITH RESPECT TO WHICH"
00440PRINT "YOU WANT TO TAKE THE EXPECTATION.";
00450GOSUB 9000
00460M2=O1
00470PRINT
00480PRINT "INPUT THE STANDARD DEVIATION OF THE DISTRIBUTION.";
00490GOSUB 9000
00500IF O1>0 THEN 530
00510PRINT "REENTER.  STANDARD DEVIATION MUST BE POSITIVE."
00520GOTO 490
00530S2=O1
00540Y3=(M2-M1)/(SQR(S1*S1+S2*S2))
00550GOSUB 8000
00560PRINT L$
00570PRINT "UTILITY FUNCTION      MEAN =";M1;"  ST DEV =";S1
00580PRINT
00590PRINT "DISTRIBUTION          MEAN =";M2;"  ST DEV =";S2
00600PRINT
00610:EXPECTED UTILITY =##.##
00620PRINT  USING 610,P
00630PRINT
00640PRINT
00650PRINT
00660PRINT "TYPE THE NUMBER OF THE OPTION YOU WANT."
00670PRINT "   1. TAKE EXPECTATION WITH RESPECT TO ANOTHER DISTRIBUTION."
00680PRINT "   2. CHANGE THE UTILITY FUNCTION."
00690PRINT "   3. EXIT MODULE"
00700GOSUB 9000
00710IF O1=2 THEN 850
00720IF O1=1 THEN 870
00730IF O1=3 THEN 760
00740PRINT "REENTER.  INPUT MUST BE 1, 2, OR 3."
00750GOTO 700
00760PRINT L$
00770IF I2=1 THEN 790
00780CHAIN "RSTRT"
00790PRINT "IF YOU WANT TO FIND THE EXPECTED UTILITY USING THE LEAST"
00800PRINT "SQUARES FIT TYPE '1' ELSE '0'.";
00810GOSUB 9000
00820IF O1=0 THEN 780
00830SCRATCH#3
00831  PRINT #  3,0
00840CHAIN "CMODP"
00850PRINT L$
00860GOTO 260
00870PRINT L$
00880GOTO 390
08000REM **********************************************************
08001REM      ROUTINE CALCULATES THE CDF FOR NORMAL DISTRIBUTION
08002REM               INPUT       Y3
08003REM               OUTPUT      P
08004REM
08005Y4=ABS(Y3)
08010X1=X
08015X=Y3
08020T=1/(1+.231642*Y4)
08021IF X*X/2<80 THEN 8025
08022D=0
08023GOTO 8030
08025D=.398942*EXP(-X*X/2)
08030C1=1.33027
08035C2=1.82126
08040C3=1.78148
08045C4=.356564
08050C5=.319382
08055P=1-D*T*((((C1*T-C2)*T+C3)*T-C4)*T+C5)
08060IF X >= 0 THEN 8070
08065P=1-P
08070X=X1
08075RETURN
08076REM
08077REM        END OF NORMAL CDF ROUTINE
08078REM **********************************************************
09000REM--SUBROUTINE THAT DETERMINES IF RESTART HAS BEEN REQUESTED.
09005INPUT O1
09015IF O1=-9999 THEN 9025
09020RETURN
09025CHAIN "RSTRT"
09035REM*************END ROUTINE
09999END