public class PolyRoot extends 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 List<Complex> |
getComplexRoots(List<? extends Number> roots)
Get a copy of only the
Complex but not real roots of a polynomial. |
static List<Double> |
getRealRoots(List<? extends Number> roots)
Get a copy of only the real roots of a polynomial.
|
List<? extends Number> |
solve(Polynomial polynomial)
Get the roots/zeros of a polynomial.
|
public List<? extends Number> solve(Polynomial polynomial)
solve in interface PolyRootSolverpolynomial - the polynomial to be solvedIllegalArgumentException - if the polynomial is a constant, hence no solutionpublic static List<Double> getRealRoots(List<? extends Number> roots)
getComplexRoots(java.util.List) are all the roots.roots - all the roots of a polynomialpublic static List<Complex> getComplexRoots(List<? extends 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 rootsCopyright © 2010-2020 NM FinTech Ltd.. All Rights Reserved.