



		    4sqrs.basic                     03/17/75  1551.7r w 03/17/75  1546.0        5022



10 PRINT "4SQRS"
20 PRINT "N = A^2 + B^2 + C^2 + D^2"
30 PRINT
40 PRINT "N    A     B     C     D"
50 PRINT"------------------------"
60 PRINT
70 INPUT M
80 LET N=ABS(M)
90 LET R=SQR(N)
100 FOR A = 0 TO R
110 LET A2=A*A
120 LET N1=N-A2
130 FOR B = 0 TO N1
140 LET B2=B*B
150 LET N2=N1-B2
160 FOR C = 0 TO N2
170 LET C2 = C*C
180 IF A2+B2+C2 > N THEN 270
190 LET D = SQR(N-A2-B2-C2)
200 IF D > INT(D) THEN 260
210 IF M>=0 THEN 240
220 PRINT " ";-A;-B;-C;-D
230 GO TO 60
240 PRINT " ";A;B;C;D
250 GO TO 60
260 NEXT C
270 NEXT B
280 NEXT A
290 GO TO 60
300 END




		    annuit.basic                    03/17/75  1551.7r w 03/17/75  1546.0       48519



3 PRINT "ANNUIT"
5 REM REVISED NOV 07. 1969
30 PRINT "WANT INSTRUCTIONS FIRST (1=YES, 2=NO)";
40 INPUT L
50 IF L<>1 THEN 70
60 GOSUB 600
70 LET S=0
80 PRINT
90 PRINT "WHICH ANNUITY TYPE (1=PAYMENT, 2=WITHDRAWAL)";
100 DEF FNA(U)=.01*INT(100*U+.5)
110 INPUT A
120 GOTO 170
130 IF A=1 THEN 160
140 LET  A=1
150 GOTO 170
160 LET  A=2
170 IF  A=1 THEN 220
180 IF A=2 THEN 1050
190 PRINT
200 PRINT "   ANSWER 1 OR 2 PLEASE."
210 GOTO 80
220 IF S=1 THEN 260
230 PRINT
240 PRINT "WHICH VARIABLE IS UNKNOWN (1=N,2=A,3=I,4=R)";
250 INPUT D
260 IF D=1 THEN 330
270 IF D=2 THEN 410
280 IF D=3 THEN 490
290 IF D=4 THEN 520
300 PRINT
310 PRINT "   ANSWER 1,2,3,OR 4 PLEASE."
320 GOTO 230
330 PRINT
340 PRINT "WHAT ARE A($),I(PCT),R($)";
350 INPUT A1,I1,R1
360 LET I1=I1/100
370 LET N1=LOG((A1*I1/R1)+1)/LOG(1+I1)
380 PRINT
390 PRINT "NUMBER OF PERIODS = N =";N1
400 GOTO 920
410 PRINT
420 PRINT "WHAT ARE N(INTEGER),I(PCT),R($)";
430 INPUT N1,I1,R1
440 LET I1=I1/100
450 LET A1=R1*((1+I1)^N1-1)/I1
460 PRINT
470 PRINT "AMOUNT AT END OF N PERIODS = A =";A1
480 GOTO 920
490 PRINT
500 PRINT "WHAT ARE N(INTEGER),A($),R($)";
510 GOTO 1760
520 PRINT
530 PRINT "WHAT ARE N(INTEGER),A($),I(PCT)";
540 INPUT N1,A1,I1
550 LET I1=I1/100
560 LET R1=A1*I1/((1+I1)^N1-1)
570 PRINT
580 PRINT "PAYMENT EACH PERIOD = R =";R1
590 GOTO 920
600 PRINT
610 PRINT "THIS PROGRAM PERFORMS CALCULATIONS FOR"
620 PRINT "BOTH PAYMENT AND WITHDRAWAL ANNUITIES."
630 PRINT
640 PRINT "VARIABLES ARE DENOTED AS FOLLOWS:"
650 PRINT
660 PRINT "   N = NUMBER OF PERIODS"
670 PRINT "   P = ORIGINAL PRINCIPAL AMOUNT"
680 PRINT "   A = TOTAL AMOUNT AT END OF N PERIODS"
690 PRINT "   I = INTEREST RATE PER PERIOD, IN PERCENT"
700 PRINT "   R = AMOUNT OF PAYMENT/WITHDRAWAL EACH PERIOD"
710 PRINT
720 PRINT "FOR A PAYMENT ANNUITY, YOU MAY GIVE ANY"
730 PRINT "  THREE OF N,A,I,R AND FIND THE FOURTH."
740 PRINT
750 PRINT "FOR A WITHDRAWAL ANNUITY, YOU GIVE ANY"
760 PRINT "  THREE OF N,P,I,R AND FIND THE FOURTH."
770 PRINT
780 PRINT "NOTE: FOR LOAN OR MORTGAGE, USE THE"
790 PRINT "      WITHDRAWAL ANNUITY OPTION."
800 PRINT
810 PRINT "AFTER EACH CASE, YOU MAY CHOOSE ONE"
820 PRINT "OF THE FOLLOWING ALTERNATIVES:"
830 PRINT
840 PRINT "   1 = ANOTHER CASE, SAME UNKNOWN VARIABLE"
850 PRINT "   2 = ANOTHER CASE, DIFFERENT UNKNOWN"
860 PRINT "   3 = ANOTHER CASE, OTHER TYPE OF ANNUITY"
870 PRINT "   4 = TOTAL INTEREST PAID OVER N PERIODS"
880 PRINT "   5 = TABLE OF WITHDRAWALS, PRINCIPAL, AND INTEREST"
890 PRINT "   6 = STOP THE PROGRAM"
900 PRINT
910 RETURN
920 PRINT
930 PRINT "ANOTHER CASE (TYPE CODE NUMBER)";
940 INPUT S
950 IF S=1 THEN 170
960 IF S=2 THEN 170
970 IF S=6 THEN 9999
980 IF S=3 THEN 130
990 IF A<>1 THEN 1030
1000 PRINT
1010 PRINT "ALTERNATIVE NOT APPLICABLE TO PAYMENT ANNUITIES."
1020 GOTO 920
1030 IF S=4 THEN 1240
1040 IF S=5 THEN 1240
1050 IF S=1 THEN 1090
1060 PRINT
1070 PRINT "WHICH VARIABLE IS UNKNOWN (1=N,2=P,3=I,4=R)";
1080 INPUT A1
1090 IF A1=1 THEN 1160
1100 IF A1=2 THEN 1660
1110 IF A1=3 THEN 1740
1120 IF A1=4 THEN 2090
1130 PRINT
1140 PRINT "   ANSWER 1,2,3, OR 4 PLEASE."
1150 GOTO 1080
1160 PRINT
1170 PRINT "WHAT ARE P($),I(PCT),R($)";
1180 INPUT P1,I1,R1
1190 LET I1=I1/100
1200 LET N1=LOG(R1/(R1-P1*I1))/LOG(1+I1)
1210 PRINT
1220 PRINT "NUMBER OF PERIODS = N =";N1
1230 GOTO 920
1240 LET N1=N1+.00001
1250 LET P2=INT(N1)-N1
1260 IF ABS(P2)>.00001 THEN 1290
1270 LET N1=N1-1
1280 GOTO 1300
1290 LET N1=INT(N1)
1300 LET P2=1
1310 IF S=4 THEN 1380
1320 IF S=5 THEN 1330
1330 LET P2=0
1340 PRINT 
1350 PRINT "PERIOD","PRINCIPAL","INTEREST","PRINC BAL","INT TO DATE"
1360 PRINT
1370 PRINT " 0"," "," ",P1
1380 LET X=0
1390 LET X9=P1
1400 LET Y=0
1410 FOR S=1 TO N1
1420 LET A3=(R1-P1*I1)*(1+I1)^(S-1)
1430 LET A2=FNA(A3)
1440 LET C=R1-A3
1450 LET B=FNA(C)
1460 LET X=X+A3
1470 LET X9=X9-A3
1480 LET Y=FNA(Y+C)
1490 IF P2 <>0 THEN 1510
1500 PRINT S,A2,B,X9,Y
1510 NEXT S
1520 LET S=N1+1
1530 LET A3=P1-X
1540 LET A2=FNA(A3)
1550 LET B1=I1*A3
1560 LET B=FNA(B1)
1570 LET X=X+A3
1580 LET X9=0
1590 LET Y=Y+B1
1600 IF P2=0 THEN 1640
1610 PRINT
1620 PRINT "TOTAL INTEREST PAID =";Y
1630 GOTO 920
1640 PRINT S,A2,B,X9,Y
1650 GOTO 920
1660 PRINT
1670 PRINT "WHAT ARE N(INTEGER),I(PCT),R($)";
1680 INPUT N1,I1,R1
1690 LET I1=I1/100
1700 LET P1=R1*((1+I1)^N1-1)/(I1*(1+I1)^N1)
1710 PRINT
1720 PRINT "ORIGINAL PRINCIPAL AMOUNT IS";P1
1730 GOTO 920
1740 PRINT
1750 PRINT "WHAT ARE N(INTEGER),P($),R($)";
1760 INPUT N1,P1,R1
1770 PRINT
1780 IF N1*R1<=P1 THEN 2170
1790 LET I1=.1
1800 LET I2=0
1810 LET I3=1
1820 IF A<>1 THEN 1850
1830 LET P3=R1*((1+I1)^N1-1)/I1
1840 GOTO 1860
1850 LET P3=R1*((1+I1)^N1-1)/(I1*(1+I1)^N1)
1860 LET P4=ABS(P1-P3)
1870 IF P4>0.001 THEN 1900
1880 PRINT "INTEREST PER PERIOD (PCT) = I =";100*I1
1890 GOTO 920
1900 IF P4/P1>.3 THEN 2010
1910 IF A=1 THEN 1940
1920 IF P3<P1 THEN 1980
1930 GOTO 1950
1940 IF P3>P1 THEN 1980
1950 LET I2=I1
1960 LET I1=(I1+I3)/2
1970 GOTO 1820
1980 LET I3=I1
1990 LET I1=(I1+I2)/2
2000 GOTO 1820
2010 IF A=1 THEN 2040
2020 IF P3<P1 THEN 2060
2030 GOTO 1950
2040 IF P3>P1 THEN 2060
2050 GOTO 1950
2060 LET I3=I1
2070 LET I1=(I1+I2)/4
2080 GOTO 1820
2090 PRINT
2100 PRINT "WHAT ARE N(INTEGER),P($),I(PCT)";
2110 INPUT N1,P1,I1
2120 LET I1=I1/100
2130 LET R1=P1*I1*(1+I1)^N1/((1+I1)^N1-1)
2140 PRINT
2150 PRINT "WITHDRAWAL EACH PERIOD = R =";R1
2160 GOTO 920
2170 PRINT"THE PRINCIPAL [P] IS NOT RECOVERED; [I] MUST BE POSITIVE."
2180 GO TO 1740
9999 END




		    bayes.basic                     03/17/75  1551.7r w 03/17/75  1546.0       33084



10 REM BAYES
12REM WRITTEN BY R.C.HEWITT, JAN 7,1969
17 DIM Y(200)
100 GO TO 675
101 GO TO 440
199 GO TO 300
200 DATA .50,.75,.90,.95,.999,.9999,.99999
299 DATA 10
300 READ N1
305 LET Y1=0
310 LET N3=N1-1
315 FOR I=1 TO N1
320 READ Y(I)
325 LET Y1=Y1+Y(I)
330 NEXT I
335 LET Y3=Y1/N1
340 LET Y1=0
345 FOR I=1 TO N1
350 LET Y1=Y1+(Y(I)-Y3)*(Y(I)-Y3)
355 NEXT I
360 LET S1=Y1/N1
365 READ N2
370 LET Y1=0
375 LET N4=N2-1
380 FOR I=1 TO N2
385 READ Y(I)
390 LET Y1=Y1+Y(I)
395 NEXT I
400 LET Y4=Y1/N2
405 LET Y1=0
410 FOR I=1 TO N2
415 LET Y1=Y1+(Y(I)-Y4)*(Y(I)-Y4)
420 NEXT I
425 LET S2=Y1/N2
430 LET Y5=Y3-Y4
435 GO TO 470
440 READ Y,N1,Y3,S1,Z,N2,Y4,S2
445 LET N3=N1-1
450 LET N4=N2-1
455 LET Y5=Y3-Y4
460 LET S1=S1*S1
465 LET S2=S2*S2
470 PRINT TAB(8);"STATISTIC";TAB(30);"SAMPLE 1";TAB(45);"SAMPLE 2"
475 PRINT
480 PRINT "SAMPLE MEAN";TAB(30);Y3,Y4
485 PRINT "SAMPLE STD DEVIATION";TAB(30);SQR(S1),SQR(S2)
490 PRINT "SAMPLE SIZE";TAB(30);N1,N2
495 PRINT "SAMPLE VARIANCE";TAB(30);S1,S2
500 PRINT
505 PRINT "DIFF OF MEANS";TAB(37);Y5
510 PRINT
515 PRINT
520 PRINT "HIGHEST POSTERIOR DENSITY INTERVALS"
521 PRINT "DIFFERENCE BETWEEN MEANS:"
525 PRINT
530 PRINT" HPD LEVEL","LOWER LIM","UPPER LIM"
535 PRINT
540 READ P
545 IF P=10 THEN 885
550 LET P=(1-P)/2
555 LET T=SQR(LOG(1/P^2))
560 LET X=2.515517+0.802853*T+0.010328*T*T
565 LET X=T-X/(1+1.432788*T+0.189269*T*T+0.001308*T*T*T)
570 LET G1=X*(1+X*X)/4
575 LET G2=X*(1+16*X*X/3*(1+5*X*X/16))/32
580 LET G3=-5*X*(1-17*X*X/15*(1+19*X*X/17*(1+3*X*X/19)))/128
585 LET G4=1-1482*X*X/1920*(1+776*X*X/1482*(+79*X*X/776))
590 LET G4=-945*X*(1+1920*X*X/245*G4)/92160
595 LET S4=S2/N2
600 LET S3=S1/N1
605 LET C1=S4/(S3+S4)
610 LET C2=S3/(S3+S4)
615 LET N6=N4/(N4-2)
620 LET N5=N3/(N3-2)
625 LET F=(N6*C1+N5*C2)*(N6*C1+N5*C2)
630 LET F=F/((N6*N6*C1*C1)/(N4-4)+(N5*N5*C2*C2)/(N3-4))
635 LET B=F+4
640 LET A=(B-2)*(N6*C1+N5*C2)/B
645 LET T5=X+G1/B+G2/B^2+G3/B^3+G4/B^4
650 LET T6=SQR(A*(S3+S4))*T5
655 LET Y6=Y5-T6
660 LET Y9=Y5+T6
665 PRINT (1-2*P)*100,Y8,Y9
670 GO TO 540
675 PRINT " THIS PROGRAM COMPUTES THE HIGHEST POSTERIOR DENSITY "
680 PRINT "INTERVALS FOR THE DIFFERENCE BETWEEN TWO POPULATION MEANS"
685 PRINT "USING BAYESIAN STATISTICAL INFERENCE.  THE DATA MAY BE"
690 PRINT "ENTERED IN EITHER OF TWO WAYS:"
695 PRINT
700 PRINT "     A. TYPE THE DATA ON ONE LINE AS:"
705 PRINT
710 PRINT "      100 DATA H1,N1,M1,S1,H2,N2,M2,S2"
715 PRINT "      RUN"
720 PRINT
725 PRINT "     WHERE,"
730 PRINT "       H1=DUMMY TO AGREE WITH CONDIF*** INPUT"
735 PRINT "          (ENTER '0' AS AN APPROPRIATE NUMBER)"
740 PRINT "       N1=SIZE OF SAMPLE 1"
745 PRINT "       M1=ARITHMETIC MEAN OF SAMPLE 1"
750 PRINT "       S1=STANDARD DEVIATION OF SAMPLE 1(BASED ON"
755 PRINT "          DIVISOR OF N1)"
760 PRINT
765 PRINT "      H2,N2,M2,S2, ARE THE SAME FOR SAMPLE 2"
770 PRINT
775 PRINT "     B. TYPE THE DATA ON MORE THAN ONE LINE AS:"
780 PRINT
785 PRINT "      100 DATA N1,Y(1),Y(2),Y(3),Y(4)"
790 PRINT "      101 DATA Y(5),   . . .    ,Y(N1)"
795 PRINT "      102 DATA N2,Z(1),Z(2),Z(3),Z(4)"
800 PRINT "      103 DATA Z(5),   . . .    ,Z(N2)"
805 PRINT "      RUN"
810 PRINT
815 PRINT "     WHERE,"
820 PRINT "       N1=THE SIZE OF SAMPLE 1"
825 PRINT "       N2=THE SIZE OF SAMPLE 2"
830 PRINT "       Y(I),I=1 TO N1  ARE THE ELEMENTS OF SAMPLE 1"
835 PRINT "       Z(I),I=1 TO N2  ARE THE ELEMENTS OF SAMPLE 2"
840 PRINT
845 PRINT
850 PRINT " IF DIFFERENT HIGHEST POSTERIOR DENSITY INTERVALS ARE"
855 PRINT "DESIRED, THEN THEY MAY BE ENTERED AS:"
860 PRINT
865 PRINT "       200 DATA L1,L2,L3,L4,L5,..."
870 PRINT
875 PRINT "       WHERE ALL L=L1,L2,L3,... ARE SUCH THAT"
880 PRINT "            0.5< L < 1.0"
885 STOP
890 END




		    biconf.basic                    03/17/75  1551.7r w 03/17/75  1546.3       15534



3REM B I C O N F
10 PRINT "DO YOU WANT INSTRUCTIONS (1=YES, 0=NO)";
20 INPUT Y7
30 IF Y7=1 THEN 700
70 DEF FNA(V)=1E-4*INT(.5+1E6*V)
75 PRINT "WHAT ARE X,N,C";
80 INPUT Y,N,C
90 LET P0=Y/N
100 LET Q0=1-P0
110 LET G0=6*SQR(P0*Q0/N)
120 LET P1=P0-G0
130 IF P1>0 THEN 150
140 LET P1=0
150 LET P1=.1*INT(10*P1)
160 LET P2=P0+G0
170 IF P2<1 THEN 190
180 LET P2=1
190 LET P2=1-.1*INT(10-10*P2)
200 LET C0=.005*(100-C)
210 LET P=P1
220 LET T=Y-1
230 LET J=0
240 LET J=J-1
250 IF J=-7 THEN 310
260 LET P=P+10^J
270 GOSUB 520
280 IF 1-Z<C0 THEN 260
290 LET P=P-10^J
300 GOTO 240
310 LET L=P
320 LET P=P2
330 LET T=Y
340 LET J=0
350 LET J=J-1
360 IF J=-7 THEN 420
370 LET P=P-10^J
380 GOSUB 520
390 IF Z<C0 THEN 370
400 LET P=P+10^J
410 GOTO 350
420 LET U=P
430 PRINT
440 PRINT
450 PRINT "   BEST ESTIMATE OF POPULATION PROPORTION (PCT) = ";
460 PRINT FNA(Y/N)
470 PRINT
480 PRINT "   THE ";C;"PERCENT CONFIDENCE LIMITS ON THE POPULATION"
490 PRINT "   PROPORTION (PCT) ARE ";FNA(L);"AND ";FNA(U)
500 PRINT
510 STOP
520 LET Q=1-P
530 LET G=6*SQR(P*Q*N)
540 LET S=INT(N*P-G)
550 IF S>0 THEN 590
560 LET S=0
570 LET X=1
580 GOTO 630
590 LET X=P*N/S
600 FOR I=1 TO S-1
605 IF S=1 THEN 620
610 LET X=X*P*(N-I)/(S-I)
620 NEXT I
630 LET F=X*(Q^(N-S))
640 LET Z=F
650 FOR I=S+1 TO T
660 LET F=F*P*(N-I+1)/(Q*I)
670 LET Z=Z+F
680 NEXT I
690 RETURN
700 PRINT "THIS PROGRAM DETERMINES THE CONFIDENCE LIMITS"
710 PRINT "FOR A POPULATION PROPORTION BASED ON THE"
720 PRINT "EXACT BINOMIAL DISTRIBUTION.  ENTER VALUES"
730 PRINT "FOR X[SUCCESSES], N[SAMPLE SIZE], AND"
740 PRINT "C[CONFIDENCE COEFFICIENT IN PERCENT] WHEN"
750 PRINT "REQUESTED BY THE PROGRAM.  ADDITIONAL"
760 PRINT "INSTRUCTIONS MAY BE FOUND IN THE LISTING."
770 GO TO 70
9999 END




		    blkjak.basic                    03/17/75  1551.7r w 03/17/75  1546.3       60138



2 PRINT
3 PRINT"               BLKJAK"
4 PRINT
20 DIM W(10),E(10),T(10),V(10)
24 PRINT"This demonstration shows the versatility of the Multics"
26 PRINT"BASIC languague by simulating a game of Blackjack."
27 PRINT" "
28 PRINT"DO YOU NEED INSTRUCTIONS (1=YES, 0=NO)"
29 INPUT k
30 IF K=0 THEN 112
32 PRINT"HERE ARE THE LAS VEGAS RULES FOR PLAYING BLACKJACK:"
34 PRINT
36 PRINT">WAGER: THE HOUSE LIMIT IS $500, SO TYPE IN A NUMBER "
38 PRINT"  FROM 0 TO 500. TO TERMINATE GAME, ENTER ZERO."
40 PRINT
42 PRINT">THE DEAL: I DEAL MYSELF 2 CARDS AND SHOW YOU ONE. THEN I"
44 PRINT"  DEAL YOU TWO CARDS, AND ASK IF YOU WANT A HIT (ANOTHER"
46 PRINT"  CARD). YOU HAVE SEVERAL OPTIONS DEPENDING ON THE CARDS"
48 PRINT"  YOU HOLD AND MY UP CARD:"
50 PRINT"    * STAND - BY TYPING A ZERO"
52 PRINT"    * TAKE A HIT - BY TYPING A ONE"
54 PRINT"    * GO DOWN FOR DOUBLES - BY TYPING A TWO"
56 PRINT"    * SPLIT A PAIR - BY TYPING A THREE"
58 PRINT
60 PRINT">INSURANCE: IF MY UP CARD IS AN ACE, I WILL ASK IF YOU"
62 PRINT"  WANT INSURANCE. IF YOU DO TYPE A ONE, BETTING ONE-HALF"
64 PRINT"  OF YOUR WAGER THAT I DO HAVE BLACKJACK. IF I DO, I PAY"
66 PRINT" 2-TO-1 ON YOUR INSURANCE BET. YOU LOSE YOUR ORIGINAL WAGER"
68 PRINT"  SINCE I HAVE BLACKJACK, SO WE ARE EVEN FOR THE HAND."
70 PRINT"  IF I DON'T HAVE BLACKJACK, YOU LOSE YOUR INSURANCE BET"
72 PRINT"  AND THE GAME CONTINUES. "
74 PRINT
76 PRINT"  IF YOU REFUSE INSURANCE (BY TYPING A ZERO) THE GAME"
78 PRINT"  CONTINUES AS NORMAL."
80 PRINT
82 PRINT">THE PLAY: WHEN YOU FINALLY STAND (BY TYPING A ZERO)"
84 PRINT"  I WILL DRAW CARDS UNTIL:"
86 PRINT"    *I HAVE AT LEAST A HARD 17 (HARD MEANS THE TOTAL"
88 PRINT"     DOES NOT INCLUDE AN ACE BEING COUNTED AS 11)"
90 PRINT"    *I HAVE A SOFT 18 (SOFT MEANS THE TOTAL INCLUDES AN"
92 PRINT"     ACE COUNTED AS 11)"
94 PRINT"    *I REACH A TOTAL OF 21"
96 PRINT"    *I EXCEED 21 AND BUST"
98 PRINT
100 PRINT">ITEMS:"
102 PRINT"    *I PAY 1.5-TO-1 ON BLACKJACK"
104 PRINT"    *I DON'T RECOGNIZE 5-CARDS-AND-UNDER"
106 PRINT"    *YOU MAY DOUBLE DOWN ON A SPLIT HAND"
108 PRINT"    *YOU DON'T LOSE ON A TIE HAND...WE PUSH"
110 PRINT"           <<<GOOD LUCK>>>"
112 PRINT"MULTICS IS THE DEALER AND GETS A BREAK AT 1945 HOURS. WHAT"
113 randomize
114 PRINT"TIME IS IT NOW";
116 LET K=0
118 LET W1=0
120 INPUT N
122 FOR I = 1TO N/2
124  let x=t(10*rnd)
126 NEXT I
128 DIM D(52)
130 FOR A=1 TO 52
132 LET D(A) = 0
134 NEXT A
136 DIM Q(52)
138 FOR A=0 TO 39 STEP 13
140 FOR C=1 TO 13
142 LET Q(A+C)=C
144 NEXT C
146 NEXT A
148 PRINT 
150 LET K=K+1
152 FOR P=1 TO 5
154 LET E(P)=0
156 LET V(P) = 0
158 LET T(P)=0
160 NEXT P
162 LET V(3)=1
164 PRINT 
166 PRINT "WAGER";
168 LET P=1
170 INPUT W
172 LET W(2)=W
174 IF W<=0 THEN 582
176 IF W<=500 THEN 182
178 PRINT "THAT'S TOO MUCH - HOUSE LIMIT IS $500."
180 GOTO 166
182 PRINT
184 PRINT "I SHOW           ",
186 GOSUB 366
188 IF E(1)=0 THEN 192
190 LET V(4)=1
192 LET V(5)=1
194 GOSUB 366
196 LET M=X
198 LET P=2
200 PRINT "FIRST CARD IS",
202 GOSUB 366
204 LET G=X
206 PRINT "NEXT  CARD IS",
208 GOSUB 366
210 IF V(2)>0 THEN 262
212 LET S=X
214 IF V(3)<>1 THEN 262
216 IF T(P)<>21 THEN 230
218 PRINT "***BLACKJACK***"
220 PRINT "MY HOLE CARD WAS ",
222 LET X=M
224 GOSUB 434
226 LET W1=W1+1.5*W
228 GOTO 538
230 IF V(4)=0 THEN 250
232 PRINT "INSURANCE ANYONE  (TYPE 1 OR 0)";
234 INPUT I
236 IF I=0 THEN 250
238 IF T(1)<>21 THEN 246
240 LET W1=W1+W
242 PRINT "YOU WIN $";W;" ON YOUR INSURANCE BET";
244 GOTO 250
246 LET W1=W1-W/2
248PRINT"YOU LOST $";W/2;" ON INSURANCE BET - I DONT HAVE BLKJAK"
250 IF T(1)<>21 THEN 262
252 PRINT "**I HAVE BLACKJACK**"
254 PRINT "MY HOLE CARD IS ",
256 LET X=M
258 GOSUB 434
260 GOTO 534
262 IF T(P)<=21 THEN 278
264 IF E(P)>0 THEN 274
266 PRINT "YOU BUSTED, ";
268 PRINT "YOUR TOTAL IS ";T(P)
270 IF V(2)=1 THEN 328
272 GOTO 494
274 LET E(P)=E(P)-1
276 LET T(P)=T(P)-10
278 IF V(1)=2 THEN 268
280 LET V(3)=V(3)+1
282 PRINT "HIT";
284 INPUT V(1)
286 IF V(1)<>3 THEN 350
288 IF V(2)>0 THEN 346
290 IF V(3)<>2 THEN 346
292 IF Q(G)=Q(S) THEN 298
294 PRINT "NOW IS THAT A PAIR "
296 GOTO 282
298 LET V(2)=1
300 IF Q(G)<>1 THEN 304
302 LET V(1)=2
304 LET P=3
306 PRINT "       PLAY HAND ONE NOW"
308 PRINT "FIRST CARD IS",
310 LET W(3)=W
312 LET X=G
314 GOSUB 318
316 GOTO 206
318 GOSUB 414
320 GOSUB 434
322 LET V(3)=1
324 LET T(P)=C
326 RETURN
328 LET P=2
330 LET V(2)=2
332 PRINT "       PLAY HAND TWO NOW"
334 PRINT "FIRST CARD IS",
336 LET X=S
338 GOSUB 318
340 IF Q(G)=1 THEN 344
342 LET V(1)=0
344 GOTO 206
346 PRINT "NO SPLITS NOW -- TRY AGAIN"
348 GOTO 282
350 IF V(1)<>2 THEN 360
352 IF V(3)=2 THEN 358
354 PRINT "TOO LATE TO DOUBLE, CHARLIE."
356 GOTO 282
358 LET W(P)=2*W(P)
360 IF V(1)>0 THEN 206
362 GOTO 268
364 REM DEAL
366 GOSUB 380
368 LET T(P)=T(P)+C
370 IF V(5)=0 THEN 376
372 LET V(5)=0
374 RETURN
376 GOSUB 434
378 RETURN
380 LET N=10 *(1+ABS(COS(N+W1)))
382 FOR A=1 TO N
384  let x=int(52.9999999*rnd)
386 IF X=0 THEN 384
388 NEXT A
390 IF D(X)=0 THEN 410
392 LET R=R+1
394 IF R<50 THEN 380
396 FOR A=1 TO 52
398 IF D(A) =K THEN 402
400 LET D(A)=0
402 NEXT A
404 LET R=0
406 PRINT "I RESHUFFLED"
408 GOTO 380
410 LET R=0
412 LET D(X)=K
414 IF Q(X)<>1 THEN 422
416 LET C=11
418 LET E(P)=E(P)+1
420 RETURN
422IF Q(X)>10 THEN 428
424 LET C=Q(X)
426 RETURN
428 LET C=10
430 RETURN
432 REM PRINT CARD
434 GOSUB 440
436 GOSUB 470
438 RETURN
440 IF Q(X)<>1 THEN 446
442 PRINT " ACE ";
444 RETURN
446 IF Q(X)>10 THEN 452
448 PRINT Q(X);
450 RETURN
452 IF Q(X)>11 THEN 458
454 PRINT " JACK ";
456 RETURN
458 IF Q(X)>12 THEN 464
460 PRINT " QUEEN ";
462 RETURN
464 PRINT " KING ";
466 RETURN
468 REM PRINT SUIT
470 IF X>39 THEN 480
472 IF X>26 THEN 484
474 IF X>13 THEN 488
476 PRINT "OF SPADES"
478 RETURN
480 PRINT "OF CLUBS"
482 RETURN
484 PRINT "OF HEARTS"
486 RETURN
488 PRINT "OF DIAMONDS"
490 RETURN
492 REM DEALER PLAYS
494 LET P=2
496 PRINT "MY HOLE CARD IS  ",
498 LET X=M
500 GOSUB 434
502 IF T(2)<22 THEN 508
504 IF V(2)=0 THEN 534
506 IF T(3)>21 THEN 534
508 LET P=1
510 IF T(1)<17 THEN 548
512 IF T(1)>17 THEN 516
514 IF E(1)>0 THEN 548
516 IF T(1)>21 THEN 554
518 LET P=2
520 PRINT "MY TOTAL IS ";T(1)
522 IF T(P)>21 THEN 534
524 IF T(1)>21 THEN 530
526 IF T(1)>T(P) THEN 534
528 IF T(1)=T(P) THEN 536
530 LET W1=W1+W(P)
532 GOTO 536
534 LET W1=W1-W(P)
536 IF V(2)>0 THEN 542
538 GOSUB 566
540 GOTO 150
542 LET P=3
544 LET V(2)=0
546 GOTO 522
548 PRINT "I DRAW           ",
550 GOSUB 366
552 GOTO 508
554 IF E(1)= 0 THEN 562
556 LET E(1) = E(1) -1
558 LET T(1)=T(1)-10
560 GOTO 508
562 PRINT "I BUSTED***";
564 GOTO 518
566 IF W1<0 THEN 574
568 IF W1=0 THEN 578
570 PRINT"YOU'RE AHEAD $";W1
572 RETURN
574 PRINT "YOU'RE BEHIND $";-W1
576 RETURN
578 PRINT "YOU'RE EVEN"
580 RETURN
582 END




		    condif.basic                    03/17/75  1551.7r w 03/17/75  1546.3       30186



