# ROOTS

## Purpose:

Finds the roots of a polynomial.

## Syntax:

ROOTS(coef, method)

coef

-

Any series, the polynomial coefficients in descending powers (highest degree to lowest).

method

-

Optional. An integer, the root finding method:

 0: companion matrix (default) 1: Laguare method

## Returns:

A real or complex series, the roots of the polynomial.

## Example:

r = roots({1, -1, -1})

r == {1.618034, -0.618034}

r[1] == phi

returns 1, demonstrating that for polynomial:

i.e. positive root of x2 - x - 1 is PHI, the Golden Mean.

## Example:

roots({1, -2, 0})

returns {0, 2}, the roots of:

## Example:

roots(poly({3, 2, 1}))

returns {3, 2, 1}, showing that roots and POLY are inverse functions within machine precision.

## Example:

a := rand

x = -10..0.01..10

W1: roots({a, 1, -1, -1})

W2: xy(W1, zeros(length(W1),1));points;setsym(14)

W3: a*x^3 + x^2 - x - 1;overp(W2, lred)

W3 displays a cubic of the form:

The roots of the cubic are overplotted in red and displayed as solid circles.

Executing the statement a := rand creates a new polynomial that is automatically updated in W3. A zoomed portion of the graph below shows the cubic nature of the location of the roots.

## Remarks:

By default, ROOTS calculates the roots of a polynomial by finding the eigenvalues of the companion matrix for the corresponding characteristic polynomial.

roots(a) finds the roots of:

where the coefficients are ordered from highest power to lowest power.

If a lower order term does not exist, the corresponding coefficient must be set to 0.

See POLYROOT to determine the roots of a polynomial in ascending powers (lowest degree to highest).