jcmachicao commited on
Commit
b5ef362
verified
1 Parent(s): cd97295

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -9
app.py CHANGED
@@ -20,11 +20,11 @@ class Pendulum:
20
  return t, solution
21
 
22
  def main():
23
- st.title("Simple Pendulum Simulator")
24
 
25
  # User inputs
26
- length = st.slider("Pendulum Length (m)", 0.1, 5.0, 1.0)
27
- initial_angle = st.slider("Initial Angle (degrees)", -90.0, 90.0, 45.0)
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('Time (s)')
40
- ax.set_ylabel('Angle (degrees)')
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("### Energy Conservation")
50
- st.line_chart({"Total Energy": E_total,
51
- "Kinetic Energy": E_kinetic,
52
- "Potential Energy": E_potential})
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()