package mathext
import "gonum.org/v1/gonum/mathext"
Package mathext implements special math functions not implemented by the Go standard library.
Index ¶
- func AiryAi(z complex128) complex128
- func AiryAiDeriv(z complex128) complex128
- func Beta(a, b float64) float64
- func CompleteB(m float64) float64
- func CompleteD(m float64) float64
- func CompleteE(m float64) float64
- func CompleteK(m float64) float64
- func Digamma(x float64) float64
- func EllipticE(phi, m float64) float64
- func EllipticF(phi, m float64) float64
- func EllipticRD(x, y, z float64) float64
- func EllipticRF(x, y, z float64) float64
- func GammaIncReg(a, x float64) float64
- func GammaIncRegComp(a, x float64) float64
- func GammaIncRegCompInv(a, y float64) float64
- func GammaIncRegInv(a, y float64) float64
- func InvRegIncBeta(a, b float64, y float64) float64
- func Lbeta(a, b float64) float64
- func MvLgamma(v float64, dim int) float64
- func NormalQuantile(p float64) float64
- func RegIncBeta(a, b float64, x float64) float64
- func Zeta(x, q float64) float64
Functions ¶
func AiryAi ¶
func AiryAi(z complex128) complex128
AiryAi returns the value of the Airy function at z. The Airy function here, Ai(z), is one of the two linearly independent solutions to
y′′ - y*z = 0.
See http://mathworld.wolfram.com/AiryFunctions.html for more detailed information.
func AiryAiDeriv ¶
func AiryAiDeriv(z complex128) complex128
AiryAiDeriv returns the value of the derivative of the Airy function at z. The Airy function here, Ai(z), is one of the two linearly independent solutions to
y′′ - y*z = 0.
See http://mathworld.wolfram.com/AiryFunctions.html for more detailed information.
func Beta ¶
Beta returns the value of the complete beta function B(a, b). It is defined as
Γ(a)Γ(b) / Γ(a+b)
Special cases are:
B(a,b) returns NaN if a or b is Inf B(a,b) returns NaN if a and b are 0 B(a,b) returns NaN if a or b is NaN B(a,b) returns NaN if a or b is < 0 B(a,b) returns +Inf if a xor b is 0.
See http://mathworld.wolfram.com/BetaFunction.html for more detailed informations.
func CompleteB ¶
CompleteB computes an associate complete elliptic integral of the 2nd kind, 0≤m≤1. It returns math.NaN() if m is not in [0,1].
B(m) = \int_{0}^{π/2} {\cos^2θ} / {\sqrt{1-m{\sin^2θ}}} dθ
func CompleteD ¶
CompleteD computes an associate complete elliptic integral of the 2nd kind, 0≤m≤1. It returns math.NaN() if m is not in [0,1].
D(m) = \int_{0}^{π/2} {\sin^2θ} / {\sqrt{1-m{\sin^2θ}}} dθ
func CompleteE ¶
CompleteE computes the complete elliptic integral of the 2nd kind, 0≤m≤1. It returns math.NaN() if m is not in [0,1].
E(m) = \int_{0}^{π/2} {\sqrt{1-m{\sin^2θ}}} dθ
func CompleteK ¶
CompleteK computes the complete elliptic integral of the 1st kind, 0≤m≤1. It returns math.NaN() if m is not in [0,1].
K(m) = \int_{0}^{π/2} 1/{\sqrt{1-m{\sin^2θ}}} dθ
func Digamma ¶
Digamma returns the logorithmic derivative of the gamma function at x.
ψ(x) = d/dx (Ln (Γ(x)).
func EllipticE ¶
EllipticE computes the Legendre's elliptic integral of the 2nd kind E(phi,m), 0≤m<1:
E(\phi,m) = \int_{0}^{\phi} \sqrt{1-m\sin^2(\theta)} d\theta
Legendre's elliptic integrals can be expressed as symmetric elliptic integrals, in this case:
E(\phi,m) = \sin\phi R_F(\cos^2\phi,1-m\sin^2\phi,1)-(m/3)\sin^3\phi R_D(\cos^2\phi,1-m\sin^2\phi,1)
The definition of E(phi,k) where k=sqrt(m) can be found in NIST Digital Library of Mathematical Functions (http://dlmf.nist.gov/19.2.E5).
func EllipticF ¶
EllipticF computes the Legendre's elliptic integral of the 1st kind F(phi,m), 0≤m<1:
F(\phi,m) = \int_{0}^{\phi} 1 / \sqrt{1-m\sin^2(\theta)} d\theta
Legendre's elliptic integrals can be expressed as symmetric elliptic integrals, in this case:
F(\phi,m) = \sin\phi R_F(\cos^2\phi,1-m\sin^2\phi,1)
The definition of F(phi,k) where k=sqrt(m) can be found in NIST Digital Library of Mathematical Functions (http://dlmf.nist.gov/19.2.E4).
func EllipticRD ¶
EllipticRD computes the symmetric elliptic integral R_D(x,y,z):
R_D(x,y,z) = (1/2)\int_{0}^{\infty}{1/(s(t)(t+z))} dt, s(t) = \sqrt{(t+x)(t+y)(t+z)}.
The arguments x, y, z must satisfy the following conditions, otherwise the function returns math.NaN():
0 ≤ x,y ≤ upper, lower ≤ z ≤ upper, lower ≤ x+y,
where:
lower = (5/(2^1022))^(1/3) = 4.809554074311679e-103, upper = ((2^1022)/5)^(1/3) = 2.079194837087086e+102.
The definition of the symmetric elliptic integral R_D can be found in NIST Digital Library of Mathematical Functions (http://dlmf.nist.gov/19.16.E5).
func EllipticRF ¶
EllipticRF computes the symmetric elliptic integral R_F(x,y,z):
R_F(x,y,z) = (1/2)\int_{0}^{\infty}{1/s(t)} dt, s(t) = \sqrt{(t+x)(t+y)(t+z)}.
The arguments x, y, z must satisfy the following conditions, otherwise the function returns math.NaN():
0 ≤ x,y,z ≤ upper, lower ≤ x+y,y+z,z+x,
where:
lower = 5/(2^1022) = 1.112536929253601e-307, upper = (2^1022)/5 = 8.988465674311580e+306.
The definition of the symmetric elliptic integral R_F can be found in NIST Digital Library of Mathematical Functions (http://dlmf.nist.gov/19.16.E1).
func GammaIncReg ¶
GammaIncReg computes the regularized incomplete Gamma integral.
GammaIncReg(a,x) = (1/ Γ(a)) \int_0^x e^{-t} t^{a-1} dt
The input argument a must be positive and x must be non-negative or GammaIncReg will panic.
See http://mathworld.wolfram.com/IncompleteGammaFunction.html or https://en.wikipedia.org/wiki/Incomplete_gamma_function for more detailed information.
func GammaIncRegComp ¶
GammaIncRegComp computes the complemented regularized incomplete Gamma integral.
GammaIncRegComp(a,x) = 1 - GammaIncReg(a,x) = (1/ Γ(a)) \int_x^\infty e^{-t} t^{a-1} dt
The input argument a must be positive and x must be non-negative or GammaIncRegComp will panic.
func GammaIncRegCompInv ¶
GammaIncRegCompInv computes the inverse of the complemented regularized incomplete Gamma integral. That is, it returns the x such that:
GammaIncRegComp(a, x) = y
The input argument a must be positive and y must be between 0 and 1 inclusive or GammaIncRegCompInv will panic. GammaIncRegCompInv should return a positive number, but can return 0 even with non-zero y due to underflow.
func GammaIncRegInv ¶
GammaIncRegInv computes the inverse of the regularized incomplete Gamma integral. That is, it returns the x such that:
GammaIncReg(a, x) = y
The input argument a must be positive and y must be between 0 and 1 inclusive or GammaIncRegInv will panic. GammaIncRegInv should return a positive number, but can return NaN if there is a failure to converge.
func InvRegIncBeta ¶
InvRegIncBeta computes the inverse of the regularized incomplete beta function. It returns the x for which
y = I(x;a,b)
The domain of definition is 0 <= y <= 1, and the parameters a and b must be positive. For other values of x, a, and b InvRegIncBeta will panic.
func Lbeta ¶
Lbeta returns the natural logarithm of the complete beta function B(a,b). Lbeta is defined as:
Ln(Γ(a)Γ(b)/Γ(a+b))
Special cases are:
Lbeta(a,b) returns NaN if a or b is Inf Lbeta(a,b) returns NaN if a and b are 0 Lbeta(a,b) returns NaN if a or b is NaN Lbeta(a,b) returns NaN if a or b is < 0 Lbeta(a,b) returns +Inf if a xor b is 0.
func MvLgamma ¶
MvLgamma returns the log of the multivariate Gamma function. Dim must be greater than zero, and MvLgamma will return NaN if v < (dim-1)/2.
See https://en.wikipedia.org/wiki/Multivariate_gamma_function for more information.
func NormalQuantile ¶
NormalQuantile computes the quantile function (inverse CDF) of the standard normal. NormalQuantile panics if the input p is less than 0 or greater than 1.
func RegIncBeta ¶
RegIncBeta returns the value of the regularized incomplete beta function I(x;a,b). It is defined as
I(x;a,b) = B(x;a,b) / B(a,b) = Γ(a+b) / (Γ(a)*Γ(b)) * int_0^x u^(a-1) * (1-u)^(b-1) du.
The domain of definition is 0 <= x <= 1, and the parameters a and b must be positive. For other values of x, a, and b RegIncBeta will panic.
func Zeta ¶
Zeta computes the Riemann zeta function of two arguments.
Zeta(x,q) = \sum_{k=0}^{\infty} (k+q)^{-x}
Note that Zeta returns +Inf if x is 1 and will panic if x is less than 1, q is either zero or a negative integer, or q is negative and x is not an integer.
See http://mathworld.wolfram.com/HurwitzZetaFunction.html or https://en.wikipedia.org/wiki/Multiple_zeta_function#Two_parameters_case for more detailed information.
Source Files ¶
airy.go beta.go betainc.go digamma.go doc.go ell_carlson.go ell_complete.go erf.go gamma_inc.go gamma_inc_inv.go mvgamma.go roots.go zeta.go
Directories ¶
Path | Synopsis |
---|---|
mathext/internal | |
mathext/prng | Package prng provides random source PRNG implementations. |
- Version
- v0.15.1 (latest)
- Published
- Aug 16, 2024
- Platform
- linux/amd64
- Imports
- 4 packages
- Last checked
- 11 hours ago –
Tools for package owners.