cubic_roots Subroutine

public subroutine cubic_roots(parameters, real_roots, complex_roots, flag)

Uses

  • proc~~cubic_roots~~UsesGraph proc~cubic_roots cubic_roots module~yaeos__auxiliar yaeos__auxiliar proc~cubic_roots->module~yaeos__auxiliar module~yaeos__constants yaeos__constants module~yaeos__auxiliar->module~yaeos__constants iso_fortran_env iso_fortran_env module~yaeos__constants->iso_fortran_env

cubic_roots

Description

Solve a real cubic polynomial with coefficients .

Uses the discriminant to distinguish three real roots, repeated real roots, and one real root with a complex-conjugate pair. Unused slots in the output arrays are set to NaN.

Arguments

Type IntentOptional Attributes Name
real(kind=pr), intent(in) :: parameters(4)

Polynomial coefficients in .

real(kind=pr), intent(out) :: real_roots(3)

Real roots; unused entries are NaN.

complex(kind=pr), intent(out) :: complex_roots(3)

Reserved complex-root output; this solver currently leaves NaN sentinels.

integer, intent(out) :: flag

Root case: 0 repeated real roots, 1 one real plus conjugate pair, -1 three distinct real roots.


Calls

proc~~cubic_roots~~CallsGraph proc~cubic_roots cubic_roots proc~sort sort proc~cubic_roots->proc~sort std std proc~sort->std

Variables

Type Visibility Attributes Name Initial
real(kind=pr), public :: disc
real(kind=pr), public :: nan
real(kind=pr), public :: p
real(kind=pr), public, parameter :: pi = atan(1.0_pr)*4.0_pr
real(kind=pr), public :: q
real(kind=pr), public :: theta
real(kind=pr), public :: u
real(kind=pr), public :: v