Doxygen Generated Documentation From Interface Source Code
Roots_x2Polynomial.F90 File Reference

Go to the source code of this file.


subroutine Roots_x2Polynomial (q1, q0, nReal, root)

Function/Subroutine Documentation

◆ Roots_x2Polynomial()

subroutine Roots_x2Polynomial ( real, intent(in)  q1,
real, intent(in)  q0,
integer  nReal,
real, dimension (1:2,1:2), intent(out)  root 

Calculates all real + complex roots of the quadratic polynomial:

x^2 + q1 * x + q0

The code checks internally, if rescaling of the coefficients is needed to avoid overflow.

The order of the roots is as follows:

1) For real roots, the order is according to their algebraic value on the number scale (largest positive first, largest negative last).

2) Since there can be only one complex conjugate pair root, no order is necessary.

q1 : coefficient of x term q0 : independent coefficient nReal : number of real roots found root (n,1) : real part of n-th root root (n,2) : imaginary part of n-th root


Definition at line 43 of file Roots_x2Polynomial.F90.