sin-titulo

Pasted Nov 9, 2026, 12:34 AM1 file30 lines

Scan to open on your phone

Point a camera at the QR code - it opens this exact paste, no app needed.

https://codepastes.com/zzgs9ftb5ajxmj9p
sin-titulo
import numpy as np
import matplotlib.pyplot as plt

# Datos de la práctica casera
L_m = np.array([0.20, 0.30, 0.40, 0.50, 0.60])
t_10 = np.array([9.23, 11.00, 13.00, 14.76, 15.81])

T_exp = t_10 / 10.0
T2_exp = T_exp**2

slope, intercept = np.polyfit(L_m, T2_exp, 1)
g_exp = (4 * np.pi**2) / slope
g_teo = 9.81
error_pct = abs((g_exp - g_teo) / g_teo) * 100

print(f"Pendiente (m): {slope:.4f} s²/m")
print(f"Gravedad experimental: {g_exp:.3f} m/s²")
print(f"Error porcentual: {error_pct:.2f}%")

L_sim = np.linspace(0.15, 0.65, 100)
plt.figure(figsize=(6, 3))
plt.plot(L_sim, (4 * np.pi**2 / g_teo) * L_sim, 'r--', label='Modelo Teórico (9.81 m/s²)')
plt.plot(L_sim, slope * L_sim + intercept, 'b-', label=f'Ajuste Exp. ({g_exp:.2f} m/s²)')
plt.scatter(L_m, T2_exp, color='navy', label='Datos Medidos')
plt.xlabel('Longitud L (m)')
plt.ylabel('Periodo T² (s²)')
plt.grid(True, linestyle=':', alpha=0.6)
plt.legend()
plt.show()

928 chars · codepastes.com