Solution (source code)

= Solution

Let $w>0$ denote the stated cost per area of the cylindrical wall. Charge for the curved wall and cap as specified; no floor cost is supplied. The volume and cost are $V=\pi r^2h+2\pi r^3/3$ and $C=2\pi wrh+4\pi wr^2$. To minimize cost at fixed volume, apply a <Lagrange multiplier> to $C-\lambda(\pi r^2h+2\pi r^3/3-V)$. Differentiation with respect to $h$ gives $\lambda=2w/r$. The $r$ derivative then gives $2\pi wh+8\pi wr=\lambda(2\pi rh+2\pi r^2)$, reducing to $h=2r$. Thus the <optimal cylinder and hemispherical cap with unequal surface costs> has
$$
\boxed{r=\left(\frac{3V}{8\pi}\right)^{1/3},\qquad h=2\left(\frac{3V}{8\pi}\right)^{1/3}.}
$$
For a global check, eliminate $h$ to obtain $C(r)=2wV/r+(8\pi w/3)r^2$. Its second derivative is positive for $r>0$, and its critical radius gives $h>0$, so the constrained optimum lies inside the physically feasible range and is the unique minimum.