Matriz inver

Solo disponible en BuenasTareas
  • Páginas : 21 (5229 palabras )
  • Descarga(s) : 0
  • Publicado : 19 de diciembre de 2011
Leer documento completo
Vista previa del texto
MATRIZ INVERSA EN VISUAL BASIC 6.0

1) Inicia VB6.0 en un proyecto estándar en blanco (figura 1):

[pic]
Figura 1

2) Coloca un botón de comando en el formulario, que sea de tamaño relativamente pequeño (figura 2) y coloque la propiedad AUTOREDRAW = True del Form1.

[pic] [pic]
Figura 2

3) Agregar un Modulo. (Figura 3)
*Click en el menú Proyecto
*Clic en Agregar Modulo

[pic]Figura 3

*Si esta ventana aparece, pulsar abrir

[pic]
Figura 4
4) Introducir código de la matriz inversa en el Module 1.

En la ventana proyecto, haga doble clic en el Module 1 para ingresar a la ventana código de este modulo.
[pic]

Figura 5.

Aparecerá la ventana código (figura 6)

[pic]
Figura 6

Copie el siguiente código y péguelo dentro de esta ventana(el tamaño de la letra fue reducido para ahorrar espacio en este documento, NO NECESITA LEERLO):

Private Const LUNB As Long = 8#

Public Type Complex
X As Double
Y As Double
End Type

Public Const MachineEpsilon = 5E-16
Public Const MaxRealNumber = 1E+300
Public Const MinRealNumber = 1E-300

Private Const BigNumber As Double = 1E+70
Private Const SmallNumber As Double = 1E-70Private Const PiNumber As Double = 3.14159265358979
Public Function MaxReal(ByVal M1 As Double, ByVal M2 As Double) As Double
If M1 > M2 Then
MaxReal = M1
Else
MaxReal = M2
End If
End Function

Public Function MinReal(ByVal M1 As Double, ByVal M2 As Double) As Double
If M1 < M2 Then
MinReal = M1
Else
MinReal = M2
End If
EndFunction

Public Function MaxInt(ByVal M1 As Long, ByVal M2 As Long) As Long
If M1 > M2 Then
MaxInt = M1
Else
MaxInt = M2
End If
End Function

Public Function MinInt(ByVal M1 As Long, ByVal M2 As Long) As Long
If M1 < M2 Then
MinInt = M1
Else
MinInt = M2
End If
End Function

Public Function ArcSin(ByVal X As Double) As DoubleDim T As Double
T = Sqr(1 - X * X)
If T < SmallNumber Then
ArcSin = Atn(BigNumber * Sgn(X))
Else
ArcSin = Atn(X / T)
End If
End Function

Public Function ArcCos(ByVal X As Double) As Double
Dim T As Double
T = Sqr(1 - X * X)
If T < SmallNumber Then
ArcCos = Atn(BigNumber * Sgn(-X)) + 2 * Atn(1)
Else
ArcCos =Atn(-X / T) + 2 * Atn(1)
End If
End Function

Public Function SinH(ByVal X As Double) As Double
SinH = (Exp(X) - Exp(-X)) / 2
End Function

Public Function CosH(ByVal X As Double) As Double
CosH = (Exp(X) + Exp(-X)) / 2
End Function

Public Function TanH(ByVal X As Double) As Double
TanH = (Exp(X) - Exp(-X)) / (Exp(X) + Exp(-X))
End Function

Public Function Pi() AsDouble
Pi = PiNumber
End Function

Public Function Power(ByVal Base As Double, ByVal Exponent As Double) As Double
Power = Base ^ Exponent
End Function

Public Function Square(ByVal X As Double) As Double
Square = X * X
End Function

Public Function Log10(ByVal X As Double) As Double
Log10 = Log(X) / Log(10)
End Function

Public Function Ceil(ByVal X As Double) AsDouble
Ceil = -Int(-X)
End Function

Public Function RandomInteger(ByVal X As Long) As Long
RandomInteger = Int(Rnd() * X)
End Function

Public Function Atn2(ByVal Y As Double, ByVal X As Double) As Double
If SmallNumber * Abs(Y) < Abs(X) Then
If X < 0 Then
If Y = 0 Then
Atn2 = Pi()
Else
Atn2 = Atn(Y / X) + Pi() *Sgn(Y)
End If
Else
Atn2 = Atn(Y / X)
End If
Else
Atn2 = Sgn(Y) * Pi() / 2
End If
End Function

Public Function C_Complex(ByVal X As Double) As Complex
Dim Result As Complex

Result.X = X
Result.Y = 0

C_Complex = Result
End Function

Public Function AbsComplex(ByRef Z As Complex) As Double
Dim Result...
tracking img