Google
 

Trailing-Edge - PDP-10 Archives - decuslib20-01 - decus/20-0020/inout.tuk
There are 2 other files named inout.tuk in the archive. Click here to see a list.
10' NAME--IN-OUT
20' 
30' DESCRIPTION--LEONTIEF INPUT OUTPUT MODEL
40'
50' SOURCE--UNKNOWN
60'
70' INSTRUCTIONS
72  REM  THIS IS A PROGRAM FOR INPUT/OUTPUT ANALYSIS.
74  REM  A HYPOTHETICAL ECONOMY IS DIVIDED INTO THREE INDUSTRIES:
76  REM  AGRICULTURE, INDUSTRY, AND SERVICES, AND ANALYZED AS TO
78  REM  THE INTERINDUSTRY FLOWS OF GOODS AND SERVICES OVER A
80  REM  PERIOD OF TIME.  THE ANALYSIS IS BASED UPON THE DATA
82  REM  FOR A PAST PERIOD AND CAN BE USED TO PREDICT FUTURE
84  REM  FLOWS UNDER DIFFERENT CONDITIONS OF CONSUMER DEMAND.
86  REM  THE DATA IS READ IN IN THE FOLLOWING ORDER:
88  REM  FLOWS FROM AGRICULTURE TO AGRICULTURE, TO INDUSTRY,
90  REM  TO SERVICES, AND TO THE FINAL CONSUMER; FROM INDUSTRY
92  REM  TO AGRICULTURE, TO INDUSTRY, TO SERVICES, TO THE CONSUMER,
94  REM  ETC.  THIS IS FOLLOWED BY REVISED FORCASTS OF CONSUMER
96  REM  DEMAND FROM AGRICULTURE, INDUSTRY, AND SERVICES.
98  REM  THE PROGRAM IS GENERAL WITH THE EXCEPTION OF THE PRINT
100 REM  ROUTINES, THAT IS, IT WILL ANALYZE DATA FOR ANY NUMBER OF
102 REM  INDUSTRY GROUPS, TO BE SPECIFIED BY THE VALUE OF "M".
110'
120' THIS PROGRAM WAS WRITTEN FOR STUDENT USE AT AMOS TUCK SCHOOL
125' OF HANOVER, N.H. WHICH DOES NOT ASSUME RESPONSIBILITY FOR
130' ITS ACCURACY.
140'
150' * * * * * * * * * MAIN PROGRAM * * * * * * * * * * * * 
160'
165 DIM A(3,3), B(3,3), X(3,3)
170 LET M = 3
180 LET N = 1
190 FOR J = 1 TO M
200 LET T(J) = 0
210 FOR K = 1 TO M
220 READ A(J,K)
230 LET T(J) = T(J) + A(J,K)
240 NEXT K
250 READ C(J)
260 LET T(J) = T(J) + C(J)
270 NEXT J
280 FOR K = 1 TO M
290 FOR J = 1 TO M
300 LET X(J,K) = A(J,K)/T(K)
310 NEXT J
320 NEXT K
330 GOSUB 850
340 PRINT
350 PRINT
360 PRINT
370 PRINT "INITIAL INPUT/OUTPUT TABLE"
380 PRINT "--------------------------"
390 PRINT
400 PRINT
410 GOSUB 1111
420 FOR G = 1 TO N
430 FOR L = 1 TO M
440 READ C(L)
450 NEXT L
460 FOR I = 0 TO M
470  FOR K = 1 TO M
480  IF K = I THEN 560
490   FOR J = 1 TO M
500   IF J <> K THEN 530
510   LET B(J,K) = 1 - X(J,K)
520   GO TO 540
530   LET B(J,K) = -X(J,K)
540   NEXT J
550  GO TO 590
560   FOR J = 1 TO M
570   LET B(J,K) = C(J)
580   NEXT J
590  NEXT K
600 GOSUB 940
610 LET D(I) = D
620 LET T(I) = D(I)/D(0)
630 NEXT I
640 FOR J = 1 TO M
650 FOR K = 1 TO M
660  LET A(J,K) = X(J,K) * T(K)
670  NEXT K
680 NEXT J
690 GOSUB 850
700 PRINT
710 PRINT
720 PRINT
730 PRINT "REVISED INPUT/OUTPUT TABLE NUMBER"G
740 PRINT "-----------------------------------"
750 PRINT
760 PRINT
770 GOSUB 1111
780 NEXT G
790 GO TO 1300
800 DATA 1.0000001, 2.25, 0.2, 1.55
810 DATA 2.0000001, 6.0000001, 1.0000001, 16.0000001
820 DATA 0.2, 3.0000001, 1.80000001, 15.0000001
830 DATA 2.05, 16.0000001, 15.0000001
840 REM SUBROUTINE FOR SECTOR INCOME (OR VALUE ADDED)
850 FOR K = 1 TO M
860 LET V(K) = 0
870  FOR J = 1 TO M
880  LET V(K) = V(K) + A(J,K)
890 NEXT J
900 LET V(K) = T(K) - V(K)
910 NEXT K
920 RETURN
930 REM SUBROUTINE TO SOLVE DETERMINANT OF ANY SIZE, "M"
940 LET D = 0
950 FOR K = 1 TO M
960 LET D(K) = 1
970 LET D(M+K) = 1
980  FOR J = 1 TO M
990  LET K1 = J - 1 + K
1000 IF K1 <= M THEN 1020
1010 LET K1 = K1 - M
1020 LET D(K) = D(K) * B(J,K1)
1030 LET K2 = M + K - J
1040 IF K2 <= M THEN 1060
1050 LET K2 = K2 - M
1060  LET  D(M+K) = D(M+K) * B(K2,J)
1070 NEXT J
1080 LET D = D + D(K) - D(M+K)
1090 NEXT K
1100 RETURN
1110 REM SUBROUTINE TO PRINT I/O TABLE
1111 LET T = 0
1112 FOR J = 1 TO M
1113 LET T = T + C(J)
1114 NEXT J
1120PRINT
1130PRINT"                           TO SECTOR"
1140PRINT"  FROM SECTOR                                    CONSUMERS TOTAL"
1150PRINT"               AGRICULTURE   INDUSTRY   SERVICES"
1160PRINT
1170PRINT"AGRICULTURE     ";A(1,1);"    ";A(1,2);"  ";A(1,3);"  "C(1);T(1)
1180PRINT"INDUSTRY        ";A(2,1);"    ";A(2,2);"  ";A(2,3);"  ";C(2);T(2)
1190PRINT"SERVICES       ";A(3,1);"   ";A(3,2);"  ";A(3,3);"  ";C(3);T(3)
1200PRINT
1210PRINT"SECTOR INCOME  ";V(1);"   ";V(2);"  ";V(3);"         ";T
1220PRINT
1230PRINT"  TOTAL         ";T(1);"    ";T(2);"  ";T(3);"  ";T
1240PRINT
1250PRINT
1260PRINT
1270PRINT
1280PRINT
1290 RETURN
1300 END