Calculando matriz inversa 3x3 vb.net

En este ejemplo de visual studio mostrare el código con el cual podrían la matriz inversa 3x3 para que entiendan el tema les dejo estos vídeos donde explican como encontrarlas:


Matriz Inversa 3X3


aqui el diseño:
En este ejemplo se ocupan 9 textfields los cuales deben llevar el nombre de a00 hasta a22, 10 labels y un button.

aqui el codigo:

 Public Class Form1

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim total As Double

        total = a00.Text * a11.Text * a22.Text + a10.Text * a21.Text * a02.Text + a20.Text * a01.Text * a12.Text
        total = total + (a02.Text * a11.Text * a20.Text) * -1 + (a12.Text * a21.Text * a00.Text) * -1 + (a22.Text * a01.Text * a10.Text) * -1

        If (total <> 0) Then

            lb00.Text = (a11.Text * a22.Text - a21.Text * a12.Text) / total
           lb10.Text = ((a10.Text * a22.Text - a20.Text * a12.Text) * -1) / total
            lb20.Text = (a10.Text * a21.Text - a20.Text * a11.Text) / total
           lb01.Text = ((a01.Text * a22.Text - a21.Text * a02.Text) * -1) / total
            lb11.Text = (a00.Text * a22.Text - a20.Text * a02.Text) / total
           lb21.Text = ((a00.Text * a21.Text - a20.Text * a01.Text) * -1) / total
            lb02.Text = (a01.Text * a12.Text - a11.Text * a02.Text) / total
           lb12.Text = ((a00.Text * a12.Text - a10.Text * a02.Text) * -1) / total
            lb22.Text = (a00.Text * a11.Text - a10.Text * a01.Text) / total
        Else
            MsgBox("Error el det da 0", MsgBoxStyle.Critical)
        End If

    End Sub
End Class


Descargar ejemplo:
Calculando matriz inversa 3x3 asp

Comentarios

Populares

Buscar en este blog