Given semiperimeter and radii of inscribed and circumscribed circles, find the side lengths of triangle

cubicsgeometryrootstriangles

Consider $\triangle ABC$ with side lengths $a,b,c$,
semiperimeter $\rho=\tfrac12\,(a+b+c)$,
inradius $r$ and circumradius $R$.
Let $u=\rho/R,\ v=r/R$,
$a'=a/R,\ b'=b/R,\ c'=c/R$.

Given $u,\,v$,
we can find
$a',\,b',\,c'$ as roots of cubic equation

\begin{align}
x^3-2\,u\,x^2+(u^2+v^2+4\,v)\,x-4\,u\,v&=0
\tag{1}\label{1}
,
\end{align}

and the side lengths in increasing order $a\le b\le c$
can be expressed as

\begin{align}
a&=
\tfrac23\,R\,\left(u+\sqrt{u^2-3\,v\,(v+4)}\,
\cos(\phi+\tfrac{2\pi}3)
\right)
\tag{2a}\label{2a}
,\\
b&=
\tfrac23\,R\,\left(u+\sqrt{u^2-3\,v\,(v+4)}\,
\cos(\phi-\tfrac{2\pi}3)
\right)
\tag{2b}\label{2b}
,\\
c&=
\tfrac23\,R\,\left(u+\sqrt{u^2-3\,v\,(v+4)}\,
\cos(\phi)
\right)
\tag{2c}\label{2c}
,\\
\phi&=
\tfrac13\,\arctan\left(
{3\,\sqrt3\,v\,\sqrt{u^2\,(2\,(27-(5-v)^2)-u^2)-v\,(v+4)^3}}
,
{u\,(9\,v\,(2-v)-u^2)}
\right)
\tag{2phi}\label{2phi}
.
\end{align}

Numerical tests demonstrate that in general
expressions \eqref{2a}-\eqref{2c}
work fine for the valid range of $u,\,v$,
except for
an annoying special case,
which corresponds to equilateral triangle,
when $v=\tfrac12$, $u=\tfrac{3\sqrt3}2$,
$a=b=c=\tfrac23\,u\,R$.
In this case \eqref{1} collapses to

\begin{align}
(x-\sqrt3)^3&=0
\tag{3}\label{3}
\end{align}

and direct numeric calculation of $\phi$ fails.

Of course, it's not a big deal and this case can be algorithmically isolated and handled differently,
but,

the question is: Is it possible to come up with some modified version
of expression for $\phi$, which would work
gracefully for all valid pairs of $u,\,v$?

This probably could be useful:
the valid range is found as follows: for $v\in(0,\tfrac12]$,

\begin{align}
u&\in[u_{\min},u_{\max}]
,\\
u_{\min}(v)&=
\sqrt{27-(5-v)^2-2\,\sqrt{(1-2\,v)^3}}
,\\
u_{\max}(v)&=
\sqrt{27-(5-v)^2+2\,\sqrt{(1-2\,v)^3}}
.
\end{align}

Both boundary curves $u_{\max}(v)$ and $u_{\min}(v)$,
correspond to isosceles triangles,
$u_{\max}(v)$ represents all isosceles triangles
with the base as the smallest side,
while
$u_{\min}(v)$ represents all isosceles triangles
with the base as the largest side.
The area, bounded by $u_{\min}(v)$, $u_{\max}(v)$
and the $u$-axis covers all possible types of valid triangles
with $R=1$ and can be used as a "map of the Trianglia"
to make a quick crude tests of some general properties of triangles,
for example, to estimate $\max(\sin\alpha+\sin\beta+\sin\gamma)$, etc.

Best Answer

(Converting comment to answer, as requested.)

Triangles aside, you are effectively asking for a universal solution to the (depressed) cubic $t^3+pt+q=0$ that works even when $p=q=0$. I'm personally not aware of one. Solutions such as those in Wikipedia separate-out such special cases. (Of course, when $p=0$, the solution is clear enough not to need a "formula".)

For completeness: Your cubic's corresponding "depressed" coefficients are $$\begin{align} p &=\frac13 (3v^2+12 v-u^2) = \frac1{3R^2}\left(3r^2+12\rho R−\rho^2\right) \\[6pt] &=−\frac1{3R^2}\left(a^2+b^2+c^2−ab−bc−ca\right) \\[10pt] q &=\frac2{27} u \left(u^2 - 18 v + 9 v^2\right) = \frac2{27R^3}\rho\left(9r^2−18rR+ρ^2\right) \\[6pt] &=−\frac1{27R^3}(2a−b−c)(−a+2b−c)(−a−b+2c) \end{align}$$ which (obviously) vanish when $a=b=c$.

Note that (a multiple of) $\sqrt{-p}$ is the coefficient of the $\cos(\phi+\cdots)$ terms in OP's expressions for the roots. So, maybe the fact that the $\phi$ formula fails when $p=0$ doesn't really matter, since those terms simply vanish.