# Time 2, Exercise 3: a leaking water clock, and a tank shaped to fix it # Part 1: a plain cylinder. Part 2: a tank whose cross-section grows with the # square root of the depth, so the level falls at a constant rate. import math G = 9.81 AREA_HOLE = 0.00001 COEFF = 0.6 START = 0.30 def run(area_of, label): level, t, last, mark = START, 0, 0, 0.25 gaps = [] while level > 0.05: outflow = COEFF * AREA_HOLE * math.sqrt(2 * G * level) level -= outflow / area_of(level) t += 1 if level <= mark: gaps.append(t - last) last = t mark = round(mark - 0.05, 2) print(label, "seconds per 5 cm:", gaps, "| last/first:", round(gaps[-1] / gaps[0], 2)) run(lambda h: 0.01, "cylinder:") K = 0.01 / math.sqrt(START) run(lambda h: K * math.sqrt(h), "shaped tank:") # Output when run: # cylinder: seconds per 5 cm: [36, 40, 45, 53, 70] | last/first: 1.94 # shaped tank: seconds per 5 cm: [35, 34, 35, 34, 34] | last/first: 0.97 # # Reading the output: in the plain cylinder the water pushes out more slowly as # the level falls, so the last 5 cm takes 70 s against 36 s for the first, # nearly twice as long (ratio 1.94). A clock that marks equal heights with equal # hours would therefore run slow as it empties. Making the tank's cross-section # grow with the square root of the depth cancels that effect: the level falls at # an almost constant rate (34 or 35 s per 5 cm; the 1 s differences are only the # whole-second steps of the simulation). Ancient makers found such shaping by # trial, and the simple fix of marking uneven scales is also possible.