fb:porticula NoPaste
MatInv in TB
Uploader: | ytwinky |
Datum/Zeit: | 16.01.2011 17:15:01 |
'Start des eigentlichen Programms, bloá kein Renum benutzen!
' Hahaa, das ist TB.. und die Inversion geht ohne GOTO
DEFINT I-N
DEFDBL A-H,O-Z
F$="####.##"
FI$="###"
RANDOMIZE TIMER
IZ=50
DIM C(IZ,IZ),B(IZ,IZ),IIZ(IZ)
Do
PRINT"Dimension der Matrix(1..";RIGHT$(STR$(IZ),2);
INPUT;"):",L
PRINT
Loop While L<1 OR L>IZ
PRINT"Matrix"
FOR I=1 TO L
FOR J=1 TO L
C(I,J)=RND
PRINT USING F$;C(I,J);
B(I,J)=C(I,J)
NEXT
PRINT
NEXT I
PRINT"Inverse"
FOR I=1 TO L
N=I-1
Do
N=N+1
IF N>L THEN PRINT"Matrix singul„r":STOP
Loop While C(n,i)=0#
K=N
FOR J=1 TO L
D=C(I,J)
C(I,J)=C(K,J)
C(K,J)=D
NEXT
IIZ(I)=K
C(I,I)=1#/C(I,I)
FOR J=1 TO L
IF J<>I THEN C(I,J)=C(I,J)*C(I,I)
NEXT J
FOR N=1 TO L
If n<>i then
D=-C(N,I)
C(N,I)=0#
FOR J=1 TO L
C(N,J)=C(N,J)+D*C(I,J)
NEXT
End If
NEXT N,I
FOR I=1 TO L
While IIZ(i)<>i
FOR J=1 TO L
D=C(J,I)
K=IIZ(I)
Do
K=IIZ(K)
loop UNTIL K=IIZ(I)
C(J,I)=C(J,K)
C(J,K)=D
NEXT J
Wend
NEXT
FOR I=1 TO L
FOR J=1 TO L
PRINT USING F$;C(I,J);
NEXT
PRINT
NEXT
PRINT"Einheits-Matrix"
FOR I=1 TO L
FOR J=1 TO L
D=0#
FOR K=1 TO L
D=D+B(I,K)*C(K,J)
NEXT
PRINT USING FI$;D;
NEXT
PRINT
NEXT
END