Example 1: Zeros of a Polynomial

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

public class ZeroPolynomialEx1
{
    public static void  Main(String[] args)
    {
        double[] coef = new double[]{- 2, 4, - 3, 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));
            Console.Out.WriteLine("    status = " + zp.GetStatus(k));
        }
    }
}

Output

root = 0.99999999999999978-0.99999999999999978i
    radius = 1.99006775678924E-14
    status = False
root = 1.0000000000000004+1.0000000000000002i
    radius = 1.96185227616234E-14
    status = False
root = 0.99999999999999989-1.6543612251060553E-24i
    radius = 2.04503081135961E-14
    status = False

Link to C# source.