10 REM CONDIF  -- REV APRIL 1971
11 DATA 5000000,5398278,5792597,6179114,6554217,6914625,7257469
12 DATA 7580363,7881446,8159399,8413447,8643339,8849303,9031995
13 DATA 9192433,9331928,9452007,9554345,9640697,9712834,9772499
14 DATA 9821356,9860966,9892759,9918025,9937903,9953388,9965330
15 DATA 9974449,9981342,9986501,9990324,9993129,9995166,9996631
16 DATA 9997674,9998409,9998922,9999277,9999519,9999683,9999793
17 DATA 9999867,9999915,9999946,9999966,9999979,9999987,9999992
18 DIM X(49)
19 DEF FNQ(V)=M3+V*R3
20 DEF FND(V)=X(V)-X(V-1)
21 DEF FNB(V)=U-V*(V-1)*(D2/(2*D1)+(V-2)*D3/(6*D1))
22 DEF FNZ(V)=1+((V^2)+1)/(4*D)+(((V^2)+3)*(5*(V^2)+1))/(96*D^2)
25 FOR I=1 TO 49
30 READ X(I)
35 NEXT I
202 DATA 1E37
203 DATA .5,.75,.9,.95,.99,.999,.9999,.99999,1E37
204 READ H1,N1,M1,S1,H2,N2,M2,S2
205 IF H1=1E37 THEN 352
206 READ I
207 IF H1<>0 THEN 210
208 LET H1=1E20
210 IF H2<>0 THEN 214
212 LET H2=1E20
214 LET M3=M1-M2
216 LET T1=S1*SQR((N1*(H1-1))/(H1*(N1-1)))
218 LET T2=S2*SQR((N2*(H2-1))/(H2*(N2-1)))
220 LET R1=T1*SQR((H1-N1)/(N1*(H1-1)))
222 LET R2=T2*SQR((H2-N2)/(N2*(H2-1)))
224 LET R5=R1^2
226 LET R6=R2^2
228 LET R3=SQR(R5+R6)
230 LET W=R5/(R5+R6)
232 LET D=((N1-1)*(N2-1))/((N2-1)*W^2+(N1-1)*(1-W)^2)
234 LET D=.1*INT(10*D+.5)
236 PRINT
238 PRINT "       STATISTIC    ","SAMPLE 1","SAMPLE 2"
240 PRINT
242 PRINT "SAMPLE MEAN         ",M1,M2
244 PRINT "SAMPLE VARIANCE     ",S1^2,S2^2
246 PRINT "SAMPLE STD DEVIATION",S1,S2
248 PRINT "SAMPLE SIZE         ",N1,N2
250 PRINT "POPULATION SIZE     ",
252 IF H1<>1E20 THEN 258
254 PRINT "INFINITE",
256 GOTO 260
258 PRINT H1,
260 IF H2<>1E20 THEN 266
262 PRINT "INFINITE"
264 GOTO 268
266 PRINT H2
268 PRINT "ESTIM POPN STD DEV  ",T1,T2
270 PRINT "STD ERROR OF MEAN   ",R1,R2
272 PRINT
274 PRINT "DIFF BETWEEN MEANS    ","         ";M3
276 PRINT "STD ERROR OF DIFF     ","         ";R3
278 PRINT "DEGR OF FREEDOM (DIFF)","         ";D
280 PRINT
282 PRINT
284 PRINT "CONFIDENCE LIMITS ON DIFFERENCE BETWEEN MEANS:"
286 PRINT
288 PRINT "CONF LEVEL","LOWER LIM","UPPER LIM"
290 PRINT
292 READ P
294 IF P=1E37 THEN 386
296 LET A1=0.5*(1+P)
298 GOSUB 310
300 IF D=0 THEN 306
302 REM  FNZ CONVERTS STUDENT'S T TO A NORMAL DEVIATE:
304 LET A2=A2*FNZ(A2)
306 PRINT 100*P,FNQ(-A2),FNQ(A2)
308 GOTO 292
310 IF A1>0.5 THEN 320
312 LET A1=1-A1
314 GOSUB 328
316 LET A2=-Q
318 GOTO 324
320 GOSUB 328
322 LET A2=Q
324 RETURN
326 REM  REVERSE INTERPOLATION FOR STD NORMAL DEVIATE:
328 LET Z=1E7*A1
330 FOR I=1 TO 46
332 IF Z<X(I) THEN 336
334 NEXT I
336 LET D1=FND(I)
338 LET E1=FND(I+1)
340 LET D2=E1-D1
342 LET D3=FND(I+2)-E1-D2
344 LET U=(Z-X(I-1))/D1
346 LET Q=FNB(FNB(U))
348 LET Q=0.1*(Q+I-2)
350 RETURN
352 PRINT
354 PRINT "THIS PROGRAM COMPUTES CONFIDENCE LIMITS FOR"
356 PRINT "THE DIFFERENCE BETWEEN TWO POPULATION MEANS,"
358 PRINT "BASED ON DATA SUPPLIED FOR TWO SAMPLES, ONE"
360 PRINT "FROM EACH POPULATION.  TO USE, TYPE:"
362 PRINT
364 PRINT "   200 DATA  H1,N1,M1,S1, H2,N2,M2,S2"
366 PRINT "   RUN"
368 PRINT
370 PRINT "WHERE  H1 = SIZE OF POPULATION 1 (LET H1"
372 PRINT "             EQUAL ZERO IF POPN IS INFINITE)"
374 PRINT "       N1 = SIZE OF SAMPLE 1"
376 PRINT "       M1 = ARITHMETIC MEAN OF SAMPLE 1"
378 PRINT "       S1 = STANDARD DEVIATION OF SAMPLE 1"
380 PRINT "              (BASED ON DIVISOR OF N1)"
382 PRINT
384 PRINT "AND H2,N2,M2,S2 ARE THE SAME FOR SAMPLE 2."
386 END




		    conlim.basic                    03/17/75  1551.7r w 03/17/75  1546.3       24048



3REM C O N L I M
20 PRINT
21 PRINT
22 PRINT
23 PRINT
24 PRINT
25 PRINT "CONLIM"
26 PRINT
27 PRINT
28 PRINT
29 REM NORMAL CURVE PROBABLILITES...KEEP 'EM HERE...DO NOT DELETE.
30 DATA 5000000,5398278,5792597,6179114,6554217,6914625,7257469
31 DATA 7580363,7881446,8159399,8413447,8643339,8849303,9031995
32 DATA 9192433,9331928,9452007,9554345,9640697,9712834,9772499
33 DATA 9821356,9860966,9892759,9918025,9937903,9953388,9965330
34 DATA 9974449,9981342,9986501,9990324,9993129,9995166,9996631
35 DATA 9997674,9998409,9998922,9999277,9999519,9999683,9999793
36 DATA 9999867,9999915,9999946,9999966,9999979,9999987,9999992
37 DIM X(49)
38 DEF FNQ(V)=M+V*S
39 DEF FND(V)=X(V)-X(V-1)
40 DEF FNB(V)=U-V*(V-1)*(D2/(2*D1)+(V-2)*D3/(6*D1))
41 DEF FNZ(V) = 1+(V^2+1)/(4*D)+((V^2+3)*(5*V^2+1))/(96*D^2)
42 DATA 0,0,0
50 DATA  1E20
100 DATA 2,3,6,9,8,11,13,16,23,45,67,89,35,67,13,43,21,67,98,7,6
200 DATA 3E33
210 DATA .5,.75,.9,.95,.99,.999,.9999,.99999,1E38
220 FOR I = 1 TO 49
230 READ X(I)
240 NEXT I
250 READ I,S1,S2
260 READ H
270 LET I=I+1
280 READ W
290 IF W=3E33 THEN 330
300 LET S1=S1+W
310 LET S2=S2+W^2
320 GOTO 270
330 LET N=I-1
340 PRINT
350 PRINT "VALUES OF SAMPLE STATISTICS:"
360 PRINT
370 PRINT "   SIZE OF SAMPLE",N
380 LET M=S1/N
390 PRINT "   SAMPLE MEAN VALUE",M
400 LET S8=S2/N-M^2
410 LET D = N-1
420 PRINT "   VARIANCE OF SAMPLE",S8
430 PRINT "   SAMPLE STD DEVIATION",SQR(S8)
440 LET S5=S8*N*(H-1)/(H*(N-1))
450 PRINT "   ESTIMATED POPN STD DEV",SQR(S5)
460 LET S6=S5*(H-N)/(N*(H-1))
470 LET S=SQR(S6)
480 PRINT "   STANDARD ERROR OF MEAN",S
490 PRINT
500 PRINT
510 PRINT "CONFIDENCE LIMITS ON POPULATION MEAN:"
520 PRINT
530 PRINT "  CONF LEVEL","  LOWER LIM","   UPPER LIM"
540 PRINT
550 READ P
560 IF P=1E38 THEN 9999
570 LET A1 = 0.5*(1+P)
580 GOSUB 610
590 LET A3 = A2 * FNZ(A2)
592 PRINT 100*P, FNQ(-A3), FNQ(A3)
600 GOTO 550
610 IF A1>0.5 THEN 660
620 LET A1=1-A1
630 GOSUB 700
640 LET A2=-Q
650 GOTO 680
660 GOSUB 700
670 LET A2=Q
680 RETURN
690 REM  REVERSE INTERPOLATION FOR STD NORMAL DEVIATE:
700 LET Z=1E7*A1
710 FOR I = 1 TO 46
720 IF Z<X(I) THEN 740
730 NEXT I
740 LET D1 = FND(I)
750 LET E1 = FND(I+1)
760 LET D2=E1-D1
770 LET D3 = FND(I+2) -E1 - D2
780 LET U = (Z - X(I-1)) / D1
790 LET Q = FNB(FNB(U))
800 LET Q = .1*(Q+I-2)
810 RETURN
820 PRINT
830 PRINT "THIS PROGRAM COMPUTES CONFIDENCE LIMITS FOR"
840 PRINT "AN UNKNOWN POPULATION MEAN, BASED ON RANDOM"
850 PRINT "SAMPLE DATA GIVEN.   TO USE, TYPE:"
860 PRINT
870 PRINT "   50  DATA  (SIZE OF POPULATION)"
880 PRINT "      (OMIT THIS INPUT IF INFINITE POP'N)"
890 PRINT "   100 DATA  X(1), X(2),.....,X(N)"
900 PRINT
910 PRINT "WHERE THE X(I) ARE THE SAMPLE OBSERVATIONS."
9999 END




		    curfit.basic                    03/17/75  1551.7r w 03/17/75  1546.3       42336



3REM C U R F I T
4 REM MODIFIED FEB 6,1975
5 PRINT
6 PRINT "C U R F I T"
7 PRINT
12 PRINT "DO YOU WANT INSTURCTIONS?  (YES OR NO)"
13 INPUT Q1$
14 IF Q1$ = "YES" THEN 20
15 IF Q1$ = "yes" THEN 20
16 IF Q1$ = "no" THEN 700
17 IF Q1$ = "NO" THEN 700
18 PRINT "ANSWER EITHER ""YES"" OR ""NO"""
19 GO TO 12
20 PRINT "LINE NUMBERS 50-699 ARE FREE FOR USE AS DATA STATEMENTS, AS REQUIRED"
22 PRINT "ALL VALUES FOR ONE VARIABLE ARE GIVE IN DATA STATEMENTS, FOLLOWED BY"
24 PRINT "ALL VALUES FOR A SECOND VARIABLE, AND SO ON."
26 PRINT "THE WAY TO ARRANGE INPUT IS TO PUT ALL VALUES OF VARIABLE 1 AT LINES"
28 PRINT "100-199, ALL FOR VARIABLE 2 AT LINES 200-299, ECT."
30 PRINT
31 PRINT " CURFIT ACCEPTS UP TO 200 OBSERVATIONS ON TWO VARIABLES. THE DATA FOR"
32 PRINT " THE DEPENDENT VARIABLE (Y) IS SUPPLIED FIRST, FOLLOWED BY THE"
33 PRINT " DATA FOR THE INDEPENDENT VARIABLE (X)."
34 PRINT
35 STOP
700DATA1E38,1E38
701DATA0,0
702 REM
703PRINT
704READP
705DIMX(200),Y(200),U(200),V(200),A(6),B(6),C(6),S(6),F(6)
706IFP=1E38THEN911
707FORK=1TO6
708LETF(K)=1
709NEXTK
710RESET
711PRINT
712PRINT"PLEASE SPECIFY THE NUMBER OF VALUES (N) GIVEN AS DATA"
713PRINT"FOR THE TWO INPUT VARIABLES, AND THE OUTPUT CODE (D)."
714PRINT"(D=1 IF OUTPUT IS TO BE IN ORDER OF INCREASING VALUES"
715PRINT"OF THE INDEPENDENT VARIABLE, ELSE D=0).  N,D = ";
716INPUTN,D
717PRINT
718FORI=1TON
719READY(I)
720NEXTI
721FORI=1TON
722READX(I)
723NEXTI
724READX,Y
725 IF X < 1E38  THEN  916
726 IF Y < 1E38  THEN  916
727PRINT
728PRINT
730 PRINT " L E A S T   S Q U A R E S   C U R V E   F I T"
731PRINT
732 PRINT"CURVE TYPE","  INDEX  OF","        A","       B"
733PRINT" ","DETERMINATION"
734PRINT
735FORI=1TO6
736FORI1=1TO6
737LETS(I1)=0
738NEXTI1
739GOSUB844
740IF(I-5)*(I-6)=0THEN755
741IF(I-2)*(I-3)=0THEN748
742FORJ=1TON
743LETV(J)=Y(J)
744GOSUB822
745NEXTJ
746IFI=1THEN765
747GOTO776
748FORJ=1TON
749IFY(J)<=0THEN762
750LETV(J)=LOG(Y(J))
751GOSUB822
752NEXTJ
753IFI=3THEN770
754GOTO765
755FORJ=1TON
756IFY(J)=0THEN762
757LETV(J)=1/Y(J)
758GOSUB822
759NEXTJ
760IFI=6THEN776
761GOTO765
762PRINT"CAN'T FIT"
763LETF(I)=0
764GOTO783
765FORJ=1TON
766LETU(J)=X(J)
767GOSUB825
768NEXTJ
769GOTO781
770FORJ=1TON
771IFX(J)<=0THEN762
772LETU(J)=LOG(U(J))
773GOSUB825
774NEXTJ
775GOTO781
776FORJ=1TON
777IFX(J)=0THEN762
778LETU(J)=1/X(J)
779GOSUB825
780NEXTJ
781GOSUB886
782PRINTC(I),A(I),B(I)
783NEXTI
784IFD<>1THEN786
785GOSUB829
786PRINT
787PRINT
788PRINT
789PRINT"DETAILS FOR";
790INPUTI
791LETK=I
792LETD1=D
793PRINT
794IFF(I)=1THEN798
795GOSUB844
796PRINT" COULD NOT BE FIT."
797GOTO786
798GOSUB862
799IF(I-1)*(I-5)*(I-6)<>0THEN810
800FORJ=1TON
801LETY=A(I)+B(I)*X(J)
802IFI=1THEN806
803LETY=1/Y
804IFI=5THEN806
805LETY=X(J)*Y
806GOSUB901
807NEXTJ
808LETD=D1
809GOTO786
810FORJ=1TON
811IFI=2THEN817
812IFI=3THEN815
813LETY=A(4)+B(4)/X(J)
814GOTO818
815LETY=A(3)*(X(J)^B(3))
816GOTO818
817LETY=A(2)*EXP(B(2)*X(J))
818GOSUB901
819NEXTJ
820LETD=D1
821GOTO786
822LETS(5)=S(5)+V(J)^2
823LETS(3)=S(3)+V(J)
824RETURN
825LETS(1)=S(1)+U(J)
826LETS(2)=S(2)+U(J)^2
827LETS(4)=S(4)+U(J)*V(J)
828RETURN
829FORI=1TON-1
830LETM=I
831FORJ=I+1TON
832IFX(M)<=X(J)THEN834
833LETM=J
834NEXTJ
835IFM=ITHEN842
836LETP=X(M)
837LETQ=Y(M)
838LETX(M)=X(I)
839LETY(M)=Y(I)
840LETX(I)=P
841LETY(I)=Q
842NEXTI
843RETURN
844LETK=I
845IFK=1THEN860
846IFK=2THEN858
847IFK=3THEN856
848IFK=4THEN854
849IFK=5THEN852
850PRINT"6. Y=X/(A+B*X) ";
851RETURN
852PRINT"5. Y=1/(A+B*X) ";
853RETURN
854PRINT"4. Y=A+(B/X)",
855RETURN
856PRINT"3. Y=A*(X^B)",
857RETURN
858PRINT"2. Y=A*EXP(B*X)";
859RETURN
860PRINT"1. Y=A+(B*X)",
861RETURN
862PRINT"   ";
863GOSUB845
864PRINT" IS A";
865IFK=1THEN870
866IFK=2THEN872
867IFK=3THEN874
868PRINT" HYPERBOLIC";
869GOTO875
870PRINT" LINEAR";
871GOTO875
872PRINT"N EXPONENTIAL";
873GOTO875
874PRINT" POWER";
875PRINT" FUNCTION.  THE RESULTS"
876IFK=1THEN878
877PRINT"      OF A LEAST-SQUARES FIT OF ITS LINEAR TRANSFORM"
878IFD<>1THEN880
879PRINT"      (SORTED IN ORDER OF ASCENDING VALUES OF X)"
880PRINT"      ARE AS FOLLOWS:"
881PRINT
882 PRINT "       X-ACTUAL       Y-ACTUAL    Y-CALC      PCT DIFFER"
883PRINT
884RETURN
885PRINT
886LETB=(N*S(4)-S(1)*S(3))/(N*S(2)-(S(1)^2))
887LETA=(S(3)-B*S(1))/N
888LETS1=S(5)-(S(3)^2)/N
889LETS2=(B^2)*(S(2)-(S(1)^2)/N)
890LETC(I)=S2/S1
891IF(I-1)*(I-4)*(I-5)=0THEN898
892IF(I-2)*(I-3)=0THEN896
893LETA(6)=B
894LETB(6)=A
895RETURN
896LETA(I)=EXP(A)
897GOTO899
898LETA(I)=A
899LETB(I)=B
900RETURN
901PRINTX(J),Y(J),Y,
902LETD=Y(J)-Y
903LETD=.1*SGN(D)*INT(1000*ABS(D/Y))
904IFD<0THEN909
905IFD>0THEN908
906PRINT"      0"
907RETURN
908PRINT"       ";
909PRINTD
910RETURN
911 PRINT
912 PRINT " DATA STATEMENTS ARE REQUIRED, SEE INSTRUCTIONS."
914 PRINT
915 STOP
916 PRINT
917 PRINT"CHECK INPUT"
9999 END




		    linpro.basic                    03/17/75  1551.7r w 03/17/75  1546.3       50481



