0% found this document useful (0 votes)
23 views3 pages

Form1: "Ing Valor en La Posicion "

This document contains code for a Visual Basic program that uses matrix operations to solve systems of linear equations. The code defines matrices and vectors to store coefficients and values. It includes buttons to input matrix and vector values, perform calculations, and display results. The calculations iterate through rows and columns of the matrices to compute sums and apply the Gauss-Seidel method to solve the systems of equations.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views3 pages

Form1: "Ing Valor en La Posicion "

This document contains code for a Visual Basic program that uses matrix operations to solve systems of linear equations. The code defines matrices and vectors to store coefficients and values. It includes buttons to input matrix and vector values, perform calculations, and display results. The calculations iterate through rows and columns of the matrices to compute sums and apply the Gauss-Seidel method to solve the systems of equations.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Public Class Form1

Dim matriz1(3, 3), terminoindependiente(3), x0(3), MAXIT, EPS, M, x1(3), k, I,


suma, J, A(3, 3), b(3) As Integer

Dim x, y As Integer

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button1.Click

TextBox1.Text = MAXIT
TextBox2.Text = EPS
TextBox3.Text = M

For x = 1 To 3
For y = 1 To 3
matriz1(x, y) = InputBox("Ing valor en la posicion " & Str(x))
Next
Next
ListBox1.Items.Clear()

For x = 1 To 3

ListBox1.Items.Add(matriz1(x, 1) & " " & matriz1(x, 2) & " " &
matriz1(x, 3))

Next

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button2.Click
For x = 1 To 3
terminoindependiente(x) = InputBox("ingrese numero en la posicion" &
Str(x))

Next
For x = 1 To 3
ListBox2.Items.Add(terminoindependiente(x))

Next
End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button3.Click
For x = 1 To 3
x0(x) = InputBox("ingrese numero en la posicion" & Str(x))

Next
For x = 1 To 3
ListBox3.Items.Add(x0(x))

Next
End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button4.Click
k = 1
Do While k <= MAXIT
If M = 0 Then
I = 1
Else
x1(x) = x0(x)
End If

Do While I <= 3
suma = matriz1(x, y) - matriz1(x, y)

J = 1
Do While J <= 3
If J = I Then

J = J + 1
Else
suma = suma + A(I, J) * x0(J)
If M = 0 Then
x1(I) = -(b(I) - suma) / A(I, I)

Else
x0(I) = (b(I) - suma) / A(I, I)

End If
I = I + 1
If Math.Abs(x - x0(3)) <= EPS Then
For x = 1 To 3
ListBox4.Items.Add(x1(x))
TextBox4.Text = k
Next

Else
If M = 0 Then
x0(x) = x1(x)
k = k + 1

End If

End If

End If
Loop

Loop
Loop

End Sub

End Class

You might also like