FindPolynomialZeroes

Non-exposed, non-supported function

FindPolynomialZeroes(C, I, J)

Finds all real-number factors of a polynomial.

The polynomial is specified by its coefficients, «C», in the first parameter, indexed by «I». The first element along «I» is the constant, the second parameter is the linear coefficient, the third the quadratic coefficient, etc., so that the full polynomial for a value X is

`Sum(C*X^(@I - 1), I)`

There are at most n - 1 solutions. The real-valued solutions (or zeroes) are returned in an array also indexed by «I». The last elements along «I» are filled with NaN when the remaining solutions are complex (since only the real-valued solutions are found and returned). The final slot will always be NaN since there are at most n - 1 solutions. Alternatively, you can supply an optional third parameter, «J», with one element less than «I», which will be used to index the result.

The highest order coefficient should always be non-zero.

Library

None: The function is not officially exposed

Notes

In the absence of numeric round-off, the algorithm employed would have the theoretical property that it would locate all real-valued zeroes of the polynomial. However, in practice, miniscule perturbations to the coefficient values (i.e., numeric round-off) causes what would be real-valued solutions to perturb off the real-axis into the complex plane, where they are then not found. For polynomials with degree less than 20, this is observed only occasionally, but for polynomials above degree 20, the impact becomes quite pronounced, with the roundoff increasing as the degree of the polynomial increases. This sensitivity to numeric round-off is the primary reason this function is not officially supported or explicitly exposed.

Examples

Find the factors of: `x3 + x2 - 32*x - 60`:

`Index n := 0..3;`
`FindPolynomialZeroes(Array(n, [-60, -32, 1, 1]), I) → [6, -2, -5, NaN] indexed by n`

Thus, the polynomial factors as: `(x - 6)*(x + 2)*(x + 5)`