nag_cubic_roots (c02akc) determines the roots of a cubic equation with real coefficients.
nag_cubic_roots (c02akc) attempts to find the roots of the cubic equation
where
and
are real coefficients with
. The roots are located by finding the eigenvalues of the associated 3 by 3 (upper Hessenberg) companion matrix2
given by
Further details can be found in
Section 9.
To obtain the roots of a quadratic equation,
nag_quartic_roots (c02alc) can be used.
nag_cubic_roots (c02akc) is not threaded in any implementation.
The method used by the function consists of the following steps, which are performed by functions from LAPACK.
(a) |
Form . |
(b) |
Apply a diagonal similarity transformation to (to give ). |
(c) |
Calculate the eigenvalues and Schur factorization of . |
(d) |
Calculate the left and right eigenvectors of . |
(e) |
Estimate reciprocal condition numbers for all the eigenvalues of . |
(f) |
Calculate approximate error estimates for all the eigenvalues of (using the 1-norm). |
To find the roots of the cubic equation