Maximizing volume of a cylinder with $2$ cones given surface area $A$ A cylinder with a cone on either side of it. The cones have the same radius as the cylinder.
Cylinder area without the sides:
$$A_{cyl}=2\pi r h_1$$
Cone area without the base:
$$A_{cone}=\pi r \sqrt{h_2^2+r^2}$$
Total area of body:
$$A_{tot}=2\pi r h_1 + 2\pi r \sqrt{h_2^2+r^2}$$
Volume:
$$V_{tot}=\pi r^2 h_1 +\frac{2\pi r^2 h_2}{3}=\pi r^2 (h_1 + \frac{2}{3}h_2)$$
I have managed to calculate the maximum volume given surface area for the cone and the cylinder separately but together there are three variables. How would I go about calculating $r,h_1,h_2$ to maximize the volume?

As I said yesterday, we can eliminate one variable,  $h_1=\frac{A}{2\pi r}-\sqrt{h_2^2+r^2}$ to get
$$V(h_2,r)=\frac{Ar}{2}-\pi r^2\sqrt{h_2^2+r^2}+\frac{2\pi r^2h_2}{3}.\tag1$$
The system of equations for critical points $\frac{\partial V}{\partial h_2}=\frac{\partial V}{\partial r}$ on the open region $r,h_2>0$ gives
$$\color{green}{-\frac{\pi r^2h_2}{\sqrt{h_2^2+r^2}}+\frac{2\pi r^2}{3}=0}\,\,\text{and}\,\,\color{blue}{\frac A2-2\pi r\sqrt{h_2^2+r^2}-\frac{\pi r^3}{\sqrt{h_2^2+r^2}}+\frac{4\pi rh_2}{3}=0}$$
From green $h_2=\frac{2}{\sqrt 5}r$ and from blue and this, $r=\sqrt{\frac{A}{2\sqrt 5\pi}}$ and thus $h_2=\sqrt{\frac{2A}{5\sqrt 5\pi}}$.
To show that at $(h_2,r)=(\sqrt{\frac{2A}{5\sqrt 5\pi}},\sqrt{\frac{A}{2\sqrt 5\pi}})$ we have a maximum we need to show that
$$\frac{\partial^2 V}{\partial h_2^2}\frac{\partial^2 V}{\partial r^2}-(\frac{\partial^2 V}{\partial h_2\partial r})^2>0\,\, \text{and} \,\,\frac{\partial^2 V}{\partial h_2^2}>0.$$
But, this is messy. Instead, when $r\rightarrow\infty$ and/or $h_2\rightarrow\infty$, from $(1)$, we see that $V\rightarrow -\infty$, so it is a local maximum $V_{\max}=\frac{A\sqrt A}{3\sqrt{2}\sqrt\pi\sqrt{\sqrt 5}}$.