100 REM HONEYWELL TIME SHARING APPLICATIONS
110 PRINT "L I N P R O"
120 REM
130 REM REVISED APRIL, 1971
140 REM
150 READ G9
160 IF G9=1E38 THEN 1890
170 RESET
180 LET C=1
190 DIM A(19,31)
200 PRINT"TYPE '2' FOR OUTPUT OF OF TABLEAUS AND BASIS AT EACH ";
210 PRINT"ITERATION,"
220 PRINT"     '1' FOR THE BASIS ONLY, OR"
230 PRINT"     '0' FOR JUST THE SOLUTION."
240 PRINT"WHICH";
250 INPUT P5
260 PRINT
270 PRINT "WHAT ARE M AND N OF THE DATA MATRIX";
280 INPUT M,N
290 PRINT
300 PRINT "HOW MANY 'LESS THANS','EQUALS','GREATER THANS'";
310 INPUT L, E, G
320 IF L+E+G = M THEN 350
330 PRINT "INPUT DATA NOT CONSISTENT."
340 STOP
350 LET B = M+N+G+2
360 LET W = M
370 IF B*(W+2)<540 THEN 400
380 PRINT "PROBLEM TOO LARGE"
390 STOP
400 IF B>31 THEN 420
410 IF W+1<19 THEN 520
420 PRINT"CHANGE DIM STATEMENT (NO. 50) FOR A";W+2;"BY";B;"MATRIX"
430 PRINT
440 PRINT"EITHER STATEMENT 260 OR 270 OR BOTH SHOULD BE CHANGED"
450 PRINT"AS FOLLOWS:"
460 PRINT
470 IF B<32 THEN 490
480 PRINT "     260 IF B>";B;"THEN 280"
490 IF W+1<19 THEN 510
500 PRINT "      270 IF W+2<";W+2;"THEN 380"
510 STOP
520 LET M = M - 1
530 LET H = 1
540 FOR I = 1 TO W+2
550 FOR J = 2 TO B 
560 LET A(I,J) = 0
570 NEXT J
580 NEXT I
590 FOR I = 1 TO M+1
600 FOR J = 2 TO N+1
610 READ A(I,J)
620 NEXT J
630 NEXT I
640 FOR I = 1 TO M+1
650 READ A(I,B)
660 NEXT I
670 FOR J = 2 TO N+1
680 READ A(W+1,J)
690 LET A(W+1,J) = -A(W+1,J)
700 NEXT J
710 FOR K = 2 TO M+2
720 LET A(K-1,N+G+K) = 1
730 LET A(K-1,1) = K+N+G
740 NEXT K
750 IF E <> 0 THEN 770
760 IF G=0 THEN 920
770 FOR K = L+E+2 TO M+2
780 LET A(K-1,K+N-L-E) = -1
790 NEXT K
800 LET W = W + 1
810 LET Q = 0
820 FOR J = 2 TO N+1 + G
830 LET S = 0
840 FOR I = M-G-E+2 TO M+1
850 LET S = S + A(I,J)
860 NEXT I
870 LET A(W+1,J) = -S
880 IF A(W+1,J) > Q THEN 910
890 LET Q = A(W+1,J)
900 LET C = J
910 NEXT J
920 PRINT
930 PRINT "      YOUR VARIABLES";H;"THROUGH";N
940 IF G = 0 THEN 960
950 PRINT "   SURPLUS VARIABLES";N+1;"THROUGH";N+G
960 IF L = 0 THEN 980
970 PRINT "     SLACK VARIABLES";N+G+1;"THROUGH";N+G+L
980 IF G+E = 0 THEN 1000
990 PRINT "ARTIFICIAL VARIABLES";N+G+L+1;"THROUGH";B-2
1000 IF P5=0 THEN 1020
1010 GOSUB 1770
1020 IF G+E=0 THEN 1360
1030 IF Q=0 THEN 1430
1040 IF P5>0 THEN 1560
1050 LET H = H + 1
1060 LET Q = 1E38
1070 LET R = 0
1080 FOR I = 1 TO M+1
1090 IF A(I,C) <= 0 THEN 1130
1100 IF A(I,B)/A(I,C) > Q THEN 1130
1110 LET Q = A(I,B)/A(I,C)
1120 LET R = I
1130 NEXT I
1140 IF R >  0 THEN 1180
1150 PRINT "SOLUTION UNBOUNDED"
1160 GOSUB 1770
1170 STOP
1180 LET P = A(R,C)
1190 LET A(R,1)=C
1200 FOR J = 2 TO B
1210 LET A(R,J) = A(R,J)/P
1220 NEXT J
1230 FOR I = 1 TO W+1
1240 IF I = R THEN 1310
1250 FOR J = 2 TO B
1260 IF J = C THEN 1300
1270 LET A(I,J) = A(I,J) - A(R,J)*A(I,C)
1280 IF ABS(A(I,J)) > 1E-8 THEN 1300
1290 LET A(I,J) = 0
1300 NEXT J
1310 NEXT I
1320 FOR I = 1 TO W+1
1330 LET A(I,C) = 0
1340 NEXT I
1350 LET A(R,C) = 1
1360 LET Q = 0
1370 FOR J = 2 TO N+1+G+L
1380 IF A(W+1,J) > Q THEN 1410
1390 LET Q = A(W+1,J)
1400 LET C = J
1410 NEXT J
1420 GOTO 1030
1430 IF W=M+1 THEN 1460
1440 LET W = W-1
1450 GOTO 1360
1460 PRINT
1470 PRINT
1480 FOR I = 1 TO M+1
1490 IF A(I,1)<N+G+L+2 THEN 1510
1500 IF A(I,B)<>0 THEN 1530
1510 NEXT I
1520 GO TO 1550
1530 PRINT"NO FEASIBLE  SOLUTION FOUND"
1540 GO TO 99999
1550 PRINT "ANSWERS:"
1560 PRINT
1570 IF Q = 0 THEN 1590
1580 PRINT "        BASIS BEFORE ITERATION";H
1590 PRINT "        VARIABLE       VALUE"
1600 FOR I=1 TO M+1
1610 IF A(I,1) = 0 THEN 1630
1620 PRINT A(I,1)-1,A(I,B)
1630 NEXT I
1640 PRINT
1650 PRINT "OBJECTIVE FUNCTION VALUE",A(W+1,B)
1660 IF Q <> 0 THEN 1050
1670 PRINT
1680 PRINT
1690 PRINT "DUAL VARIABLES:"
1700 PRINT "         COLUMN       VALUE"
1710 FOR J=N+2 TO B-G-1
1720 PRINT J-1,A(W+1,J)
1730 NEXT J
1740 IF P5=0 THEN 1760
1750 GOSUB 1770
1760 GOTO 99999
1770 PRINT
1780 IF P5=1 THEN 1880
1790 PRINT
1800 PRINT "TABLEAU AFTER";H-1;"ITERATIONS"
1810 FOR I = 1 TO W+1
1820 FOR J = 2 TO B
1830 PRINT A(I,J),
1840 NEXT J
1850 PRINT
1860 PRINT
1870 NEXT I
1880 RETURN
1890 PRINT"                     INSTRUCTIONS FOR LINPRO"
1900 PRINT
1910 PRINT"THIS CODE MAXIMIZES THE OBJECTIVE FUNCTION" 
1920 PRINT"BY THE TWO-PHASE METHOD."  
1930 PRINT "MAXIMUM SIZE 18X30.  LARGE PROBLEMS MAY RESULT IN"
1940 PRINT "EXCESSIVE RUNNING TIME AND LARGE ROUNDOFF ERROR."
1950 PRINT"ENTER DATA USING LINES 1-99 AND 10000,90000:"
1960 PRINT"  FIRST - ARRANGE YOUR RESTRICTIONS SO THAT THE"
1970 PRINT"  'LESS THAN' INEQUALITIES PRECEDE THE STRICT EQUALITIES,"
1980 PRINT"  WHICH , IN TURN, PRECEDE THE 'GREATER THAN' INEQUALITIES."
1990 PRINT
2000 PRINT
2010 PRINT"THEN-TYPE IN THE COEFFICIENTS OF THE RESTRICTIONS ROW BY ROW"
2020 PRINT"    DO NOT INCLUDE COEFFICIENTS FOR SLACK, SURPLUS,"
2030 PRINT"    OR ARTIFICIAL VARIABLES."
2040 PRINT"NEXT - TYPE IN THE ''B'' VECTOR (THE CONSTANTS OF THE"
2050 PRINT"RESTRICTIONS.)  THESE VALUES MUST BE NON-NEGATIVE"
2060 PRINT
2070 PRINT
2080 PRINT"FINALLY - TYPE IN THE COEFFICIENTS OF THE COST FUNCTION."
2090 PRINT
2100 PRINT
2110 PRINT"FOR A MINIMIZATION PROBLEM, REVERSE THE SIGNS OF THE"
2120 PRINT"COEFFICIENTS OF THE OBJECTIVE FUNCTION."
2130 PRINT
2140 PRINT
2150 PRINT"AT RUN TIME YOU WILL BE ASKED TO:"
2160 PRINT"  (1) INDICATE THE LEVEL OF DETAIL FOR OUTPUT."
2170 PRINT"  (2) INPUT THE NUMBER OR RESTRICTIONS AND VARIABLES - "
2180 PRINT"      M AND N RESPECTIVELY."
2190 PRINT"  (3) AND TO INPUT THE NUMBER OF LESS THAN INEQUALITIES,"
2200 PRINT"      STRICT EQUALITIES, AND GREATER THAN INEQUALITIES,"
2210 PRINT"      RESPECTIVELY."
2220 PRINT
2230 PRINT"REMEMBER TO ALWAYS SUPPLY ZEROES WHEN THEY ARE APPLICABLE"
99998 DATA 1E38
99999 END




		    linreg.basic                    03/17/75  1551.7r w 03/17/75  1546.3       25425



1 REM MODIFIED FEB 1975
2 PRINT"               L I N R E G"
200 DATA 1E35,1E35
201 PRINT" DO YOU WANT INSTRUCTIONS? (YES=1, NO=0)"
202 INPUT Z9
203 IF Z9 = 1 THEN 650
206 PRINT"WHAT TYPE OF CURVE DO YOU WANT TO FIT:"
210 PRINT "LINEAR=1, EXPONENTIAL=2, POWER=3";
215 INPUT Q1
220 DIM D(250,2)
225 PRINT
230 LET I=0
235 LET I=I+1
240 READ D(I,1),D(I,2)
245 IF D(I,1)<>1E35 THEN 235
250 LET Q2=I-1
255 LET S9=0
260 IF Q1=1 THEN 280
265 IF Q1=2 THEN 335
270 IF Q1=3 THEN 405
275 GOTO 230
280 LET S9=1
285 GOSUB 505
290 PRINT "LINEAR:  Y=A+B*X  WITH  A=";Q8;"AND B=";Q9
295 GOSUB 580
300 FOR J=1 TO Q2
305 LET W7=Q8+Q9*D(J,1)
310 LET Z7=W7-D(J,2)
315 LET Q4=100*Z7/D(J,2)
320 PRINT D(J,1),D(J,2),W7,Z7,Q4
325 NEXT J
330 STOP
335 FOR J=1 TO Q2
340 LET D(J,2)=LOG(D(J,2))
345 NEXT J
350 GOSUB 505
355 PRINT "EXPONENTIAL:  Y=A*EXP(B*X)  WITH  A=";EXP(Q8);"AND B=";Q9
360 GOSUB 580
365 FOR J=1 TO Q2
370 LET W7=EXP(Q8+Q9*D(J,1))
375 LET W8=EXP(D(J,2))
380 LET Z7=W7-W8
385 LET Q4=100*Z7/W8
390 PRINT D(J,1),W8,W7,Z7,Q4
395 NEXT J
400 STOP
405 FOR J=1 TO Q2
410 LET D(J,1)=LOG(D(J,1))
415 LET D(J,2)=LOG(D(J,2))
420 NEXT J
425 GOSUB 505
430 PRINT "POWER:  Y=A*(X^B)  WITH  A=";EXP(Q8);"AND B=";Q9
435 GOSUB 580
440 FOR J=1 TO Q2
445 LET W7=EXP(D(J,1))
450 LET W8=EXP(D(J,2))
455 LET W9=EXP(Q8)*W7^Q9
460 LET Q4=W9/W8-1
465 LET Z7=W9-W8
470 IF Q4<0 THEN 485
475 LET Q4=INT(1000*Q4+0.5)/10
480 GOTO 490
485 LET Q4=INT(1000*Q4-0.5)/10
490 PRINT W7,W8,W9,Z7,Q4
495 NEXT J
500 STOP
505 LET Q3=0
510 LET Q4=0
515 LET Q5=0
520 LET Q6=0
525 LET Q7=0
530 FOR J=1 TO Q2
535 LET Q3=Q3+D(J,1)
540 LET Q4=Q4+D(J,2)
545 LET Q5=Q5+D(J,1)*D(J,2)
550 LET Q6=Q6+(D(J,1))^2
555 LET Q7=Q7+(D(J,2))^2
560 NEXT J
565 LET Q9=(Q2*Q5-Q3*Q4)/(Q2*Q6-Q3^2)
570 LET Q8=(Q4-Q3*Q9)/Q2
575 RETURN
580 LET Q0=(Q2*Q5-Q3*Q4)/SQR((Q2*Q6-Q3^2)*(Q2*Q7-Q4^2))
585 PRINT
590 PRINT "COEFFICIENT OF CORRELATION = ";Q0
595 PRINT "COEFFICIENT OF DETERMINATION = ";Q0^2
600 PRINT
605 PRINT "DO YOU WANT TO SEE A COMPARISON OF THE ACTUAL Y'S AND"
610 PRINT "THE ESTIMATED Y'S. 1=YES, 0=NO";
615 INPUT P9
620 IF P9<>1 THEN 715
625 PRINT
630 PRINT "X-ACTUAL","Y-ACTUAL","Y-ESTIM","DIFFER","PCT-DIFF"
635 PRINT
640 RETURN
645 PRINT
650 PRINT "THIS IS A LINEAR REGRESSION PROGRAM FOR DATA IN TWO "
655 PRINT "VARIABLES, X AND Y.  FROM INPUT POINTS, DESCRIBED BY"
660 PRINT "THEIR X AND Y COORDINATES, AN EQUATION IS PRODUCED THAT"
665 PRINT "BEST FITS THESE POINTS IN THE LEAST-SQUARES SENSE.  TO"
670 PRINT "USE THE PROGRAM, TYPE THE FOLLOWING:"
675 PRINT
680 PRINT "   2 DATA  X(1),Y(1), X(2),Y(2),......, X(N),Y(N)"
685 PRINT "        (WHERE X(1),Y(1) IS THE FIRST POINT, X(2),"
690 PRINT "        Y(2) IS THE SECOND, AND SO ON UNTIL ALL"
695 PRINT "        POINTS HAVE BEEN ENTERED.  ADDITIONAL DATA"
700 PRINT "        STATEMENTS 3-199 MAY BE USED AS NEEDED.)"
705 PRINT
715 END




		    pert.basic                      03/17/75  1551.7r w 03/17/75  1546.3       90099



