Gauss Jordan Codigo
Enviado por Jerry • 28 de Agosto de 2018 • 627 Palabras (3 Páginas) • 369 Visitas
...
End If
Next
If Not (j = l) Then
For i = 1 To m
tem = a(l, i)
a(l, i) = a(j, i)
a(j, i) = tem
Next
End If
For j = l + 1 To n
tem = a(j, l) / a(l, l)
For i = 1 To m
a(j, i) = a(j, i) - tem * a(l, i)
Next
Next
Next
ReDim C(n * 2)
C(n) = a(n, m) / a(n, n)
For i = 1 To n - 1
j = n - i
Sum = 0
For l = 1 To i
k = j + l
Sum = Sum + a(j, k) * C(k)
Next
C(j) = (a(j, m) - Sum) / a(j, j)
Next
'For i = 1 To n
' MsgBox "Raíz " & i & " = " & C(i)
'Next i
End Sub
- Código de referencia
Sub GAUSSJORDAN()
For l As Integer = 1 To n - 1
j = l
For k = l + 1 To n
If (Math.Abs(A(j, l)) >= Math.Abs(A(k, l))) Then
Else : j = k
End If
Next
If Not (j = l) Then
For i As Integer = 1 To m
tem = A(l, i)
A(l, i) = A(j, i)
A(j, i) = tem
Next
End If
For j = l + 1 To n
tem = A(j, l) / A(l, l)
For i As Integer = 1 To m
A(j, i) = A(j, i) - tem * A(l, i)
Next
Next
Next
ReDim C(n * 2)
C(n) = A(n, m) / A(n, n)
For i As Integer = 1 To n - 1
j = n - i
sum = 0
For l As Integer = 1 To i
k = j + l
sum = sum + A(j, k) * C(k)
Next
C(j) = (A(j, m) - sum) / A(j, j)
Next
End Sub
...