# NAG CL Interfacec02alc (quartic_​real)

Settings help

CL Name Style:

## 1Purpose

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

## 2Specification

 #include
 void c02alc (double e, double a, double b, double c, double d, double zeror[], double zeroi[], double errest[], NagError *fail)
The function may be called by the names: c02alc, nag_zeros_quartic_real or nag_quartic_roots.

## 3Description

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 $e\ne 0$. 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, c02akc can be used.
Golub G H and Van Loan C F (1996) Matrix Computations (3rd Edition) Johns Hopkins University Press, Baltimore

## 5Arguments

1: $\mathbf{e}$double Input
On entry: $e$, the coefficient of ${z}^{4}$.
Constraint: ${\mathbf{e}}\ne 0.0$.
2: $\mathbf{a}$double Input
On entry: $a$, the coefficient of ${z}^{3}$.
3: $\mathbf{b}$double Input
On entry: $b$, the coefficient of ${z}^{2}$.
4: $\mathbf{c}$double Input
On entry: $c$, the coefficient of $z$.
5: $\mathbf{d}$double Input
On entry: $d$, the constant coefficient.
6: $\mathbf{zeror}\left[4\right]$double Output
7: $\mathbf{zeroi}\left[4\right]$double Output
On exit: ${\mathbf{zeror}}\left[i-1\right]$ and ${\mathbf{zeroi}}\left[i-1\right]$ contain the real and imaginary parts, respectively, of the $i$th root.
8: $\mathbf{errest}\left[4\right]$double Output
On exit: ${\mathbf{errest}}\left[i-1\right]$ contains an approximate error estimate for the $i$th root.
9: $\mathbf{fail}$NagError * Input/Output
The NAG error argument (see Section 7 in the Introduction to the NAG Library CL Interface).

## 6Error Indicators and Warnings

NE_C02_NOT_CONV
The iterative procedure used to determine the eigenvalues has failed to converge.
NE_C02_OVERFLOW
The companion matrix $H$ cannot be formed without overflow.
NE_INTERNAL_ERROR
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.
NE_REAL
On entry, ${\mathbf{e}}=0.0$.
Constraint: ${\mathbf{e}}\ne 0.0$.

## 7Accuracy

If ${\mathbf{fail}}=\mathrm{NE_NOERROR}$ on exit, then the $i$th computed root should have approximately $|{\mathrm{log}}_{10}\left({\mathbf{errest}}\left[i-1\right]\right)|$ correct significant digits.

## 8Parallelism and Performance

c02alc is not threaded in any implementation.

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

## 10Example

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

### 10.1Program Text

Program Text (c02alce.c)

### 10.2Program Data

Program Data (c02alce.d)

### 10.3Program Results

Program Results (c02alce.r)