Visual Basic
Podrian ayudarme con un metodo de resolucion de ecuaciones Llamado Gauss Seidel?. Me pidieron que lo hiciera en Visual Basic y no tengo idea de como hacerlo. Cualquier sugerencia de antemano se agradece.
Oie, disculpa tengo una preguta acerca de VISUAL BASIC 6.0, resulta que estoy aprendiendo programacion de este lenguaje! y empiezo aprender a diseñar para poder agregar el codigo! tengo un programa que con una ScrollBar cambia el fondo del texto, y con otro scrollbar se cambia el color de las letras! el problema es que el fondo si cambia al deslizar las barras, pero el texto no cambia no me imagino que esta mal el codigo me podrias ayudar??
este es mi codigo Option Explicit
Public Brojo, Bverde, Bazul As Integer
Public Frojo, Fverde, Fazul As Integer
Private Sub cmdSalir_Click()
End
End Sub
Private Sub Form_Load()
Brojo = 0
Bverde = 0
Bazul = 0
Frojo = 255
Fverde = 255
Fazul = 255
lblcuadro.BackColor = RGB(Brojo, Bverde, Bazul)
lblcuadro.ForeColor = RGB(Frojo, Fverde, Fazul)
End Sub
Private Sub HsbColor_Change(Index As Integer)
If optColor(0).Value = True Then
lblcuadro.BackColor = RGB(HsbColor(0).Value, HsbColor(1).Value, HsbColor(2).Value)
Dim i As Integer
For i = 0 To 2
txtColor(i).Text = HsbColor(i).Value
Next i
Else
End If
End Sub
Private Sub optColor_Click(Index As Integer)
If Index = 0 Then
Frojo = HsbColor(0).Value
Fverde = HsbColor(1).Value
Fazul = HsbColor(2).Value
HsbColor(0).Value = Brojo
HsbColor(1).Value = Bverde
HsbColor(2).Value = Bazul
Else
Brojo = HsbColor(0).Value
Bverde = HsbColor(1).Value
Bazul = HsbColor(2).Value
HsbColor(0).Value = Frojo
HsbColor(1).Value = Fverde
HsbColor(2).Value = Fazul
End If
End Sub
este es mi codigo Option Explicit
Public Brojo, Bverde, Bazul As Integer
Public Frojo, Fverde, Fazul As Integer
Private Sub cmdSalir_Click()
End
End Sub
Private Sub Form_Load()
Brojo = 0
Bverde = 0
Bazul = 0
Frojo = 255
Fverde = 255
Fazul = 255
lblcuadro.BackColor = RGB(Brojo, Bverde, Bazul)
lblcuadro.ForeColor = RGB(Frojo, Fverde, Fazul)
End Sub
Private Sub HsbColor_Change(Index As Integer)
If optColor(0).Value = True Then
lblcuadro.BackColor = RGB(HsbColor(0).Value, HsbColor(1).Value, HsbColor(2).Value)
Dim i As Integer
For i = 0 To 2
txtColor(i).Text = HsbColor(i).Value
Next i
Else
End If
End Sub
Private Sub optColor_Click(Index As Integer)
If Index = 0 Then
Frojo = HsbColor(0).Value
Fverde = HsbColor(1).Value
Fazul = HsbColor(2).Value
HsbColor(0).Value = Brojo
HsbColor(1).Value = Bverde
HsbColor(2).Value = Bazul
Else
Brojo = HsbColor(0).Value
Bverde = HsbColor(1).Value
Bazul = HsbColor(2).Value
HsbColor(0).Value = Frojo
HsbColor(1).Value = Fverde
HsbColor(2).Value = Fazul
End If
End Sub
Private Sub Command1_Click()
Dim matrixp(3, 2) As Double
Dim matrixs(2, 2) As Double
Dim d(2) As Double
Dim matrixf(30, 2) As Double
Dim i, j As Integer
Dim str1, str2 As Variant
Dim e As Double
Dim estado As Boolean
e = 0.00001
matrixp(0, 0) = x1
matrixp(0, 1) = x2
matrixp(0, 2) = x3
matrixp(1, 0) = y1
matrixp(1, 1) = y2
matrixp(1, 2) = y3
matrixp(2, 0) = z1
matrixp(2, 1) = z2
matrixp(2, 2) = z3
matrixp(3, 0) = s1
matrixp(3, 1) = s2
matrixp(3, 2) = s3
For i = 0 To 2 Step 1
For j = 0 To 2 Step 1
Select Case j
Case 0
matrixs(i, j) = matrixp(i, j) / x1 * -1
Case 1
matrixs(i, j) = matrixp(i, j) / y2 * -1
Case 2
matrixs(i, j) = matrixp(i, j) / z3 * -1
End Select
Next
Next
matrixs(0, 0) = 0
matrixs(1, 1) = 0
matrixs(2, 2) = 0
For i = 0 To 2 Step 1
Select Case i
Case 0
d(i) = matrixp(3, i) / x1
Case 1
d(i) = matrixp(3, i) / y2
Case 2
d(i) = matrixp(3, i) / z3
End Select
Next
For i = 0 To 2 Step 1
For j = 0 To 2 Step 1
str1 = str1 & "," & matrixs(i, j)
Next
Next
For i = 0 To 2 Step 1
str2 = str2 & "," & d(i)
Next
MsgBox str1
MsgBox str2
matrixf(0, 0) = d(0)
matrixf(0, 1) = d(1)
matrixf(0, 2) = d(2)
i = 1
j = 1
MsgBox (Abs(matrixf(i, 0) - matrixf(i - 1, 0)) > e)
MsgBox (Abs(matrixf(i, 1) - matrixf(i - 1, 1)) > e)
MsgBox (Abs(matrixf(i, 2) - matrixf(i - 1, 2)) > e)
estado = True
Do While estado = True
MsgBox (Abs(matrixf(i, 0) - matrixf(i - 1, 0)) > e)
MsgBox (Abs(matrixf(i, 1) - matrixf(i - 1, 1)) > e)
MsgBox (Abs(matrixf(i, 2) - matrixf(i - 1, 2)) > e)
If i = 15 Then
MsgBox 4 / 1
End If
MsgBox "worked"
matrixf(i, 0) = d(0) + (matrixs(0, 0) * matrixf(i - 1, 0)) + (matrixs(1, 0) * matrixf(i - 1, 2)) + (matrixs(2, 0) * matrixf(i - 1, 2))
matrixf(i, 1) = d(1) + (matrixs(0, 1) * matrixf(i - 1, 1)) + (matrixs(1, 1) * matrixf(i - 1, 2)) + (matrixs(2, 1) * matrixf(i - 1, 2))
matrixf(i, 2) = d(2) + (matrixs(0, 2) * matrixf(i - 1, 2)) + (matrixs(1, 2) * matrixf(i - 1, 2)) + (matrixs(2, 2) * matrixf(i - 1, 2))
MsgBox matrixf(i, 0)
MsgBox matrixf(i, 1)
MsgBox matrixf(i, 2)
estado = ((Abs(matrixf(i, 0) - matrixf(i - 1, 0)) > e) Or (Abs(matrixf(i, 1) - matrixf(i - 1, 1)) > e) Or (Abs(matrixf(i, 2) - matrixf(i - 1, 2)) > e))
i = i + 1
Loop
MsgBox matrixf(i - 1, 0)
MsgBox matrixf(i - 1, 1)
MsgBox matrixf(i - 1, 2)
End Sub
Dim matrixp(3, 2) As Double
Dim matrixs(2, 2) As Double
Dim d(2) As Double
Dim matrixf(30, 2) As Double
Dim i, j As Integer
Dim str1, str2 As Variant
Dim e As Double
Dim estado As Boolean
e = 0.00001
matrixp(0, 0) = x1
matrixp(0, 1) = x2
matrixp(0, 2) = x3
matrixp(1, 0) = y1
matrixp(1, 1) = y2
matrixp(1, 2) = y3
matrixp(2, 0) = z1
matrixp(2, 1) = z2
matrixp(2, 2) = z3
matrixp(3, 0) = s1
matrixp(3, 1) = s2
matrixp(3, 2) = s3
For i = 0 To 2 Step 1
For j = 0 To 2 Step 1
Select Case j
Case 0
matrixs(i, j) = matrixp(i, j) / x1 * -1
Case 1
matrixs(i, j) = matrixp(i, j) / y2 * -1
Case 2
matrixs(i, j) = matrixp(i, j) / z3 * -1
End Select
Next
Next
matrixs(0, 0) = 0
matrixs(1, 1) = 0
matrixs(2, 2) = 0
For i = 0 To 2 Step 1
Select Case i
Case 0
d(i) = matrixp(3, i) / x1
Case 1
d(i) = matrixp(3, i) / y2
Case 2
d(i) = matrixp(3, i) / z3
End Select
Next
For i = 0 To 2 Step 1
For j = 0 To 2 Step 1
str1 = str1 & "," & matrixs(i, j)
Next
Next
For i = 0 To 2 Step 1
str2 = str2 & "," & d(i)
Next
MsgBox str1
MsgBox str2
matrixf(0, 0) = d(0)
matrixf(0, 1) = d(1)
matrixf(0, 2) = d(2)
i = 1
j = 1
MsgBox (Abs(matrixf(i, 0) - matrixf(i - 1, 0)) > e)
MsgBox (Abs(matrixf(i, 1) - matrixf(i - 1, 1)) > e)
MsgBox (Abs(matrixf(i, 2) - matrixf(i - 1, 2)) > e)
estado = True
Do While estado = True
MsgBox (Abs(matrixf(i, 0) - matrixf(i - 1, 0)) > e)
MsgBox (Abs(matrixf(i, 1) - matrixf(i - 1, 1)) > e)
MsgBox (Abs(matrixf(i, 2) - matrixf(i - 1, 2)) > e)
If i = 15 Then
MsgBox 4 / 1
End If
MsgBox "worked"
matrixf(i, 0) = d(0) + (matrixs(0, 0) * matrixf(i - 1, 0)) + (matrixs(1, 0) * matrixf(i - 1, 2)) + (matrixs(2, 0) * matrixf(i - 1, 2))
matrixf(i, 1) = d(1) + (matrixs(0, 1) * matrixf(i - 1, 1)) + (matrixs(1, 1) * matrixf(i - 1, 2)) + (matrixs(2, 1) * matrixf(i - 1, 2))
matrixf(i, 2) = d(2) + (matrixs(0, 2) * matrixf(i - 1, 2)) + (matrixs(1, 2) * matrixf(i - 1, 2)) + (matrixs(2, 2) * matrixf(i - 1, 2))
MsgBox matrixf(i, 0)
MsgBox matrixf(i, 1)
MsgBox matrixf(i, 2)
estado = ((Abs(matrixf(i, 0) - matrixf(i - 1, 0)) > e) Or (Abs(matrixf(i, 1) - matrixf(i - 1, 1)) > e) Or (Abs(matrixf(i, 2) - matrixf(i - 1, 2)) > e))
i = i + 1
Loop
MsgBox matrixf(i - 1, 0)
MsgBox matrixf(i - 1, 1)
MsgBox matrixf(i - 1, 2)
End Sub
Espero sea oportuno, elabore este codigo porque tambien lo necesito para una asignatura.