10 REM SAVE "TORSION",A
  14 REM 1994.6.22
  15 REM 2006.11.8
  16 REM 単純ねじりを受ける梁  大学院:構造工学特論
  20 DIM KAKOM(30,2),X(20),Y(20),AJ(30),SM(2,2),TSM(40,40),F(40)
  30 DIM NOKT(18),INDEX(40),REAC(40),DIS(40),STRE(30,2),WD(2)
  35 REM DAIGAKUIN LECTURE EXAMPLE NO.1
  40 DATA 3,2,2
  50 DATA 1,2,1
  60 DATA 2,3,1
  70 DATA 0,0,0
  80 DATA 4,0,1
  90 DATA 10,0,0
 100 DATA 1
 110 DATA 1,3
 115 REM 全節点数 全要素数 拘束点数
 120 READ NODT,NELT,KOT
 130 FOR I=1 TO NELT
 140 FOR J=1 TO 2
 145 REM 左端 右端 ねじりモーメント
 150 READ KAKOM(I,J):NEXT J:READ AJ(I)
 160 NEXT I
 170 FOR I=1 TO NODT
 175 REM X座標 Y座標 ねじりモーメント荷重
 180 READ X(I),Y(I),F(I)
 190 NEXT I
 195 REM せん断弾性係数
 200 READ G
 210 FOR I=1 TO KOT
 215 REM ねじり角拘束点
 220 READ NOKT(I)
 230 NEXT I
 240 NT=NODT
 250 FOR I=1 TO NT
 260 FOR J=1 TO NT
 270 TSM(I,J)=0 :NEXT J,I
 280 FOR NE=1 TO NELT
 290 GOSUB *TORM
 300 PRINT " NE=";NE; "I=";KAKOM(NE,1); "J=";KAKOM(NE,2)
 310 FOR I=1 TO 2
 320 FOR J=1 TO 2
 325 PRINT USING "  ";
 330 PRINT USING "##.####^^^^";SM(I,J);
 340 NEXT J:PRINT
 350 NEXT I
 360 GOSUB *ASMAT
 370 NEXT NE
 380 PRINT :PRINT :PRINT
 390 FOR I=1 TO NT
 400 FOR J=1 TO NT
 410 AA=13*(J-1):AA=AA-78*INT(AA/78)
 420 PRINT USING "##.####^^^^";TSM(I,J);
 430 NEXT J:PRINT
 440 NEXT I
 450 FOR I=1 TO NT
 460 DIS(I)=0
 470 INDEX(I)=I:NEXT I
 480 FOR I=1 TO KOT
 490 N=NOKT(I)
 500 INDEX(N)=0 :NEXT I
 510 MM=0
 520 FOR I=1 TO NT
 530 IF INDEX(I)=0 THEN 560
 540 MM=MM+1
 550 INDEX(MM)=INDEX(I)
 560 NEXT I
 570 FOR I=1 TO MM
 580 IA=INDEX(I)
 590 F(I)=F(IA)
 600 FOR J=1 TO MM
 610 JA=INDEX(J)
 620 TSM(I,J)=TSM(IA,JA) :NEXT J,I
 630 PRINT :PRINT :PRINT "***** SHITENSHORI *****"
 640 FOR I=1 TO MM
 650 FOR K=1 TO MM
 660 AA=13*(K-1):AA=AA-78*INT(AA/78)
 670 PRINT USING "##.####^^^^";TSM(I,K);
 680 NEXT K:PRINT
 690 NEXT I
 700 GOSUB *MATI
 710 PRINT :PRINT :PRINT "********** GYAKU **********"
 720 FOR K=1 TO MM
 730 FOR J=1 TO MM
 740 AA=13*(J-1):AA=AA-78*INT(AA/78)
 750 PRINT USING "##.####^^^^";TSM(K,J);
 760 NEXT J:PRINT
 770 NEXT K
 780 FOR I=1 TO MM
 790 REAC(I)=0
 800  FOR K=1 TO MM
 810  REAC(I)=REAC(I)+TSM(I,K)*F(K)
 820  NEXT K,I
 830 FOR I=1 TO MM
 840 IA=INDEX(I)
 850 DIS(IA)=REAC(I) :NEXT I
 860 FOR I=1 TO NT
 870 FOR J=1 TO NT
 880  TSM(I,J)=0 :NEXT J,I
 890 FOR NE=1 TO NELT
 900 GOSUB *TORM
 910 GOSUB *ASMAT
 920 NEXT NE
 930 FOR I=1 TO NT
 940 REAC(I)=0
 950  FOR K=1 TO NT
 960  REAC(I)=REAC(I)+TSM(I,K)*DIS(K)
 970  NEXT K,I
 980 PRINT :PRINT :PRINT
 990 PRINT "     ********** TORSIONAL ANGLE AND TORSIONAL MOMENT  **********"
1000 PRINT "  NODE No.     ねじり角φ      ΣT         "
1010 FOR I=1 TO NODT
1015 PRINT USING "    ";
1020 PRINT I;
1025 PRINT USING "    ";
1030 PRINT USING "##.####^^^^";DIS(I);
1035 PRINT USING "    ";
1040 PRINT USING "##.####^^^^";REAC(I)
1050 NEXT I
1060 PRINT :PRINT
1070 PRINT "       ********** TORSIONAL MOMENTS **********"
1080 PRINT "  NELT No.       TI       TJ"
1090 FOR NE=1 TO NELT
1100 GOSUB *TORM
1110  FOR I=1 TO 2
1120  IA=KAKOM(NE,I)
1130  WD(I)=DIS(IA)
1140  NEXT I
1150  FOR I=1 TO 2
1160  STRE(NE,I)=0
1170  FOR K=1 TO 2
1180   STRE(NE,I)=STRE(NE,I)+SM(I,K)*WD(K)
1190  NEXT K,I
1195 PRINT USING "   ";
1200 PRINT NE;
1205 PRINT USING "   ";
1210 FOR I=1 TO 2
1215 PRINT USING "   ";
1220 PRINT USING "##.####^^^^";STRE(NE,I);
1230 NEXT I
1235 PRINT
1237 NEXT NE
1240 END
1250 *TORM
1260 II=KAKOM(NE,1)
1270 JJ=KAKOM(NE,2)
1280 XI=X(II) :XJ=X(JJ)
1290 YI=Y(II) :YJ=YJ(JJ)
1300 AL=SQR((XJ-XI)^2+(YJ-YI)^2)
1310 C1=G*AJ(NE)/AL
1320 SM(1,1)=C1
1330 SM(1,2)=-C1
1340 SM(2,1)=-C1
1350 SM(2,2)=C1
1360 RETURN
1370 *ASMAT
1380 FOR I=1 TO 2
1390 FOR J=1 TO 2
1400  KI=(KAKOM(NE,I)-1)
1410  KJ=(KAKOM(NE,J)-1)
1420  IS=(I-1)
1430  JS=(J-1)
1440  FOR K=1 TO 1
1450  FOR L=1 TO 1
1460   KIK=KI+K
1470   KJL=KJ+L
1480   ISK=IS+K
1490   JSL=JS+L
1500   TSM(KIK,KJL)=TSM(KIK,KJL)+SM(ISK,JSL)
1510  NEXT L,K
1520 NEXT J,I
1530 RETURN
1540 *MATI
1550 DIM IND(40)
1560 FOR KO=1 TO MM
1570 IND(KO)=KO:NEXT
1580 FOR KO=1 TO MM
1590 W=0
1600 FOR IO=KO TO MM
1610 IF ABS(TSM(IO,1))=<W THEN 1630
1620 W=ABS(TSM(IO,1)):IR=IO
1630 NEXT IO
1640 IF IR=KO THEN 1710
1650  FOR JO=1 TO MM
1660  W=TSM(KO,JO)
1670  TSM(KO,JO)=TSM(IR,JO):TSM(IR,JO)=W
1680  NEXT JO
1690  M=IND(KO)
1700  IND(KO)=IND(IR):IND(IR)=M
1710 W=TSM(KO,1)
1720 NNA=MM-1
1730 FOR JO=1 TO NNA
1740  TSM(KO,JO)=TSM(KO,JO+1)/W:NEXT
1750 TSM(KO,MM)=1/W
1760 FOR IO=1 TO MM
1770  IF IO=KO THEN 1820
1780  W=TSM(IO,1)
1790  FOR JO=1 TO NNA
1800   TSM(IO,JO)=TSM(IO,JO+1)-W*TSM(KO,JO):NEXT
1810  TSM(IO,MM)=-W*TSM(KO,MM)
1820 NEXT IO
1830 NEXT KO
1840 FOR KO=1 TO NNA
1850 IF KO=IND(KO) THEN 1970
1860 KA=KO+1
1870 FOR IO=KA TO MM
1880  IF KO<>IND(IO) THEN 1910
1890  IR=IO
1900  GOTO 1920
1910 NEXT IO
1920 FOR JO=1 TO MM
1930 W=TSM(JO,KO)
1940 TSM(JO,KO)=TSM(JO,IR)
1950 TSM(JO,IR)=W:NEXT
1960 IND(IR)=IND(KO):IND(KO)=KO
1970 NEXT KO
1980 RETURN