Péndulo simple

Para mayores detalles consulta:

Script

# Gravity g = 9.81 # Length L = 2 # Initial Position and initial velocity θ0 = 3 pi/4 ω0 = 0 # System of ODEs θ'(t, θ, ω) = ω ω'(t, θ, ω) = -g / L sin(θ) # Solve the system NSolveODE({θ', ω'}, 0, {θ0, ω0}, 17.3) SetVisibleInView(numericalIntegral1, 1, false) SetVisibleInView(numericalIntegral2, 1, false) # Plot the pendulum # first get values of theta len = Length(numericalIntegral1) c = Slider(0, 1, 1 / len, 1, 100, false, true, true, false) SetVisibleInView(c, 1, false) # calculate position xp = L sin(y(Point(numericalIntegral1, c))) yp = -L cos(y(Point(numericalIntegral1, c))) # plot mass A = (xp, yp) ShowLabel(A, false) SetColor(A, "Red") SetPointSize(A, 9) # plot bar f = Segment((0, 0), A) SetCaption(f, "L") StartAnimation()

Otras versiones:

Thijs: Pendulum