Programacion Aleatoria

Páginas: 2 (410 palabras) Publicado: 8 de agosto de 2012
Option Explicit
Private mat() As Single
Private NoOfVariableEquations As Integer


Private Sub BkSubst() ' BackSubstitution

Dim i As Integer
Dim j AsInteger
Dim mBound As Integer
Dim sSum As Single
Dim msgStr As String

mBound = NoOfVariableEquations - 1
ReDim reslt(mBound) As Single
reslt(mBound) = FormatNumber(mat(mBound,mBound + 1) / mat(mBound, mBound), 5)
For i = mBound - 1 To 0 Step -1
sSum = 0
For j = i + 1 To mBound
sSum = sSum + mat(i, j) * reslt(j)
Next jreslt(i) = FormatNumber((mat(i, mBound + 1) - sSum) / mat(i, i), 5)
Next i
For i = 0 To mBound
msgStr = msgStr + vbNewLine & "X" & i + 1 & vbTab & reslt(i)
Next i
MsgBoxmsgStr, , "Result"
Print "Solution of Equations" & msgStr

End Sub

Private Sub Command1_Click() ' Input Matrix data

Dim mBound As Integer
Dim i As Integer
Dim j As IntegerNoOfVariableEquations = Val(InputBox("Number of variables", "Equations", 3))
If Not NoOfVariableEquations 1 Then
ReDim mat(mBound, mBound + 1)
End If
For i= 0 To mBound
For j = 0 To mBound
mat(i, j) = InputBox("Enter Element co-eff value" & vbNewLine & "Element [" & i & "," & j & "]", "Input Data Element")
Next j
mat(i,mBound + 1) = InputBox("Enter Element Value" & vbNewLine & "Value [" & i & "," & mBound + 1 & "]", "Input Equation Value")
Next i
Print "Matrix representation of the linear Equations"DisplayMatrixData
UpperTriangular
Print "converted to Upper Triangular form"
DisplayMatrixData
BkSubst
End If

End Sub

Private SubDisplayMatrixData()

Dim i As Integer
Dim j As Integer
Dim res As String

For i = 0 To NoOfVariableEquations - 1
For j = 0 To NoOfVariableEquations
res = res & vbTab & mat(i, j)...
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • 10597 TRABAJO DE PROGRAMACION ARCHIVOS ALEATORIOS
  • Aleatorios
  • aleatorio
  • Aleatorio
  • aleatorio
  • aleatorio
  • aleatorio
  • variable aleatoria y variable aleatoria continua

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS