 Web pdp-10.trailing-edge.com

Trailing-Edge - PDP-10 Archives - decuslib20-01 - decus/20-0020/lessim.tuk
There are 2 other files named lessim.tuk in the archive. Click here to see a list.
```10 ' NAME--LESSIM
20 '
30 ' DESCRIPTION--THIS PROGRAM CALCULATES THE LESSOR'S CASH FLOWS
32 ' AND RATE OF RETURN ON A LEASE WITH PERIOD-END PAYMENTS.
40 '
50 ' SOURCE--UPDATED 7/8/68 BY J. GUERBER
55 '
60 ' INSTRUCTIONS
61 '     VALUES ARE REQUIRED FOR THE FOLLOWING VARIABLES:
62 '
63 ' 1. P = INVESTMENT
64 ' 2. L = LEASE PAYMENT, 0 IF THE LEASE RATE RATHER THAN THE
65 '        LEASE PAYMENT IS GIVEN,
66 ' 3. C1= NUMBER OF TIMES PER YEAR THAT LEASE PAYMENTS ARE MADE.
67 ' 4. R1= LEASE RATE, 0 IF THE LEASE PAYMENT RATHER THAN THE
68 '        LEASE RATE IS GIVEN, OTHERWISE A DECIMAL REPRESEN-
69 '        TATION OF AN ANNUAL RATE COMPOUNDED C1 TIMES A YEAR,
70 ' 5. M = LIFE OF LEASE IN YEARS,
71 ' 6. N1= DEPRECIABLE LIFE IN YEARS,
72 ' 7. S1= SALVAGE FOR TAX PURPOSES,
73 ' 8. S2= SALVAGE ACTUALLY EXPECTED,
74 ' 9. T = DISPOSITION OF THE INVESTMENT TAX CREDIT, 0 IF TO THE
75 '        LESSEE AND 1 IF TO THE LESSOR,
76 '10. T1= THE RATE AT WHICH THE LESSOR IS TAXED
77 '11. D = METHOD OF DEPRECIATION, 1 IF STRAIGHT LINE, 2 IF
78 '        DOUBLE DECLINING BALANCE, 3 IF SUM OF THE YEARS DIGITS,
79 '12. N2= THE NUMBER OF RUNS IN THE SIMULATION
80 '
85 ' THIS PROGRAM WAS WRITTEN FOR STUDENT USE AT AMOS TUCK SCHOOL
86 ' OF HANOVER, N.H., WHICH DOES NOT ASSUME RESPONSIBILITY FOR
87 ' ITS ACCURACY.
88 '
90 ' * * * * * * * * * * * * * MAIN PROGRAM * * * * * * * * * * *
95 '
100 DIM A(500),B(500),C(500),D(500),E(500),L(500),P(500),T(500)
110 DIM R(100),M(100)
111 READ P,L,C1,R1
112 READ M,N1,S1,S2
113 READ T,T1,D,N2
120 DATA 60000,900,12,0
121 DATA 8,10,0,20000
122 DATA 1,.7,3,50
180 PRINT
190 PRINT
200 PRINT " ","SUMMARY OF INPUT DATA"
210 PRINT
220 PRINT "INVESTMENT",P,"LEASE PAYMENT"," ",L
230 PRINT "PAYMENTS",C1"X A YEAR","LEASE LIFE",,M
240 IF D = 2 THEN 280
250 IF D = 3 THEN 300
260 PRINT "DEPRECIATION","STRAIGHT LINE","DEPRECIABLE LIFE",N1
270 GO TO 310
280 PRINT "DEPRECIATION"," D D B  ","DEPRECIABLE LIFE",N1
290 GO TO 310
300 PRINT "DEPRECIATION","SOYD","DEPRECIABLE LIFE",N1
310 PRINT "TAX SALVAGE",S1,"ACTUAL SALVAGE"," ",S2
320 IF T = 0 THEN 350
330 PRINT "INVESTMENT TAX CREDIT IS TO BE TAKEN BY THE LESSOR"
340 GO TO 360
350 PRINT "INVESTMENT TAX CREDIT IS TO BE TAKEN BY THE LESSEE"
360 PRINT "-------------------------------------------------------------------"
370 PRINT
380 PRINT
390 PRINT " ","RESULTS OF CALCULATION"
400 PRINT
410 LET N=M*C1
420 LET M = N
430 LET N4 = 0
440 LET N5 = 0
450 LET N6 = 0
460 LET N7 = 0
470 LET N8 = 0
480 LET N9 = 0
490 LET M5 = 0
500 FOR I = 1 TO 672
510   LET U=RND
520 NEXT I
530 FOR I = 1 TO N
540    LET A(I) = L
550    LET D(I) = 0
560 NEXT I
570 LET X = P
580 GO SUB 1710
590 LET R=((1+R)^C1-1)*100
600 PRINT "LEASE RATE:"R"PER CENT PER YEAR, COMPOUNDED "C1"TIMES A YEAR"
610 PRINT
620 PRINT
630 GO SUB 1880
640 GO SUB 2190
650 IF N3 = 0 THEN 690
660 PRINT " ","RUN","LIFE","LESSOR'S"
670 PRINT " "," "," "," RETURN "
680 PRINT
690 LET R2 = 0
700 FOR H = 1 TO N2
710 LET N = N/C1
720 LET L = L*C1
730    GO SUB 2280
740 LET N = N*C1
750 LET L = L/C1
760 LET M = M*C1
770    FOR I = 1 TO N
780       LET L(I) = L
790       LET E(I) = L(I) - D(I)
800       LET T(I)=E(I)*T1
810    NEXT I
820    LET T(1) = T(1) - C
830    LET T(M)=T(M)+(S-P(M))*T1
840    LET L(M) = L(M) + S
850    FOR I = 1 TO M
860       LET A(I) = L(I) - T(I)
870    NEXT I
880    LET X = P
890    GO SUB 1710
900    LET R=((1+R)^C1-1)*100
910    IF N3 = 0 THEN 930
920    PRINT " ",H,M,R
930    LET R(H) = R
940    LET M(H) = M
950    LET R2 = R2 + R
960 NEXT H
970 LET R2 = R2/N2
980 LET R3 = 0
990 FOR H = 1 TO N2
1000    LET R3 = R3 + (R2-R(H))^2
1010 NEXT H
1020 LET R3 = (R3/N2)^.5
1030 PRINT
1040 PRINT
1050 PRINT " ","SUMMARY OF SIMULATION"
1060 PRINT " ","---------------------"
1070 PRINT
1080 PRINT "NUMBER OF RUNS"," ",N2
1090 PRINT "AVERAGE RETURN PER RUN",R2"PER CENT"
1100 PRINT "STANDARD DEVIATION OF RETURNS",R3
1110 PRINT
1120 PRINT "SUMMARY OF RUNS IN WHICH A DEFAULT OCCURS"
1130 PRINT "RUN","PERIOD","RETURN"
1140 FOR H=1 TO N2
1150    IF M(H)=N THEN 1190
1160    PRINT H,M(H)  ,R(H)
1170    LET M5=M5+1
1180    GOTO 1220
1190    IF H<N2 THEN 1220
1200    IF M5>0 THEN 1220
1210    PRINT M5,M5,M5
1220 NEXT H
1230 PRINT
1240 PRINT"SUMMARY OF THE"N2-M5"RUNS IN WHICH NO DEFAULT OCCURS"
1250 LET C=10
1260 LET O=N2
1270 FOR I= 1 TO O
1280    IF M(I)<>N THEN 1330
1290    LET X=R(I)
1300    LET S1= X
1310    LET S2= X*X
1320    LET S= B= X
1330 NEXT I
1340 FOR I=2 TO O-1
1350    IF M(I)<>N THEN 1440
1360    LET X=R(I)
1370    LET S1= S1+X
1380    LET S2= S2+X*X
1390    IF X< B THEN 1420
1400    LET B= X
1410    GO TO 1440
1420    IF X> S THEN 1440
1430    LET S= X
1440 NEXT I
1450 LET W= (B-S)/C
1460 FOR I=1 TO O
1470    IF M(I)<>N THEN1530
1480    LET X=R(I)
1490    IF X<> S THEN 1510
1500    LET X= X+.0001
1510    LET F= INT(((X-S)/(B-S))*C+.999999)
1520    LET B(F)= B(F)+1
1530 NEXT I
1540 PRINT
1541 PRINT TAB(25)"NUMBER OF RUNS"
1560 FOR I= 1 TO C
1570    IF I<> 1 THEN 1590
1580    LET W1= S
1590    PRINT INT(W1*100+.5)/100;TAB(6)"< RETURN <="INT((W1+W)*100+.5)/100;TAB(25);
1600    LET W1= W1+W
1610    FOR J= 1 TO B(I)
1620       PRINT "*";
1630    NEXT J
1640    PRINT
1650 NEXT I
1660 PRINT
1670 PRINT "MEAN  = "S1/(O-M5)
1680 PRINT "RANGE = "S"-"B
1690 PRINT "STD D = "SQR((S2-((S1^2)/O))/(O-1))
1700 GOTO 2530
1710 LET R = 0
1720 FOR J = 1 TO 5
1730    LET Z = .1^J
1740    LET R = R + Z
1750    LET Y = 0
1760    FOR I = 1 TO M
1770       IF Y>1E34 THEN 1790
1780       LET Y = Y + A(I)/(1+R)^I
1790    NEXT I
1800    IF Y - X > 0 THEN 1740
1810    LET R = R - Z
1820 NEXT J
1830 IF R > 0 THEN 1870
```
```1840 IF R < 0 THEN 1870
1850 LET R = -1
1860 GO TO 1720
1870 RETURN
1880 LET P(0) = P
1890 IF D = 2 THEN 1950
1900 IF D = 3 THEN 2060
1910 FOR I = 1 TO N1
1920    LET A(I) = (P-S1)/N1
1930 NEXT I
1940 GO TO 2110
1950 FOR I = 1 TO N1
1960    LET A(I) = P(I-1)*(2/N1)
1970    LET B(I) = (P(I-1)-S1)/(N1-I+1)
1980    IF A(I) > B(I) THEN 2000
1990    LET A(I) = B(I)
2000    LET P(I) = P(I-1) - A(I)
2010    IF P(I)>S1 THEN 2040
2020    LET P(I)=S1
2030    LET A(I)=P(I-1)-P(I)
2040 NEXT I
2050 GO TO 2110
2060 LET W = (N1*(N1+1))/2
2070 FOR I = 1 TO N1
2080    LET A(I) = (P-S1)*((N1-I+1)/W)
2090 NEXT I
2100 LET W=0
2110 FOR I = 1 TO N1
2120    FOR K=1 TO C1
2130       LET W=W+1
2140       LET D(W)=A(I)/C1
2150       LET P(W)=P(W-1)-D(W)
2160    NEXT K
2170 NEXT I
2180 RETURN
2190 LET C = 0
2200 IF T = 0 THEN 2270
2210 IF N1 < 4 THEN 2270
2220 LET C = C + .02333*P
2230 IF N1 < 6 THEN 2270
2240 LET C = C + .02333*P
2250 IF N1 < 8 THEN 2270
2260 LET C = C + .02334*P
2270 RETURN
2280 LET M = 1
2290 LET U=RND
2300 IF M = N THEN 2330
2310 LET M = M + 1
2320 IF U > .005 THEN 2290
2330 LET U=RND
2340 IF U > .3 THEN 2370
2350 LET Q = 2
2360 GO TO 2380
2370 LET Q = 6
2380 LET O = (P-S2)*.5^(.5*M)
2390 IF Q < N-M THEN 2440
2400 LET Q = N-M
2410 IF Q > 0 THEN 2440
2420 LET O = 0
2430 LET U=RND -.5
2440 LET S = (S2+O+(P/10)*U)
2450 LET S = S + L*Q
2460 IF (N-M) = 0 THEN 2520
2470 LET K = L*(N-M)
2480 IF K>S THEN 2500
2490 LET S = K
2500 LET U=RND
2510 LET S = S*U
2520 RETURN
2530 END
```
```
```