naginterfaces.library.zeros.cubic_complex¶
- naginterfaces.library.zeros.cubic_complex(u, r, s, t)[source]¶
cubic_complex
determines the roots of a cubic equation with complex coefficients.For full information please refer to the NAG Library document for c02am
https://support.nag.com/numeric/nl/nagdoc_30.2/flhtml/c02/c02amf.html
- Parameters
- ucomplex
, the coefficient of .
- rcomplex
, the coefficient of .
- scomplex
, the coefficient of .
- tcomplex
, the constant coefficient.
- Returns
- zerocomplex, ndarray, shape
contains the th root.
- errestfloat, ndarray, shape
contains an approximate error estimate for the th root.
- Raises
- NagValueError
- (errno )
On entry, .
Constraint:
- (errno )
The companion matrix cannot be formed without overflow.
- (errno )
Failure to converge in
lapackeig.zhseqr
.
- Notes
No equivalent traditional C interface for this routine exists in the NAG Library.
cubic_complex
attempts to find the roots of the cubic equationwhere , , and are complex coefficients with . The roots are located by finding the eigenvalues of the associated (upper Hessenberg) companion matrix given by
The eigenvalues are obtained by a call to
lapackeig.zhseqr
. Further details can be found in Further Comments.To obtain the roots of a quadratic equation,
quadratic_complex()
can be used.
- References
Golub, G H and Van Loan, C F, 1996, Matrix Computations, (3rd Edition), Johns Hopkins University Press, Baltimore