10 REM PERT
20 REM REVISED FEB 1975
30 PRINT TAB(25);"PERT ANALYSIS PROGRAM"
40 PRINT
50 PRINT
60 READ T
70 REM
80 IF T <> 4E36 THEN 1600
90 PRINT
100 PRINT "ENTER DATA STARTING IN LINE 3000."
110 PRINT
120 PRINT "FOR PROGRAM DESCRIPTION AND INSTRUCTIONS TYPE:"
130 PRINT
140 PRINT "LIST 170 1590"
150 STOP
160 REM
170 REM
180 REM                 PROGRAM DOCUMENTATION
190 REM
200 REM         THIS PROGRAM ANALYZES A PERT NETWORK.  THE ANALYSIS
210 REM     IS ADOPTED FROM THE PROGRAM AS SET FORTH IN MC MILLAN
220 REM     AND GONZALES (PAGES 189 TO 211).
230 REM
240 REM         FOLLOWING THE CONVENTION AS DELINEATED IN M &G,
250 REM     A CIRCLE CORRESPONDS TO A 'COMPLETION EVENT' AND
260 REM     AN ARROW CORRESPONDS TO AN 'ACTIVITY'.  IN THE 
270 REM     NETWORK ANALYSIS TWO PARAMETERS ARE ASSOCIATED
280 REM     WITH EACH TIME CONSUMING ACTIVITY: A MEAN AND A
290 REM     VARIANCE.
300 REM
310 REM         FOR EACH EVENT IN  YOUR NETWORK, THE PROGRAM
320 REM     WILL DETERMINE THE FOLLOWING VARIABLES FOR YOU:
330 REM
340 REM       1)  TE = THE EARLIEST EXPECTED TIME OF OCCURRENCE
350 REM                OF COMPLETION EVENT X.
360 REM
370 REM       2)  V = THE VARIANCE ASSOCIATED WITH THE TE OF THE 
380 REM                EVENT.
390 REM
400 REM       3)  TL = THE LATEST EXPECTED TIME WHICH A COM-
410 REM                PLETION EVENT CAN BE ALLOWED TO OCCUR
420 REM                WITHOUT DISTURBING THE TE OF THE FINAL
430 REM                EVENT OF THE NETWORK.
440 REM
450 REM       4)  SLACK = TE-TL
460 REM
470 REM        THE ABOVE MENTIONED VARIABLE TE MUST NOT BE CONFUSED
480 REM     WITH T(E).  THE VALUE T(E) IS THE EXPECTED ANOUNT OF
490 REM     TIME REQUIRED FOR THE COMPLETION OF A SINGLE ACTIVITY,
500 REM     INDEPENDENT OF WHAT HAS OCCURRED BEFORE IT.  THE DATA
510 REM     FOR T(E) OF EACH EVENT WILL BE ENTERED BY YOU AS
520 REM     DESCRIBED BELOW.  THE SAME NOMENCLATURE IS USED WITH
530 REM     V AND V(E).
540 REM
550 REM         IN THIS PROGRAM NO EVENT CAN HAVE MORE THAN TWO
560 REM     IMMEDIATE PREDECESSOR EVENTS OR MORE THAN TWO
570 REM     IMMEDIATE SUCCESSOR EVENTS.  TO USE THIS PROGRAM WITH
580 REM     MORE COMPLEX NETWORKS CONTAINING MORE THAN TWO
590 REM     IMMEDIATE PREDECESSOR OR SUCCESSOR EVENTS, ENTER
600 REM     A NUMBERED 'DUMMY' EVENT THAT HAS A T(E) =0 AND
610 REM     A V(E) =0.
620 REM
630 REM         FOR EXAMPLE, IF EVENTS 1, 2 AND 3 PRECEED EVENT 5
640 REM     THEN ENTER A 'DUMMY' EVENT 4, OF ZERO (0) TIME FOR
650 REM     COMPLETION AND ZERO (0) VARIANCE, SUCH THAT EVENTS
660 REM     1 AND 2, OR 1 AND 3, OR 2 AND 3 PRECEED EVENT 4.
670 REM     THEN EVENT 5 WILL HAVE ONLY TWO PRECEEDING EVENTS AS
680 REM     ALLOWED BY THE PROGRAM. (IE, EVENT 5 WILL BE PRECEEDED
690 REM     BY 1 AND 4, OR 2 AND 4, OR 3 AND 4)  --SEE PAGE 197
700 REM     OF M & G.
710 REM
720 REM         BEGINNING IN LINE 3000 ENTER THE DATA.  FIRST ENTER
730 REM     T, THE TOTAL NUMBER OF EVENTS IN THE NETWORK INCLUDING
740 REM     DUMMY EVENTS IN LINE 3000.
750 REM
760 REM         THEN BEGINNING WITH THE FINAL EVENT AS NUMBER ONE,
770 REM     ( 1 ), ENTER IN LINE 3001 THE FOLLOWING 8 PIECES OF
780 REM     INFORMATION ABOUT THE EVENT IN THE ORDER INDICATED,
790 REM     ALL ON LINE 3001.  REPEAT THIS SEQUENCE, ENTERING THE
800 REM     8 PIECES OF DATA FOR EACH OF THE REMAINING EVENTS ON A 
810 REM     SINGLE LINE.  INCREMENT LINE NUMBERS BY 1 AFTER LINE
820 REM     3001.
830 REM
840 REM     1) THE NUMBER OF THE EVENT'S FIRST IMMEDIATE
850 REM        PREDECESSOR EVENT.
860 REM
870 REM     2) THE T(E) ASSOCIATED WITH THE ACTIVITY BOUNDED
880 REM        BY THIS COMPLETION EVENT AND ITS FIRST
890 REM        IMMEDIATE PREDECESSOR EVENT.
900 REM
910 REM     3) THE VARIANCE V(E) ASSOCIATED WITH THE ACTIVITY
920 REM        BOUNDED BY THIS COMPLETION EVENT AND ITS FIRST
930 REM        IMMEDIATE PREDECESSOR EVENT.
940 REM
950 REM     4) THE NUMBER OF THE EVENT'S SECOND IMMDEIATE
960 REM        PREDECESSOR EVENT. IF NONE, ENTER ZERO.
970 REM
980 REM     5) THE T(E) ASSOCIATED WITH THE ACTIVITY BOUNDED BY
990 REM        THIS COMPLETION EVENT AND ITS SECOND IMMEDIATE
1000 REM        PREDECESSOR EVENT.  IF NONE, ENTER ZERO.
1010 REM
1020 REM     6) THE VARIANCE V(E) ASSOCIATED WITH THE ACTIVITY
1030 REM        BOUNDED BY THIS COMPLETION EVENT AND ITS SECOND
1040 REM        IMMEDIATE PREDECESSOR EVENT. IF UNKNOWN, ENTER ZERO.
1050 REM
1060 REM     7) THE TE OF THE EVENT, WHERE KNOWN.
1070 REM        IF UNKNOWN, ENTER ZERO.
1080 REM
1090 REM     8) THE VARIANCE V ASSOCIATED WITH THE EVENT, WHERE
1100 REM        KNOWN.  IF UNKNOWN, ENTER ZERO.
1110 REM
1120 REM        THE LAST EVENT (ACTUALLY ENTERED FIRST, AS ABOVE) 
1130 REM     MUST BE LABELED ONE.  THE OTHER EVENTS NEED NOT HAVE
1140 REM   ANY ORDER.  REMEMBER, WHEN ENTERING THE DATA THAT YOU
1150 REM     ENTER T (LINE 3000), THE 8 PIECES OF DATA FOR EVENT
1160 REM     1 (LINE 3001), THEN 8 FOR EVENT 2 (LINE 3002), THEN
1170 REM     8 FOR EVENT 3 (LINE 3003), ETC., IN STRICT
1180 REM     SEQUENTIAL EVENT NUMBER ORDER, REGARDLESS OF THE
1190 REM     PHYSICAL LAYOUT ORDER OF THE NETWORK EVENTS.
1200 REM
1210 REM     T(E) IS DEFINED AS;  T(E) = ( A + 4*M + B )/6, WHERE
1220 REM
1230 REM     A = MOST OPTIMISTIC TIME FOR COMPLETION OF THE ACTIVITY
1240 REM     B = MOST PESSEMISTIC TIME FOR COMPLETION OF THE
1250 REM         ACTIVITY
1260 REM     C = MOST LIKELY TIME FOR COMPLETION OF THE ACTIVITY
1270 REM
1280 REM     VARIANCE = V(E) = ((B-A)/6)^2, WHERE A AND B ARE 
1290 REM     DEFINED AS ABOVE.
1300 REM
1310 REM
1320 REM          AT LEAST ONE EVENT IN THE NETWORK MUST HAVE ITS
1330 REM     EARLIEST COMPLETION TIME SPECIFIED ( I.E. AT LEAST
1340 REM     ONE EVENT'S TE MUST BE KNOWN.
1350 REM
1360 REM         IF HOWEVER, NO EVENT HAS A SPECIFIED TE, LET THE
1370 REM     THE TE OF THE INITIAL EVENT IN THE NETWORK BE
1380 REM     SPECIFIED AS ONE, ( 1 ).  THUS, THE INITIAL EVENT IN
1390 REM     THE NETWORK WOULD HAVE IN ITS SEVENTH DATA LOCATION
1400 REM     A ONE, INSTEAD OF A ZERO.  (IE, ASSUME EVENT NUMBER
1410 REM     9 IS THIS FIRST EVENT IN THE NETWORK AND STARTS AT 
1420 REM     TIME ZERO, ITS DATA FORM WOULD LOOK LIKE
1430 REM     XXXX DATA ------0-, HOWEVER, FOR THE PROGRAM TO 
1440 REM     OPERATE THE EVENT WOULD HAVE TO BE ASSIGNED AN
1450 REM     ARBITRARY TE, SAY 1, ITS CORRECT DATA STATEMENT
1460 REM     WOULD TAKE THE FORM,  XXXX DATA ------1-.
1470 REM
1480 REM
1490 REM          DON'T FORGET TO ENTER 'T', THE NUMBER OF EVENTS
1500 REM     IN THE NETWORK.  EACH EVENT IN THE NETWORK MUST HAVE 
1510 REM     8 PIECES OF DATA ENTERED FOR IT.
1520 REM
1530 REM          IF THERE ARE MORE THAN TEN EVENTS IN THE NETWORK
1540 REM     ENTER A DIM STATEMENT IN LINE  1600 SUCH THAT E(T,13),
1550 REM     P(T) AND S(T) ARE DIMENSIONED, WHERE T=NUMBER OF EVENTS.
1560 REM     FOR EXAMPLE, IF YOUR NETWORK HAS 18 EVENTS, THE
1570 REM     DIM STATEMENT WOULD BE DIM E(18,13),P(18),S(18).
1580 REM     AFTER THE DATA HAS BEEN ENTERED, TYPE: RUN
1590 REM
1600 DIM E(10,13),P(10),S(10)
1610 REM T READ ALREADY AT FRONT OF PROGRAM
1620 FOR N= 1 TO T
1630 FOR I= 1 TO 8
1640 READ E(N,I)
1650 NEXT I
1660 FOR I= 9 TO 13
1670 LET E(N,I) = 0
1680 NEXT I
1690 NEXT N
1700 REM FIND TE
1710 FOR I= 1 TO T
1720 LET P(I) = 0
1730 NEXT I
1740 LET I = 1
1750 LET P(1)  = 1
1760 LET N = 1
1770 LET N = E(N,1)
1780 LET I = I + 1
1790 IF I>T THEN 2820
1800 LET P(I) = N
1810 IF E(N,7) = 0 THEN 1770
1820 LET I = I - 1
1830 IF I = 0 THEN 2200
1840 LET N = P(I)
1850 IF S(N) = 2 THEN 2040
1860 IF E(N,4) <> 0 THEN 1900
1870 LET E(N,7) = E(N,2) + E(P(I+1),7)
1880 LET E(N,8) =  E(N,3) + E(P(I+1),8)
1890 GO TO 1820
1900 LET A = E(P(I+1),7) + E(N,2)
1910 LET F = E(P(I+1),8) + E(N,3)
1920 LET N = E(N,4)
1930 LET I = I + 1
1940 LET P(I) = N
1950 IF E(N,7) <> 0 THEN 1980
1960 LET S(P(I-1)) = 2
1970 GO TO 1770
1980 LET I = I - 1
1990 IF I = 0 THEN 2100
2000 LET N=P(I)
2010 LET B = E(P(I+1),7) + E(N,5)
2020 LET G = E(P(I+1),8) + E(N,6)
2030 GO TO 2120
2040 LET B = E(P(I+1),7) + E(N,5)
2050 LET G = E(P(I+1),8) + E(N,6)
2060 LET N = E(N,1)
2070 LET C = E(N,7)
2080 LET H = E(N,8)
2090 LET N = P(I)
2100 LET A = C + E(N,2)
2110 LET F = H + E(N,3)
2120 IF A > B THEN 2160
2130 LET E(N,7) = B
2140 LET E(N,8) = G
2150 GO TO 1820
2160 LET E(N,7) = A
2170 LET E(N,8) = F
2180 GO TO 1820
2190 REM  FIND SUCCESSOR EVENTS AND RECORD TE'S
2200 FOR I = 1 TO T
2210 LET N = E(I,1)
2220 IF N = 0 THEN 2290
2230 IF E(N,9) <> 0 THEN 2270
2240 LET E(N,9) = I
2250 LET E(N,10) = E(I,2)
2260 GO TO 2290
2270 LET E(N,11) = I
2280 LET E(N,12) = E(I,2)
2290 LET N = E(I,4)
2300 IF N = 0 THEN 2370
2310 IF E(N,9) <> 0 THEN 2350
2320 LET E(N,9) = I
2330 LET E(N,10) = E(I,5)
2340 GO TO 2370
2350 LET E(N,11) = I
2360 LET E(N,12) = E(I,5)
2370 NEXT I
2380 REM  FIND TL
2390 LET E(1,13) = E(1,7)
2400 FOR K= 1 TO T
2410 IF E(K,13) = 0 THEN 2440
2420 NEXT K
2430 GOTO 2740
2440 LET N = K
2450 LET I = 1
2460 LET P(1) = N
2470 IF E(N,13) <> 0 THEN 2610
2480 LET A = E(N,9)
2490 IF E(A,13) = 0 THEN 2650
2500 LET B = E(N,11)
2510 IF B = 0 THEN 2600
2520 IF E(B,13) = 0 THEN 2690
2530 LET T1 = E(A,13) - E(N,10)
2540 LET T2 = E(B,13) - E(N,12)
2550 IF T1 < T2 THEN 2580
2560 LET E(N,13) = T2
2570 GO TO 2610
2580 LET E(N,13) = E(A,13) - E(N,10)
2590 IF I = 1 THEN 2400
2600 LET E(N,13) = E(A,13) - E(N,10)
2610 IF I = 1 THEN 2400
2620 LET I = I - 1
2630 LET N = P(I)
2640 GO TO 2470
2650 LET N = A
2660 LET I = I + 1
2670 LET P(I) = N
2680 GO TO 2470
2690 LET N = B
2700 LET I = I + 1
2710 LET P(I) = N
2720 GO TO 2470
2730 REM PRINT RESULTS
2740 PRINT "EVENT NUMBER";TAB(22);"TE";TAB(38);"V";TAB(54);"TL";
2750 PRINT TAB(62);"TOTAL SLACK"
2760 PRINT "----- ------";TAB(22);"--";TAB(38);"-";TAB(54);"--";
2770 PRINT TAB(62);"----- -----"
2780 PRINT
2790 FOR N = T TO 1 STEP -1
2800 PRINT USING " -####            -####.#        -####.#         -####.#      -####.#",N,E(N,7),E(N,8),E(N,13),E(N,13)-E(N,7)
2810 NEXT N
2815 STOP
2820 PRINT "DATA NOT CONSISTENT--OR NO TE SPECIFIED"
2830 STOP
3000 DATA 4E36
9999 END




		    plotto.basic                    03/17/75  1551.7r w 03/17/75  1548.5       27612



10 REM  PLOTTO
100 GO TO 840
104 READ A1,H,I,J,E1,F1
108 LET G=(F1-E1)/40
112 LET G1=G/2
116 PRINT
120 PRINT" ","MULTIPLE PLOT OF THE FUNCTIONS ";
124 FOR K=1TO A1
128 GOSUB 1080
132 IF K=A1THEN 144
136 PRINT", ";
140 NEXT K
144 PRINT
148 PRINT" ","         HORIZ INCREMENT =";G
152 GOSUB 710
156 GOSUB 730
160 PRINT"X-VALUE"
164 LET X=H-J
168 PRINT
172 LET L1=0
176 LET X=X+J
180 IF X>I THEN 660
184 PRINTX,
260 LET Y=E1-G
270 PRINT" ";
280 LET Y=Y+G
290 IF Y>F1THEN 168
300 IF ABS(A-Y)<G1THEN 420
310 IF A1<2THEN 270
320 IF ABS(B-Y)<G1THEN 460
330 IF A1<3THEN 270
340 IF ABS(C-Y)<G1THEN 500
350 IF A1<4THEN 270
360 IF ABS(D-Y)<G1THEN 540
370 IF A1<5THEN 270
380 IF ABS(E-Y)<G1THEN 580
390 IF A1<6THEN 270
400 IF ABS(F-Y)<G1THEN 620
410 GOTO  270
420 PRINT"A";
430 LET L1=L1+1
440 IF L1=A1THEN 168
450 GOTO  280
460 PRINT"B";
470 LET L1=L1+1
480 IF L1=A1THEN 168
490 GOTO  280
500 PRINT"C";
510 LET L1=L1+1
520 IF L1=A1THEN 168
530 GOTO  280
540 PRINT"D";
550 LET L1=L1+1
560 IF L1=A1THEN 168
570 GOTO  280
580 PRINT"E";
590 LET L1=L1+1
600 IF L1=A1THEN 168
610 GOTO  280
620 PRINT"F";
630 LET L1=L1+1
640 IF L1=A1THEN 168
650 GOTO  280
660 PRINT
670 GOSUB 730
680 GOSUB 710
690 PRINT
700 GOTO  750
710 PRINT TAB(5), E1, TAB(45), F1
720 RETURN
730 PRINT" "," :....:....:....:....:....:....:....:....:"
740 RETURN
750 PRINT
760 PRINT
770 PRINT "TYPE 'S' TO STOP, OR GIVE NEW VALUES OF"
780 PRINT"NUM,XMIN,XMAX,DELX,HMIN,HMAX";
790 INPUT A1,H,I,J,E1,F1
800 PRINT
810 PRINT
820 GO TO 108
840 PRINT
850 PRINT"THIS PROGRAM PLOTS ONE TO  SIX FUNCTIONS OF X SIMULTANEOUSLY."
860 PRINT"ALL FUNCTIONS HAVE THE SAME UPPER AND LOWER LIMITS FOR  THE"
870 PRINT"PLOT.  THE FUNCTIONS ARE CALLED A,B,C,D,E,F AND ARE PLOTTED"
880 PRINT"IN THAT ORDER OF PRIORITY.  WHERE PLOTS WOULD OVERLAP, THE"
890 PRINT"LOWER PRIORITY FUNCTIONS ARE SUPPRESSED.  VALUES EXCEEDING"
900 PRINT"THE SELECTED BOUNDS ARE DISREGARDED.  ENTER INFOR MATION FOR "
910 PRINT "A RUN IN THE FOLLOWING FORMAT:"
920 PRINT
930 PRINT"   100 DATA NUM,XMIN,XMAX,DELX,HMIN,HMAX"
940 PRINT"   200 LET  A= ANY 'BASIC' FUNCTION OF X"
950 PRINT"   210 LET  B= ANY 'BASIC' FUNCTION OF X AND/OR A"
960 PRINT"   220 LET  C= DITTO  FOR  X AND/OR A AND/OR B"
970 PRINT"   230 (SIMILARLY FOR  D)"
980 PRINT"   240 (SIMILARLY FOR  E)"
990 PRINT"   250 (SIMILARLY FOR  F)"
1000 PRINT"   RUN"
1005 IF O0=1 THEN 1270
1010 PRINT
1020 PRINT"WHERE NUM IS THE NUMBER OF FUNCTIONS GIVEN (1-6), XMIN AND"
1030 PRINT"XMAX ARE THE LOWER AND UPPER LIMITS FOR  X, DELX IS THE IN-"
1040 PRINT"CREMENT FOR  X, AND HMIN AND HMAX ARE THE LOWER AND UPPER"
1050 PRINT"LIMITS FOR  THE VALUES OF THE FUNCTION.  NOTE THAT THE HOR-"
1060 PRINT"IZONTAL INCREMENT IS ALWAYS (HMAX-HMIN)/40."
1070 STOP
1080 IF K=1THEN 1150
1090 IF K=2THEN 1170
1100 IF K=3THEN 1190
1110 IF K=4THEN 1210
1120 IF K=5THEN 1230
1130 IF K=6THEN 1250
1140 PRINT"MORE THAN SIX FUNCTIONS SPECIF IED.  STO P."
1150 PRINT"A";
1160 RETURN
1170 PRINT"B";
1180 RETURN
1190 PRINT"C";
1200 RETURN
1210 PRINT"D";
1220 RETURN
1230 PRINT"E";
1240 RETURN
1250 PRINT"F";
1260 RETURN
1270 END




		    polfit.basic                    03/17/75  1551.7r w 03/17/75  1549.2       49563



3REM P O L F I T
4REM
7REM       (DO NOT RESEQUENCE)
8 PRINT"POLFIT"
10 GO TO 1890
19 READ M,N
20 DIM A(15),B(15),S(15),G(16),U(15)
25 DIM Q(100),P(100),X(100),Y(100),C(100)
30 LET Z=0
33 LET O = 1
34 DEF FNL(P) = .43429448 * LOG(P)
35 LET O9 = 1E-19
36 LET O8 = 1E19
37 LET O7 = 1E38
38 LET O6 = 1E-38
39 DEF FNR(P) = INT(P*1000000+.5)/1000000
40 LET K=12
45 LET N=N+1
50 IF N > 12 THEN 1870
55 IF M <  N THEN 2170
60 IF M >100 THEN 1840
70 LET T7=Z
75 LET T8=Z
80 LET W7=Z
100 DATA 1,38.1,1.5,14.67,2,12.76,2.5,13.15,3,11.78
101 DATA 3.5,1.67,4,5.35,4.5,14.6,5,5.3,5.5,1.67,6
102 DATA 8.91,6.5,15.67
300 FOR I=1 TO M
310 READ X(I),Y(I)
320 LET W7=W7+X(I)
330 LET T7=T7+Y(I)
340 LET T8=T8+Y(I)^2
350 NEXT I
360 LET T9=(M*T8-T7^2)/(M^2-M)
370 PRINT
380 PRINT "L E A S T - S Q U A R E S   P O L Y N O M I A L S"
390 PRINT
391 PRINT "VERSION OF 9/16/69"
392 PRINT
400 PRINT "       NUMBER OF POINTS =";M
410 PRINT "        MEAN VALUE OF X =";W7/M
420 PRINT "        MEAN VALUE OF Y =";T7/M
430 PRINT "         STD ERROR OF Y =";SQR(T9)
440 PRINT
450 PRINT "   NOTE:  CODE FOR 'WHAT NEXT?' IS:"
460 PRINT
470 PRINT "           0 = STOP PROGRAM"
480 PRINT "           1 = COEFFICIENTS ONLY"
490 PRINT "           2 = ENTIRE SUMMARY"
500 PRINT "           3 = FIT NEXT HIGHER DEGREE"
510 PRINT
520 PRINT
530 FOR I=1 TO M
540 LET P(I) = Z
550 LET Q(I) = O
560 NEXT I
570 FOR I = 1 TO 11
580 LET A(I) = Z
590 LET B(I) = Z
600 LET S(I) = Z
610 NEXT I
620 LET E1=Z
630 LET F1=Z
640 LET W1=M
650 LET N4=K
660 LET I=1
670 LET K1=2
680 IF N=0 THEN 700
690 LET K1=N4
700 LET W=Z
710 FOR L=1 TO M
720 LET W=W+Y(L)*Q(L)
730 NEXT L
740 LET S(I)=W/W1
750 IF I-N4>=0 THEN 1090
760 IF I-M>=0 THEN 1090
770 LET E1=Z
780 FOR L=1 TO M
790 LET A9 = ABS(Q(L))
800 IF A9 < O9 THEN 860
801 LET X9 = ABS(X(L))
802 IF X9 < O6 THEN 844
803 REM: SO  X & Q  NOT TOO CLOSE TO 0.0 FOR LOG
810 LET L2 = FNL(X9) + 2*FNL(A9)
820 IF L2 < 38 THEN 850
821 REM: SO  X & Q  TOO BIG FOR  X*Q^2
830 LET E1 = O7
831 LET L2 = 38
840 GO TO 870
844 IF A9 < 1  THEN 860
846 IF A9 < O8 THEN 850
847 REM: SO  Q  TOO BIG FOR  Q^2
849 GO TO 830
850 LET E1 = E1 + X(L) * A9^2
860 NEXT L
870 IF L2 - FNL(W1) > (-38) THEN 900
880 LET E1 = 0
890 GO TO 910
900 LET E1 = E1/W1
910 LET A(I+1)=E1
920 LET W=Z
930 FOR L=1 TO M
940 LET V=(X(L)-E1)*Q(L)-F1*P(L)
950 LET P(L)=Q(L)
960 LET Q(L)=V
970 LET V9 = ABS(V)
980 IF V9 < O9 THEN 1030
990 IF V9 < O8 THEN 1020
1000 LET W = O7
1010 GO TO 1040
1020 LET W=W+V*V
1030 NEXT L
1040 LET F1= W/W1
1050 LET B(I+2)=F1
1060 LET W1=W
1070 LET I=I+1
1080 GOTO 700
1090 FOR L = 1 TO 13
1100 LET G(L)=Z
1110 NEXT L
1120 REM:
1130 LET G(2) = O
1140 FOR J=1 TO N
1150 LET S1 = Z
1160 FOR L = 2 TO N+1
1170 IF L=2 THEN 1190
1180 LET G(L) = G(L) - A(L-1)*G(L-1) - B(L-1)*G(L-2)
1190 LET S1 = S1 + S(L-1)*G(L)
1200 NEXT L
1210 LET U(J)=S1
1220 REM:
1230 LET L = N+1
1240 FOR I2=2 TO N
1250 LET G(L)=G(L-1)
1260 LET L=L-1
1270 NEXT I2
1280 LET G(2) = Z
1290 NEXT J
1300 REM: 
1310 PRINT
1320 LET T=Z
1330 FOR L=1 TO M
1340 LET C(L)=Z
1350 LET J=N
1360 FOR I2=1 TO N
1370 LET C(L)=C(L)*X(L)+U(J)
1380 LET J=J-1
1390 NEXT I2
1400 LET T3=Y(L)-C(L)
1410 LET T=T+T3^2
1420 NEXT L
1430 IF M<>N THEN 1460
1440 LET T5=0
1450 GOTO 1470
1460 LET T5=T/(M-N)
1470 LET Q7 = 1 - T/(T9*(M-1))
1490 PRINT "POLYFIT OF DEGREE";N-1;
1500 PRINT "INDEX OF DETERM =";FNR(Q7);
1510 GOSUB 2200
1540 IF R=0 THEN 9999
1550 IF R=3 THEN 1810
1555 PRINT""
1560 PRINT TAB(8),  "TERM "," COEFFICIENT"
1570 PRINT
1580 FOR J=1 TO N
1590 LET I2=J-1
1600 PRINT I2,U(J)
1610 NEXT J
1620 IF R=1 THEN 1780
1630 PRINT
1640 PRINT "    X-ACTUAL","    Y-ACTUAL","      Y-CALC","        DIFF";
1650 PRINT "       PCT-DIFF"
1660 PRINT
1670 FOR L=1 TO M
1680 LET Q8=Y(L)-C(L)
1690 PRINT X(L),Y(L),C(L),Q8,
1700 IF C(L)=0 THEN 1730
1710 PRINT 100*Q8/C(L)
1720 GOTO 1740
1730 PRINT "INFINITE"
1740 NEXT L
1750 PRINT
1760 PRINT "          STD ERROR OF ESTIMATE FOR Y =";SQR(T5)
1770 IF K=N THEN 9999
1780 PRINT
1790 GOSUB 2200
1800 GOTO 1540
1810 LET N=N+1
1820 IF M<N THEN 2170
1830 GOTO 1090
1840 PRINT
1850 PRINT "PROGRAM SIZE LIMIT IS 100 DATA POINTS."
1860 GOTO 9999
1870 PRINT "ELEVENTH DEGREE IS THE LIMIT."
1880 GOTO 9999
1890 PRINT "MINIMUM INSTRUCTION = 0,  ALL = OTHER #, WHICH...";
1900 INPUT O0
1910 IF O0=0 THEN 2090
1920 PRINT
1930 PRINT "REVISED  9/16/69"
1940 PRINT 
1950 PRINT "FITS LEAST-SQUARES POLYNOMIALS TO BIVARIATE DATA BY";
1960 PRINT " ORTHOGONAL POLYNMLS."
1970 PRINT 
1980 PRINT "   LIMITS :   11-TH DEGREE FIT   &   MAX OF 100 DATA POINTS."
1985 PRINT"  BUT FITS HIGHER THAN DEGREE 5 MAY GIVE POOR RESULTS."
1990 PRINT "   POLFIT ALLOWS USER TO SPECIFY THE LOWEST DEGREE POLYNOM";
2000 PRINT "IAL TO BE FIT"
2010 PRINT"   AND THEN FITS POLYNOMIALS IN ORDER OF ASCENDING DEGREE."
2020 PRINT"   AT EACH STAGE, THE INDEX OF DETERMINATION IS PRINTED, AND"
2030 PRINT"   THEN THE USER HAS THE CHOICE OF:"
2040 PRINT"       GOING TO NEXT HIGHER FIT, OR"
2050 PRINT"       GETTING ONE OF TWO SUMMARIES, OR"
2060 PRINT"       STOPPING THE PROGRAM."
2070 PRINT
2080 PRINT "TO USE, TYPE:"
2090 PRINT
2100 PRINT "   10   DATA N,D"
2110 PRINT "          (WHERE N = NUMBER OF DATA POINTS TO BE READ"
2120 PRINT "             AND D = INITIAL [LOWEST] DEGREE TO BE FIT)"
2130 PRINT "   100 DATA X(1),Y(1),X(2),Y(2),....,X(N),Y(N)"
2140 PRINT "         (CONTINUATION ON LINES 101-299 AS NEEDED)"
2150 PRINT "   RUN"
2160 GO TO 9999
2170 PRINT
2180 PRINT "TOO FEW POINTS FOR FITTING DEGREE";N-1
2190 GOTO 9999
2200 PRINT "   WHAT NEXT";
2210 INPUT R
2220 RETURN
9999 END




		    return.basic                    03/17/75  1551.7r w 03/17/75  1549.2       45567



10REM  RETURN      (BASIC PROGRAM BEGINS AT LINE 115)
12REM REVISED AUGUST 1972
15REM
20REM  DESCRIPTION-- THIS BASIC PROGRAM COMPUTES A MATRIX OF
30REM  RETURNS FOR AN INVESTMENT IN A SECURITY, IT THEN COMPUTES
35REM  AN AVERAGE RETURN FOR A PURCHASE AT THE BEGINNING OF A
40REM  YEAR, SELLING AT EACH OF THE FOLLOWING YEAR ENDS, AND
45REM  COMPUTES AN AVERAGE RETURN FOR ALL DESIGNATED HOLDING
50REM  PERIODS. IT ALSO COMPUTES AN AVERAGE RETURN, STANDARD
55REM  DEVIATION AND COEFFICIENT OF VARIATION FOR DIFFERENT
60REM  LENGTH HOLDING PERIODS.
70REM
75REM-------------------------------------------------------------
80REM INSTRUCTIONS--SAMPLE DATA-NO. OF YRS.,BASE YR.-DIVIDENDS
85REM               PER YR.,ANNUAL CLOSING PRICE ARE PRESENTLY
90REM               ENTERED STARTING IN LINE 1000
95REM               TYPE "RUN" AND PROGRAM WILL ASK IF YOU HAVE
100REM              ALREADY ENTERED OR WISH TO ENTER DATA.
102REM
105REM-------------------------------------------------------------
110 DIM D(25),P(25),W(25,25)
115 PRINT "DO YOU WANT INSTRUCTIONS FOR SUPPLYING DATA";
120 INPUT A$
125 IF A$="DATA" THEN 240
130 IF A$="NO" THEN 265
135 PRINT
140 PRINT"OR HOW MANY YEARS DO YOU WISH TO ENTER PRICE AND DIVIDEND"
145 PRINT"DATA, REMEMBERING THE NEED FOR A BASE YEAR. E.G., 10 YEARS"
150 PRINT"OF DATA ARE NEEDED TO GIVE 9 ANNUAL RETURNS. THE MAXIMUM"
155 PRINT"NUMBER OF YEARS IS 25.  ";
160 INPUT N
165 PRINT
170 PRINT"WHAT IS THE FIRST YEAR FOR WHICH YOU WISH TO ENTER DATA";
175 INPUT Y1
180 PRINT
185 PRINT"ENTER THE DIVIDEND PER SHARE (DPS) AND THE CLOSING SECURITY"
190 PRINT"PRICE (CSP), SEPARATED BY A COMMA, FOR EACH OF THE FOLLOWING"
195 PRINT"YEARS:"
200 PRINT
205 PRINT TAB(12);"DPS, CSP"
210 PRINT
215 FOR I=1 TO N
220 PRINT"YEAR";Y1+(I-1);
225 INPUT D(I),P(I)
230 NEXT I
235 GOTO 285
240 READ N,Y1
245 FOR I=1 TO N
250 READ D(I),P(I)
255 NEXT I
260 GOTO 285
265 PRINT
270 PRINT "NO. OF YEARS, FIRST YEAR";
275 INPUT N,Y1
280 GOTO 200
285 PRINT
290 PRINT"-----------------------------------------------------------"
300 FOR I = 1 TO (N-1)
305 FOR J = (I+1) TO N
310 LET B = 0
315 FOR C = 1 TO 5
320 LET Q = .1^C
325 LET B = B + Q
330 LET E = 0
335 FOR F = (I+1) TO J
340 LET E = (D(F)*(1/((1+B)^(F-I)))) + E
345 NEXT F
350 LET E = E + P(J)*(1/((1+B)^(J-I)))
355 IF E-P(I)>0 THEN 325
360 LET B = B-Q
365 NEXT C
370 IF B = 0 THEN 380
375 GO TO 390
380  LET B = -.8
385 GO TO 315
390 LET W(I,J) =B
395 NEXT J
400 NEXT I
405 PRINT
410 PRINT
415 PRINT
420 PRINT
425 PRINT"                 RETURNS ON INVESTMENTS"
430 PRINT"                 ----------------------"
435 PRINT TAB(11);"(ANNUAL RATES COMPOUNDED ANNUALLY)"
440 PRINT
445 PRINT
450 FOR K=1 TO (N-1) STEP4
455 IF N-1-K<4 THEN540
460 PRINT"   TO",Y1+K,Y1+(K+1),Y1+(K+2),Y1+(K+3)
465 PRINT"FROM"
470 FOR I=1 TO K
475 PRINT Y1+(I-1),
480 FOR J=(K+1) TO (K+4)
485 PRINT W(I,J),
490 NEXT J
495 NEXT I
500 PRINT Y1+K," ",W(K+1,K+2),W(K+1,K+3),W(K+1,K+4)
505 PRINT Y1+K+1," "," ",W(K+2,K+3),W(K+2,K+4)
510 PRINT Y1+K+2," "," "," ",W(K+3,K+4)
515 PRINT
520 PRINT
525 PRINT
530 NEXT K
535 GO TO 665
540 PRINT"   TO",
545 FOR I=K TO (N-1)
550 PRINT Y1+I,
555 NEXT I
560 LET Q=4-(N-K)
565 GOSUB 645
570 PRINT"FROM"
575 FOR I=1 TO N-1
580 PRINT Y1+(I-1),
585 IF I<=(N-(N-K)) THEN 610
590 LET Q=I-K
595 GOSUB 645
600 LET J=K+1+Q
605 GO TO 615
610 FOR J=K+1 TO N
615 PRINT W(I,J),
620 NEXT J
625 LET Q=4-(N-K)
630 GOSUB 645
635 NEXT I
640 GO TO 665
645 FOR H=1 TO Q
650 PRINT " ",
655 NEXT H
660 RETURN
665 PRINT
670 PRINT
675 PRINT
680 LET X=0
685 LET Y=0
690 LET V=0
695 FOR I=1 TO (N-1)
700 FOR J=(I+1) TO N
705 LET X=W(I,J)+X
710 LET Y=W(I,J)+Y
715 NEXT J
720 PRINT"AVERAGE RETURN FROM";Y1+(I-1);"=";X/(N-I)
725 LET V=(N-I)+V
730 PRINT
735 LET X=0
740 NEXT I
745 PRINT
750 PRINT" AVERAGE RETURN FOR ALL"
755 PRINT"POSSIBLE HOLDING PERIODS =";Y/V
760 PRINT
765 PRINT
770 PRINT"               ----------------------------"
775 PRINT
780 PRINT
785 PRINT TAB(35);"AVERAGE";TAB(47);"STANDARD";TAB(61);"COEFF."
790 PRINT TAB(36);"RETURN";TAB(47);"DEVIATION";TAB(60);"VARIATION"
795 PRINT
800 LET V3=0
805 LET N2 = 0
810 LET X2 = 0
815 LET Y2 = 0
820 LET V2 = 0
825 FOR I = 1 TO (N-1)
830 FOR J = 1 TO N
835 IF J + I > N THEN 855
840 LET X2 = W(J,J+I) + X2
845 LET V2 = W(J,J+I) + V2
850 NEXT J
855 LET X2 = X2/(J-1)
860 FOR J = 1 TO N
865 IF J + I > N THEN 885
870 LET Y2 = (W(J,J+I)-X2)^2+Y2
875 LET V3 = (W(J,J+I))^2+V3
880 NEXT J
885 LET Y2 = SQR(Y2/(J-1))
890 PRINT "FOR ALL";I;"YEAR HOLDING PERIODS:";TAB(35);X2;TAB(47);Y2;
895 PRINT TAB(60);Y2/X2
900 PRINT
905 LET X2 = 0
910 LET Y2=C3=0
915 NEXT I
920 IF V-1 =0 THEN 930
925 LET C3=SQR((V*V3-V2*V2)/V/(V-1))
930 PRINT "FOR ALL POSSIBLE HOLDING PERIODS:";TAB(35);V2/V;TAB(47);C3;
935 PRINT TAB(60);C3/(V2/V)
940 PRINT
945 PRINT
950 PRINT
955 PRINT"-----------------------------------------------------------"
1000 DATA 10,1962
1010 DATA 0,39.25
1020 DATA 1.02,43.65
1030 DATA 1.10,46.75
1040 DATA 1.20,60.125
1050 DATA 1.30,60.00
1060 DATA 1.30,58.00
1070 DATA 1.30,50.25
1080 DATA 1.30,49.125
1090 DATA 1.30,47.25
1100 DATA 1.40,66.50
9999 END




		    saving.basic                    03/17/75  1551.7r w 03/17/75  1549.6        9873



3REM S A V I N G
4REM
10 PRINT"SAVING"
100 PRINT
110 PRINT "    THIS PROGRAM CALCULATES THE AMOUNT OF MONEY THAT"
120 PRINT "WOULD ACCUMULATE AFTER N YEARS AT AN ANNUAL INTEREST"
130 PRINT "RATE R COMPOUNDED T TIMES PER YEAR, WHEN THE INITIAL"
140 PRINT "AMOUNT IS P AND AN AMOUNT D IS ADDED AT THE BEGINNING"
150 PRINT "OF EACH SUBSEQUENT YEAR.  NOTE THAT P AND D ARE GIVEN"
160 PRINT "IN DOLLARS, N AND T MUST BE INTEGERS, AND R IS GIVEN"
170 PRINT "AS A PERCENTAGE."
180 PRINT
190 PRINT "WHAT ARE P,D,N,T,R";
200 INPUT L,N,Y,X,A
210 IF X<>0 THEN 250
220 PRINT
230 PRINT "X MUST NOT EQUAL ZERO..."
240 GOTO 180
250 LET D=0
260 LET B=.01*A
270 LET S=L
280 LET D=0
290 LET S=L
300 FOR Z=1 TO Y
310 LET S=S+D
320 FOR W=1 TO X
330 LET S=S*(1+B/X)
340 NEXT W
350 LET D=N
360 NEXT Z
370 PRINT
380 PRINT "   AFTER ";Y;"YEARS, ";L;"DOLLARS INVESTED AT";A
390 PRINT "   PERCENT COMPOUNDED ";X;"TIMES PER YEAR, WITH THE"
400 PRINT "   ADDITION OF ";N;"DOLLARS PER YEAR, YIELDS A TOTAL"
410 PRINT "   OF ";S;"DOLLARS."
420 PRINT
430 PRINT "MORE DATA (1=YES,0=NO)";
440 INPUT I
450 IF I=1 THEN 190
9999 END




		    stat12.basic                    03/17/75  1551.7r w 03/17/75  1549.8       13932



5 REM ---STAT12---OCT 27, 1969
10   REM  DESCRIPTION: COMPUTES THE CORRELATION MATRIX FOR N 
20   REM  SERIES OF DATA.
40   REM  INSTRUCTIONS: ENTER DATA STARTING IN LINE 900 IN THE 
50   REM  FOLLOWING ORDER:  1) THE NUMBER OF SERIES, 2) THE NUMBER
60   REM  IN EACH SERIES, 3) THEN THE DATA BY GROUP (NOT BY SERIES).
70   REM  THIS PROGRAM IS LIMITED TO 25 SERIES, WITH AN ARBITRARY
75   REM  NUMBER IN EACH SERIES.  TO INCREASE THE MAXIMUM NUMBER OF 
80  REM  SERIES, CHANGE THE DIM STATEMENTS IN LINE 100.
90  READ O0
91  RESET
92  IF O0 <> 999999 THEN 100
93  PRINT "LIST LINES 10 TO 85 FOR INSTRUCTIONS"
94 STOP
100 DIM S(25,25),D(25),X(25)
110  READ N, M
170  LET X(0) = 1
200  FOR K = 1 TO M
210  FOR I = 1 TO N
220  READ X(I)
230  NEXT I
240  FOR I = 0 TO N
250  FOR J = I TO N
260  LET S(I,J) = S(I,J) + X(I)*X(J)
270  NEXT J
280  NEXT I
290  NEXT K
300  REM HAVING COMPUTED THE SUM-OF-SQUARES MATRIX, WE CONTINUE.
305  PRINT TAB(3);"VARIABLE";TAB(23);"MEAN";TAB(34);"VARIANCE";
306  PRINT TAB(48);"STD. DEV."
310  FOR I = 1 TO N
320  LET M1 = S(0,I) / M
330  LET Q = ( M * S(I,I) -S(0,I)*S(0,I) ) / M / (M-1)
340  LET D(I) = SQR(Q)
350  PRINT I, M1, Q, D(I)
360  NEXT I
600  REM NOW WE PRODUCE AND PRINT THE CORRELATION MATRIX...
605  PRINT
610  PRINT "THE CORRELATION MATRIX"
620  PRINT
630  FOR I = 1 TO N
635 IF I = 1 THEN 670
640  FOR J = 1 TO I-1
650 PRINT " ",
660  NEXT J
670  FOR J = I TO N
680  PRINT (M*S(I,J) - S(0,I)*S(0,J))/M/(M-1)/D(I)/D(J),
690  NEXT J
700  PRINT
710  PRINT
720  NEXT I
730  STOP
900 DATA 999999
9999 END




		    triang.basic                    03/17/75  1551.7r w 03/17/75  1550.0       32886



3REM T R I A N G
4REM
6 PRINT "TRIANG"
10 DIM A(10),B(10),C(10),H(10),R(10),S(10)
100 PRINT
105 DEF FNS(I)= .01*INT(6000*(B(I)-INT(B(I)))+.5)
110 PRINT "THIS PROGRAM WILL FIND THE UNKNOWN FEATURES OF ANY"
115 PRINT "TRIANGLE, GIVEN ONE SIDE AND ANY TWO OTHER PARTS."
120 PRINT
125 PRINT
130 PRINT "WHAT WILL BE GIVEN (1=SSS, 2=SAS, 3=SSA, 4=ASA, 5=AAS)";
135 INPUT N
140 PRINT
145 LET R8=0
150 LET R9=0
155 IF (N-1)*(N-2)*(N-3)*(N-4)*(N-5)=0 THEN 170
160 PRINT "ANSWER 1, 2, 3, 4, OR 5 PLEASE...."
165 GOTO 125
170 IF N=1 THEN 210
175 PRINT "NOTE: SPECIFY ANGLES AS 'DEGREES, MINUTES, SECONDS'  OR"
180 PRINT "      'DEGREES, MINUTES.DECIMAL, 0' (I.E., SECONDS=0)"
185 PRINT
190 IF N=2 THEN 230
195 IF N=4 THEN 270
200 IF N=5 THEN 335
205 IF N=3 THEN 385
210 PRINT "WHAT ARE SIDE1, SIDE2, SIDE3";
215 INPUT S(1),S(2),S(3)
220 GOSUB 540
225 GOTO 630
230 PRINT "WHAT ARE SIDE1, ANGLE3, SIDE2";
235 INPUT S(1),A(3),B(3),C(3),S(2)
240 GOSUB 830
245 LET I=3
250 GOSUB 620
255 LET S(3)=SQR(S(1)^2+S(2)^2-2*S(1)*S(2)*COS(R(3)))
260 GOSUB 540
265 GOTO 630
270 PRINT "WHAT ARE ANGLE1, SIDE3, ANGLE2";
275 INPUT A(1),B(1),C(1),S(3),A(2),B(2),C(2)
280 GOSUB 830
285 FOR I=1 TO 2
290 GOSUB 620
295 NEXT I
300 LET R(3)=3.14159265-R(1)-R(2)
305 LET I=3
310 GOSUB 575
315 FOR I=1 TO 2
320 GOSUB 530
325 NEXT I
330 GOTO 630
335 PRINT "WHAT ARE ANGLE3, ANGLE1, SIDE3";
340 INPUT A(3),B(3),C(3),A(1),B(1),C(1),S(3)
345 GOSUB 830
350 FOR I=1 TO 3 STEP 2
355 GOSUB 620
360 NEXT I
365 LET R(2)=3.14159265-R(1)-R(3)
370 LET I=2
375 GOSUB 575
380 GOTO 315
385 PRINT "WHAT ARE SIDE1, SIDE3, ANGLE1";
390 INPUT S(1),S(3),A(1),B(1),C(1)
395 GOSUB 830
400 LET R8=1
405 LET I=1
410 GOSUB 620
415 LET T=(S(3)*SIN(R(1)))/S(1)
420 IF T-1>0.0000001 THEN 515
425 IF 1-T>0.00000001 THEN 440
430 LET R(3)=1.57079632
435 GOTO 445
440 LET R(3)=ATN(T/SQR(1-T^2))
445 LET R(2)=3.14159265-R(1)-R(3)
450 LET I=2
455 GOSUB 530
460 FOR I=2 TO 3
465 GOSUB 575
470 NEXT I
475 IF R9=1 THEN 510
480 IF S(3)>S(1) THEN 490
485 GO TO 505
490 PRINT
495 PRINT "ONE SOLUTION IS:"
500 GO TO 510
505 LET R8 = 0
510 GOTO 630
515 PRINT
520 PRINT "NO SOLUTION POSSIBLE...."
525 GOTO 800
530 LET S(I)=(S(3)/SIN(R(3)))*SIN(R(I))
535 RETURN
540 LET P=(S(1)+S(2)+S(3))/2
545 LET R=SQR(((P-S(1))*(P-S(2))*(P-S(3)))/P)
550 FOR I=1 TO 3
555 LET R(I)=2*ATN(R/(P-S(I)))
560 GOSUB 575
565 NEXT I
570 RETURN
575 LET X1=57.2957795*R(I)
580 LET A(I)=INT(X1)
585 LET B(I)=60*(X1-A(I))
590 IF ABS(60-B(I))>0.00005 THEN 605
595 LET B(I)=0
600 LET A(I)=A(I)+1
605 IF ABS(B(I))>0.0001 THEN 615
610 LET B(I)=0
615 RETURN
620 LET R(I)=(A(I)+B(I)/60)/57.2957795
625 RETURN
630 GOSUB 540
635 LET W=R*P
640 LET R1=S(1)/(2*SIN(R(1)))
645 LET H(1)=S(3)*SIN(R(2))
650 LET H(2)=S(1)*SIN(R(3))
655 LET H(3)=S(2)*SIN(R(1))
660 PRINT
665 IF R9=1 THEN 685
670 PRINT
675 PRINT " ","        1","        2","        3"
680 PRINT " ","     -------","     -------","     -------"
685 PRINT
690 PRINT "SIDE",S(1),S(2),S(3)
695 PRINT
700 PRINT "ANGLE (RAD)",R(1),R(2),R(3)
705 PRINT
710 PRINT "ANGLE (DEG)",A(1),A(2),A(3)
715 PRINT "      (MIN)", INT(B(1)),INT(B(2)),INT(B(3))
720 PRINT "      (SEC)", FNS(1), FNS(2), FNS(3)
725 PRINT
730 PRINT "ALT TO SIDE",H(1),H(2),H(3)
735 PRINT
740 PRINT
745 PRINT "RADIUS OF CIRCUMSCR CIRCLE = ";R1
750 PRINT "RADIUS OF INSCRIBED CIRCLE = ";R
755 PRINT "          AREA OF TRIANGLE = ";W
760 PRINT
765 IF R9=1 THEN 800
770 IF R8=0 THEN 800
775 PRINT
780 PRINT "A SECOND SOLUTION IS:"
785 LET R9=1
790 LET R(3)=3.14159265-R(3)
795 GOTO 445
800 PRINT
805 PRINT
810 PRINT "ANOTHER CASE (1=YES)";
815 INPUT Q
820 IF Q=1 THEN 120
825 STOP
830 FOR I=1 TO 3
835 LET B(I)= B(I) + C(I)/60
840 NEXT I
845 RETURN
9999 END




		    truint.basic                    07/27/78  1745.2r w 07/27/78  1745.3       13428



