Module ppm_module_util_quadeq_real

This module provides the routines that solve quadratic equations with real roots.

Defined Types

name description

no types

Defined Module Interfaces

name description

ppm_util_quadeq_real

Defined Module Subroutines

name description

no subroutines

Interface ppm_util_quadeq_real

Subroutines contained in this interface:

name description

ppm_util_quadeq_real_s

This routine solves a quadratic equation using the

ppm_util_quadeq_real_d

This routine solves a quadratic equation using the

Subroutine ppm_util_quadeq_real_d

This routine solves a quadratic equation using the well-known explicit solution formula. The equation must only have REAL roots. If complex roots are found, the routine returns info = ppm_error_error and exits.

[Note]Note

If the discriminant is < ppm_eps, the roots are considered equal and returned as exact bit-copy in order to allow comparisons outside this routine.

[Tip]Tip

For ppm_debug > 1 the routine checks its own result. Maybe - after some time - this can be removed.

Arguments

name type dimension intent optional description

coef

real array

(3)

(IN)

Coefficients. The equation being solved is:

roots

real array

(2)

(OUT)

Contains the two real roots

qtol

real

(OUT)

Numerical tolerance (estimated) of result.

info

integer

(OUT)

Return status, ppm_error_error if roots are complex

coef

real array, (3), (IN)

Coefficients. The equation being solved is:

coef(3)*x^2+coef(2)*x+coef(1) = 0
roots

real array, (2), (OUT)

Contains the two real roots

qtol

real, , (OUT)

Numerical tolerance (estimated) of result.

info

integer, , (OUT)

Return status, ppm_error_error if roots are complex

Used Modules

ppm_module_data, ppm_module_error, ppm_module_write, ppm_module_substop, ppm_module_substart

Subroutine ppm_util_quadeq_real_s

This routine solves a quadratic equation using the well-known explicit solution formula. The equation must only have REAL roots. If complex roots are found, the routine returns info = ppm_error_error and exits.

[Note]Note

If the discriminant is < ppm_eps, the roots are considered equal and returned as exact bit-copy in order to allow comparisons outside this routine.

[Tip]Tip

For ppm_debug > 1 the routine checks its own result. Maybe - after some time - this can be removed.

Arguments

name type dimension intent optional description

coef

real array

(3)

(IN)

Coefficients. The equation being solved is:

roots

real array

(2)

(OUT)

Contains the two real roots

qtol

real

(OUT)

Numerical tolerance (estimated) of result.

info

integer

(OUT)

Return status, ppm_error_error if roots are complex

coef

real array, (3), (IN)

Coefficients. The equation being solved is:

coef(3)*x^2+coef(2)*x+coef(1) = 0
roots

real array, (2), (OUT)

Contains the two real roots

qtol

real, , (OUT)

Numerical tolerance (estimated) of result.

info

integer, , (OUT)

Return status, ppm_error_error if roots are complex

Used Modules

ppm_module_data, ppm_module_error, ppm_module_write, ppm_module_substop, ppm_module_substart

Defined Module Variables

name type dimension description

no variables

Used Modules

has no uses