public class PolyRoot extends java.lang.Object implements PolyRootSolver
double) or Complex.
The Abel–Ruffini theorem says that we have analytical solution for polynomials of degree up to 4.
This implementation solves a polynomial of degree 1 by LinearRoot, degree 2 by QuadraticRoot, degree 3 by CubicRoot,
degree 4 by QuarticRoot, and others by the Jenkins-Traub algorithm JenkinsTraubReal.| Constructor and Description |
|---|
PolyRoot() |
| Modifier and Type | Method and Description |
|---|---|
static java.util.List<Complex> |
getComplexRoots(java.util.List<? extends java.lang.Number> roots)
Get a copy of only the
Complex but not real roots of a polynomial. |
static java.util.List<java.lang.Double> |
getRealRoots(java.util.List<? extends java.lang.Number> roots)
Get a copy of only the real roots of a polynomial.
|
java.util.List<? extends java.lang.Number> |
solve(Polynomial polynomial)
Get the roots/zeros of a polynomial.
|
public java.util.List<? extends java.lang.Number> solve(Polynomial polynomial)
solve in interface PolyRootSolverpolynomial - the polynomial to be solvedjava.lang.IllegalArgumentException - if the polynomial is a constant, hence no solutionpublic static java.util.List<java.lang.Double> getRealRoots(java.util.List<? extends java.lang.Number> roots)
getComplexRoots(java.util.List) are all the roots.roots - all the roots of a polynomialpublic static java.util.List<Complex> getComplexRoots(java.util.List<? extends java.lang.Number> roots)
Complex but not real roots of a polynomial.
The union of these and getRealRoots(java.util.List) are all the roots.roots - all the roots of a polynomialComplex roots