ROOTS - DADiSP

DADiSP Worksheet Functions > Function Categories > Polynomials > ROOTS

 

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:

image\roots01.gif

 

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

 

r == {1.618034, -0.618034}

 

r[1] == phi

 

returns 1, demonstrating that for polynomial:

 

image\roots05.gif

 

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

Example:

roots({1, -2, 0})

 

returns {0, 2}, the roots of:

 

image\roots02.gif

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)

 

image\rootspic.gif

 

W3 displays a cubic of the form:

 

image\roots03.gif

 

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.

 

image\polyrootpic2.gif

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:

 

image\roots04.gif

 

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).

See Also:

EIG

PFIT

POLY

POLYFIT

POLYGRAPH

POLYROOT

POLYSTAB

POLYVAL

RESIDUE