You are on page 1of 2

Public Class Form1 Dim n(,) As Double = {{52, 13, 24, 44}, {33, 44, 22, 12}, {22,

22, 12, 34}, {13, 33, 23, 12}} Dim id(,) As Double = {{1, 0, 0, 0}, {0, 1, 0, 0}, {0, 0, 1, 0}, {0, 0, 0, 1}} Dim d As Double Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click TextBox1.Text = TextBox1.Text & vbCrLf TextBox1.Text = TextBox1.Text & " Matriz N " & vbCrLf TextBox1.Text = TextBox1.Text & vbCrLf For i = 0 To UBound(n, 1) For j = 0 To UBound(n, 2) TextBox1.Text = TextBox1.Text & Format(n(i, j), "#0.###0") & " " Next j TextBox1.Text = TextBox1.Text & vbCrLf Next i For i = 0 To UBound(n, 1) For j = 0 To UBound(n, 2) If i <> j Then d = -n(j, i) / n(i, i) For k = 0 To UBound(n, 2) n(j, k) = d * n(i, k) + n(j, k) id(j, k) = d * id(i, k) + id(j, k) Next End If Next Next TextBox1.Text = TextBox1.Text & vbCrLf TextBox1.Text = TextBox1.Text & " Matriz N transformada" & vbCrLf TextBox1.Text = TextBox1.Text & vbCrLf For i = 0 To UBound(n, 1) For j = 0 To UBound(n, 2) TextBox1.Text = TextBox1.Text & Format(n(i, j), "#0.###0") & " " Next j TextBox1.Text = TextBox1.Text & vbCrLf Next i TextBox1.Text = TextBox1.Text & vbCrLf TextBox1.Text = TextBox1.Text & " Matriz identidad transformada" & vbCrLf TextBox1.Text = TextBox1.Text & vbCrLf For i = 0 To UBound(n, 1) For j = 0 To UBound(n, 2) TextBox1.Text = TextBox1.Text & Format(id(i, j), "#0.###0") & " " Next j TextBox1.Text = TextBox1.Text & vbCrLf Next i TextBox1.Text = TextBox1.Text & vbCrLf TextBox1.Text = TextBox1.Text & " Matriz inversa de n" & vbCrLf TextBox1.Text = TextBox1.Text & vbCrLf

For i = 0 To UBound(n, 1) For j = 0 To UBound(n, 2) TextBox1.Text = TextBox1.Text & Format(id(i, j) / n(i, i), "#0.###0") & " " Next j TextBox1.Text = TextBox1.Text & vbCrLf Next i End Sub End Class

You might also like