''' Program carousel-range.py At which angle of deflection should a physical pendulum released at the top be released/broken to achieve maximum horizontal distance from the pendulum's axis? How far will it fly w/o friction? x = max range in units of pendulum rad. R co = cos(theta) <- search on uniform mesh ''' from numpy import sqrt,cos,pi def rangex(co): si = sqrt(1.-co*co) # sin(theta) tmp = 1.+co return si +2.*co \ * (tmp*si +sqrt(tmp*(2.-co*co*tmp))) theta = 1. while (theta > 0.): theta = float(input(" theta[deg] = ")) co = cos(theta/180*pi) # cos(theta) print(theta,' range/R =',rangex(co))