96

I believe that many of you know about the moving sofa problem; if not you can find the description of the problem here.

From wikipedia


In this question I am going to rotate the L shaped hall instead of moving a sofa around the corner. By rotating the hall $180^{\circ}$ what remains between the walls will give the shape of the sofa. Like this:


enter image description here

The points on the hall have the following properties:

\begin{eqnarray} A & = & \left( r\cos { \alpha } ,t\sin { \alpha } \right) \\ { A }' & = & \left( r\cos { \alpha } +\sqrt { 2 } \cos { \left( \frac { \pi }{ 4 } +\frac { \alpha }{ 2 } \right) } ,t\sin { \alpha } +\sqrt { 2 } \sin { \left( \frac { \pi }{ 4 } +\frac { \alpha }{ 2 } \right) } \right) \\ { B } & = & \left( r\cos { \alpha } -\frac { t\sin { \alpha } }{ \tan { \left( \frac { \alpha }{ 2 } \right) } } ,0 \right) \\ { B }' & = & \left( r\cos { \alpha } -\frac { t\sin { \alpha } }{ \tan { \left( \frac { \alpha }{ 2 } \right) } } -\frac { 1 }{ \sin { \left( \frac { \alpha }{ 2 } \right) } } ,0 \right) \\ C & = & \left( r\cos { \alpha } +t\sin { \alpha } \tan { \left( \frac { \alpha }{ 2 } \right) } ,0 \right) \\ { C }' & = & \left( r\cos { \alpha } +t\sin { \alpha } \tan { \left( \frac { \alpha }{ 2 } \right) } +\frac { 1 }{ \cos { \left( \frac { \alpha }{ 2 } \right) } } ,0 \right) \end{eqnarray}

Attention: $\alpha$ is not the angle of $AOC$, it is some angle $ADC$ where $D$ changes location on $x$ axis for $r\neq t$. I am saying this because images can create confusion. Anyways I will change them as soon as possible.

I could consider $r=f(\alpha)$ and $t=g(\alpha)$ but for this question I am going to take $r$ and $t$ as constants. If they were functions of $\alpha$ there would appear some interesting shapes. I experimented for different functions however the areas are more difficult to calculate, that's why I am not going to share. Maybe in the future.

We rotate the hall for $r=t$ in the example above:
In this case:

  1. point A moves on a semicircle
  2. The envelope of lines between A' and C' is a circular arc. One has to prove this but I assume that it is true for $r=t$.

If my second assumption is correct the area of sofa is $A= 2r-\frac { \pi r^{ 2 } }{ 2 } +\frac { \pi }{ 2 } $. The maximum area is reached when $r = 2/\pi$ and it's value is: $$A = 2/\pi+\pi/2 = 2,207416099$$

which matches with Hammersley's sofa. The shape is also similar or same:

enter image description here

Now I am going to increase $t$ with respect to $r$. For $r=2/\pi$ and $t=0.77$:

enter image description here

Well, this looks like Gerver's sofa.

I believe thearea can be maximized by finding the equations of envelopes above and below the sofa. Look at this question where @Aretino has computed the area below $ABC$.

I don't know enough to find equations for envelopes. I am afraid that I will make mistakes. I considered to calculate area by counting number of pixels in it, but this is not a good idea because for optimizing the area I have to create many images.

I will give a bounty of 200 for whom calculates the maximum area. As I said the most difficult part of the problem is to find equations of envelopes. @Aretino did it.

PLUS: Could following be the longest sofa where $(r,t)=((\sqrt 5+1)/2,1)$ ? enter image description here

If you want to investigate further or use animation for educational purposes here is the Geogebra file: http://ggbm.at/vemEtGyj


Ok, I had some free time and I count number of pixels in the sofa and I am sure that I have something bigger than Hammersley's constant.

First, I made a simulation for Hammersley's sofa where $r=t=2/\pi$ and exported the image to png in 300 dpi (6484x3342 pixels) and using Gimp counted number of pixels which have exactly same value. For Hammersley I got $3039086$ pixels.

