Código
a11 = 1 a12 = 2 a13 = 3 a21 = 1 a22 = 2 a23 = 1 a31 = 2 a32 = 1 a33 = 1 ' |1 2 3| 'A=|1 2 1| ' |2 1 1| '|A|=-6 MSGBOX determinante(a11,a12,a13,a21,a22,a23,a31,a32,a33 ) Function determinante(ij11,ij12,ij13,ij21,ij22,ij23, ij31, ij32, ij33) FC = ij11 * ((ij22 * ij33) - (ij32 * ij23)) +((-1 * ij12) * ((ij21 * ij33) - (ij31 * ij23)) + (ij13 * ((ij21 * ij32) - (ij31 * ij22)))) determinante = FC End Function
Encontre este code para determinantes n*n Pero no lo comprendo
visual basic 2010 este codigo al pareser usa el metodo de cofactor y yo lo quiero en script vbs
si alguien me ayuda estare agradesido
Código
Function DET(ByVal Aux(,) As Double) For i As Integer = 1 To n For j = 1 To n T(i, j) = Aux(i, j) Next Next deter = 1 For k As Integer = 1 To n If T(k, k) = 0 Then j = k If T(k, j)= 0 Then If j =n Then deter = 0 End If j = j+ 1 End If If T(k, j) <> 0 Then For i As Integer = k To n temp = T(i, j) T(i, j) = T(i, k) T(i, k) = temp Next i deter= -deter End If End If If (k - n) < 0 Then k1 = k + 1 For i As Integer = k1 To n For j = k1 To n T(i, j) = T(i, j) - (T(i,k) * T(k, j) /T(k, k)) Next j Next i End If deter = deter * T(k, k) Next k DET = deter End Function