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.0000000000000004+1.0000000000000004i
    radius = 6.30e-14
    status = False
root = 0.99999999999999944+2.0000000000000018i
    radius = 1.96e-13
    status = False
root = 0.999999999999999+2.9999999999999987i
    radius = 1.47e-13
    status = False

Link to C# source.