0% found this document useful (0 votes)
8 views6 pages

Calculadora de Geometría y Cálculos Matemáticos

The document contains code snippets from several Visual Basic .NET programs that calculate various geometric values and solve math problems. The code includes functions to calculate the distance between two points, the dimensions of a cone, the area of a triangle, the distance from a point to a circle, integration using Simpson's method, calculating moments and centers of gravity, summing and finding the min/max of an array, filling/emptying tank calculations, and finding angles and sides of shapes. The code takes in user input, performs calculations, and returns output values.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views6 pages

Calculadora de Geometría y Cálculos Matemáticos

The document contains code snippets from several Visual Basic .NET programs that calculate various geometric values and solve math problems. The code includes functions to calculate the distance between two points, the dimensions of a cone, the area of a triangle, the distance from a point to a circle, integration using Simpson's method, calculating moments and centers of gravity, summing and finding the min/max of an array, filling/emptying tank calculations, and finding angles and sides of shapes. The code takes in user input, performs calculations, and returns output values.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

DISTANCIA CORTA

Private Sub CALCULAR_Click(sender As Object, e As EventArgs) Handles [Link]


'Variables
Dim X1, Y1, X2, Y2, Xe, Ye, Xi, Yi, Dc, m21, k21 As Decimal
'Datos
X1 = [Link]
Y1 = [Link]
X2 = [Link]
Y2 = [Link]
Xe = [Link]
Ye = [Link]
' Calculos
m21 = (Y2 - Y1) / (X2 - X1)
k21 = Y1 - m21 * X1
Xi = (Xe - m21 * (k21 - Ye)) / (1 + m21 ^ 2)
Yi = m21 * Xi + k21
Dc = [Link]((Xi - Xe) ^ 2 + (Yi - Ye) ^ 2)
'resultados
[Link] = xi
[Link] = yi
[Link] = Dc

CALCULO DE LAS DIMENCIONES DE UN CONO


' VARIABLES
Dim V, R, H As Decimal
Dim pi As Decimal = 3.141592
'DATOS
V = [Link]
'CALCULOS
R = ((9 * V ^ 2) / (2 * pi ^ 2)) ^ (1 / 6)
H = (3 * V) / (pi * R ^ 2)
'RESULTADOS
[Link] = R
[Link] = H
TRIANGULO
Private Sub CALCULAR_Click(sender As Object, e As EventArgs) Handles [Link]
'VARIABLES
Dim B, A, L, H, X, AT As Decimal
Dim pi As Decimal = 3.141592654
'DATOS
B = [Link]
A = [Link]
L = [Link]
'CALCULOS
H = L * [Link](B * pi / 180)
X = H / [Link](A * pi / 180)
AT = 1 / 2 * (X + L) * H
'RESULTADOS
[Link] = AT
[Link] = H
[Link] = X

DISTANCIA CORTA A UNA CIRCUNFERENCIA


Private Sub CALCULAR_Click(sender As Object, e As EventArgs) Handles [Link]
'VARIABLES
Dim XE, YE, R, XI, YI, DC As Decimal
'DATOS
XE = [Link]
YE = [Link]
R = [Link]
'CALCULOS
XI = (R * XE) / ([Link](XE ^ 2 + YE ^ 2))
YI = [Link](R ^ 2 - XI ^ 2)
DC = [Link]((XI - XE) ^ 2 + (YI - YE) ^ 2)
'RESULTADOS
[Link] = XI
[Link] = YI
[Link] = DC

METODO DE INTEGRACION DE SIMPSON


Private Sub CALCULAR_Click(sender As Object, e As EventArgs) Handles [Link]
'VARIABLES
Dim LS, LI, N, YI, YP, AR, DX, YO, YN As Decimal
'DATOS
LS = [Link]
LI = [Link]
N = [Link]
'CALCULOS
DX = (LS - LI) / N
YO = fx(LI)
YN = fx(LS)
'CALCULO DE Y IMPARES
For i = 1 To N - 1 Step 2
YI = YI + fx(LI + i * DX)
Next
For i = 2 To N - 2 Step 2
YP = YP + fx(LI + i * DX)
Next
AR = DX / 3 * (YO + YN + 4 * YI + 2 * YP)
'RESULTADOS
[Link] = YI
[Link] = YP
[Link] = AR
End Sub
Private Function fx(ByRef X As Decimal) As Decimal
Return (3 * X ^ 2 - 2)
End Function

Calculo de momentos y centros de gravedad