3REM T R U I N T
7 PRINT "DO YOU WANT INSTRUCTIONS, (1=YES, 0=NO)"
8 INPUT Y7
9 IF Y7=0 THEN 80
10 PRINT"TRUINT"
20 PRINT "THIS PROGRAM WILL CALCULATE THE TRUE ANNUAL INTEREST"
30 PRINT "RATE CHARGED ON AN INSTALLMENT LOAN.  YOU SUPPLY THE"
40 PRINT "VALUES OF FOUR VARIABLES:  A = AMOUNT OF LOAN (IN $),"
50 PRINT "P = AMOUNT OF EACH PAYMENT ($), N = THE TOTAL NUMBER"
60 PRINT "OF PAYMENTS DUE, AND  K = THE NUMBER OF PAYMENTS DUE"
70 PRINT "IN ONE YEAR.  ";
80 PRINT "WHAT ARE A,P,N,K";
90 INPUT A, P, N, K
100 PRINT
110 IF N=1 THEN 510
120 IF P*N>=A THEN 180
130 PRINT
140 PRINT "THAT'S NOT REASONABLE.  THE PAYMENTS ADD UP"
150 PRINT "TO LESS THAN THE AMOUNT OWED.  TRY AGAIN:"
160 PRINT
170 GOTO 80
180 LET R=0
190 LET D=100
200 GOSUB 290
210 IF P=P1 THEN 390
220 IF P>P1 THEN 250
230 LET R=R-D
240 GOTO 260
250 LET R=R+D
260 LET D=D/2
270 IF D<0.0001 THEN 390
280 GOTO 200
290 LET R1=R/(100*K)
300 LET Q=1+R1
310 IF N*LOG(Q)/LOG(10)<=75 THEN 340
320 LET P1=A*R1
330 RETURN
340 IF Q>1 THEN 370
350 LET P1=A/N
360 RETURN
370 LET P1=A*Q^N*R1/(Q^N-1)
380 RETURN
390 LET R=0.01*INT(0.5+100*R)
400 LET R2=.01*INT(.5+10000*((1+R/(100*K))^K-1))
410 IF R<199.5 THEN 460
420 PRINT
430 PRINT "RATE WOULD BE OVER 200 PERCENT.  TRY AGAIN:"
440 PRINT
450 GOTO 80
460 PRINT "TRUE ANNUAL INTEREST RATE (NOMINAL)=";R
470 PRINT "TRUE ANNUAL INTEREST RATE (EFFECTIVE)=";R2
480 PRINT
490 PRINT "ANOTHER CASE?  (TYPE 'S' TO STOP NOW)."
500 GOTO 80
510 LET R=(P/A-1)*K
520 LET R=100*R
530 GOTO 390
9999 END




		    twoplo.basic                    03/17/75  1551.7r w 03/17/75  1550.0       24336



