Class QuadraticRealRootFinder

  • All Implemented Interfaces:
    Polynomial1DRootFinder<Double>

    public class QuadraticRealRootFinder
    extends Object
    implements Polynomial1DRootFinder<Double>
    Class that calculates the real roots of a quadratic function.

    The roots can be found analytically. For a quadratic $ax^2 + bx + c = 0$, the roots are given by: $$ \begin{align*} x_{1, 2} = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a} \end{align*} $$ If no real roots exist (i.e. $b^2 - 4ac < 0$) then an exception is thrown.