DET Example10 DIM Matrix(1:3,1:3)
20 DATA 1, 2, 3, 4, -5, 6, 7, 8, 9
30 RESTORE
40 CLEAR SCREEN
50 READ Matrix(*)
60 PRINT "The matrix looks like: "
70 Prtmat(Matrix(*),3,3) !Print out the matrix used.
80 PRINT "The determinant is: ";DET(Matrix)
90 END
100 SUB Prtmat(A(*),Lenarr,Widarr)
110! This sub prints out a matrix length of Lenarr and wide as widarr.
120! A 3x3 matrix would print like:
130! [ 1 2 3 ] Widarr = 3
140! [ 4 5 6 ]
150! [ 7 8 9 ]
160! Lenarr = 3
170 ASSIGN @Out TO CRT
180 FOR Col=1 TO Lenarr
190 OUTPUT @Out;" [";
200 FOR Row=1 TO Widarr
210 OUTPUT @Out;A(Col,Row);
220 NEXT Row
230 OUTPUT @Out;" ]"
240 NEXT Col
250 ASSIGN @Out TO *
260 SUBEND
|