$$d^4 – 2 u d^2 + q \ge 0$$

is easily converted to an inequality with no false positives at all, just by explicitly choosing the lower root of the quadratic in $d^2$:

$$d^2 \le u – \sqrt{u^2 – q}$$

Here, $q$ is entirely independent of the displacement vector $d$, while $u$ depends on a unit vector $\hat{d}$ in the direction of the displacement.

My instinct up until now has been to try to clear as many square roots as possible to make the calculations simpler, but now that I’ve realised the downside of that I should try the opposite approach!

]]>The Milne quartic could also give “false positives”, but only when the centre of the ellipsoid lay outside the sphere. But with this degree-16 polynomial, the false positives appear inside the sphere.

I suspect this means that it’s impossible to find a single polynomial expression whose sign being positive is necessary and sufficient for the existence of a nested simplex, for an ellipsoid at an arbitrary location inside the sphere, in four or more dimensions.

That’s disappointing, but there’s still the simple formula for the axis-aligned case in $n$ dimensions, so maybe I can think of another way to prove that that’s necessary as well as sufficient.

]]>There are 12,870 terms in the polynomial, so it’s not very enlightening as it stands, but I’m hoping to find a way to rewrite it in terms of traces, determinants, etc.

]]>$$(d_1^2 – (R \pm s_1 \pm s_2 \pm s_3 \pm s_4)(R \pm s_1 \pm s_2 \pm s_3 \pm s_4))$$

I’ve now found a 1,423-parameter family of degree 16, and it *does* permit the axially aligned case to be written as a product of eight factors like this.

But this requirement doesn’t fix all the parameters, so I’m hoping to pin down the rest by imposing some further symmetries: requiring both the planar displacement and 3D specialisations to factor neatly into four quartics that differ only in choices of signs for the $s_i$.

]]>I found a 151-parameter family of degree 12 polynomials that specialise to give the correct 3D case and the 4D planar displacement case, and also the axially-aligned case which is a further specialisation of the planar case. But when specialised for the axially-aligned case, the degree 12 polynomials factored into four terms of the form:

$$(d_1^2 – (R \pm s_1 \pm s_2 \pm s_3 \pm s_4))$$

along with a quartic that depended on some of the parameters, but which could **not** be turned into a product of terms of the above form, for any choice of the parameters.

So I’m now looking for a family of degree 16, to see if I can get that kind of extra symmetry. I have a huge expression that I know must contain the 4D form as a factor, and though it’s too big to actually factorise I can at least *check* candidate factors.

$$ (d_1^2-(R+s_1+s_2-s_R) (R+s_1-s_2+s_R)) (d_1^2-(R-s_1-s_2-s_R) (R-s_1+s_2+s_R))+\\

(d_2^2-(R-s_1-s_2-s_R) (R+s_1-s_2+s_R)) (d_2^2-(R+s_1+s_2-s_R) (R-s_1+s_2+s_R))+\\

2 d_1^2 d_2^2- (R-s_1-s_2-s_R)(R+s_1+s_2-s_R) (R+s_1-s_2+s_R) (R-s_1+s_2+s_R) \ge 0$$

Here $s_R$ is the sum of all the semi-axes other than $s_1$ and $s_2$. In 2D, we set $s_R=0$ and this expression becomes the 2D Milne quartic.

]]>$$\mu_2(v) = a \cdot v – b$$

where $v$ is the vertex we’re varying, subject to the constraint $|v|=R$. It’s easy to see that this will have its maximum when $v$ is a multiple of $a$, and we can determine the relationship between $a$ and $b$ that allows that maximum to be at least zero.

But the 3D Milne quartic has an extra term, proportional to the square root of the determinant of the associated matrix. When we try to find the 4D condition by holding the hyperplane of one 3-face of the 4-simplex fixed and varying the vertex opposite, the form of the 3D Milne quartic we have to maximise is:

$$\mu_3(v) = a \cdot v – b – \sqrt{K((v-d)^T M (v-d) – 1)}$$

where $K$ is a constant, $d$ is the centre of the 4D ellipsoid, and $M$ is the matrix that defines the 4D ellipsoid through the equation:

$$(x-d)^T M (x-d) = 1$$

The most important goal is to identify the marginal case, where the maximum achieved by $\mu_3(v)$ is zero. Because we’re imposing the constraint $|v|=R$, we don’t want the gradient of $\mu_3(v)$ to be zero, but rather we want it to be parallel to the gradient of $v \cdot v$, i.e. parallel to $v$ itself. But if we also have the condition $\mu_3(v)=0$, we can multiply $\mu_3(v)$ by any non-zero function $f(v)$ at such a point, and the gradient of the product:

$$\nabla (f(v) \mu_3(v)) = f(v) \nabla \mu_3(v)$$

will also be parallel to $v$. This allows us to multiply $\mu_3(v)$ by:

$$a \cdot v – b + \sqrt{K((v-d)^T M (v-d) – 1)}$$

