can you help me to fix my inverse matrix code?

Status
Not open for further replies.

darkhero

New member
Joined
Jan 7, 2021
Messages
1
Programming Experience
3-5
VB.NET:
    r = InputBox("enter row")
    c = InputBox("enter coloumns")
    ReDim a(r, c)
    ReDim trans(r, c)
    ReDim Matrice(r, c)
    ReDim Inverse_Matrix(r, c)
    ReDim Operations_Matrix(r, c)
    Print "mat is"
    For i = 1 To r
        For j = 1 To c
            a(i, j) = InputBox("enter")
            Print a(i, j); "      ";
        Next
        Print "         "
    Next
    Print "inverse is"

//the program wont print this

    For j = 0 To c

            trans(i, j) = trans(i, j)
            If i <> j Then
                a(i, j) = 0
            Else
                a(i, j) = 1
            End If

        Next
    Next
   
    Dim fak As Double

    For j = 0 To c
        trans(k, j) = trans(k, j) / fak
        a(k, j) = a(k, j) / fak
    Next
   
    For i = 0 To c
        If i <> k Then
            fak = trans(i, k)
            For j = 0 To c
                trans(i, j) = trans(i, j) - fak * trans(k, j)
                a(i, j) = a(i, j) - fak * a(k, j)
            Next
        End If
    Next
   
   
   
    Print a(i, j);
i dont know but the result dont came up , when i compile the program run but doesn't print the answer im so confused to solve this matrix code can just someone give me the algorithm ?
 
Last edited by a moderator:
Status
Not open for further replies.
Top Bottom