_{Note: I asked this on Mathematics SE and even though @TheSimpliFire offered a bounty on it, no-one had a good answer}

Find the optimal shape of a coffee cup for heat retention. Assuming

- A constant coffee flow rate out of the cup.
- All surfaces radiate heat equally, i.e. liquid surface, bottom of cup and sides of cup.
- The coffee is drunk quickly enough that the temperature differential between the coffee and the environment can be ignored/assumed constant.

So we just need to minimise the average surface area as the liquid drains

I have worked out the following 2 alternative equations for the average surface area over the lifetime of the liquid in the cup (see below for derivations):

$$ S_{ave} =\pi r_0^2+ \frac{\pi^2}{V}\int_{0}^{h}{r^4ds}+\frac{2\pi^2}{V}\int_{0}^{h}{\int_{0}^{s}{r\sqrt{1+(\frac{dr}{dz})^2}\ dz\ }{r}^2ds\ } \tag{1}$$

$$S_{ave}=\pi r_0^2+\frac{\pi^2}{V}\int_{0}^{h}r^4ds+\frac{2\pi^2}{V}\int_{0}^{h}r{\underbrace{\int_{s}^{h}{{r}^2dz\ }}_{\text{Volume Drunk}}}\sqrt{1+(\frac{dr}{ds})^2}ds \tag{2}$$

If the volume of the cup is constant

$$ V=\pi\int_{0}^{h}{r^2dz\ }$$

Can the function, $r(z)$, be found that minimises the average surface area $S_{ave}$?

If r is expressed as a parametric equation in the form $r=f(t), z=g(t)$ and $f,g$ are polynomials then a genetic search found the best function of parametric polynomials to be: $r\left(z\right)=\sqrt{\frac{3}{2}}z^\frac{1}{2}-\frac{\sqrt6}{9}z^\frac{3}{2}, f\left(t\right)=\sqrt{\frac{3}{2}}t-\sqrt{\frac{3}{2}}t^3, g\left(t\right)=\frac{9}{2}t^2$

This parametric shape has a maximum radius of 1, height of 4.5, starting volume of $\frac{3^4}{2^5}\pi$ and is shown here:

I can't prove that there is (or is not) a better $r(z)$ but...

the average surface area of this surface turns out to be $12.723452r^2$ or $4.05\pi r_{max}^2$. I suspect that the optimal surface will have the same surface area as a sphere, i.e. $4\pi r_{max}^2$ $(12.5664)$

**Conjecture: The optimally shaped coffee cup has the same average surface area as a sphere of the same maximum radius.**

**Derivation of Surface Area Formula:**

Surface area when surface of liquid is at level s is the sum of the areas of the top disc, bottom disc and the sides.

$S(s)=\pi r_0^2+\pi r_s^2+2\pi\int_{0}^{s}{r(z)dldz}$

$S(s)=\pi r_0^2+\pi r_s^2+2\pi\int_{0}^{s}{r(z)\sqrt{1+\left(\frac{dr}{dz}\right)^2}\ dz\ }$

The average surface area will be the sum of all the As’s times the time spent at each surface area.

$S_{ave}=\frac{1}{T}\int_{t_0}^{t_h}{S(s)dt\ }$

In order to have the drain rate constant we need to set the flow rate Q to be constant i.e. the rate of change volume is constant and $Q=dV/dt =V/T$

Time spent at a particular liquid level $dt\ =\frac{T}{V}dV$ and $ dV={\pi r}^2ds$

$dt=\frac{T\pi r^2}{V}ds$

$S_{ave}=\int_{s=0}^{s=h}{S(s)\frac{T\pi{r(s)}^2}{V}ds\ }$ $S_{ave}=\frac{\pi}{V}\int_{s=0}^{s=h}{(r_0^2+r(s)^2+2\int_{z=0}^{z=s}{r(z)\sqrt{1+(\frac{dr(z)}{dz})^2}\ dz\ })\pi{r(s)}^2ds\ }$

$S_{ave}=\frac{\pi}{V}r_0^2\int_{0}^{h}{\pi{r(s)}^2ds}+\frac{\pi}{V}\int_{s=0}^{s=h}{\left(r\left(s\right)^2+2\int_{z=0}^{z=s}{r(z)\sqrt{1+(\frac{dr(z)}{dz})^2}\ dz\ }\right)\pi{r(s)}^2ds\ }$

$S_{ave}=\pi\ r_0^2+\frac{\pi^2}{V}\int_{s=0}^{s=h}{\left(r^2+2\int_{z=0}^{z=s}{r(z)\sqrt{1+\left(\frac{dr(z)}{dz}\right)^2}\ dz\ }\right)r^2ds\ }$

**Alternative Formula Derivation:**

Surface area of highlighted ribbon in the diagram is:

$S_{ribbon}=2\pi rdl$

And the contribution towards the average surface area lasts for the ratio of volume of the liquid above the current level to the total volume.

$$S_{sides}=2\pi\frac{\pi}{V}{\underbrace{\int_{s}^{h}{{r\left(z\right)}^2dz\ }}_{\text{Volume Drunk}}}rdl$$

$$S_{sides}=\frac{2\pi^2}{V}{\underbrace{\int_{s}^{h}{{r\left(z\right)}^2dz\ }}_{\text{Volume Drunk}}}r\left(s\right)\sqrt{1+\left(\frac{dr}{ds}\right)^2}ds$$

Integrate the contribution of all such sections.

$$S_{sides}=\frac{2\pi^2}{V}\int_{0}^{h}{r\left(s\right){\underbrace{\int_{s}^{h}{{r\left(z\right)}^2dz\ }}_{\text{Volume Drunk}}}\sqrt{1+\left(\frac{dr}{ds}\right)^2}ds}$$

Contribution of top surfaces to average surface area is area of top by proportion of volume that area x dz is:

$$S_{tops}=\frac{1}{V}\int_{0}^{h}{\pi{r(s)}^2{\pi r(s)}^2}ds$$

Contribution of bottom surface is constant $\pi r_0^2$ so adding together all three gives:

$$S_{ave}=\pi r_0^2+\frac{\pi^2}{V}\int_{0}^{h}r\left(s\right)^4ds+\frac{2\pi^2}{V}\int_{0}^{h}r{\underbrace{\int_{s}^{h}{{r\left(z\right)}^2dz\ }}_{\text{Volume Drunk}}}\sqrt{1+\left(\frac{dr}{ds}\right)^2}ds$$

8more comments