Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

Chapter Contents
Chapter Introduction
NAG Toolbox

# NAG Toolbox: nag_zeros_quartic_real (c02al)

## Purpose

nag_zeros_quartic_real (c02al) determines the roots of a quartic equation with real coefficients.

## Syntax

[zeror, zeroi, errest, ifail] = c02al(e, a, b, c, d)
[zeror, zeroi, errest, ifail] = nag_zeros_quartic_real(e, a, b, c, d)

## Description

nag_zeros_quartic_real (c02al) attempts to find the roots of the quartic equation
 ez4 + az3 + bz2 + cz + d = 0, $ez4+az3+bz2+cz+d=0,$
where e$e$, a$a$, b$b$, c$c$ and d$d$ are real coefficients with e0$e\ne 0$. The roots are located by finding the eigenvalues of the associated 4$4$ by 4$4$ (upper Hessenberg) companion matrix H$H$ given by
H =
 0 0 0 − d / e 1 0 0 − c / e 0 1 0 − b / e 0 0 1 − a / e
.
$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 nag_lapack_dhseqr (f08pe). Further details can be found in Section [Further Comments].
To obtain the roots of a cubic equation, nag_zeros_cubic_real (c02ak) 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:     e – double scalar
e$e$, the coefficient of z4${z}^{4}$.
Constraint: e0.0${\mathbf{e}}\ne 0.0$.
2:     a – double scalar
a$a$, the coefficient of z3${z}^{3}$.
3:     b – double scalar
b$b$, the coefficient of z2${z}^{2}$.
4:     c – double scalar
c$c$, the coefficient of z$z$.
5:     d – double scalar
d$d$, the constant coefficient.

None.

None.

### Output Parameters

1:     zeror(4$4$) – double array
2:     zeroi(4$4$) – double array
zeror(i)${\mathbf{zeror}}\left(i\right)$ and zeroi(i)${\mathbf{zeroi}}\left(i\right)$ contain the real and imaginary parts, respectively, of the i$i$th root.
3:     errest(4$4$) – double array
errest(i)${\mathbf{errest}}\left(i\right)$ contains an approximate error estimate for the i$i$th root.
4:     ifail – int64int32nag_int scalar
${\mathrm{ifail}}={\mathbf{0}}$ unless the function detects an error (see [Error Indicators and Warnings]).

## Error Indicators and Warnings

Errors or warnings detected by the function:
ifail = 1${\mathbf{ifail}}=1$
 On entry, e = 0.0${\mathbf{e}}=0.0$.
ifail = 2${\mathbf{ifail}}=2$
The companion matrix H$H$ cannot be formed without overflow.
ifail = 3${\mathbf{ifail}}=3$
The iterative procedure used to determine the eigenvalues has failed to converge.

## Accuracy

If ${\mathbf{ifail}}={\mathbf{0}}$ on exit, then the i$i$th computed root should have approximately |log10(errest(i))|$|{\mathrm{log}}_{10}\left({\mathbf{errest}}\left(i\right)\right)|$ correct significant digits.

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

## Example

```function nag_zeros_quartic_real_example
e = 1;
a = 2;
b = 6;
c = -8;
d = -40;
[zeror, zeroi, errest, ifail] = nag_zeros_quartic_real(e, a, b, c, d)
```
```

zeror =

2.0000
-2.0000
-1.0000
-1.0000

zeroi =

0
0
3.0000
-3.0000

errest =

1.0e-14 *

0.0890
0.1100
0.1002
0.1002

ifail =

0

```
```function c02al_example
e = 1;
a = 2;
b = 6;
c = -8;
d = -40;
[zeror, zeroi, errest, ifail] = c02al(e, a, b, c, d)
```
```

zeror =

2.0000
-2.0000
-1.0000
-1.0000

zeroi =

0
0
3.0000
-3.0000

errest =

1.0e-14 *

0.0890
0.1100
0.1002
0.1002

ifail =

0

```