0% found this document useful (0 votes)
42 views

Distancia Corta: Calculo de Las Dimenciones de Un Cono

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)
42 views

Distancia Corta: Calculo de Las Dimenciones de Un Cono

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
You are on page 1/ 6

DISTANCIA CORTA

Private Sub CALCULAR_Click(sender As Object, e As EventArgs) Handles CALCULAR.Click


'Variables
Dim X1, Y1, X2, Y2, Xe, Ye, Xi, Yi, Dc, m21, k21 As Decimal
'Datos
X1 = TextX1.Text
Y1 = TextY1.Text
X2 = TextX2.Text
Y2 = TextY2.Text
Xe = TextXe.Text
Ye = TextYe.Text
' Calculos
m21 = (Y2 - Y1) / (X2 - X1)
k21 = Y1 - m21 * X1
Xi = (Xe - m21 * (k21 - Ye)) / (1 + m21 ^ 2)
Yi = m21 * Xi + k21
Dc = Math.Sqrt((Xi - Xe) ^ 2 + (Yi - Ye) ^ 2)
'resultados
TextXi.Text = xi
TextYi.Text = yi
TextDc.Text = Dc

CALCULO DE LAS DIMENCIONES DE UN CONO


' VARIABLES
Dim V, R, H As Decimal
Dim pi As Decimal = 3.141592
'DATOS
V = TextV.Text
'CALCULOS
R = ((9 * V ^ 2) / (2 * pi ^ 2)) ^ (1 / 6)
H = (3 * V) / (pi * R ^ 2)
'RESULTADOS
TextR.Text = R
TextH.Text = H
TRIANGULO
Private Sub CALCULAR_Click(sender As Object, e As EventArgs) Handles CALCULAR.Click
'VARIABLES
Dim B, A, L, H, X, AT As Decimal
Dim pi As Decimal = 3.141592654
'DATOS
B = TextB.Text
A = TextA.Text
L = TextL.Text
'CALCULOS
H = L * Math.Tan(B * pi / 180)
X = H / Math.Tan(A * pi / 180)
AT = 1 / 2 * (X + L) * H
'RESULTADOS
TextAT.Text = AT
TextH.Text = H
TextX.Text = X

DISTANCIA CORTA A UNA CIRCUNFERENCIA


Private Sub CALCULAR_Click(sender As Object, e As EventArgs) Handles CALCULAR.Click
'VARIABLES
Dim XE, YE, R, XI, YI, DC As Decimal
'DATOS
XE = TextXE.Text
YE = TextYE.Text
R = TextR.Text
'CALCULOS
XI = (R * XE) / (Math.Sqrt(XE ^ 2 + YE ^ 2))
YI = Math.Sqrt(R ^ 2 - XI ^ 2)
DC = Math.Sqrt((XI - XE) ^ 2 + (YI - YE) ^ 2)
'RESULTADOS
TextXI.Text = XI
TextYI.Text = YI
TextDC.Text = DC

METODO DE INTEGRACION DE SIMPSON


Private Sub CALCULAR_Click(sender As Object, e As EventArgs) Handles CALCULAR.Click
'VARIABLES
Dim LS, LI, N, YI, YP, AR, DX, YO, YN As Decimal
'DATOS
LS = TextLS.Text
LI = TextLI.Text
N = TextN.Text
'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
TextYI.Text = YI
TextYP.Text = YP
TextAR.Text = 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 CALCULAR.Click
' 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 = TextLS.Text
LI = TextLI.Text
N = TextN.Text
'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)
TextAR.Text = 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)
TextMX.Text = 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)
TextMY.Text = MY
'CALCULO DEL CENTRO DE GRAVEDAD
XC = MY / AR
YC = MX / AR
'RESULTADOS
TextXC.Text = XC
TextYC.Text = YC
End Sub
Private Function fA(ByRef x As Decimal) As Decimal
Return (Math.Sin(x))
End Function
Private Function fmx(ByRef x As Decimal) As Decimal
Return (1 / 2 * Math.Sin(x) * Math.Sin(x))
End Function
Private Function fmy(ByRef x As Decimal) As Decimal
Return (x * Math.Sin(x))
End Function
End Class

PROGRAMA SUMA MAYOR MENO R EN UN VECTOR


Private Sub CALCULAR_Click(sender As Object, e As EventArgs) Handles CALCULAR.Click
Dim S, MAYOR, MENOR, LI, LS, tmp As Integer
Dim i, j As Integer
'VECTOR
Dim n(5) As Integer
'DATOS
n(1) = TextN1.Text
n(2) = TextN2.Text
n(3) = TextN3.Text
n(4) = TextN4.Text
n(5) = TextN5.Text
'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
TextS.Text = S
TextMAYOR.Text = MAYOR
TextMENOR.Text = 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
Text01.Text = n(1)
Text02.Text = n(2)
Text03.Text = n(3)
Text04.Text = n(4)
Text05.Text = n(5)

End Sub

Private Sub OTROCALCULO_Click(sender As Object, e As EventArgs) Handles OTROCALCULO.Click


TextN1.Text = ""
TextN2.Text = ""
TextN3.Text = ""
TextN4.Text = ""
TextN5.Text = ""
Text01.Text = ""
Text02.Text = ""
Text03.Text = ""
Text04.Text = ""
Text05.Text = ""
End Sub
End Class
Llenado y vaciado de tanques

Private Sub CALCULAR_Click(sender As Object, e As EventArgs) Handles CALCULAR.Click


'VARIABLES
Dim AL, R, Q, TL As Decimal
Dim pi As Decimal = 3.141592654
'datos
AL = TextAL.Text
R = TextR.Text
Q = TextQ.Text
'CALCULAR
TL = (pi * R ^ 2) * AL / Q
'RESULTADOS
TextTL.Text = TL
ENCONTRANDO ANGULOS Y LADOS
Private Sub CALCULAR_Click(sender As Object, e As EventArgs) Handles CALCULAR.Click
'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 = TextL1.Text
L2 = TextL2.Text
L3 = TextL3.Text
A = TextA.Text
G = TextG.Text
'Calculos
L5 = Math.Sqrt(L1 ^ 2 + L2 ^ 2 - 2 * L1 * L2 * Math.Cos(A * pi / 180))
B1 = Math.Asin(L3 * Math.Sin(G * pi / 180) / L5)
D1 = pi - (G * pi / 180 + B1)
A1 = L1 * L2 * Math.Sin(A * pi / 180) / 2
A2 = L3 * L5 * Math.Sin(D1) / 2
AT = A1 + A2
'RESULTADOS
TextL5.Text = L5
TextB1.Text = B1
TextD1.Text = D1
TextA1.Text = A1
TextA2.Text = A2
TextAT.Text = AT

End Sub

Private Sub OTROCALCULO_Click(sender As Object, e As EventArgs) Handles OTROCALCULO.Click


TextL5.Text = ""
TextB1.Text = ""
TextD1.Text = ""
TextA1.Text = ""
TextA2.Text = ""
TextAT.Text = ""
TextL1.Text = ""
TextL2.Text = ""
TextL3.Text = ""
TextA.Text = ""
TextG.Text = ""

You might also like