Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
Language Reference

POLYROOT Function

finds zeros of a real polynomial

POLYROOT( vector)

where vector is an n ×1 (or 1 ×n) vector containing the coefficients of an (n-1) degree polynomial with the coefficients arranged in order of decreasing powers. The POLYROOT function returns the array r, which is an (n-1) ×2 matrix containing the roots of the polynomial. The first column of r contains the real part of the complex roots and the second column contains the imaginary part. If a root is real, the imaginary part will be 0.

The POLYROOT function finds the real and complex roots of a polynomial with real coefficients.

The POLYROOT function uses an algorithm proposed by Jenkins and Traub (1970) to find the roots of the polynomial. The algorithm is not guaranteed to find all roots of the polynomial. An appropriate warning message is issued when one or more roots cannot be found. The POLYROOT algorithm produces roots within the precision allowed by the hardware. If r is given as a root of the polynomial P(x), then 1+P(R)=1 based on the roundoff error of the computer that is employed.

For example, to find the roots of the polynomial
P(x)= 0.2567x4 + 0.1570x3 + 0.0821x2 - 0.3357x + 1
use the following IML code to produce the result shown:
      p={0.2567 0.1570 0.0821 -0.3357 1};
      r=polyroot(p);


                R             4 rows      2 cols    (numeric)

                             0.8383029 0.8514519
                             0.8383029 -0.851452
                             -1.144107 1.1914525
                             -1.144107 -1.191452
The polynomial has two conjugate pairs of roots that, within machine precision, are given by r = 0.8383029 +- 0.8514519i and r = -1.144107 +- 1.1914525i.

Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
Top
Top

Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.