Find closest real root of cubic given two imaginary roots I have a cubic polynomial root-solving algorithm (the one at https://www.particleincell.com/2013/cubic-line-intersection/) which works perfectly, however I would like to be able to finding the closest real root when the cubic function has two imaginary roots.
At first I thought I could just disregard the real part, for example if my two imaginary roots are 3+0.0005i and 3-0.0005i then I figured that the corresponding close real root would be x=3 (which would in fact be the turning point of the graph), however when shifting my graph so that there ARE indeed two real roots, the turning point turns out to be at (for example) x = 3.1.
I could, of course, solve for the turning points, however I thought that I would simply be able to disregard my imaginary components and it would just work. Is this maybe the case and I am doing something wrong in my algorithm, or is there an explanation as to why you cannot simply do this?
Thanks
Edit:
I've decided to add the actual polynomial I am working with so I can illustrate what I mean.
$$y = 3x^3 + 15x^2 + 6x -36.185$$
The roots (according to my pocket calculator) are 1.239..., and -3.1196591 +-...i. However, the turning point is -3.1196329. Why is this different?
 A: Relation to the third real root
Suppose that $f(x)$ is your cubic with two imaginary roots, one real root.  As pointed out by user Empy2, the sum of all the roots is $-\frac{m}{n}$, where $m$ is the coefficient of the square term and $n$ is the coefficient of the cubic term.  So, if you know the two imaginary roots, you absolutely know the remaining real roots with no need to guess.
However, there need be no relation between the real part of the imaginary roots and the third (real) root.  To see this, manufacture a large number of arbitrary examples.  For example, let $z=a+bi$ and let $c \in \mathbb{R}$.  The polynomial
$$
f(x) = (x-z)(x-\overline{z})(x-c) = (x^2 -2ax +z\overline{z})(x-c)
$$
is a real cubic polynomial with complex roots $z, \overline{z}$, and the real root $c$.  However, there is plainly no relation between $a$ and $c$ (without further assumptions on your polynomial).  You can manufacture any choices of $a$ and $c$ that you like.
Relation to the turning points
Take the same example polynomial above.  Its derivative is
$$
f'(x) = (2x-2a)(x-c)+x^2-2ax+z\overline{z}.
$$
If you expand this out using that $z\overline{z}=a^2+b^2$ you get that
$$
f'(x) = 3x^2 -(2c+4a)x +(2ac+a^2+b^2).
$$
We use the quadratic formula and doing some very careful algebra (noting that $(a-c)^2 = a^2+c^2-2ac$ along the way) gives potential turning points as
$$
x = \frac{c+2a\pm\sqrt{(a-c)^2-3b^2}}{3}.
$$
When $b^2 > \frac{(a-c)^2}{3}$ there are of course no turning points.
For the case more interesting to you, take the example of such a cubic with complex roots $\pm 5i$ and real root $10$.  Thus we are taking $a=0$, $b=5$, and $c=10$.  In this case we get turning points $\frac{10 \pm 5}{3}$ which gives $x=\frac{5}{3}\approx 1.667$ and $x=5$. Note that in this case, the turning points are not anywhere close to the real part of the imaginary roots (namely, $a=0$).  This is only one example:  it is easy to manufacture more.
If, however, we are in the case $b^2 \leq \frac{(a-c)^2}{3}$ so that we have real turning points, and with $|a-c|$ very small, the turning points will be reasonably close to the real part of the complex roots.  Note that in this case $b^2$ and hence $b$ must also be small.  Then the formula above for the turning points is approximately (by ignoring the square root term and taking $a \approx c$)
$$
x = \frac{c+2a\pm\sqrt{(a-c)^2-3b^2}}{3} \approx \frac{c+2a}{3} \approx \frac{a+2a}{3} = a.
$$
Hence, in this case, the turning points are in fact close to $a$, which was the real part of the complex roots of $f$.  I believe this is what you are witnessing.
