#---------------------------------------------[br]# String[br]#---------------------------------------------[br]L = Slider(1, 13, 0.01, 1, 150, false, true, false, false)[br]SetValue(L, 11)[br]posY = 430[br]SetCoords(L, 50, posY)[br]SetVisibleInView(L, 1, false)[br][br]O = (0, 0)[br]SetVisibleInView(O, 1, false)[br][br]#---------------------------------------------[br]# Slider to animate[br]#---------------------------------------------[br]speed = 1[br]t = Slider(0, 1, 0.01, speed, 150, false, true, false, false)[br]SetVisibleInView(t, 1, false)[br][br]#---------------------------------------------[br]# Gravity[br]#---------------------------------------------[br]g = Slider(0, 15, 0.01, 1, 150, false, true, false, false)[br]SetCoords(g, 300, posY)[br]SetValue(g, 9.81)[br]SetVisibleInView(g, 1, false)[br][br]#---------------------------------------------[br]# mass[br]#---------------------------------------------[br][br]mass = Slider(0, 15, 0.01, 1, 150, false, true, false, false)[br]SetValue(mass, 3)[br]SetVisibleInView(mass, 1, false)[br][br]#---------------------------------------------[br]# Slider for user to change the angle[br]#---------------------------------------------[br]userAngle = Slider(0, 3.14, 0.01, 1, 150, false, true, false, false)[br]SetValue(userAngle, pi * 0.6)[br]SetCaption(userAngle, "θ")[br]SetLabelMode(userAngle, 9)[br]SetCoords(userAngle, 50, posY)[br][br]#-----------------------[br]# Initial conditions[br]#-----------------------[br]angleV = 0[br]angleA = 0[br]angle = pi * 0.6[br]damping = 0.791[br][br]#---------------------------------------------[br]# Force and position of Bob[br]#---------------------------------------------[br]force = -g * sin(angle)[br]fdamp = - damping * angleV[br]posx = L * sin(angle);[br]posy = -L * cos(angle);[br]angleA = fdamp/mass + (force)/L[br][br]#---------------------------[br]# Plot pendulum[br]#---------------------------[br]s = Segment(O, (posx, posy))[br]SetLabelMode(s, 3)[br]SetCaption(s, "L")[br]SetLineThickness(s, 7)[br]ShowLabel(s, true)[br]c = Circle((posx, posy), 1)[br]ShowLabel(c, false)[br]SetFilling(c, 1)[br][br]a = false[br]SetValue(a, false)[br][br]#---------------------------------------------[br]# Then add these lines in the slider 't'[br]#---------------------------------------------[br]#SetValue(angleA, fdamp/mass + (force)/L)[br]#SetValue(angleV, angleV + angleA/3)[br]#SetValue(angle, angle + angleV/3)[br][br]#---------------------------------------------------------[br]# Finally add these lines in the slider 'userAngle'[br]#---------------------------------------------------------[br]#SetValue(angle, userAngle)[br]#StartAnimation(t, false)[br]#SetValue(a, false)[br]#SetValue(angleV, 0)[br]#SetValue(angleA, 0)