A rectangular box (aka *parallelepiped*) looks like a sturdy object:

But this particular box, with dimensions 7.147 by 6.021 by 4.095, took me the better part of an hour to figure out.

It was a part of a numerical methods assignment: find the dimensions of a box with given volume , surface area , and diameter (i.e., space diagonal). Algebraic approach leads to pretty ugly expressions, which is the motivation for a numerical method. Specifically, the task was to apply the Newton-Raphson method to the map

Of course, I understood that not every triple is attainable. Also realized that the Jacobian of is degenerate when two of the coordinates coincide, which is a problem for the method. So I thought: let’s generate some random values that are not too close to one another, and give students the resulting parameters .

With , , and the parameters are , , and . Sure, a little rounding can’t hurt when numbers are of this size and we are quite far from the critical points of . So I put , and in one of the versions of the assignment.

But the Newton-Raphson method would not converge… because no such box exists! The rounding did hurt after all.

This motivated me to describe all attainable triples explicitly, which ended up being less of a chore than I expected. It helps to realize that , which reduces the search to the intersection of the sphere with the plane . This is a circle (called below), and the allowed range for is between the minimum and maximum of on .

This goes into Calculus 3 territory. Using Lagrange multipliers with two constraints looks like a tedious job. Instead, I decided to parametrize . Its center is where . The radius is . We also need an orthonormal basis of the subspace : the vectors

do the job.

So, the circle is parametrized by

This is not as bad as it looks: the product simplifies to

which tells us right away that the volume lies within

In terms of the original data the bounds for take the form

(And of course, cannot be negative even if the lower bound is.) It is easy to see that with equality only for a cube; however can be relatively small even when the box does not look very cube-ish. For the box pictured above, the tolerance is approximately ; after rounding and this drops to , and the desired volume of is way out of the allowable range .

Yes, the set of attainable triples is quite thin. Parallelepipeds are fragile objects: handle them with care.

Call , and . Then x, y, z are the roots of the polynomial . The can be expressed in terms of V, S, D, so why don’t you apply Newton-Raphson for the function , ? You want that are such that the polynomial has 3 real, non-negative solutions.

I knew the number of variables could be reduced, but the topic of the assignment was Newton-Raphson for nonlinear systems of equations. I wanted a system that is not too complicated and would admit a simple, “practical” interpretation, such as designing a shape with desired parameters.

OK, but the number of variables are not reduced here. You just look for all the roots of a function of degree 3. Just forget that’s a formula for this, you just have to pick the right initial points for the algorithm (take the derivative of f for this, for example), then run the algorithm three times. Besides, I bet that in terms of S, D, V, the condition for the polynomial to have all roots real and moreover nonnegative have nice geometrical interpretations (like isoperimetric, isodiametric inequalities for parallelipipeds).

I think that picking right initial points to find all three roots might take more computations or human effort (repeated guess and check) than working with the system. The system has multiple roots too, but they are permutations of x,y,z, so it does not matter to which we converge. Starting with three unequal positive values of x,y,z, the method converged in all tests that I ran (when the solution existed).

But an interesting point about nonnegativity of roots as a criterion for solvability; this ought to be a shorter path to the characterization of attainable (S,D,V) than in my post.