What's the largest possible volume of a taco, and how do I make one that big?

Solution 1:

Here's your optimal taco (with vegetarian filling):

tacoid

I'd call it a Jordan curve, but that name is unfortunately already taken, so how about "tacoid"?

Rather appropriately, we can calculate the volume of the taco using something similar to the method of shells. Let $s$ be the arc length parameter along the curve, and consider the part of the taco volume between the two surface elements that correspond to an arc length element $\mathrm ds$. The distance between them along the $x$ axis is $2x$, their length along the $y$ axis is $\sqrt{1-s^2}$, and their height along the $z$ axis is $\mathrm dz=\dot z\mathrm ds$, where here and in the following a dot denotes differentiation with respect to the arc length.

Thus the taco volume is

$$V=\int_0^12\sqrt{1-s^2}x\dot z\mathrm ds\;.$$

We can eliminate $\dot z$ from $\dot x^2+\dot z^2=1$, which gives $\dot x=\sqrt{1-\dot z^2}$, and thus

$$V=\int_0^12\sqrt{1-s^2}x\sqrt{1-\dot x^2}\mathrm ds=:\int_0^1\mathcal L(s,x,\dot x)\mathrm ds\;.$$

We can maximize this using the calculus of variations. The Euler–Lagrange equation is

$$\frac{\mathrm d}{\mathrm ds}\frac{\partial\mathcal L}{\partial \dot x}=\frac{\partial\mathcal L}{\partial x}\;,$$

which yields

$$\frac{\mathrm d}{\mathrm ds}\left(-\sqrt{1-s^2}x\frac{\dot x}{\sqrt{1-\dot x^2}}\right)=\sqrt{1-s^2}\sqrt{1-\dot x^2}\;,$$

which we can simplify to

$$x\ddot x+1-\dot x^2=x\dot x(1-\dot x^2)\frac{s}{1-s^2}\;.$$

Note that the left-hand side is what we'd usually get for a circle if we didn't have the factor $\sqrt{1-s^2}$ from the shape of the taco; a rectangular taco wouldn't have this term and would thus take the form of a semi-cylinder, as Will noted.

None of the candidates solves this equation; I doubt that it can be solved analytically. I solved it numerically using RK4. This was a bit tricky because there are singularities both at $x=0$ (horizontal tangent) and at $s=1$ (vertical tangent).

Since we have an initial condition at $s=0$ and a fixed arc length parameter value for the endpoint, $s=1$, we'd like to integrate the equation from $s=0$ towards $s=1$; then we could vary the remaining initial condition to get the optimal volume. However, the problem is that the singularity at $x=0$ forces the tangent to be horizontal there, so we can't freely specify a first derivative there.

The situation at $x=0$, where $s=0$, is basically the same as for the semi-circle we get without the $\sqrt{1-s^2}$ term, so we can try to get some guidance from there. The solution in that case is

$$\begin{array}{ccccc} x=r\sin\frac sr&&\dot x=\cos\frac sr&&\ddot x=-\frac1r\sin\frac sr\\ z=r(1-\cos\frac sr)&&\dot z=\sin\frac sr&&\ddot z=\frac1r\cos\frac sr\\ \end{array} $$

with a free parameter $r$, the radius of the semi-circle.

We can see from this solution that we also can't freely specify $\ddot x$ at $x=0$, since its value $0$ is independent of the curvature, as is $\dot z=0$. However, $\ddot z=1/r$ is the curvature, which we can choose freely. Thus, we transform from $x$ to $z$ using

$$\dot x=\sqrt{1-\dot z^2}$$

and

$$\ddot x=-\frac{\dot z\ddot z}{\sqrt{1-\dot z^2}}$$

to obtain

$$\ddot z=\frac{\dot x\dot z}x-\dot x^2\dot z\frac s{1-s^2}\;.$$

Now we can circumvent the singularity by calculating $\ddot z$ from the differential equation for $x\ne0$ and freely choosing a value for it at $x=0$, which will determine the taco's curvature. We can then vary this parameter to maximize the volume.

It turns out that at small initial curvatures, the graph is at first roughly circular (near $s=0$) but then turns and ends in a horizontal tangent. This makes sense if you look at the signs of $\ddot x$ and $\ddot z$: The additional term from the $\sqrt{1-s^2}$ factor increases $\ddot x$ and decreases $\ddot z$, so if it dominates at $s=1$, it causes the tangent to be horizontal. (The tangent has to be either horizontal or vertical at $s=1$ to counter the pole in the $s$-dependent term.)

However, as the initial curvature is increased, eventually the tangent becomes vertical before $s=1$ is reached. The mechanism for this is similar as in the circular case, and the $s$-dependent term only causes a quantitative correction in this case. It turns out that, as in the circular case, the volume is maximal precisely at the curvature that makes the tangent at $s=1$ come out vertical. To avoid problems from this singularity, I switched from the equation for $\ddot z$ to the equation for $\ddot x$ at $s=1/2$, so that at either singularity I was effectively dealing with a "horizontal" tangent and finite curvature.

It turns out that the correction due to the $s$-dependent term is actually quite small. In practical terms, it's probably not worth making the effort to optimize the form, since the cylindrical form is almost as good. The optimal volume is about $0.415015$ (with the curvature at $x=0$ about $2.0328$), whereas if you wrap the disk around the cylinder with radius $2/\pi$ that solves the rectangular version, the volume is $1/2-J_1(\pi)/\pi\approx0.409404$ (according to Wolfram|Alpha).

Here's a comparison of the tacoid and the semi-circle:

tacoid and semi-circle

Red is the tacoid, green is the semi-circle. The tacoid rises more rapidly, since it doesn't want to waste arc length on first getting further out, since it can't profit from that as much later on when the $\sqrt{1-s^2}$ factor kicks in. The tacoid would be a bit worse than the semi-circle if the taco were rectangular (only $0.618983$ instead of the optimal volume $2/\pi\approx0.636620$ of the semi-cylinder). To illustrate how this changes due to the $\sqrt{1-s^2}$ factor, I weighted the $x$ values by that factor. Blue shows the weighted tacoid, and yellow shows the weighted semi-circle. The taco's gain near the top is slightly bigger than the loss near the bottom.

We can also compare with a circular graph optimized for a disk-shaped taco. The optimal value of the radius in that case is about $0.899736\cdot2/\pi\approx0.572790$, and the corresponding cylindrical volume is about $0.413570$, which is less than half a percent below the optimum, so in calculating cylindrical approximations your students were coming quite close to the optimal result.

We can draw the same graphs as above to compare the tacoid and the reoptimized cylinder,

tacoid and reoptimized cylinder

but perhaps more interesting is a comparison of the enclosed volume plotted against the arc length,

enclosed volume against arc length

which shows that these two solutions make use of their arc length in a surprisingly similar manner, with the tacoid (red) only very slightly more greedy than the cylinder (green), and even that small difference almost evening out at the end.

Since the reoptimized cylinder has the added advantage of bending back inwards slightly to improve your grip on the contents, this raises the question whether it might be preferable in practical terms to forgo the half-percent optimization and go for a simple cylindrical form with optimal radius.