Back to godoc.org
gonum.org/v1/gonum / mathext

Package mathext

v0.7.0
Latest Go to latest
Published: Feb 26, 2020 | License: BSD-3-Clause | Module: gonum.org/v1/gonum

Overview

Package mathext implements special math functions not implemented by the Go standard library.

Index

Package Files

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

func Beta(a, b float64) float64

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

func CompleteB(m float64) float64

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

func CompleteD(m float64) float64

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

func CompleteE(m float64) float64

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

func CompleteK(m float64) float64

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

func Digamma(x float64) float64

Digamma returns the logorithmic derivative of the gamma function at x.

ψ(x) = d/dx (Ln (Γ(x)).

func EllipticE

func EllipticE(phi, m float64) float64

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

func EllipticF(phi, m float64) float64

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

func EllipticRD(x, y, z float64) float64

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

func EllipticRF(x, y, z float64) float64

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

func GammaIncReg(a, x float64) float64

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

func GammaIncRegComp(a, x float64) float64

GammaIncRegComp computes the complemented regularized incomplete Gamma integral.

GammaIncRegComp(a,x) = 1 - GammaIncReg(a,x)
                  = (1/ Γ(a)) \int_0^\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

func GammaIncRegCompInv(a, y float64) float64

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

func GammaIncRegInv(a, y float64) float64

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

func InvRegIncBeta(a, b float64, y float64) float64

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

func Lbeta(a, b float64) float64

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

func MvLgamma(v float64, dim int) float64

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

func NormalQuantile(p float64) float64

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

func RegIncBeta(a, b float64, x float64) float64

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

func Zeta(x, q float64) float64

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.

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier