1 " "CLEAR :DIM A(12,6):PAUSE "     MATRIX INVERSION":PAUSE "  Copr. 1982 Tandy Corp.":LOCK :GOTO 7
2 FOR C=1TO J-1:IF J=2LET I=A(1,1)*A(2,2)-A(1,2)*A(2,1):RETURN 
3 IF A(C,C)=0LET I=0:RETURN 
4 FOR D=C+1TO J:I=-A(D,C)/A(C,C):FOR E=C+1TO J:A(D,E)=A(D,E)+I*A(C,E):NEXT E:NEXT D:NEXT C
5 I=A(1,1):FOR C=2TO J:I=I*A(C,C):NEXT C:RETURN 
7 CLS :WAIT 0:PRINT "  New Lst Edt Inv End"
8 A=ASC INKEY$ -16:IF A<1OR A>5THEN 8
9 GOTO 10*A
10 INPUT "Size? ";F:IF F>2AND F<7THEN 12
11 GOTO 10
12 FOR A=1TO F:FOR B=1TO F:CLS :PRINT "Enter A(";STR$ A;",";STR$ B;:INPUT "): ";A(5+A,B)
13 NEXT B:NEXT A:GOTO 7
20 GOSUB 60:FOR A=1TO F:FOR B=1TO F:B$="A("+STR$ A+","+STR$ B+") =":PAUSE B$;A(5+A,B):GOSUB 70
21 IF P$="Y"LPRINT B$;A(5+A,B)
22 NEXT B:NEXT A:GOTO 7
30 CLS :INPUT "Row? ";A,"Column? ";B:GOTO 32
31 GOTO 7
32 IF A<1OR (A>F)OR B<1OR B>FTHEN 30
33 PRINT "A(";STR$ A;",";STR$ B;") =";A(5+A,B);:INPUT " New? ";A(5+A,B)
34 GOTO 30
40 GOSUB 60:CLS :FOR A=1TO F:FOR B=1TO F:A(A,B)=A(A+5,B):NEXT B:NEXT A
41 J=F:GOSUB 2:IF I=0WAIT :PRINT "SINGULAR MATRIX":GOTO 7
42 H=I:J=J-1:FOR A=1TO F:FOR B=1TO F:X=1:Y=1:FOR C=1TO F:FOR D=1TO F:IF D=ATHEN 45
43 IF C=BTHEN 46
44 A(X,Y)=A(C+5,D):X=X+1
45 NEXT D:Y=Y+1:X=1
46 NEXT C:GOSUB 2:I=(-1)^(A+B)*I/H:B$="B("+STR$ A+","+STR$ B+") =":PAUSE B$;I:GOSUB 70
47 IF P$="Y"LPRINT B$;I
48 NEXT B:NEXT A:GOTO 7
50 UNLOCK :END
60 P$="":INPUT "Hard copy? (Y/N) ";P$
61 RETURN 
70 IF INKEY$ <>""THEN 70
71 RETURN 
99 END