For the second case $r=0.59$ and $t=0.66$ and I got $3052780$ pixels. To calculate area for this case:

$$\frac{3052780}{3039086}(2/\pi + \pi/2)=2.217362628$$

which is slightly less than Gerver's constant which is $2.2195$. Here is the sofa:

enter image description here

newzad
  • 4,923
  • 9
    +1 for the sofa problem and the nice simulations. I believe you could make your question clearer at the beginning. – Laurent Duval May 16 '16 at 12:22
  • Any edit is wellcome. – newzad May 16 '16 at 14:08
  • 1
    Fantastic problem. – curious_cat May 16 '16 at 16:40
  • Your assumption that the envelope of lines $A'C'$ is a circular arc is right, in the case $r=t$. – Intelligenti pauca May 16 '16 at 17:36
  • @Aretino I believe that you can maximize the area since you've done the most difficult part. I am eager to see. – newzad May 16 '16 at 17:58
  • Did you investigate what are the admissible values for $r$ and $t$? – Intelligenti pauca May 16 '16 at 18:01
  • Sorry it would be for $r=2/\pi$, $t = 0.7$ – newzad May 16 '16 at 18:13
  • Wow, incredible. My understanding is this is an open problem, would OP's maximum area be THE maximum possible? – Bennett Gardiner May 18 '16 at 04:42
  • 1
    @BennettGardiner He is constraining point $A$ on an ellipse, which is not necessarily the best possible situation, as far as I can tell. Nonetheless it is an interesting attempt. – Intelligenti pauca May 18 '16 at 17:43
  • Ah, of course. Still, fascinating work. – Bennett Gardiner May 19 '16 at 00:08
  • 1
    @nikamed: I wrote a small program to calculate the envelope numerically. (The sofa is split into $2N$ slices horizontally, with the vertical extents solved (exactly) for each slice.) The largest area it found was $2.21785$, for $r = 0.6055$, $t = 0.6678$ (using $N=1,000,000$, i.e. two million horizontal slices). – Nominal Animal May 19 '16 at 06:46
  • @NominalAnimal Can you share your work? That's nice to know we have some answer. As Aretino says point $A$ is not necessarily has to move on en ellipse. Another path may give better results. It seems to me that your program doesn't consider the path, so it will help. – newzad May 19 '16 at 07:10
  • @nikamed: Sure. I tried to explain how to derive the equations and functions for a non-elliptical-path $A$. For the actual code shown, the path is baked in. It is possible to replace the path with some other, parametric, function, but the equations must then be re-evaluated. – Nominal Animal May 19 '16 at 08:58
  • Philip Gibbs made a brilliant computation a couple of years ago which can be found here: http://vixra.org/abs/1411.0038 in which if I remember rightly he showed that a couple more discontinuities exist in the shape, allowing for a tiny bit more to be added on the sofa. The curves are involutes. I constructed a calculus version of the optimisation which he said would have required optimising an unknown integral using calculus of variations but I never had the time to see it through. I have no idea where those notes are, or whether I kept them. – Robert Frost May 22 '16 at 12:27
  • There is something I don't understand: you state that points $B$ and $C$ are symmetric with respect to the origin, but in your GeoGebra pictures they are not. How did you define those points in your GeoGebra files? – Intelligenti pauca May 23 '16 at 15:10
  • @Aretino $\alpha$ is not at the origin; in the other words, the origin is not stable. Imagine that $y$ axis moves every time $\alpha$ changes. I couldn't show the behaviour with geogebra. I am going to change images as soon as possible. – newzad May 23 '16 at 17:42
  • @Aretino I have changed properties of points for a constant coordinate system, FYI if you are interested. – newzad May 24 '16 at 20:51
  • 1
    I've done my computation again with those new points. I get exactly the same maximum area as before, but for slightly different values of $r$ and $t$. The good news is that with the new parameterization all the integrals admit a simple analytical expression: I'll soon post my results. – Intelligenti pauca May 25 '16 at 13:32
  • @Aretino you got your 200 bounty, I expect your results :) – newzad May 25 '16 at 13:38
  • if I read Gerver's proof correctly, he does not use a single function [r(a), t(a)] but a concatination of two different functions [r1(a),r2(a)] for 0<a<a1 and [r2(a),r2(a)] for a1<a<pi/2. – user601647 Nov 12 '17 at 09:22
  • @newzad , what type of functions did you want to try for $f$ and $g$ ? – pureundergrad Jan 29 '19 at 11:38

