The discriminant of any monic polynomial is the product $\prod_{i \neq j} (x_i - x_j)^2$ of the squares of the differences of the roots (in an algebraic closure, e.g. $C$). Cf. the Wikipedia article on this. Consequently, if the roots are all real and distinct, this must be positive.
(If the polynomial is not monic, the factor $a_0^{2n-2}$ is thrown in, for $a_0$ the leading coefficient and $n$ the degree; this is positive for a real polynomial.)
I think you can avoid the Newton-Raphson altogether, since cubic is solvable in radicals.
Here is the complete algorithm (working under constraints outlined in the problem), in Mathematica:
Clear[PositiveCubicRoot];
PositiveCubicRoot[p_, q_, r_] :=
Module[{po3 = p/3, a, b, det, abs, arg},
b = ( po3^3 - po3 q/2 + r/2);
a = (-po3^2 + q/3);
det = a^3 + b^2;
If[det >= 0,
det = Power[Sqrt[det] - b, 1/3];
-po3 - a/det + det
,
(* evaluate real part, imaginary parts cancel anyway *)
abs = Sqrt[-a^3];
arg = ArcCos[-b/abs];
abs = Power[abs, 1/3];
abs = (abs - a/abs);
arg = -po3 + abs*Cos[arg/3]
]
]
Then
In[222]:= PositiveCubicRoot[-2.52111798, -71.424692, -129.51520]
Out[222]= 10.499
However, if the Newton-Raphson method must be used, then a good initial guess is imperative. Binary division is a good method to isolate the root in the case at hand.
We start with an arbitrary point $x$, I chose $x=1$, and double it while the polynomial
at that point is negative. Then do binary division a certain number of times (the code below does it twice). Ultimately, polish it off with Newton-Raphson iterations:
In[283]:=
NewtonRaphsonStartingPoint[{p_, q_, r_}] := Module[{x1=0, x2=1,f1,f2,xm,fm},
f1 = r + x1 (q + (p + x1) x1);
While[(f2 = r + x2 (q + (p + x2) x2)) <= 0,
x1 = x2; f1 = f2; x2 = 2 x2];
Do[xm = (x1 + x2)/2; fm = r + xm (q + (p + xm) xm);
If[fm <= 0, f1 = fm; x1 = xm, f2 = fm; x2 = xm], {i, 2}];
(f2 x2 - f1 x1)/(f2 - f1)
];
NewtonRaphsonIterate[{p_, q_, r_}, x0_Real] :=
FixedPoint[
Function[x, x - (r + x (q + (p + x) x))/(q + (2 p + 3 x) x)], x0]
In[285]:=
NewtonRaphson[p_, q_, r_] :=
NewtonRaphsonIterate[{p, q, r}, NewtonRaphsonStartingPoint[{p, q, r}]]
In[286]:= NewtonRaphson[-2.52111798, -71.424692, -129.51520]
Out[286]= 10.499
Best Answer
If we can show that the value of $A$ changes the amount of maxima or minima from 1 to 2 such that one extreme is at a positive $y$-location and the other at a zero or negative $y$-location, then we know that this value of $A$ is the border for all real solutions versus 1 real and 2 complex solutions.
Denote $f(x) = x^3 + Ax^2 + 1.$
$$f'(x) = 3x^2+2Ax=x(3x+2A) = 0.$$
We see that $f(0)$ is always either a local maximum or minimum and $f(0) > 0.$ The other zero is given by $x = -2A/3 = \xi.$
We need $f(\xi) \leq 0.$
$$f(\xi) = \frac{4}{27}A^3 + 1 \leq 0$$
solves for the values of $A$ where 3 real solutions are guaranteed.
If there are 3 real roots, then since $x = 0$ is always a local extreme, at least one has to be positive and another has to be negative. Also, if $A \leq -3/\sqrt[3]{4}$ and the location of the moving extreme is $x=-2A/3 > 0,$ then the remaining real root has to be positive.
If there's only 1 real root, then $A > -3/\sqrt[3]{4}$ and the moving extreme is located at $x < \sqrt[3]{2}.$ Thus the only real root must be negative.