Skip to content
Snippets Groups Projects
Commit d8e9aed2 authored by Juan Sebastian Urrea Vega's avatar Juan Sebastian Urrea Vega
Browse files

Upload New File

parent f80938d2
No related branches found
No related tags found
No related merge requests found
import math
def integral(k, theta):
def integrando(t):
return 1 / math.sqrt(1 - k**2 * math.sin(t)**2)
puntos = 1000
h = (theta - 0) / puntos
sumadelaintegral = 0.0
for i in range(puntos + 1):
t = i * h
weight = 2 if i == 0 or i == puntos else 4 if i % 2 == 1 else 2
sumadelaintegral += weight * integrando(t)
return (h / 3) * sumadelaintegral
def periodo(L, g, theta):
alpha = theta / 2
k = math.sin(alpha)
T = 4 * math.sqrt(L / g) * integral(k, math.pi/2)
return T
longitudpendulo = 1.0
aceleraciongravedad = 9.81
anguloinicialengrados = 3.7
anguloinicialenradianes = math.radians(anguloinicialengrados)
periodo = periodo(longitudpendulo, aceleraciongravedad, anguloinicialenradianes)
print(f"El periodo del péndulo es: {periodo:.2f} segundos")
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment