C02ANF (PDF version)
C02 Chapter Contents
C02 Chapter Introduction
NAG Library Manual

NAG Library Routine Document


Note:  before using this routine, please read the Users' Note for your implementation to check the interpretation of bold italicised terms and other implementation-dependent details.

+ Contents

    1  Purpose
    7  Accuracy

1  Purpose

C02ANF determines the roots of a quartic equation with complex coefficients.

2  Specification

REAL (KIND=nag_wp)  ZEROR(4), ZEROI(4), ERREST(4)
COMPLEX (KIND=nag_wp)  E, A, B, C, D

3  Description

C02ANF attempts to find the roots of the quartic equation
where e, a, b, c and d are complex coefficients with e0. The roots are located by finding the eigenvalues of the associated 4 by 4 (upper Hessenberg) companion matrix H given by
H= 0 0 0 -d/e 1 0 0 -c/e 0 1 0 -b/e 0 0 1 -a/e .
The eigenvalues are obtained by a call to F08PSF (ZHSEQR). Further details can be found in Section 8.
To obtain the roots of a cubic equation, C02AMF can be used.

4  References

Golub G H and Van Loan C F (1996) Matrix Computations (3rd Edition) Johns Hopkins University Press, Baltimore

5  Parameters

1:     E – COMPLEX (KIND=nag_wp)Input
On entry: e, the coefficient of z4.
Constraint: E0.0,0.0.
2:     A – COMPLEX (KIND=nag_wp)Input
On entry: a, the coefficient of z3.
3:     B – COMPLEX (KIND=nag_wp)Input
On entry: b, the coefficient of z2.
4:     C – COMPLEX (KIND=nag_wp)Input
On entry: c, the coefficient of z.
5:     D – COMPLEX (KIND=nag_wp)Input
On entry: d, the constant coefficient.
6:     ZEROR(4) – REAL (KIND=nag_wp) arrayOutput
7:     ZEROI(4) – REAL (KIND=nag_wp) arrayOutput
On exit: ZERORi and ZEROIi contain the real and imaginary parts, respectively, of the ith root.
8:     ERREST(4) – REAL (KIND=nag_wp) arrayOutput
On exit: ERRESTi contains an approximate error estimate for the ith root.
9:     IFAIL – INTEGERInput/Output
On entry: IFAIL must be set to 0, -1​ or ​1. If you are unfamiliar with this parameter you should refer to Section 3.3 in the Essential Introduction for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value -1​ or ​1 is recommended. If the output of error messages is undesirable, then the value 1 is recommended. Otherwise, if you are not familiar with this parameter, the recommended value is 0. When the value -1​ or ​1 is used it is essential to test the value of IFAIL on exit.
On exit: IFAIL=0 unless the routine detects an error or a warning has been flagged (see Section 6).

6  Error Indicators and Warnings

If on entry IFAIL=0 or -1, explanatory error messages are output on the current error message unit (as defined by X04AAF).
Errors or warnings detected by the routine:
On entry,E=0.0,0.0.
The companion matrix H cannot be formed without overflow.
The iterative procedure used to determine the eigenvalues has failed to converge.

7  Accuracy

If IFAIL=0 on exit, then the ith computed root should have approximately log10ERRESTi correct significant digits.

8  Further Comments

The method used by the routine consists of the following steps, which are performed by routines from LAPACK in Chapter F08.
(a) Form matrix H.
(b) Apply a diagonal similarity transformation to H (to give H).
(c) Calculate the eigenvalues and Schur factorization of H.
(d) Calculate the left and right eigenvectors of H.
(e) Estimate reciprocal condition numbers for all the eigenvalues of H.
(f) Calculate approximate error estimates for all the eigenvalues of H (using the 1-norm).

9  Example

This example finds the roots of the quartic equation

9.1  Program Text

Program Text (c02anfe.f90)

9.2  Program Data

Program Data (c02anfe.d)

9.3  Program Results

Program Results (c02anfe.r)

C02ANF (PDF version)
C02 Chapter Contents
C02 Chapter Introduction
NAG Library Manual

© The Numerical Algorithms Group Ltd, Oxford, UK. 2012