3 Answers3

6

WARNING: this answer uses the new parameterization of points introduced by the OP: \begin{eqnarray} A & = & \left( r\cos { \alpha } ,t\sin { \alpha } \right) \\ { A }' & = & \left( r\cos { \alpha } +\sqrt { 2 } \cos { \left( \frac { \pi }{ 4 } +\frac { \alpha }{ 2 } \right) } ,t\sin { \alpha } +\sqrt { 2 } \sin { \left( \frac { \pi }{ 4 } +\frac { \alpha }{ 2 } \right) } \right) \\ C & = & \left( r\cos { \alpha } +t\sin { \alpha } \tan { \left( \frac { \alpha }{ 2 } \right) } ,0 \right) \\ { C }' & = & \left( r\cos { \alpha } +t\sin { \alpha } \tan { \left( \frac { \alpha }{ 2 } \right) } +\frac { 1 }{ \cos { \left( \frac { \alpha }{ 2 } \right) } } ,0 \right) \end{eqnarray}

Another parameterization, which also apperaed in a first version of this question, was used in a previous answer to a related question.

The inner shape of the sofa is formed by the ellipse of semiaxes $r$, $t$ and by the envelope of lines $AC$ (here and in the following I'll consider only that part of the sofa in the $x\ge0$ half-plane).

The equations of lines $AC$ can be expressed as a function of $\alpha$ ($0\le\alpha\le\pi$) as $F(x,y,\alpha)=0$, where: $$ F(x,y,\alpha)= -t y \sin\alpha \tan{\alpha\over2} - t \sin\alpha \left(x - r \cos\alpha - t \sin\alpha \tan{\alpha\over2}\right). $$ The equation of the envelope can be found from: $$ F(x,y,\alpha)={\partial\over\partial\alpha}F(x,y,\alpha)=0, $$ giving the parametric equations for the envelope: $$ \begin{align} x_{inner}=& (r-t) \cos\alpha+\frac{1}{2}(t-r) \cos2\alpha+\frac{1}{2}(r+t),\\ y_{inner}=& 4 (t-r) \sin\frac{\alpha}{2}\, \cos^3\frac{\alpha}{2}.\\ \end{align} $$

We need not consider this envelope if $t<r$, because in that case $y_{inner}<0$. If $t>r$ the envelope meets the ellipse at a point $P$: the corresponding value of $\alpha$ can be found from the equation $(x_{inner}/r)^2+(y_{inner}/t)^2=1$, whose solution $\alpha=\bar\alpha$ is given by: $$ \begin{cases} \displaystyle\bar\alpha= 2\arccos\sqrt{t\over{t+r}}, &\text{for $t\le3r$;}\\ \displaystyle\bar\alpha= \arccos\sqrt{t\over{2(t-r)}}, &\text{for $t\ge3r$.}\\ \end{cases} $$

The corresponding values $\bar\theta$ for the parameter of the ellipse can be easily computed from: $\bar\theta=\arcsin(y_{inner}(\bar\alpha)/t)$: $$ \begin{cases} \displaystyle\bar\theta= \arcsin\frac{4 \sqrt{rt} (t-r)}{(r+t)^2}, &\text{for $t\le3r$;}\\ \displaystyle\bar\theta= \arcsin\frac{\sqrt{t(t-2 r)}}{t-r}, &\text{for $t\ge3r$.}\\ \end{cases} $$

For $t\ge r$ we can then represent half the area under the inner shape of the sofa as an integral: $$ {1\over2}Area_{inner}=\int_0^{2t-r} y\,dx= \int_{\pi/2}^{\bar\theta}t\sin\theta{d\over d\theta}(r\cos\theta)\,d\theta+ \int_{\bar\alpha}^{\pi} y_{inner}{dx_{inner}\over d\alpha}\,d\alpha. $$

This can be computed explicitly, here's for instance the result for $r<t<3r$: $$ \begin{align} {1\over2}Area_{inner}= {\pi\over4}(r^2-rt+t^2) +\frac{1}{48} (t-r)^2 \left[-24 \cos ^{-1}\frac{\sqrt{t}}{\sqrt{r+t}} +12 \sin \left(2 \cos^{-1}\frac{\sqrt{t}}{\sqrt{r+t}}\right)\\ +12 \sin \left(4 \cos^{-1}\frac{\sqrt{t}}{\sqrt{r+t}}\right) -4 \sin \left(6 \cos^{-1}\frac{\sqrt{t}}{\sqrt{r+t}}\right) -3 \sin \left(8 \cos^{-1}\frac{\sqrt{t}}{\sqrt{r+t}}\right) \right]\\ -2 r t {\sqrt{rt} |r^2-6 r t+t^2|\over(r+t)^4} -{1\over4} r t \sin ^{-1}\frac{4 \sqrt{rt} (t-r)}{(r+t)^2}\\ \end{align} $$

The outer shape of the sofa is formed by line $y=1$ and by the envelope of lines $A'C'$. By repeating the same steps as above one can find the parametric equations of the outer envelope: $$ \begin{align} x_{outer}&= (r-t) \left(\cos\alpha-{1\over2}\cos2\alpha\right) +\cos\frac{\alpha}{2}+{1\over2}(r+t)\\ y_{outer}&= \sin\frac{\alpha}{2} \left(-3 (r-t) \cos\frac{\alpha}{2} +(t-r) \cos\frac{3 \alpha}{2}+1\right)\\ \end{align} $$ This curve meets line $y=1$ for $\alpha=\pi$ if $t-r\le\bar x$, where $\bar x=\frac{1}{432} \left(17 \sqrt{26 \left(11-\sqrt{13}\right)}-29 \sqrt{2 \left(11-\sqrt{13}\right)}\right)\approx 0.287482$. In that case the intersection point has coordinates $(2t-r,1)$ and the area under the outer shape of the sofa can be readily found: $$ {1\over2}Area_{outer}={1\over3}(r+2t)+{\pi\over4}(1-(t-r)^2) $$ If, on the other hand, $t-r>\bar x$ then one must find the value of parameter $\alpha$ at which the envelope meets the line, by solving the equation $y_{outer}=1$ and looking for the smallest positive solution. This has to be done, in general, by some numerical method.

The area of the sofa can then be found as $Area_{tot}=Area_{outer}-Area_{inner}$. I used Mathematica to draw a contour plot of this area, as a function of $r$ (horizontal axis) and $t$ (vertical axis):

enter image description here

There is a clear maximum in the region around $r = 0.6$ and $t = 0.7$. In this region one can use the simple expressions for $Area_{inner}$ and $Area_{outer}$ given above, to find the exact value of the maximum. A numerical search gives $2.217856997942074266$ for the maximum area, reached for $r=0.605513519698965$ and $t=0.6678342468712839$.

  • Did you get to optimize the area? – newzad May 25 '16 at 21:23
  • Yes: the final result is 2.21786, obtained for $r = 0.605514$, $t= 0.667834$. It is not exactly the same as before, that's why I think this new parameterization is not equivalent to the previous one. – Intelligenti pauca May 25 '16 at 22:02
  • I guess I can say that I am sure about the parametization. BTW, It would be very interesting investigation areas for $r=f(\alpha)$ and $t=g(\alpha)$, however it seems to create a lot of job. Thank you for your great job. At least now I see that for $r,t$ some arbitrary constants we can't have a bigger sofa then Gerver's. I'd be appreciated if you share your work in the future. – newzad May 25 '16 at 22:09
  • Actually your result is the same as @Nominal Animal's. He used the old parametization. Interesting indeed. – newzad May 25 '16 at 22:12
  • A bit late, but how did you find the values of $\overline{\alpha}$? I am a bit confused. – bravesheeptribe Aug 24 '21 at 22:17
  • @bravesheeptribe Probably the confusion arises from the appearance of $x_{env}$ and $y_{env}$, which should be $x_{inner}$ and $y_{inner}$. I'll correct that. – Intelligenti pauca Aug 25 '21 at 08:28
  • So did you plug in the parameterization of $x_{inner}$ and $y_{inner}$ into the ellipse equation and solve for $\alpha$? – bravesheeptribe Aug 25 '21 at 17:04
  • @bravesheeptribe Yes, that's what I did. – Intelligenti pauca Aug 25 '21 at 18:08
  • Out of curiosity, is there some sort of trick to solving that equation? It seems very difficult to solve. – bravesheeptribe Aug 25 '21 at 18:44
  • @bravesheeptribe I used Mathematica... – Intelligenti pauca Aug 25 '21 at 19:35
5

This is not an answer to the stated question, just an outline and an example of how to compute the envelope (and thus area) numerically, pretty efficiently.

The code seems to work, but it is not tested, or nowhere near optimal in the algorithmic level; it is just a rough initial sketch to explore the problem at hand.

The sofa is symmetric with respect to the $x$ axis, so we only need to consider the (positive $x$) half plane. If we use $\alpha$ for the rotation, $\alpha \in [0, \pi]$, the initially vertical walls (on the right side) are the only ones we need to consider. For simplicity, I'll use $r_x$ and $r_y$ for the radiuses (OP used $r$ and $t$, respectively).

The equation for the points that form the near side wall ($t \ge 0$) is $$\vec{p}_{nw}(t, \alpha) = \begin{cases} x_{nw}(t, \alpha) = r_x \cos(\alpha) + t \sin(\alpha/2)\\ y_{nw}(t, \alpha) = r_y \sin(\alpha) - t \cos(\alpha/2)\end{cases}$$

Setting $x_{nw}(t, \alpha) = x$, solving for $t$, and substituting into $y_{nw}(t, \alpha)$ yields $$y_n(x, \alpha) = r_y \sin(\alpha) + \frac{r_x \cos(\alpha) - x}{\tan(\alpha/2)}$$ Because the near wall starts at angle $\alpha$, we must only consider $x \ge x_n(0,\alpha)$. We can do that in practice by defining $$\alpha_0(x) = \left\lbrace\begin{matrix} r_y\sqrt{1 - \left(\frac{x}{r_x}\right)^2},&x \lt r_x\\ 0,&x \ge r_x\end{matrix}\right.$$ and only considering $\alpha_0 \le \alpha \le \pi$ when evaluating $y_n(x,\alpha)$. It reaches its maximum when its derivative, $$\frac{d y_n(x,\alpha)}{d \alpha} = \frac{x - r_x}{1 - \cos(\alpha)} - (r_x - r_y)\cos(\alpha)$$ is zero. There may be two real roots, $$\begin{align}\alpha_1(x) &= \arccos\left(\frac{\sqrt{ (r_x - r_y)(5 r_x - r_y - 4 x)} + (r_x - r_y)}{2 ( r_x - r_y )}\right)\\ \alpha_2(x) &= \pi - \arccos\left(\frac{\sqrt{ (r_x - r_y)(5 r_x - r_y - 4 x)} - (r_x - r_y)}{2 ( r_x - r_y )}\right)\end{align}$$ In summary, the near wall is the maximum of one, two, or three values: $y_n(x,\alpha_0)$; $y_n(x,\alpha_1)$ if $\alpha_0 \lt \alpha_1 \lt \pi$; and $y_n(x,\alpha_2$) if $\alpha_0 \lt \alpha_2 \lt \pi$.

For the far side wall, the points are $$\vec{p}_f(t, \alpha) = \begin{cases} x_f(t) = r_x \cos(\alpha) + \cos(\alpha/2) + \sin(\alpha/2) + t \sin(\alpha/2)\\ y_f(t) = r_y \sin(\alpha) + \sin(\alpha/2) - \cos(\alpha/2) - t \cos(\alpha/2)\end{cases}$$ The first added term represents the corridor width, and the second the corridor height, both $1$. Setting $x_f(t, \alpha) = x$, solving for $t$, and substituting into $y_f(t, \alpha)$ yields $$y_f(x, \alpha) = \frac{(r_x + r_y - 2x)\cos(\alpha/2) + (r_x - r_y)\cos(3\alpha/2) + 2 }{2 \sin(\alpha/2)}$$ Its derivative is $$\frac{d y_f(x, \alpha)}{d \alpha} = \frac{rx - x + \cos(\alpha/2)}{\cos(\alpha) - 1} - \cos(\alpha)(r_x - r_y)$$ It can have up to four real roots (the roots of $4(r_x-r_y)\chi^4 - 6(r_x-r_y)\chi^2 - \chi + (r_x - r_y) + (x - r_y) = 0$). While it does have analytical solutions, they are nasty, so I prefer to use a binary search instead. I utilize the fact that the sign (and zeros) of the derivative are the same as the simpler function $$d_f(x, \alpha) = \cos(\alpha)\left(\cos(\alpha)-1\right)(r_x - r_y) - \cos(\alpha/2) - r_x + x$$ which does not have poles at $\alpha=0$ or $\alpha=\pi$.

Here is an example implementation in C:

#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <math.h>

#define PI 3.14159265358979323846

static double near_y(const double x,
                     const double xradius,
                     const double yradius)
{
    double y = (x < xradius) ? yradius * sqrt(1.0 - (x/xradius)*(x/xradius)) : 0.0;
    if (xradius != yradius) {
        const double a0 = (x < xradius) ? acos(x/xradius) : 0.0;
        const double s  = (xradius - yradius)*(5*xradius - yradius - 4*x);
        if (s >= 0.0) {
            const double r = 0.5 * sqrt(s) / (xradius - yradius);
            if (r > -1.5 && r < 0.5) {
                const double a1 = acos(r + 0.5);
                if (a1 > a0 && a1 < PI) {
                    const double y1 = yradius * sin(a1) + (xradius * cos(a1) - x) / tan(0.5 * a1);
                    if (y < y1)
                        y = y1;
                } 
            }
            if (r > -0.5 && r < 1.5) {
                const double a2 = PI - acos(r - 0.5);
                if (a2 > a0 && a2 < PI) {
                    const double y2 = yradius * sin(a2) + (xradius * cos(a2) - x) / tan(0.5 * a2);
                    if (y < y2)
                        y = y2;
                }
            }
        }
    }
    return y;
}

Above, near_y() finds the maximum $y$ coordinate the near wall reaches at point $x$.

static double far_y(const double x,
                    const double xradius,
                    const double yradius)
{
    const double rxy = xradius - yradius;
    const double rx = xradius - x;
    double       retval = 1.0;
    double       anext = 0.0;
    double       dnext = x - 1.0 - xradius;
    double       acurr, dcurr, y;

    /* Outer curve starts at min(1+xradius, 2*yradius-xradius). */
    if (x < 1.0 + xradius && x < yradius + yradius - xradius)
        return 1.0;

    while (1) {
        acurr = anext;
        dcurr = dnext;
        anext += PI/1024.0;
        if (anext >= PI)
            break;
        dnext = cos(anext)*(cos(anext) - 1.0)*rxy - cos(anext*0.5) - rx;

        if ((dcurr < 0.0 && dnext > 0.0) ||
            (dcurr > 0.0 && dnext < 0.0)) {
            double amin = (dcurr < 0.0) ? acurr : anext;
            double amax = (dcurr < 0.0) ? anext : acurr;
            double a, d;
            do {
                a = 0.5 * (amin + amax);
                d = cos(a)*(cos(a)-1.0)*rxy - cos(a*0.5) - rx;
                if (d < 0.0)
                    amin = a;
                else
                if (d > 0.0)
                    amax = a;
                else
                    break;
            } while (amax > amin && a != amin && a != amax);
            y = (cos(0.5*a)*(0.5*(xradius+yradius)-x) + cos(1.5*a)*rxy*0.5 + 1.0) / sin(0.5*a);
            if (retval > y) {
                retval = y;
                if (y <= 0.0)
                    return 0.0;
            }
        } else
        if (dcurr == 0.0) {
            y = (cos(0.5*acurr)*(0.5*(xradius+yradius)-x) + cos(1.5*acurr)*rxy*0.5 + 1.0) / sin(0.5*acurr);
            if (retval > y) {
                y = retval;
                if (y <= 0.0)
                    return 0.0;
            }
        }
    }
    return retval;
}

Above, far_y() finds the minimum $y$ coordinate for the far wall at $x$. the far wall reaches at the same point. It calculates the sign of the derivative for 1024 values of $\alpha$, and uses a binary search to find the root (and the extremum $y$) whenever the derivative spans zero.

With the above two functions, we only need to divide the full sofa width ($1 + r_x$) to slices, evaluate the $y$ coordinates for each slice, multiply the $y$ coordinate difference by the double slice width (since we only calculate one half of the sofa), to obtain an estimate for the sofa area (using the midpoint rule for the integral):

double sofa_area(const unsigned int xsamples,
                 const double       xradius,
                 const double       yradius)
{
    if (xradius > 0.0 && yradius > 0.0) {
        const double dx = (1.0 + xradius) / xsamples;
        double       area = 0.0;
        unsigned int i;
        for (i = 0; i < xsamples; i++) {
            const double x = dx * (0.5 + i);
            const double ymin = near_y(x, xradius, yradius);
            const double ymax = far_y(x, xradius, yradius);
            if (ymin < ymax)
                area += ymax - ymin;
        }        
        return 2*dx*area;
    } else
        return 0.0;
}

As far as I have found, the best one is sofa_area(N, 0.6055, 0.6678) = 2.21785 (with N ≥ 5000, larger N yields more precise estimates; I checked up to N = 1,000,000).

The curve the inner corner makes ($(x_{wn}(0,\alpha), y_{wn}(0,\alpha))$, $0 \le \alpha \le \pi$) is baked inside near_y() and far_y() functions. However, it would be possible to replace $y_{wn}(0,\alpha)$ with a more complicated function (perhaps a polynomial scaling $r_y$, so that it is $1$ at $\alpha = 0, \pi$?), if one re-evaluates the functions above. I personally use Maple or Mathematica for the math, so the hard part, really, is to think of a suitable function that would allow "deforming" the elliptic path in interesting ways, without making the above equations too hard or slow to implement.

The C code itself could be optimized, also. (I don't mean micro-optimizations; I mean things like using the trapezoid rule for the integral, better root finding approach for far_y(), and so on.)

  • Your answer is very advanced for me, it costs me to understand than @Aretino's answer does. I didn't mark your response as answer because I didn't understand. However I appreciate very much for your effort. – newzad May 25 '16 at 22:22
  • @nikamed: That's all right. I do appreciate you letting me know, as that helps me write better answers in the future. In any case, I have toyed with a different approach, one that takes an arbitrary number of samples $(x, y, \theta)$ (in text form, generated using e.g. an awk script or other program), with the near corner at $(x,y)$ and rotated by $\theta$, and constructs the sofa as a polygon. This would allow experimenting with arbitrary paths through the corner... – Nominal Animal May 26 '16 at 15:11
0

The envelope of $A'C'$ is not monotonic in some cases, which was not considered in the above analytical answers.

$a=0.25, b=0.55$

Blue: trajactory of $A$ Orange: envelope of $AC$ Green: envelope of $A'C'$

curves

K Leng
  • 11