[url=https://bestiariotopologico.blogspot.com/2021/09/simulacion-del-pendulo-simple-con.html]Simulación del péndulo simple con GeoGebra (y oscilaciones amortiguadas)[/url]
# Gravity[br]g = 9.81[br][br]# Mass[br]m = 3[br][br]# Damping[br]γ = 0.791 [br][br]# Length[br]L = 2[br][br]# Initial Position and initial velocity[br]θ0 = 3 pi/4[br]ω0 = 0[br][br]# System of ODEs[br]θ'(t, θ, ω) = ω[br]ω'(t, θ, ω) = -γ/m ω - g / L sin(θ)[br][br]# Solve the system[br]NSolveODE({θ', ω'}, 0, {θ0, ω0}, 40)[br]SetVisibleInView(numericalIntegral1, 1, false)[br]SetVisibleInView(numericalIntegral2, 1, false)[br][br]# Plot the pendulum[br][br]# first get values of theta[br]len = Length(numericalIntegral1)[br]c = Slider(0, 1, 1 / len, 1, 100, false, true, true, false)[br]SetVisibleInView(c, 1, false)[br][br]# calculate position[br]xp = L sin(y(Point(numericalIntegral1, c)))[br]yp = -L cos(y(Point(numericalIntegral1, c)))[br][br]# plot mass[br]A = (xp, yp)[br]ShowLabel(A, false)[br]SetColor(A, "Red")[br]SetPointSize(A, 9)[br][br]# plot bar[br]f = Segment((0, 0), A)[br]SetCaption(f, "L")[br][br]StartAnimation()