# Physical constants H = 2.0 # 2 Hands N = 3.0 # 3 balls # Flight time comes from physics # y = 1/2at^2 # but we want t, so t = sqrt(2*y/a) G = 9.8 # gravity in m/s**2 G *= 100 # in cm/s**2 F = lambda h: 2*(2*h/G)**.5 # Flight time for 25cm (~= 1ft) height = 25 F_1ft = F(height) "%.4fs flight time at height %d cm" % (F_1ft, height) D = lambda f: f*H/(2*N-H) Hand_cycle_time = 2 * D(F(25)) Hand_Hz = 1/Hand_cycle_time Hand_rpm = 60 * Hand_Hz 'Hand cycles in %.4fs, or at %.4fHz (%.1f rpm)' % (Hand_cycle_time, Hand_Hz, Hand_rpm) def hand_rpm(balls, height_in_cm=25): H = 2.0 F = 2*(2*height_in_cm/980.0)**.5 D = F * H / ( 2 * balls - H ) cycle_time = 2 * D hz = 1 / cycle_time rpm = 60 * hz return '%d balls cycle in %.4fs, or at %.4fHz (%.1f rpm)' % (balls, cycle_time, hz, rpm) for hands in (3, 5, 7, 9): print hand_rpm(hands)