Minimum “egg” curve circumscribing a given rectangle

geometryoptimizationsystems of equationstrigonometry

Construct a circle centred at $O$, with diameter $AB$ and call its radius $r$. Construct the perpendicular bisector of $AB$, intersecting the circle at point $C$. Draw rays $AC$ and $BC$ which extend some way beyond $C$. Draw an arc with radius length $AB$, hence twice the radius of the circle $(2r)$, centred on $B$ and starting at $A$ and ending at the ray $BC$. Draw a similar arc, centred on $A$ and starting at $B$ and ending at the ray $AC$. Draw an arc centred on $C$ and completing the egg curve by connecting the arcs of radius $2r$. This is the basic egg curve I am using. Now draw a rectangle inside the egg so that its corners touch the egg at $PQRS$ (labelling starts at upper right corner). The sides $RS$ and $PQ$ intersect with $AB$ at $M$ and $N$ respectively. The angle $MOR$ is $\theta$ and $PAN$ is $\lambda$. $PB$ is now a chord of the circle radius $2r$ centred at $A$, and $RQ$ is a chord of the circle radius $r$ centred at $O$.

enter image description here

NOTE: In the diagram, $X$ should be the length of $AN$ not $MB$, but still equivalent.

My question is, for a rectangle of width $55$mm and height $68$mm, what is the minimum radius $r$ of the original circle such that the egg circumscribes the rectangle.

I have written some equations based on

  • the trigonometry of triangles $ANP$ and $OMR$

$$X = 2r \cos λ$$
$$Y = 2r \sin λ$$

$$x = r \cos θ$$
$$y = r \sin θ$$

  • by definition

$$Y + y = 68$$
$$X – x = r$$
$$2x = 55$$

  • chords $PB$ (radius $2r$) and $RQ$ (radius $r$)

$$55 = 2r \sin(90-θ)$$
$$68 = 4r \sin(λ/2)$$

  • applying the cosine rule to triangles $PAQ$ and $OAQ$, giving $2 $ expressions for $AQ^2$, equated and simplified

$$2r^2 + 4624 – 272 \sin λ = 2r^2\cos θ$$

I have tried in vain to solve this with no joy.

Best Answer

Egg figure

What I would do is fix a specific instance of the egg and think in terms of coordinates of that. Say you use $A=(-1,0), B=(1,0)$. Then you can choose one coordinate of one corner and compute everything else in relation to that. The semicircle at the bottom has radius $1$, the arcs in the middle have radius $2$, so your formulas remain reasonably manageable thanks to these simple numbers. If you pick the $x$ coordinate of $P$ and $Q$ as your variable $x$, you get

\begin{align*} P &= \left(\phantom+x,\sqrt{2^2-\left(1+x\right)^2}\right) \\ Q &= \left(\phantom+x,-\sqrt{1-x^2}\right) \\ R &= \left(-x,-\sqrt{1-x^2}\right) \\ S &= \left(-x,\sqrt{2^2-\left(1+x\right)^2}\right) \end{align*}

Note that the above assumes $P$ and $S$ are on the large radius sides of the egg, not on the small radius arc at the tip. You might need a case distinction if you need to cover that tip as well.

Next you can compute the aspect ratio as a function of $x$. Make that equal to the aspect ratio of your actual rectangle and solve for $x$. That will give you a scaled version of the configuration you're looking for. Compare the actual size with the size in the scaled version to determine the scale factor, then you know by what factor to scale all the radii for your actual setup.

Applied to your task you want

$$\frac{PQ}{QR}=\frac{\sqrt{2^2-\left(1+x\right)^2}+\sqrt{1-x^2}}{2x}=\frac{68}{55}$$

But how do you solve such a beast of an equation?

  1. You could use numerical methods, e.g. bisection, to narrow down the value to the desired precision.
  2. Define variables for the $y$ coordinates of $P$ and $Q$ as well, then get a computer algebra system to solve the resulting system of three polynomial euqations. This is what I did at first, and I've included a code snippet at the end of this post.
  3. You could square both sides of the equation. This will cause a product of two different square roots remainig. Move the remaining square roots to one side and everything else to the other, then square again and you should get an equation in $x$ with no square roots. I will demonstrate that approach now:

