NAG FL Interface
c02alf (quartic_​real)

Settings help

FL Name Style:

FL Specification Language:

1 Purpose

c02alf determines the roots of a quartic equation with real coefficients.

2 Specification

Fortran Interface
Subroutine c02alf ( e, a, b, c, d, zeror, zeroi, errest, ifail)
Integer, Intent (Inout) :: ifail
Real (Kind=nag_wp), Intent (In) :: e, a, b, c, d
Real (Kind=nag_wp), Intent (Out) :: zeror(4), zeroi(4), errest(4)
C Header Interface
#include <nag.h>
void  c02alf_ (const double *e, const double *a, const double *b, const double *c, const double *d, double zeror[], double zeroi[], double errest[], Integer *ifail)
The routine may be called by the names c02alf or nagf_zeros_quartic_real.

3 Description

c02alf attempts to find the roots of the quartic equation
where e, a, b, c and d are real coefficients with e0. The roots are located by finding the eigenvalues of the associated 4×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 f08pef. Further details can be found in Section 9.
To obtain the roots of a cubic equation, c02akf can be used.

4 References

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

5 Arguments

1: e Real (Kind=nag_wp) Input
On entry: e, the coefficient of z4.
Constraint: e0.0.
2: a Real (Kind=nag_wp) Input
On entry: a, the coefficient of z3.
3: b Real (Kind=nag_wp) Input
On entry: b, the coefficient of z2.
4: c Real (Kind=nag_wp) Input
On entry: c, the coefficient of z.
5: d Real (Kind=nag_wp) Input
On entry: d, the constant coefficient.
6: zeror(4) Real (Kind=nag_wp) array Output
7: zeroi(4) Real (Kind=nag_wp) array Output
On exit: zeror(i) and zeroi(i) contain the real and imaginary parts, respectively, of the ith root.
8: errest(4) Real (Kind=nag_wp) array Output
On exit: errest(i) contains an approximate error estimate for the ith root.
9: ifail Integer Input/Output
On entry: ifail must be set to 0, −1 or 1 to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of 0 causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of −1 means that an error message is printed while a value of 1 means that it is not.
If halting is not appropriate, the value −1 or 1 is recommended. If message printing is undesirable, then the value 1 is recommended. Otherwise, the value 0 is recommended. 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.
Constraint: e0.0.
The companion matrix H cannot be formed without overflow.
Failure to converge in f08pef.
An unexpected error has been triggered by this routine. Please contact NAG.
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library FL Interface for further information.
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.

7 Accuracy

If ifail=0 on exit, then the ith computed root should have approximately |log10(errest(i))| correct significant digits.

8 Parallelism and Performance

Background information to multithreading can be found in the Multithreading documentation.
c02alf is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
c02alf makes calls to BLAS and/or LAPACK routines, which may be threaded within the vendor library used by this implementation. Consult the documentation for the vendor library for further information.
Please consult the X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this routine. Please also consult the Users' Note for your implementation for any additional implementation-specific information.

9 Further Comments

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

9.1 Internal Changes

Internal changes have been made to this routine as follows:
For details of all known issues which have been reported for the NAG Library please refer to the Known Issues.

10 Example

This example finds the roots of the quartic equation

10.1 Program Text

Program Text (c02alfe.f90)

10.2 Program Data

Program Data (c02alfe.d)

10.3 Program Results

Program Results (c02alfe.r)