Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -20,11 +20,11 @@ class Pendulum:
|
|
20 |
return t, solution
|
21 |
|
22 |
def main():
|
23 |
-
st.title("Simple
|
24 |
|
25 |
# User inputs
|
26 |
-
length = st.slider("
|
27 |
-
initial_angle = st.slider("
|
28 |
|
29 |
# Convert to radians
|
30 |
initial_angle_rad = np.deg2rad(initial_angle)
|
@@ -36,8 +36,8 @@ def main():
|
|
36 |
# Plot results
|
37 |
fig, ax = plt.subplots()
|
38 |
ax.plot(t, np.rad2deg(solution[:, 0]))
|
39 |
-
ax.set_xlabel('
|
40 |
-
ax.set_ylabel('
|
41 |
ax.grid(True)
|
42 |
st.pyplot(fig)
|
43 |
|
@@ -46,10 +46,10 @@ def main():
|
|
46 |
E_potential = 9.81 * length * (1 - np.cos(solution[:, 0]))
|
47 |
E_total = E_kinetic + E_potential
|
48 |
|
49 |
-
st.write("###
|
50 |
-
st.line_chart({"Total
|
51 |
-
"
|
52 |
-
"
|
53 |
|
54 |
if __name__ == "__main__":
|
55 |
main()
|
|
|
20 |
return t, solution
|
21 |
|
22 |
def main():
|
23 |
+
st.title("Simulaci贸n Simple del Mecanismo del P茅ndulo")
|
24 |
|
25 |
# User inputs
|
26 |
+
length = st.slider("Amplitud del P茅ndulo (m)", 0.1, 5.0, 1.0)
|
27 |
+
initial_angle = st.slider("Angulo Inicial (grados)", -90.0, 90.0, 45.0)
|
28 |
|
29 |
# Convert to radians
|
30 |
initial_angle_rad = np.deg2rad(initial_angle)
|
|
|
36 |
# Plot results
|
37 |
fig, ax = plt.subplots()
|
38 |
ax.plot(t, np.rad2deg(solution[:, 0]))
|
39 |
+
ax.set_xlabel('Tiempo (s)')
|
40 |
+
ax.set_ylabel('Angulo (grados)')
|
41 |
ax.grid(True)
|
42 |
st.pyplot(fig)
|
43 |
|
|
|
46 |
E_potential = 9.81 * length * (1 - np.cos(solution[:, 0]))
|
47 |
E_total = E_kinetic + E_potential
|
48 |
|
49 |
+
st.write("### Conservaci贸n de la Energ铆a")
|
50 |
+
st.line_chart({"Energ铆a Total": E_total,
|
51 |
+
"Energ铆a Cin茅tica": E_kinetic,
|
52 |
+
"Energ铆a Potencial": E_potential})
|
53 |
|
54 |
if __name__ == "__main__":
|
55 |
main()
|