nag_quartic_roots (c02alc) (PDF version)
c02 Chapter Contents
c02 Chapter Introduction
NAG Library Manual

NAG Library Function Document

nag_quartic_roots (c02alc)


    1  Purpose
    7  Accuracy

1  Purpose

nag_quartic_roots (c02alc) determines the roots of a quartic equation with real coefficients.

2  Specification

#include <nag.h>
#include <nagc02.h>
void  nag_quartic_roots (double e, double a, double b, double c, double d, double zeror[], double zeroi[], double errest[], NagError *fail)

3  Description

nag_quartic_roots (c02alc) attempts to find the roots of the quartic equation
ez4 + az3 + bz2 + cz + d = 0 ,  
where e , a , b , c  and d  are real 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 = -d / e -c / e -b / e -a / e .  
Further details can be found in Section 9.
To obtain the roots of a cubic equation, nag_cubic_roots (c02akc) 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 doubleInput
On entry: e , the coefficient of z 4 .
Constraint: e0.0 .
2:     a doubleInput
On entry: a , the coefficient of z 3 .
3:     b doubleInput
On entry: b , the coefficient of z 2 .
4:     c doubleInput
On entry: c , the coefficient of z .
5:     d doubleInput
On entry: d , the constant coefficient.
6:     zeror[4] doubleOutput
7:     zeroi[4] doubleOutput
On exit: zeror[i-1]  and zeroi[i-1]  contain the real and imaginary parts, respectively, of the i th root.
8:     errest[4] doubleOutput
On exit: errest[i-1]  contains an approximate error estimate for the i th root.
9:     fail NagError *Input/Output
The NAG error argument (see Section 3.6 in the Essential Introduction).

6  Error Indicators and Warnings

The iterative procedure used to determine the eigenvalues has failed to converge.
The companion matrix H  cannot be formed without overflow.
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
On entry, e=0.0 .
Constraint: e0.0 .

7  Accuracy

If fail=NE_NOERROR  on exit, then the i th computed root should have approximately log10 errest[i-1]  correct significant digits.

8  Parallelism and Performance

Not applicable.

9  Further Comments

The method used by the function consists of the following steps, which are performed by functions from LAPACK.
(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).

10  Example

To find the roots of the quartic equation
z 4 + 2 z 3 + 6 z 2 - 8 z - 40 = 0 .  

10.1  Program Text

Program Text (c02alce.c)

10.2  Program Data

Program Data (c02alce.d)

10.3  Program Results

Program Results (c02alce.r)

nag_quartic_roots (c02alc) (PDF version)
c02 Chapter Contents
c02 Chapter Introduction
NAG Library Manual

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