# naginterfaces.library.zeros.poly_​real¶

naginterfaces.library.zeros.poly_real(a, scal=True)[source]

poly_real finds all the roots of a real polynomial equation, using a variant of Laguerre’s method.

Deprecated since version 27.1.0.0: poly_real is deprecated. Please use poly_real_fpml() instead. See also the Replacement Calls document.

For full information please refer to the NAG Library document for c02ag

https://www.nag.com/numeric/nl/nagdoc_27.1/flhtml/c02/c02agf.html

Parameters
afloat, array-like, shape

must contain (i.e., the coefficient of ), for .

scalbool, optional

Indicates whether or not the polynomial is to be scaled. See Further Comments for advice on when it may be preferable to set and for a description of the scaling strategy.

Returns
zcomplex, ndarray, shape

The roots. Complex conjugate pairs of roots are stored in consecutive elements of .

Raises
NagValueError
(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

The iterative procedure has failed to converge. This error is very unlikely to occur. If it does, please contact NAG immediately, as some basic assumption for the arithmetic has been violated.

(errno )

poly_real cannot evaluate near some of its zeros without underflow. If this message occurs please contact NAG.

(errno )

poly_real cannot evaluate near some of its zeros without overflow. If this message occurs please contact NAG.

Notes

In the NAG Library the traditional C interface for this routine uses a different algorithmic base. Please contact NAG if you have any questions about compatibility.

poly_real attempts to find all the roots of the th degree real polynomial equation

The roots are located using a modified form of Laguerre’s method, originally proposed by Smith (1967).

The method of Laguerre (see Wilkinson (1965)) can be described by the iterative scheme

where and is specified.

The sign in the denominator is chosen so that the modulus of the Laguerre step at , viz. , is as small as possible. The method can be shown to be cubically convergent for isolated roots (real or complex) and linearly convergent for multiple roots.

The function generates a sequence of iterates , such that and ensures that ‘roughly’ lies inside a circular region of radius about known to contain a zero of ; that is, , where denotes the Fejér bound (see Marden (1966)) at the point . Following Smith (1967), is taken to be , where is an upper bound for the magnitude of the smallest zero given by

is the zero of smaller magnitude of the quadratic equation

and the Cauchy lower bound for the smallest zero is computed (using Newton’s Method) as the positive root of the polynomial equation

Starting from the origin, successive iterates are generated according to the rule , for , and is ‘adjusted’ so that and . The iterative procedure terminates if is smaller in absolute value than the bound on the rounding error in and the current iterate is taken to be a zero of (as is its conjugate if is complex). The deflated polynomial of degree if is real ( of degree if is complex) is then formed, and the above procedure is repeated on the deflated polynomial until , whereupon the remaining roots are obtained via the ‘standard’ closed formulae for a linear () or quadratic () equation.

Note that quadratic_real(), cubic_real() and quartic_real() can be used to obtain the roots of a quadratic, cubic () and quartic () polynomial, respectively.

References

Marden, M, 1966, Geometry of polynomials, Mathematical Surveys (3), American Mathematical Society, Providence, RI

Smith, B T, 1967, ZERPOL: a zero finding algorithm for polynomials using Laguerre’s method, Technical Report, Department of Computer Science, University of Toronto, Canada

Thompson, K W, 1991, Error analysis for polynomial solvers, Fortran Journal (Volume 3) (3), 10–13

Wilkinson, J H, 1965, The Algebraic Eigenvalue Problem, Oxford University Press, Oxford