public class QuadraticRealRootFinder extends Object implements Polynomial1DRootFinder<Double>
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.
| Constructor and Description |
|---|
QuadraticRealRootFinder() |
public Double[] getRoots(RealPolynomialFunction1D function)
getRoots in interface Polynomial1DRootFinder<Double>function - The function, not nullIllegalArgumentException - If the function is not a quadraticMathException - If the roots are not realCopyright 2009-Present by OpenGamma Inc. and individual contributors
Apache v2 licensed
Additional documentation can be found at strata.opengamma.io.