Class PolyRoot

    • Constructor Detail

      • PolyRoot

        public PolyRoot()
    • Method Detail

      • solve

        public List<? extends Number> solve​(Polynomial polynomial)
        Get the roots/zeros of a polynomial.
        Specified by:
        solve in interface PolyRootSolver
        Parameters:
        polynomial - the polynomial to be solved
        Returns:
        the roots of the polynomial
        Throws:
        IllegalArgumentException - if the polynomial is a constant, hence no solution
      • getRealRoots

        public static List<Double> getRealRoots​(List<? extends Number> roots)
        Get a copy of only the real roots of a polynomial. The union of these and getComplexRoots(java.util.List) are all the roots.
        Parameters:
        roots - all the roots of a polynomial
        Returns:
        a copy of the real roots
      • getComplexRoots

        public static List<Complex> getComplexRoots​(List<? extends Number> roots)
        Get a copy of only the Complex but not real roots of a polynomial. The union of these and getRealRoots(java.util.List) are all the roots.
        Parameters:
        roots - all the roots of a polynomial
        Returns:
        a copy of the Complex roots