1
$\begingroup$

Are there numerical rounding issues in using the cubic formula to find roots of cubic equations? Similarly with the quartic formula?

I do know for the quadratic formula to solve $ax^2+bx+c = 0$ that you use the formulas $x = \frac{-b \pm \sqrt{b^2-4ac}}{2a}$ or $x = \frac{2c}{-b \mp \sqrt{b^2-4ac}}$ so that the numerator or denominator respectively are chosen so that they are the sum of two terms with the same sign.

$\endgroup$
2
$\begingroup$

It could certainly be.

You have

$$S = \sqrt [3] {R + \sqrt{Q^3 + R^2}}$$ and $$T = \sqrt [3] {R - \sqrt{Q^3 + R^2}}$$

so if $Q$ is small compared with $R$, there could be trouble.

The $\sqrt{}$s could be computed safely in that case, as in the quadratic case, by $a-\sqrt{a^2+b} =(a-\sqrt{a^2+b})\frac{a+\sqrt{a^2+b}}{a+\sqrt{a^2+b}} =\frac{-b}{a+\sqrt{a^2+b}} $.

I wouldn't be surprised if standard libraries took these kind of precautions.

$\endgroup$
  • $\begingroup$ Do any standard libraries actually use the cubic or quartic formulas? Or do they use some kind of numerical technique (like finding eigenvalues of the companion matrix)? $\endgroup$ – Stephen Montgomery-Smith Jul 16 '15 at 20:59
  • $\begingroup$ If they used the formulae, I certainly hope they practice safe computation. $\endgroup$ – marty cohen Jul 16 '15 at 21:07
  • $\begingroup$ I would not be surprised if many standard libraries use regula falsi to get a real zero, since it's known (if I recall correctly) to be quite well behaved. $\endgroup$ – Robert Lewis Jul 16 '15 at 21:28
  • $\begingroup$ If the libraries have good numerical methods for solving higher-degree polynomials, I don't see why they would bother trying to use the cubic or quartic formula for finding numerical solutions. $\endgroup$ – Robert Israel Jul 16 '15 at 21:40
  • $\begingroup$ Here's a link to matlab where they say that "Note that these solution formulas are well known to be numerically unstable." mathworks.com/matlabcentral/answers/… $\endgroup$ – marty cohen Jul 23 '15 at 2:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.