hide long namesshow long names
hide short namesshow short names
Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

NAG Toolbox: nag_zeros_cubic_complex (c02am)

Purpose

nag_zeros_cubic_complex (c02am) determines the roots of a cubic equation with complex coefficients.

Syntax

[zeror, zeroi, errest, ifail] = c02am(u, r, s, t)
[zeror, zeroi, errest, ifail] = nag_zeros_cubic_complex(u, r, s, t)

Description

nag_zeros_cubic_complex (c02am) attempts to find the roots of the cubic equation
uz3 + rz2 + sz + t = 0,
uz3+rz2+sz+t=0,
where uu, rr, ss and tt are complex coefficients with u0u0. The roots are located by finding the eigenvalues of the associated 33 by 33 (upper Hessenberg) companion matrix HH given by
H =
  0 0 − t / u 1 0 − s / u 0 1 − r / u  
.
H= 0 0 -t/u 1 0 -s/u 0 1 -r/u .
The eigenvalues are obtained by a call to nag_lapack_zhseqr (f08ps). Further details can be found in Section [Further Comments].
To obtain the roots of a quadratic equation, nag_zeros_quadratic_complex (c02ah) can be used.

References

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

Parameters

Compulsory Input Parameters

1:     u – complex scalar
uu, the coefficient of z3z3.
Constraint: u(0.0,0.0)u(0.0,0.0).
2:     r – complex scalar
rr, the coefficient of z2z2.
3:     s – complex scalar
ss, the coefficient of zz.
4:     t – complex scalar
tt, the constant coefficient.

Optional Input Parameters

None.

Input Parameters Omitted from the MATLAB Interface

None.

Output Parameters

1:     zeror(33) – double array
2:     zeroi(33) – double array
zeror(i)zerori and zeroi(i)zeroii contain the real and imaginary parts, respectively, of the iith root.
3:     errest(33) – double array
errest(i)erresti contains an approximate error estimate for the iith root.
4:     ifail – int64int32nag_int scalar
ifail = 0ifail=0 unless the function detects an error (see [Error Indicators and Warnings]).

Error Indicators and Warnings

Errors or warnings detected by the function:
  ifail = 1ifail=1
On entry,u = (0.0,0.0)u=(0.0,0.0).
  ifail = 2ifail=2
The companion matrix HH cannot be formed without overflow.
  ifail = 3ifail=3
The iterative procedure used to determine the eigenvalues has failed to converge.

Accuracy

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

Further Comments

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

Example

function nag_zeros_cubic_complex_example
u =  complex(1);
r =  -2 + 3i;
s =  5 + 14i;
t =  -40 - 5i;
[zeror, zeroi, errest, ifail] = nag_zeros_cubic_complex(u, r, s, t)
 

zeror =

   -2.0000
    1.0000
    3.0000


zeroi =

    3.0000
   -2.0000
   -4.0000


errest =

   1.0e-14 *

    0.1729
    0.3637
    0.3743


ifail =

                    0


function c02am_example
u =  complex(1);
r =  -2 + 3i;
s =  5 + 14i;
t =  -40 - 5i;
[zeror, zeroi, errest, ifail] = c02am(u, r, s, t)
 

zeror =

   -2.0000
    1.0000
    3.0000


zeroi =

    3.0000
   -2.0000
   -4.0000


errest =

   1.0e-14 *

    0.1729
    0.3637
    0.3743


ifail =

                    0



PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2013