Trailing-Edge
-
PDP-10 Archives
-
decuslib20-01
-
decus/20-0025/disrat.bas
There are 2 other files named disrat.bas in the archive. Click here to see a list.
2 DIM X(100),Y(100),U(100),V(100)
3 LET I=0
4 LET X1=0.99
5 LET I=I+1
6 READ X(I)
10 DATA -663,-530,300,434,437
11 DATA 455,431,443,445,767
50 DATA 9999999
60 IF X(I)=9999999 THEN 80
70 GO TO 4
80 LET N=I-1
90 LET S1=X(1)
100 LET S2=0.
110 LET X2=1.
120 FOR I=2 TO N
130 LET S2=S2+(I-1)*X2*X(I)
140 LET X2=X2*X1
150 LET S1=S1+X2*X(I)
160 NEXT I
170 LET D1=S1/S2
180 LET X1=X1-D1
190 IF ABS(D1)>0.000005 THEN 90
200 LET D=100.*((1./X1)-1.)
212 LET Y(1)=X(1)
215 LET U(1)=X(1)
230 LET V(1)=X(1)
240 FOR I=2 TO N
250 LET Y(I)=Y(I-1)+X(I)
260 LET U(I)=X(I)*(X1^(I-1))
270 LET V(I)=V(I-1)+U(I)
280 NEXT I
290 LET I=0
300 LET Y(0)=99.
310 LET V(N)=0.
320 LET I=I+1
330 IF I>N THEN 420
340 IF Y(I)=0 THEN 390
350 IF Y(I-1)<0 THEN 360
360 IF Y(I)>0 THEN 405
370 LET P1=0
380 GO TO 410
390 LET P1=I-1
400 GO TO 410
405 LET P1=I-2-Y(I-1)/(Y(I)-Y(I-1))
410 IF P1=0 THEN 320
420 PRINT
430 PRINT
440 PRINT"DISCOUNTED CASH FLOW CALCULATION"
450 PRINT
460 PRINT" FOR TIME-VALUE-OF-MONEY = 0.0"
470 PRINT" THE PAYBACK PERIOD = ";P1
480 PRINT
490 PRINT" THIS PERIODS CUMULATIVE FLOW"
500 PRINT"PERIOD NET FLOW END OF PERIOD"
510 PRINT
520 FOR I=1 TO N
530 PRINT (I-1),X(I),Y(I)
540 NEXT I
550 PRINT
560 PRINT"MORE OUTPUT WANTED (1=YES)",
570 INPUT I
580 IF I<>1 THEN 820
590 LET C1=100.*LOG(D/100.+1.)
600 LET D2=LOG(2)/LOG(1+D/100.)
610 PRINT
620 PRINT" THE DISCOUNTED RATE OF RETURN (PERCENT):"
630 PRINT" PERIOD BASIS: ";D
640 PRINT" CONTINUOUS: ";C1
650 PRINT
660 PRINT" THE DOUBLE-LIFE IS ";D2;" PERIODS"
670 PRINT
680 PRINT" PRESENT WORTH CUMULATIVE"
690 PRINT" THIS PERIODS PRESENT WORTH"
700 PRINT"PERIOD NET FLOW END OF PERIOD"
710 PRINT
720 FOR I=1 TO N
730 PRINT (I-1),U(I),V(I)
740 NEXT I
750 GO TO 820
760 PRINT"THIS PROGRAM CALCULATES DISCOUNTED RATE OF RETURN (PERIOD"
770 PRINT"AND CONTINUOUS), THE DOUBLE-LIFE, AND PAYBACK PERIOD FOR A"
780 PRINT"SEQUENCE OF CASH FLOWS. TO USE, TYPE:"
790 PRINT
800 PRINT" 10 DATA FLOW(1),FLOW(2),....,FLOW(N)"
810 PRINT" RUN"
815 PRINT
820 PRINT"LINES 11 THROUGH 49 CAN BE USED FOR ADDITIONAL DATA."
830 END