>  Docs Center  >  IDL Reference  >  Advanced Math and Stats  >  IMSL_ZEROPOLY

IMSL_ZEROPOLY

IMSL_ZEROPOLY

The IMSL_ZEROPOLY function finds the zeros of a polynomial with real or complex coefficients using the companion matrix method or, optionally, the Jenkins- Traub, three-stage algorithm.

This routine requires an IDL Advanced Math and Stats license. For more information, contact your sales or technical support representative.

The IMSL_ZEROPOLY function computes the n zeros of the polynomial:

p (z) = an zn + an – 1zn – 1 + ... + a1 z + a0

where the coefficients ai for i = 0, 1, ..., n are real and n is the degree of the polynomial.

The default method used by IMSL_ZEROPOLY is the companion matrix method. The companion matrix method is based on the fact that if Ca denotes the companion matrix associated with p(z), then det (zI – Ca) = a(z), where I  is an n x n identity matrix. Thus, det (z0I – Ca) = 0 if, and only if, z0 is a zero of p(z). This implies that computing the eigenvalues of Ca will yield the zeros of p(z). This method is thought to be more robust than the Jenkins-Traub algorithm in most cases, but the companion matrix method is not as computationally efficient. Thus, if speed is a concern, the Jenkins-Traub algorithm should be considered.

If the keyword JENKINS_TRAUB is set, then IMSL_ZEROPOLY function uses the Jenkins-Traub three-stage algorithm (Jenkins and Traub 1970, Jenkins 1975). The zeros are computed one-at-a-time for real zeros or two-at-a-time for a complex conjugate pair. As the zeros are found, the real zero or quadratic factor is removed by polynomial deflation.

Example


This example finds the zeros of the third-degree polynomial:

p (z) = z3 – 3z2 + 4z – 2

where z is a complex variable.

coef = [-2, 4, -3, 1]
; Set the coefficients. zeros = IMSL_ZEROPOLY(coef)
; Compute the zeros.
PM, zeros, Title = $
'The complex zeros found are: '
; Print results.
The complex zeros found are:
  (      1.00000,      0.00000)
  (      1.00000,     -1.00000)
  (      1.00000,      1.00000)

Errors


Warning Errors

MATH_ZERO_COEFF: First several coefficients of the polynomial are equal to zero. Several of the last roots are set to machine infinity to compensate for this problem.

MATH_FEWER_ZEROS_FOUND: Fewer than (N_ELEMENTS (coef) – 1) zeros were found. The root vector contains the value for machine infinity in the locations that do not contain zeros.

Syntax


Result = IMSL_ZEROPOLY(Coef [, /DOUBLE] [, COMPANION=value] [, JENKINS_TRAUB=value])

Return Value


The complex array of zeros of the polynomial.

Arguments


Coef

Array containing coefficients of the polynomial in increasing order by degree. The polynomial is Coef (n) zn + Coef (n – 1) zn – 1 + ... + Coef

Keywords


COMPANION (optional)

If present and nonzero, the companion matrix method is used. Default: companion matrix method

DOUBLE (optional)

If present and nonzero, then double precision is used.

JENKINS_TRAUB (optional)

If present and nonzero, the Jenkins-Traub, three-stage algorithm is used.

Version History


6.4

Introduced



© 2019 Harris Geospatial Solutions, Inc. |  Legal
My Account    |    Store    |    Contact Us