Skip to content

Polynomial.Roots() does not return the correct results #936

Open
@sfetzel

Description

@sfetzel
var polynomialCoefficients = new double[]
{
   1.19469367e+21, 1.67924808e+16, 3.97850921e+10, 1.39471145e+00, 1.56417732e-07
};
var polynomial = new Polynomial(polynomialCoefficients);

The result of polynomial.Roots() will return the following roots:
[0]: {(-4458290,732664504, 504313068,0086204)}
[1]: {(-4458290,732664504, -504313068,0086204)}
[2]: {(0, 0)}
[3]: {(0, 0)}

Using octave:
roots([1.56417732e-07, 1.39471145e+00, 3.97850921e+10, 1.67924808e+16, 1.19469367e+21])
The expected roots are:
(-4247248.3831557, 5.04311305e+08),
(-4247248.3831557, -5.04311305e+08),
(-331498.88729568, 0),
(-90585.83564952, 0)

My current workaround is:

Evd<Complex> eigen = polynomial.EigenvalueMatrix().ToComplex().Evd(Symmetricity.Asymmetric);
var roots = eigen.EigenValues;

However, these roots are not 100% complex conjugated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions