In their book "Mathematics: Its contents, methods and meaning", Aleksandrov, Kolmogorov and Levrent'ev give an example how to minimize cost of material for the production of a cylindric cistern of minimal area while enabling it to store maximal volume of liquid. They draw a picture of an open vertical cylinder and state that the base diameter must be equal to the cylinder height to fulfill this condition (see page 53), but do not give details how they arrive at this result. The intent here is to look whether the same result can be obtained by means of optimization.
from math import pi from scipy.optimize import minimize # Cistern with solid base only def f1(x): base_radius, cylinder_height = x circle_area = pi * base_radius**2 area_wall = 2*pi*base_radius*cylinder_height area_cylinder = circle_area + area_wall volume_cylinder = pi*base_radius**2*cylinder_height # Seeking minimal area by maximal volume means minimizing the ratio return area_cylinder / volume_cylinder # Closed (at top) cistern def f2(x): base_radius, cylinder_height = x # After term cancellation return 2*(base_radius + cylinder_height) / (base_radius * cylinder_height) # Minimize these functions x0 = [1,1] res = minimize(f1, x0, method='L-BFGS-B') print(res.x) # [484.66890469 387.40431197]
Function optimization tells us that in the case the cylinder is open at the top, we need to have approx. r = 1.25*h, which differs from the d = h (or r = 0.5*h) result.
x0 = [1,1] res = minimize(f2, x0, method='L-BFGS-B') print(res.x) # [589.70999353 589.70999353]
When the cylinder is closed, we obtain best result when r = h, which also differs from d = h. If we were to use d = 10 (r = 5), h = 10, we would obtain f2(x) = 30/50 = 0.6, but if we were to take r = 10, h= 10, we have f2(x) = 40/100 = 0.4, which is smaller. Do you see problems with this approach?