#Imports from __future__ import division from visual import * from physutil import * #Objects axel = cylinder(pos=vector(0,-5,0), axis=vector(0,0.5,0), radius=0.1, color=color.white) platform = cylinder(pos=vector(0,-5,0), axis=vector(0,0.1,0), radius=10, material=materials.marble) #Parameters and Initial Conditions I = (1/2)*300*(2.5**2) L = 0 F = 200 r = 2.5 b = 0.00025 #Time and time step t=0 tf=10 dt=0.01 #MotionMap/Graph Larrow = arrow(color=color.orange) EnergyGraph = PhysGraph(1) #Calculation Loop while t < tf: rate(100) taufric = -b*L**2 tauhose = r*F taunet = tauhose + taufric L = L + taunet*dt platform.rotate(angle=(L/I)*dt, axis=vector(0,1,0), origin=axel.pos) EnergyGraph.plot(t, (1/2)*(1/I)*(L)**2) Larrow.pos = axel.pos Larrow.axis = vector(0,L/100,0) t = t + dt