to clear the square root, giving us the function:

$$G(v) = (a \cdot v – b)^2 – K((v-d)^T M (v-d) – 1)$$

We want to find a simultaneous extremum and zero of $G(v)$, still subject to the constraint $|v|=R$. This leads to an equation of the form:

$$2 R^2 g \cdot v + v^T B v = 0$$

where $g$ is a vector and $B$ a symmetric matrix defined in terms of our previous parameters. This equation describes an ellipsoid in 4D that will be tangent to the sphere $|v|=R$ if the geometry of the original problem is a marginal case.

I don’t know a more efficient way to express the condition for an ellipsoid being tangent to a sphere than to describe both shapes projectively in 5D as homogeneous quadratic forms, say $Q_E$ and $Q_S$, compute the determinant of a linear combination of the two:

$$D(\alpha) = \det(Q_E + \alpha Q_S)$$

and then require that the degree-5 polynomial $D(\alpha)$ have a double root. A polynomial has a double root when it shares a zero with its own derivative, so the condition we want can be expressed as a resultant, the determinant of a $9 \times 9$ matrix in the coefficients of the polynomial $D$ and its derivative.

So, the 4D condition ought to be a factor of that $9 \times 9$ determinant (of a matrix whose entries are themselves high-degree polynomials, with hundred of terms, in the original parameters of the problem).

I’ve computed the full determinant with Mathematica, and even checked that it becomes zero in some expected cases (where the ellipsoid’s displacement from the centre of the sphere is aligned with one of its axes) … but so far Mathematica has been unable to factor the expression, after running for almost 24 hours!

]]>One lemma I’ve relied on is that if you can fit a simplex between a given ellipsoid and a sphere, you are free to choose a point $P$ anywhere on the sphere and there will be a simplex that fits that has $P$ as one of its vertices.

This animation is for a case where the Milne inequality becomes an equals sign, i.e. it is as tight a fit as possible, and yet we still have the freedom to put a vertex of the simplex anywhere on the sphere:

http://www.gregegan.net/SCIENCE/Simplex/SnugSimplices.gif

I haven’t written up a formal proof, but I think it should be easy to prove this by induction, starting with Poncelet’s Porism in two dimensions. In higher dimensions, imagine you have an $n$-simplex that fits, and if necessary you expand it into one whose vertices all lie on the sphere. While keeping one vertex $V$ fixed and the hyperplane of the $(n-1)$-face opposite $V$ fixed as well, you can intersect the cone of tangents to the ellipsoid from $V$ into the hyperplane to get a lower-dimensional ellipsoid, and also intersect the hyperplane with the sphere, to create a new version of the nesting problem in dimension $n-1$. Assuming the lemma holds for $n-1$, the existence of the original $(n-1)$-face implies a whole family of other $(n-1)$-simplices that fit in the lower-dimensional problem, which include locations for one vertex anywhere at all on the lower-dimensional sphere. Any one of these can be turned back into a higher-dimensional simplex that fits in the original problem, simply by adjoining vertex $V$ to them. And while this only gives us freedom to put a vertex anywhere on a particular lower-dimensional sphere, for each choice in that $(n-2)$-parameter family, we can follow up with a second transformation where we hold a different vertex fixed. That lets us place a vertex anywhere on the sphere.

As a corollary to this, if you can fit a simplex at all, it follows that you can nominate any unit vector $u$ and find a simplex that fits and has $u$ as the outwards normal to one of its faces.

What these results mean is that, without loss of generality, we can assume a convenient choice of $u$, such as an axis of the ellipsoid, even when the centre of the ellipsoid is displaced from the centre of the sphere by a generic vector. We can then assess the possibility of a fit in $n$ dimensions by holding $u$ fixed, putting a hyperplane tangent to the ellipsoid with $u$ as its normal vector, then varying one candidate vertex, $v$, to see if the cone of tangents to the ellipsoid from $v$ can ever intersect the hyperplane in a lower-dimensional ellipsoid that has room for a lower-dimensional simplex around it.

Using this approach, I’ve managed to derive the general 3D Milne condition from the 2D version. If you compute the 2D Milne quartic for the ellipse obtained from the tangent cone, it can be put into the form:

$$\mu_2(v) = a \cdot v – b$$

where $v$ is the vertex we’re free to vary, and $a$ is a constant vector and $b$ a positive constant scalar that depend only on the geometry of the problem and a choice of $u$ as one of the ellipsoid axes. It’s not hard to see that $\mu_2(v)$ can only be made positive for some choice of $v$ with $|v|^2=R^2$ if:

$$R^2 |a|^2 – b^2 \ge 0$$

And $R^2 |a|^2 – b^2$ factors into terms that include the 3D Milne quartic, $\mu_3$, regardless of which ellipsoid axis we chose for $u$.

I’m now trying to use the same kind of approach to obtain a generic condition for four dimensions, but it’s quite a bit harder, because even with $u$ fixed $\mu_3(v)$ isn’t linear in $v$.

]]>