Private Sub CALCULAR_Click(sender As Object, e As EventArgs) Handles [Link]
' VARIABLES
Dim LS, LI, YI, YP, YO, YN, AR, MX, MXP, MXI, MY, MYP, MYI, YC, XC, DX As Decimal
Dim i, N As Single
Dim pi As Decimal = 3.141582654
'DATOS
LS = [Link]
LI = [Link]
N = [Link]
'CALCULOS
DX = (LS - LI) / N
YN = fA(LS)
YO = fA(LI)
'CALCULO DE AREA
For i = 1 To N - 1 Step 2
YI = YI + fA(LI + i * DX)
Next
For i = 2 To N - 2 Step 2
YP = YP + fA(LI + i * DX)
Next
AR = DX / 3 * (YO + YN + 4 * YI + 2 * YP)
[Link] = AR
'MOMENTO EN X
For i = 1 To N - 1 Step 2
MXI = MXI + fmx(LI + i * DX)
Next
For i = 2 To N - 2 Step 2
MXP = MXP + fmx(LI + i * DX)
Next
MX = DX / 3 * (YO + YN + 4 * MXI + 2 * MXP)
[Link] = MX
'MOMENTO EN Y
For i = 1 To N - 1 Step 2
MYI = MYI + fmy(LI + i * DX)
Next
For i = 2 To N - 2 Step 2
MYP = MYP + fmy(LI + i * DX)
Next
MY = DX / 3 * (YO + YN + 4 * MYI + 2 * MYP)
[Link] = MY
'CALCULO DEL CENTRO DE GRAVEDAD
XC = MY / AR
YC = MX / AR
'RESULTADOS
[Link] = XC
[Link] = YC
End Sub
Private Function fA(ByRef x As Decimal) As Decimal
Return ([Link](x))
End Function
Private Function fmx(ByRef x As Decimal) As Decimal
Return (1 / 2 * [Link](x) * [Link](x))
End Function
Private Function fmy(ByRef x As Decimal) As Decimal
Return (x * [Link](x))
End Function
End Class

PROGRAMA SUMA MAYOR MENO R EN UN VECTOR


Private Sub CALCULAR_Click(sender As Object, e As EventArgs) Handles [Link]
Dim S, MAYOR, MENOR, LI, LS, tmp As Integer
Dim i, j As Integer
'VECTOR
Dim n(5) As Integer
'DATOS
n(1) = [Link]
n(2) = [Link]
n(3) = [Link]
n(4) = [Link]
n(5) = [Link]
'CALCULO
For i = 1 To 5
S = S + n(i)
Next
For i = 1 To 5
If n(i) > MAYOR Then
MAYOR = n(i)
End If
Next
MENOR = 10000
For i = 1 To 5
If n(i) < MENOR Then
MENOR = n(i)
End If
Next

'RESULTADOS
[Link] = S
[Link] = MAYOR
[Link] = MENOR
'ORDENA NUMERO DE MENOR A MAYOR
LI = LBound(n, 1)
LS = UBound(n, 1)
For i = LI To LS - 1
For j = LI To LS - 1
If n(j) > n(j + 1) Then
tmp = n(j)
n(j) = n(j + 1)
n(j + 1) = tmp

End If
Next
Next
[Link] = n(1)
[Link] = n(2)
[Link] = n(3)
[Link] = n(4)
[Link] = n(5)

End Sub

Private Sub OTROCALCULO_Click(sender As Object, e As EventArgs) Handles [Link]


[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
End Sub
End Class
Llenado y vaciado de tanques

Private Sub CALCULAR_Click(sender As Object, e As EventArgs) Handles [Link]


'VARIABLES
Dim AL, R, Q, TL As Decimal
Dim pi As Decimal = 3.141592654
'datos
AL = [Link]
R = [Link]
Q = [Link]
'CALCULAR
TL = (pi * R ^ 2) * AL / Q
'RESULTADOS
[Link] = TL
ENCONTRANDO ANGULOS Y LADOS
Private Sub CALCULAR_Click(sender As Object, e As EventArgs) Handles [Link]
'variables
Dim L1, L2, L3, L4, L5, A, B, G, B1, D1, A1, A2, AT As Decimal
Dim pi As Decimal = 3.141592654
'Datos
L1 = [Link]
L2 = [Link]
L3 = [Link]
A = [Link]
G = [Link]
'Calculos
L5 = [Link](L1 ^ 2 + L2 ^ 2 - 2 * L1 * L2 * [Link](A * pi / 180))
B1 = [Link](L3 * [Link](G * pi / 180) / L5)
D1 = pi - (G * pi / 180 + B1)
A1 = L1 * L2 * [Link](A * pi / 180) / 2
A2 = L3 * L5 * [Link](D1) / 2
AT = A1 + A2
'RESULTADOS
[Link] = L5
[Link] = B1
[Link] = D1
[Link] = A1
[Link] = A2
[Link] = AT

End Sub

Private Sub OTROCALCULO_Click(sender As Object, e As EventArgs) Handles [Link]


[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""

You might also like