$$ \frac{\sqrt{2^2-\left(1+x\right)^2}+\sqrt{1-x^2}}{2x}=\frac{68}{55} \\[4ex] \sqrt{4-\left(1+x\right)^2}+\sqrt{1-x^2}=\frac{68}{55}\cdot2x \\[4ex] \left(4-\left(1+x\right)^2\right) + 2\sqrt{4-\left(1+x\right)^2}\sqrt{1-x^2} + \left(1-x^2\right) = \left(\frac{136}{55}x\right)^2 \\[4ex] 2\sqrt{4-\left(1+x\right)^2}\sqrt{1-x^2} = \left(\frac{136}{55}x\right)^2 - \left(4-\left(1+x\right)^2\right) - \left(1-x^2\right) \\[4ex] 2\sqrt{4-\left(1+x\right)^2}\sqrt{1-x^2} = \frac{24546}{3025}x^2 + 2x - 4 \\[4ex] \left(4-\left(1+x\right)^2\right)\left(1-x^2\right) = \left(\frac{12273}{3025}x^2 + x - 2\right)^2 \\[4ex] x^4 + 2x^3 - 4x^2 - 2x + 3 = \frac{150626529}{9150625}x^4 + \frac{24546}{3025}x^3 - \frac{46067}{3025}x^2 - 4x + 4 \\[4ex] 9150625x^4 + 18301250x^3 - 36602500x^2 - 18301250x + 27451875 = \\ = 150626529x^4 + 74251650x^3 - 139352675x^2 - 36602500x + 36602500 \\[4ex] 141475904x^4 + 55950400x^3 - 102750175x^2 - 18301250x + 9150625 = 0 $$

Solving quartic equations (degree 4) using radicals (root symbols) is no fun. But you can feed it to a suitable algorithm and eventually obtain four solutions. Some of them will have $x<0$ and others will only solve the original equation if you pick a different sign for some of the square roots. (Specifically: The solution $x\approx0.24$ corresponds to $Q_y=\sqrt{1-x^2}>0$ i.e. with a positive sign there.) The only solution which remains fully valid is

$$x\approx0.70723107681149752495796$$

This is also the solution you would have gotten from one of the other solution techniques, so if you try a different solution approach there, now you should be with me again. From that solution for $x$ you can read that you have to scale the whole figure by a factor of

$$r = \frac{55\text{mm}}{2x} \approx 38.88403790735815952438\text{mm}$$

which is also the radius of the circle with diameter $AB$. Again, if you use exact solutions you would find a quartic equation

$$4r^4 - 220r^3 - 33967r^2 + 508640r + 35368976 = 0$$

as the polynomial describing that factor (omitting the unit mm for simplicity).

Compared to your original approach, the above mainly benefits from avoiding all angles and all trigonometric functions. The above isn't pretty but it's still a simpler framework than if you had gotten those trigonometric functions added to the mix. Also, the above allows you to express the final radius exactly as an algebraic number (i.e. a zero of some polynomial). If you had taken a detour to angles, that property would have been hard to maintain.

Here is a short Sage session for solution approach 2:

sage: PR.<x,Py,Qy> = QQ[]
sage: v = ideal([x^2+Qy^2-1, (x+1)^2+Py^2-4, (Py-Qy)*55-(2*x)*68]).variety(AA)
sage: v
[{Qy: -0.9159378601485164?, Py: -1.908293058664547?, x: -0.4013201170469240?},
 {Qy: -0.7069824637090016?, Py: 1.041807108043065?, x: 0.7072310768114975?},
 {Qy: 0.3326861498748562?, Py: -1.999188656838219?, x: -0.9430376056560230?},
 {Qy: 0.9703634488590393?, Py: 1.567898273759794?, x: 0.2416501130113345?}]
sage: v[1][x].n(digits=50)
0.70723107681149752495796187525162910453067873565041
sage: v[1][x].minpoly().numerator()
141475904*x^4 + 55950400*x^3 - 102750175*x^2 - 18301250*x + 9150625
sage: r = 55 / 2 / v[1][x]
sage: r.n(digits=50)
38.884037907358159524380524101404068709500680192371
sage: r.minpoly().numerator()
4*x^4 - 220*x^3 - 33967*x^2 + 508640*x + 35368976

Here I define a polynomial ring called PR with three indeterminates $x,P_y,Q_y$ and coefficients from $\mathbb Q$ (QQ). I formulate the three conditions as polynomials which must be zero, combine them into an ideal and since the dimension of the ideal is zero, the variety will be the set (or rather a Python list) of distinct solutions. I'm taking solutions over $\mathbb A$ (AA), the real algebraic numbers. Of the solutions I only want the one with $Q_y<0, P_y>0, x>0$, which has index 1 in Python's zero-based indexing (v[1]). Those algebraic numbers in the solution I can print to arbitrary precision, and also compute the defining polynomial (which I prefer to do using integers, so I multiply the monic minimal polynomial with the common denominator of its coefficients by requesting the numerator).

Related Question