3REM T W O P L O
8 LET J=0
9 LET P7=0
10 GO TO 620
100 LET Y1=Z
105 LET T=0
110 LET T1=0
115 IF J=0 THEN 125
120 RETURN
125 PRINT
130 PRINT "WHAT ARE  FMIN,FMAX,XMIN,XMAX,DELX";
135 INPUT Q0,Q1,Q2,Q3,Q4
140 LET Q5=(Q1-Q0)/60
145 LET Q6=0
150 LET J=2
155 FOR X = Q2 TO Q3 STEP Q4
160 GOSUB 10
165 IF Q6=0 THEN 315
170 IF Q6 = 20 THEN 185
175 PRINT " . ";
180 GOTO 195
185 PRINT " - ";
190 LET Q6 = 10
195 IF Y > Q1 THEN 305
200 IF Y1>Q1 THEN 305
205 IF Y < Q0 THEN 305
210 IF Y1<Q0 THEN 305
215 LET Q7 = Q0 + 2*Q5
220 LET Z=Q7+0.5*Q5
225 IF T>0 THEN 435
230 IF Z<Y THEN 430
235 IF T1>0 THEN 250
240 IF Z<Y1 THEN 250
245 GOTO 490
250 IF Z-Y>=2*Q5 THEN 280
255 IF Z-Y>=Q5 THEN 270
260 PRINT "  +";
265 GOTO 370
270 PRINT " + ";
275 GOTO 370
280 PRINT "+  ";
285 GOTO 370
290 PRINT "   ";
295 LET Q7= Q7+ 3*Q5
300 GOTO 220
305 PRINT "OFF SCALE.  (X,Y,Z) =";X;",";Y;",";Y1
310 GOTO 380
315 PRINT
320 IF P7=99 THEN 335
325 PRINT
330 PRINT "(NOTE: Y IS PLOTTED '+', Z IS '.', AND 'O' IS COMMON POINT)"
335 PRINT
340 PRINT "FOR X:TOP = ";Q2;" BOTTOM = ";Q3;" INCREMENT = ";Q4
345 PRINT "FOR FCTS:   LEFT = ";Q0;"  RIGHT = ";Q1;" INCREMENT = ";Q5
350 PRINT
355 PRINT "   I.........I.........I.........I.........I.........I.........I"
360 PRINT
365 GOTO 185
370 LET T= 1
375 IF T1=0 THEN 295
380 LET Q6=Q6+1
385 IF INT(Z)>Q1 THEN 395
390 PRINT
395 NEXT X
400 LET P7=99
405 PRINT
410 PRINT
415 PRINT "TYPE 'S' TO STOP NOW, OR ELSE SPECIFY NEW VALUES"
420 PRINT "FOR  FMIN,FMAX,XMIN,XMAX,DELX";
425 GOTO 135
430 IF T1>0 THEN 290
435 IF Z<Y1 THEN 290
440 IF Z-Y1>=2*Q5 THEN 470
445 IF Z-Y1>=Q5 THEN 460
450 PRINT "  .";
455 GOTO 475
460 PRINT " . ";
465 GOTO 475
470 PRINT ".  ";
475 LET T1=1
480 IF T>0 THEN 380
485 GOTO 295
490 IF Z-Y>=2*Q5 THEN 580
495 IF Z-Y>=Q5 THEN 540
500 IF Z-Y1>=2*Q5 THEN 530
505 IF Z-Y1>=Q5 THEN 520
510 PRINT "  O";
515 GOTO 380
520 PRINT " .+";
525 GOTO 380
530 PRINT ". +";
535 GOTO 380
540 IF Z-Y1>=2*Q5 THEN 570
545 IF Z-Y1>=Q5 THEN 560
550 PRINT " +.";
555 GOTO 380
560 PRINT " O";
565 GOTO 380
570 PRINT ".+";
575 GOTO 380
580 IF Z-Y1>=2*Q5 THEN 610
585 IF Z-Y1>=Q5 THEN 600
590 PRINT "+ .";
595 GOTO 380
600 PRINT "+.";
605 GOTO 380
610 PRINT "O";
615 GOTO 380
620 PRINT
625 PRINT "THIS PROGRAM WILL SIMULTANEOUSLY PLOT TWO FUNCTIONS"
630 PRINT "OF A SINGLE VARIABLE X.  TO USE, TYPE:"
635 PRINT
640 PRINT "   10 LET Y= (THE FIRST FUNCTION OF X)"
645 PRINT "   20 LET Z= (THE SECOND FUNCTION OF X AND/OR Y)"
650 PRINT "   RUN"
655 PRINT
660 PRINT "THE FUNCTIONS Y AND Z MAY BE ANY LEGITIMATE 'BASIC'"
665 PRINT "EXPRESSIONS.  INTERMEDIATE VARIABLES MAY BE DEFINED"
670 PRINT "USING INTERMEDIATE LINES, IF THE FUNCTIONS ARE TOO"
675 PRINT "COMPLICATED TO FIT ON ONE LINE."
9999 END




		    unista.basic                    03/17/75  1551.7r w 03/17/75  1550.0       46962



3 PRINT "UNISTA"
5 REM REVISED FEB 5, 1975
6 REM THE SORT USED IN THIS PROGRAM IS SLOW
10 REM:   UNISTA      [DO NOT RESEQUENCE]
12 PRINT "DO YOU WANT INSTURCTIONS?  (YES OR NO)"
13 INPUT Q1$
14 IF Q1$ = "YES" THEN 20
15 IF Q1$ = "yes" THEN 20
16 IF Q1$ = "no" THEN 700
17 IF Q1$ = "NO" THEN 700
18 PRINT "ANSWER EITHER ""YES"" OR ""NO"""
19 GO TO10
20 PRINT "LINE NUMBERS 50-699 ARE FREE FOR USE AS DATA STATEMENTS, AS REQUIRED"
22 PRINT "ALL VALUES FOR ONE VARIABLE ARE GIVE IN DATA STATEMENTS, FOLLOWED BY"
24 PRINT "ALL VALUES FOR A SECOND VARIABLE, AND SO ON."
26 PRINT "THE WAY TO ARRANGE INPUT IS TO PUT ALL VALUES OF VARIABLE 1 AT LINES"
28 PRINT "100-199, ALL FOR VARIABLE 2 AT LINES 200-299, ECT."
30  PRINT "UNISTA ACCEPTS UP TO 300 OBSERVATIONS ON ONE VARIABLE."
32 PRINT
34 STOP
700 PRINT
730 RESET
740 PRINT
750 PRINT"TYPICAL INTERVAL FOR FREQUENCY DISTRIBUTIONS:";
760 PRINT" L,U =";
770 INPUT W1,W2
780 PRINT
790 PRINT
800 DIM X(300),S(4),Y(4),Z(4)
810 DIM C(50),G(50),E(50),F(50)
820 DEF FNR(M)=.001*INT(1000*M+.5)
830 DATA 1E38,0,0,0,0,0,0,0
840 LET I = 0
850 LET I = I+1
860 READ X(I)
870 IF  X(I) <> 1E38 THEN 850
880 LET N1 = I-1
890 LET N = N1-1
900 FOR I=1 TO 4
910 LET S(I) = 0
920 NEXT I
930 FOR I = 1 TO N1
940 LET Y(1) = X(I)
950 LET Y(2) = X(I)^2
960 LET Y(3) = Y(1)*Y(2)
970 LET Y(4) = Y(2)^2
980 FOR J=1 TO 4
990 LET S(J)=S(J)+Y(J)
1000 NEXT J
1010 NEXT I
1020 LET S = S(1)
1030 FOR I = 1 TO 4
1040 LET Y(I)=(1/N1)*S(I)
1050 NEXT I
1060 LET S(2) = Y(2) - Y(1)^2
1070 LET S(3) = Y(3) - 3*Y(1)*Y(2) + 2*Y(1)^3
1080 LET S(4) = Y(4) - 4*Y(3)*Y(1) + 6*Y(2)*Y(1)^2 - 3*Y(1)^4
1090 LET Y(2) = SQR(S(2))
1100 LET Y(3) = S(3) / (S(2)*Y(2))
1110 LET Y(4) = S(4)/S(2)^2 - 3
1120 PRINT
1130 PRINT "S U M M A R Y    S T A T I S T I C S"
1140 PRINT
1150 PRINT"    NUMBER OF VARIATES =";N1
1160 PRINT"       ARITHMETIC MEAN =";Y(1)
1170 PRINT"    STANDARD DEVIATION =";Y(2)
1180 PRINT"              VARIANCE =";S(2)
1190 PRINT"    COEFF OF VAR (PCT) =  ";FNR(100*Y(2)/Y(1))
1200 PRINT"     STANDARD SKEWNESS = ";FNR(Y(3))
1210 PRINT"       STANDARD EXCESS = ";FNR(Y(4))
1220 PRINT
1230 PRINT
1240 REM  SORT
1250 FOR I = 1 TO N
1260 FOR J = I+1 TO N1
1270 IF X(I)<X(J) THEN  1310
1280 LET Y1=X(I)
1290 LET X(I)=X(J)
1300 LET X(J)=Y1
1310 NEXT J
1320 NEXT I
1330 PRINT"O R D E R   S T A T I S T I C S"
1340 PRINT
1350 PRINT"      SMALLEST VARIATE =";X(1)
1360 LET P1=10
1370 GOSUB 2360
1380 LET T1=P2
1390 PRINT"          LOWER DECILE =";T1
1400 LET P1=25
1410 GOSUB 2360
1420 LET T2=P2
1430 PRINT"        FIRST QUARTILE =";T2
1440 LET P1=50
1450 GOSUB 2360
1460 PRINT"                MEDIAN =";P2
1470 LET P5=P2
1480 LET P1=75
1490 GOSUB 2360
1500 LET T3=P2
1510 PRINT"        THIRD QUARTILE =";T3
1520 LET P1=90
1530 GOSUB 2360
1540 LET T4=P2
1550 PRINT"          UPPER DECILE =";T4
1560 PRINT"       LARGEST VARIATE =";X(N1)
1570 PRINT
1580 LET  U=X(N1)-X(1)
1590 PRINT"           TOTAL RANGE =";U
1600 PRINT"          DECILE RANGE =";T4-T1
1610 PRINT"   SEMI-QUARTILE RANGE =";(T3-T2)/2
1620 PRINT"     BOWLEY'S SKEWNESS = ";FNR((T3+T2-2*P5)/(T3-T2))
1630 PRINT"      PEARSON SKEWNESS = ";FNR(3*(Y(1)-P5)/Y(2))
1640 PRINT
1650 PRINT
1660 PRINT
1670 LET D=ABS(W2-W1)
1680 IF D=0 THEN  2510
1690 LET  Y1=W1-INT((W1-X(1))/D+ 1.99999)*D
1700 LET  L=INT((X(N1)-Y1+.00001)/D)+1
1710 IF  L>50  THEN  2450
1720 FOR I=1 TO L+2
1730 LET  C(I)=Y1+ (I-1)*D
1740 LET  F(I)=0
1750 LET  E(I)=0
1760  NEXT  I
1770 PRINT"      F R E Q U E N C Y     D I S T R I B U T I O N"
1780 PRINT
1790 PRINT"                   UP TO BUT"," ","   PERCENT"
1800 PRINT"        FROM     NOT INCLUDING   FREQUENCY","   FREQUENCY"
1810 PRINT
1820 FOR I = 1 TO N1
1830 LET H=INT((1+1E-8)*(X(I)-C(1))/D) + 2
1840 LET F(H)=F(H)+1
1850 LET E(H)=E(H)+X(I)
1860 NEXT I
1870 LET  J = 1
1880 LET J=J+1
1890 LET G(J)=100*F(J)/N1
1900 PRINT C(J-1),C(J),F(J),FNR(G(J))
1910 IF  J=L+2  THEN  1930
1920 GOTO 1880
1930 FOR J = 3 TO L+1
1940 LET F(J)=F(J-1)+F(J)
1950 LET G(J)=100*F(J)/N1
1960 LET E(J)=E(J-1)+E(J)
1970 NEXT J
1980 PRINT
1990 PRINT
2000 PRINT"      C U M U L A T I V E     D I S T R I B U T I O N"
2010 PRINT
2020 PRINT"                  NUMBER LESS    % LESS          VARIATE SUM %"
2030 PRINT"       VALUE      THAN VALUE     THAN VALUE     LESS THAN VALUE"
2040 PRINT
2050 LET  J = 1
2060 LET J=J+1
2070 LET E(J)=100*E(J)/S
2080 PRINT C(J),F(J),FNR(G(J)),FNR(E(J))
2090 IF  J=L+1  THEN  2110
2100 GOTO 2060
2110 PRINT
2120 PRINT
2130 PRINT"O R D E R E D     A R R A Y"
2140 PRINT
2150 LET M=INT(N1/4-.05)+1
2160 LET H=4*(M-1)
2170 LET L=N1-H
2180 FOR I = 1 TO M-1
2190 LET K1=I+M
2200 IF L=1 THEN  2230
2210 LET K2=I+2*M
2220 GOTO 2240
2230 LET K2=I+2*M-1
2240 IF (L-1)*(L-2)=0 THEN  2270
2250 LET K3=I+3*M
2260 GOTO 2280
2270 LET K3=I+3*M-2/L
2280 PRINT X(I),X(K1),X(K2),X(K3)
2290 NEXT I
2300 FOR I = 2 TO L+1
2310 PRINT X((I-1)*M),
2320 NEXT I
2330 PRINT
2340 STOP
2350 REM "SUBROUTINE"
2360 LET G5 = P1*(N1+1)/100
2370 LET  P2 = X(1)
2380 IF G5<1 THEN  2440
2390 LET P2=X(N1)
2400 IF G5>N1 THEN  2440
2410 LET Q5 = INT(G5)
2420 LET  H5=G5-Q5
2430 LET P2=H5*X(Q5+1)+(1-H5)*X(Q5)
2440 RETURN
2450 PRINT
2460 PRINT"INTERVAL IS TOO SMALL.  MAXIMUM IS 50 CLASSES"
2470 PRINT"RESPECIFY L,U";
2480 INPUT W1,W2
2490 GOTO 1640
2510 END




		    xyplot.basic                    03/17/75  1551.7r w 03/17/75  1550.0       16254



3REM X Y P L O T
9 LET J=0
10 GO TO 610
11 IF J=0 THEN 130
12 RETURN
20 PRINT "                                XYPLOT"
130 PRINT
140 PRINT "WHAT ARE  YMIN,YMAX,XMIN,XMAX,DELX";
150 INPUT Q0,Q1,Q2,Q3,Q4
160 LET Q5=(Q1-Q0)/60
170 LET Q6=0
180 LET J=2
190 FOR X = Q2 TO Q3 STEP Q4
200 GOSUB 10
210 IF Q6 = 0 THEN 470
220 IF Q6 = 20 THEN 250
230 PRINT " . ";
240 GOTO 270
250 PRINT " - ";
260 LET Q6 = 10
270 IF Y > Q1 THEN 440
280 IF Y < Q0 THEN 440
290 LET Q7 = Q0 + 2*Q5
300 LET Z=Q7+0.5*Q5
310 IF Z<Y THEN 410
320 LET Q6 = Q6 + 1
330 IF Z-Y>=2*Q5 THEN 390
340 IF Z-Y>=Q5 THEN 370
350 PRINT "  +"
360 GOTO 530
370 PRINT " +"
380 GOTO 530
390 PRINT "+"
400 GOTO 530
410 LET Q7 = Q7 + 3*Q5
420 PRINT "   ";
430 GOTO 300
440 PRINT "OFF SCALE:  (X,Y) =  ";X;",  ";Y
450 LET Q6 = Q6 + 1
460 GOTO 530
470 PRINT
480 PRINT "FOR X:    TOP = ";Q2;" BOTTOM = ";Q3;" INCREMENT = ";Q4
490 PRINT "FOR Y:   LEFT = ";Q0;"  RIGHT = ";Q1;" INCREMENT = ";Q5
500 PRINT
510 PRINT "   I.........I.........I.........I.........I.........I.........I"
520 GOTO 250
530 NEXT X
540 PRINT
550 PRINT "TYPE '0' TO STOP OR '1' TO CHANGE LIMITS.  WHICH";
560 INPUT Q8
570 IF Q8 = 0 THEN 9999
580 IF Q8 = 1 THEN 130
590 PRINT
600 GOTO 540
610 PRINT
620 PRINT "THIS PROGRAM WILL PLOT SINGLE-VALUED FUNCTIONS OF X,"
630 PRINT "WITH X ON THE VERTICAL AXIS.  TO USE, TYPE:"
640 PRINT
650 PRINT "   10 LET Y= (THE FUNCTION TO BE PLOTTED)"
660 PRINT "   RUN"
670 PRINT
680 PRINT "DURING RUNNING, THE PROGRAM WILL ASK FOR YMIN AND"
690 PRINT "YMAX (THE LIMITS ON THE HORIZONTAL Y-AXIS), FOR"
700 PRINT "XMIN AND XMAX (THE LIMITS ON THE VERTICAL X-AXIS),"
710 PRINT "AND FOR DELX, THE INCREMENT TO BE USED ALONG THE"
720 PRINT "X-AXIS.  NOTE: LINES 70-99 OF THE PROGRAM MAY BE"
730 PRINT "USED AS DESIRED TO EXPRESS COMPLICATED FUNCTIONS."
9999 END





		    bull_copyright_notice.txt       08/30/05  1008.4r   08/30/05  1007.3    00020025

                                          -----------------------------------------------------------


Historical Background

This edition of the Multics software materials and documentation is provided and donated
to Massachusetts Institute of Technology by Group Bull including Bull HN Information Systems Inc. 
as a contribution to computer science knowledge.  
This donation is made also to give evidence of the common contributions of Massachusetts Institute of Technology,
Bell Laboratories, General Electric, Honeywell Information Systems Inc., Honeywell Bull Inc., Groupe Bull
and Bull HN Information Systems Inc. to the development of this operating system. 
Multics development was initiated by Massachusetts Institute of Technology Project MAC (1963-1970),
renamed the MIT Laboratory for Computer Science and Artificial Intelligence in the mid 1970s, under the leadership
of Professor Fernando Jose Corbato.Users consider that Multics provided the best software architecture for 
managing computer hardware properly and for executing programs. Many subsequent operating systems
incorporated Multics principles.
Multics was distributed in 1975 to 2000 by Group Bull in Europe , and in the U.S. by Bull HN Information Systems Inc., 
as successor in interest by change in name only to Honeywell Bull Inc. and Honeywell Information Systems Inc. .

                                          -----------------------------------------------------------

Permission to use, copy, modify, and distribute these programs and their documentation for any purpose and without
fee is hereby granted,provided that the below copyright notice and historical background appear in all copies
and that both the copyright notice and historical background and this permission notice appear in supporting
documentation, and that the names of MIT, HIS, Bull or Bull HN not be used in advertising or publicity pertaining
to distribution of the programs without specific prior written permission.
    Copyright 1972 by Massachusetts Institute of Technology and Honeywell Information Systems Inc.
    Copyright 2006 by Bull HN Information Systems Inc.
    Copyright 2006 by Bull SAS
    All Rights Reserved
