package com.imsl.test.example.math; import com.imsl.math.*; /** *

* Finds the zeros of a polynomial with complex coefficients.

* * This example solves the following equation: * $$z^3-(3+6i)*z^2+(-8+12i)*z+10=0$$ * * @see Code * @see Output */ public class ZeroPolynomialEx2 { public static void main(String args[]) throws ZeroPolynomial.DidNotConvergeException { // Find zeros of z^3-(3+6i)*z^2+(-8+12i)*z+10 Complex coef[] = { new Complex(10), new Complex(-8, 12), new Complex(-3, -6), new Complex(1) }; ZeroPolynomial zp = new ZeroPolynomial(); Complex root[] = zp.computeRoots(coef); for (int k = 0; k < root.length; k++) { System.out.println("root = " + root[k]); System.out.println(" radius = " + zp.getRadius(k)); System.out.println(" status = " + zp.getStatus(k)); } } }