Google
 

Trailing-Edge - PDP-10 Archives - decus_20tap1_198111 - decus/20-0025/growth.bas
There are 2 other files named growth.bas in the archive. Click here to see a list.
00001	DIM Y(250),Z(250)
00002	LET L=0.
00003	LET L=L+1
00004	READ Z(L)
00010	GO TO 480
00049	1E37
00050	IF Z(L)<=0. THEN 580
00060	IF Z(L)<>1E37 THEN 3
00070	LET M=L-1
00080	FOR I=1 TO M
00090	LET Y(I)=Z(I)
00095	NEXT I
00096	READ N
00100	DATA 3
00110	LET S1=0.
00120	LET S2=0.
00130	FOR I=1 TO M
00140	LET Z(I)=LOG(Y(I))
00150	LET S1=S1+Z(I)
00160	LET S2=S2+I*Z(I)
00170	NEXT I
00180	LET T=M*(M+1)/2.
00190	LET D1=T*M*(M-1)/6.
00200	LET D2=M*S2-S1*T
00210	LET B=D2/D1
00220	LET A=EXP((S1-B*T)/M)
00230	FOR I=1 TO M+N
00240	LET Z(I)=A*EXP(B*I)
00250	NEXT I
00260	LET C=(EXP(B)-1.)*100.
00270	LET B=100.*B
00280	LET D=LOG(2)/(B/100.)
00290	PRINT
00300	PRINT
00310	PRINT"G R O W T H  C A L C U L A T I O N"
00320	PRINT
00330	PRINT
00340	PRINT"   AVERAGE PERIOD RATE (PCT) = ";C
00350	PRINT"       CONTINUOUS RATE (PCT) = ";B
00360	PRINT"   THE DOUBLE LIFE (PERIODS) = ";D
00370	PRINT
00380	PRINT"PERIOD","ESTIMATE","ACTUAL"
00390	PRINT
00400	FOR I=1 TO M
00410	PRINT (I-M),Z(I),Y(I)
00420	NEXT I
00430	FOR I=M+1 TO M+N
00440	PRINT (I-M),Z(I)
00450	NEXT I
00460	GO TO 600
00470	PRINT
00480	PRINT
00490	PRINT"THIS PROGRAM CALCULATES GROWTH RATES USING DATA SUPPLIED"
00500	PRINT"FOR A NUMBER OF EQUISPACED PERIODS.  THE COMPUTED RATE MAY"
00510	PRINT"BE PROJECTED FOR 'N' ADDITIONAL PERIODS BY ENTERING DATA"
00520	PRINT"AT LINE 100.  TO USE TYPE:"
00530	PRINT
00540	PRINT"     10 DATA DATUM1,DATUM2,....,DATUMLAST"
00550	PRINT"             (CONTINUE ON LINES 11-48)"
00560	PRINT"     100 DATA N   (OPTIONAL...N=3 BUILT-IN)"
00570	PRINT"     RUN"
00580	PRINT
00590	PRINT"NOTE:  THIS GROWTH CALCULATION WITH ZERO OR NEGATIVE VALUES"
00595	PRINT"       NOT PERMITTED."
00600	END