Tools to compute the complex roots of quadratic, cubic, and quartic polynomials. More...
Functions/Subroutines | |
| pure subroutine, public | mod_polynomial_roots::solve_quadratic (a, b, x) |
| Solve quadratic equation in monic form. | |
| pure subroutine, public | mod_polynomial_roots::solve_cubic (a, b, c, x) |
| Solve cubic equation in monic form. | |
| pure subroutine, public | mod_polynomial_roots::solve_quartic (a, b, c, d, x) |
| Solve quartic equation in monic form. | |
| pure subroutine | mod_polynomial_roots::solve_complex_quadratic (a, b, x) |
| Solve quadratic equation in monic form with complex coefficients. | |
| pure subroutine | mod_polynomial_roots::fitcubic (a, b, c, x) |
| Solve cubic equation using a fitting algorithm. | |
| pure subroutine | mod_polynomial_roots::sort_roots (x) |
| Sort complex root using the Insertion Sort algorithm from larger to lower magnitude. | |
| pure subroutine | mod_polynomial_roots::quartic_closed_form (a, b, c, d, x) |
| Ferrari's algorithm to solve quartic equations in monic form (closed form root finding) | |
Tools to compute the complex roots of quadratic, cubic, and quartic polynomials.
The equations must be represented in the monic form, that is the leading coefficient of the polynomial is equal to 1:
\[ x^n + a_{n-1} x^{n-1} + \cdots + a_0 = 0 \]
The coefficients must be real numbers.
|
private |
Solve cubic equation using a fitting algorithm.
References:
| [in] | a,b,c | Coefficients of the cubic polynomial in monic form. |
| [out] | x | Roots of the equation. |
|
private |
Ferrari's algorithm to solve quartic equations in monic form (closed form root finding)
\[ x^4 + ax^3 + bx^2 + cx + d = 0 \]
| [in] | a,b,c,d | Coefficients of the quartic polynomial in monic form. |
| [out] | x | Roots of the quartic equation. |
|
private |
Solve quadratic equation in monic form with complex coefficients.
\[ x^2 + ax + b = 0 \]
| [in] | a,b | Complex cefficients of the second order polynomial in monic form. |
| [out] | x | The two complex roots. |
| pure subroutine, public mod_polynomial_roots::solve_cubic | ( | double precision, intent(in) | a, |
| double precision, intent(in) | b, | ||
| double precision, intent(in) | c, | ||
| complex(kind=8), dimension(3), intent(out) | x ) |
Solve cubic equation in monic form.
The cubic equation to solve must be in the form:
\[ x^3 + ax^2 + bx + c = 0 \]
References:
| [in] | a,b,c | Coefficients of the third order polynomial in monic form. |
| [out] | x | The three complex roots. |
| pure subroutine, public mod_polynomial_roots::solve_quadratic | ( | double precision, intent(in) | a, |
| double precision, intent(in) | b, | ||
| complex(kind=8), dimension(2), intent(out) | x ) |
Solve quadratic equation in monic form.
The quadratic equation to solve must be in the form:
\[ x^2 + ax + b = 0 \]
Reference:
| [in] | a,b | Coefficients of the second order polynomial in monic form. |
| [out] | x | The two complex roots. |
| pure subroutine, public mod_polynomial_roots::solve_quartic | ( | double precision, intent(in) | a, |
| double precision, intent(in) | b, | ||
| double precision, intent(in) | c, | ||
| double precision, intent(in) | d, | ||
| complex(kind=8), dimension(4), intent(out) | x ) |
Solve quartic equation in monic form.
The quartic equation to solve must be in the form:
\[ x^4 + ax^3 + bx^2 + cx + d = 0 \]
References:
| [in] | a,b,c,d | Coefficients of the fourth order polynomial in monic form. |
| [out] | x | The four complex roots. |
|
private |
Sort complex root using the Insertion Sort algorithm from larger to lower magnitude.
| [in,out] | x | Array of complex roots |