Example usage for org.apache.commons.math3.analysis.solvers LaguerreSolver solveAllComplex

List of usage examples for org.apache.commons.math3.analysis.solvers LaguerreSolver solveAllComplex

Introduction

In this page you can find the example usage for org.apache.commons.math3.analysis.solvers LaguerreSolver solveAllComplex.

Prototype

public Complex[] solveAllComplex(double[] coefficients, double initial)
        throws NullArgumentException, NoDataException, TooManyEvaluationsException 

Source Link

Document

Find all complex roots for the polynomial with the given coefficients, starting from the given initial value.

Usage

From source file:dom.rootlocus.utils.Utils.java

public Complex[] getRoots(PolynomialFunction p) {
    double[] coefficients = p.getCoefficients();
    LaguerreSolver solver = new LaguerreSolver(1e-10);
    Complex[] r = solver.solveAllComplex(p.getCoefficients(), 0);
    return r;// w  w  w  .  j  a  v  a2  s . c  o  m
    //        Complex[] roots = new Complex[r.length];
    //        for (int i = 0; i < r.length; i++) {
    //            double Re = new BigDecimal(r[i].getReal()).setScale(5, RoundingMode.HALF_UP).doubleValue();
    //            double Img = new BigDecimal(r[i].getImaginary()).setScale(5, RoundingMode.HALF_UP).doubleValue();
    //            roots[i] = new Complex(Re, Img);
    //        }
    //        return roots;
}