polynomialroots
Module
Description
- PURPOSE - Solve for the roots of a polynomial equation with real
coefficients, up to quartic order. Returns a code indicating the nature of the roots found.
Quick access
- Variables:
cuberoot,czero,dp,four,fourth,half,one,onelargetwosmall,outputcode,polyroots_version,sp,three,two,zero- Routines:
cubicroots(),linearroot(),quadraticroots(),quarticroots(),selectsort(),solvepolynomial(),swapdouble(),swapsingle()
Variables
- polynomialroots/cuberoot [private]
- polynomialroots/czero [complex,private/parameter/optional/default=(0.d0,0.d0)]
- polynomialroots/dp [integer,private/parameter/optional/default=selected_real_kind(12)]
- polynomialroots/eps [real,private/parameter/optional/default=epsilon(one)]
- polynomialroots/four [real,private/parameter/optional/default=4.0d0]
- polynomialroots/fourth [real,private/parameter/optional/default=0.25d0]
- polynomialroots/half [real,private/parameter/optional/default=0.5d0]
- polynomialroots/one [real,private/parameter/optional/default=1.0d0]
- polynomialroots/onelargetwosmall [private]
- polynomialroots/outputcode [integer,private]
- polynomialroots/polyroots_version [character,public/parameter/optional/default="1.3 (4 jan 1999)"]
- polynomialroots/sp [integer,private/parameter/optional/default=selected_real_kind(6)]
- polynomialroots/three [real,private/parameter/optional/default=3.0d0]
- polynomialroots/two [real,private/parameter/optional/default=2.0d0]
- polynomialroots/zero [real,private/parameter/optional/default=0.0d0]
Subroutines and functions
- subroutine polynomialroots/linearroot(a, z)
- PURPOSE - COMPUTES THE ROOTS OF THE REAL POLYNOMIAL
A(1) + A(2)*Z
AND STORES THE RESULTS IN Z. It is assumed that a(2) is non-zero.
- Parameters:
a (*) [real,in]
z [real,out]
- subroutine polynomialroots/quadraticroots(a, z)
- PURPOSE - COMPUTES THE ROOTS OF THE REAL POLYNOMIAL
A(1) + A(2)*Z + A(3)*Z**2
AND STORES THE RESULTS IN Z. IT IS ASSUMED THAT A(3) IS NONZERO.
- Parameters:
a (*) [real,in] :: negative discriminant => roots are complex
z (*) [complex,out] :: one root is obviously zero
- Called from:
- subroutine polynomialroots/cubicroots(a, z)
- PURPOSE - Compute the roots of the real polynomial
A(1) + A(2)*Z + A(3)*Z**2 + A(4)*Z**3
- Parameters:
a (*) [real,in]
z (*) [complex,out] :: one root is obviously zero
- Called from:
- Call to:
- subroutine polynomialroots/quarticroots(a, z)
- PURPOSE - Compute the roots of the real polynomial
A(1) + A(2)*Z + … + A(5)*Z**4
- Parameters:
a (*) [real,in]
z (*) [complex,out] :: one root is obviously zero
- Called from:
- Call to:
- subroutine polynomialroots/selectsort(a)
PURPOSE - Reorder the elements of in increasing order.
- Parameters:
a (*) [real,inout]
- Called from:
- subroutine polynomialroots/solvepolynomial(quarticcoeff, cubiccoeff, quadraticcoeff, linearcoeff, constantcoeff, code, root1, root2, root3, root4)
- Parameters:
quarticcoeff [real,in]
cubiccoeff [real,in]
quadraticcoeff [real,in]
linearcoeff [real,in]
constantcoeff [real,in]
code [integer,out]
root1 [complex,out]
root2 [complex,out]
root3 [complex,out]
root4 [complex,out]
- Call to:
- subroutine polynomialroots/swapdouble(a, b)
PURPOSE - Interchange the contents of a and b
- Parameters:
a [real,inout]
b [real,inout]
- subroutine polynomialroots/swapsingle(a, b)
PURPOSE - Interchange the contents of a and b
- Parameters:
a [real,inout]
b [real,inout]