Example 2: Zeros of a Polynomial with Complex Coefficients

The zeros of a polynomial with Complex coefficients are computed.
using System;
using Imsl.Math;

public class ZeroPolynomialEx2
{
	public static void  Main(String[] args)
	{
		// Find zeros of z^3-(3+6i)*z^2+(-8+12i)*z+10
		Complex[] coef = new Complex[]{
			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++)
		{
			Console.Out.WriteLine("root = " + root[k]);
			Console.Out.WriteLine("    radius = " +
            zp.GetRadius(k).ToString("0.00e+0"));
			Console.Out.WriteLine("    status = " + zp.GetStatus(k));
		}
	}
}

Output

root = 1+1i
    radius = 6.11e-14
    status = False
root = 0.99999999999999856+2i
    radius = 1.95e-13
    status = False
root = 1.0000000000000013+3.0000000000000013i
    radius = 1.50e-13
    status = False

Link to C# source.