Teaser 3264: Saving rum
From The Sunday Times, 13th April 2025 [link] [link]
Captain Noah was tired of spilling his rum at sea. His glass (twice the density of the rum) is a hollow cylinder with a solid flat base. The outer diameter is 72 mm. The glass thickness and base height are both 4 mm. After testing the stability of the upright glass, he instructed the steward to keep his glass topped up to one-third full, where it has the lowest centre of mass.
What is the overall height of the glass (including the base)?
[teaser3264]
Jim Randell 8:03 am on 13 April 2025 Permalink |
Here is a numerical solution, using the [[
find_min()]] function from the enigma.py library.I treat the glass and rum system as 3 separate components:
The individual centres of mass of the three components are then combined to give the combined centre of mass. Each of them is somewhere on the central line of the cylinder, so we only need to worry about their heights above the table.
For a given value of h we can calculate the value of x that gives the minimum height for the combined centre of mass, and then look for a value of h where h = 3x.
This Python program runs in 69ms. (Internal runtime is 2.3ms).
from enigma import (sq, fdiv, find_min, find_value, printf) # given height h find height of rum that gives the minimal centre of mass def fn(h): # calculate centre of mass for rum height x def f(x): # mass of cylinder, base, rum (half the density) mc = (sq(36) - sq(32)) * h * 2 mb = sq(36) * 4 * 2 mr = x * sq(32) # heights of their respective centres of mass hc = 4 + h * 0.5 hb = 2 hr = 4 + x * 0.5 # calculate height of combined centre of mass return fdiv(mc * hc + mb * hb + mr * hr, mc + mb + mr) # find minimal centre of mass = x r = find_min(f, 0, h) x = r.v # return h/x return fdiv(h, x) # find when h/x = 3 (i.e. the minimal centre of mass is when the glass is 1/3 full) r = find_value(fn, 3, 20, 200) # output overall glass height (including base = 4 mm) h = r.v + 4 printf("height = {h:.2f} mm")Solution: The glass is 112 mm high.
So the internal height is 108 mm, and the lowest centre of mass occurs with 36 mm of rum in the glass.
We can get an exact answer to the puzzle using analysis.
LikeLike
Jim Randell 1:14 pm on 15 April 2025 Permalink |
Here is my analytical solution:
The CoM of the cylinder is in the centre of the cylinder, and adding the base will bring the CoM down a little.
Suppose we then start adding rum to the glass:
We start by adding a little rum. This forms a layer of rum below the current CoM of the glass, so the combined CoM moves down a bit. And this continues until the combined CoM is level with the top of the rum. At this point, when we add additional rum, it forms a layer above the current CoM, and so the combined CoM starts to move upwards.
Hence the combined CoM is at a minimum when it is level with the top of the rum.
So we are interested in when:
And we want to find solutions when h = 3x, which we can do manually, or use a program.
from enigma import (Polynomial, rdiv, sq, printf) x = Polynomial('x') h = 3 * x half = rdiv(1, 2) # mass of cylinder, base, rum (half the density) mc = (sq(36) - sq(32)) * h * 2 mb = sq(36) * 4 * 2 mr = x * sq(32) # heights of their respective centres of mass hc = 4 + h * half hb = 2 hr = 4 + x * half # polynomial to solve: sum(m[i] * h[i]) = (x + 4) * sum(m[i]) p = (mc * hc + mb * hb + mr * hr) - (x + 4) * (mc + mb + mr) p = p.scale() printf("[p = {p}]") # find real, positive solutions for p(x) = 0 for x in p.roots(domain='F', include='+'): h = 3 * x height = h + 4 printf("height = {height} mm [x={x} h={h}]")Manually we find the resulting polynomial p(x) factorises as follows:
From which we see there is a single positive real root that is an integer, and this provides an integer answer to the puzzle.
Or we can use calculus to determine when the minimum height centre of mass occurs:
For a glass with an internal height h and a depth of rum x we can calculate the centre of mass as:
And we can calculate when the derivative of this function with respect to x is 0, using the quotient rule:
So the minimum value occurs when p’ q = p q’.
In this case:
And we want to find the minimum value when h = 3x:
And the answer to the puzzle follows directly.
LikeLike