Documentation ¶
Overview ¶
Package special provides common special functions to extend the Go standard package math.
Index ¶
- Constants
- func Beta(x, y float64) float64
- func ChebyshevT(n int, x float64) float64
- func ChebyshevU(n int, x float64) float64
- func Chi(x float64) float64
- func Ci(x float64) float64
- func Cin(x float64) float64
- func Digamma(x float64) float64
- func Ei(x float64) float64
- func En(n int, x float64) float64
- func Eta(x float64) float64
- func Fibonacci(n float64) float64
- func GammaIncL(a, x float64) float64
- func GammaIncU(a, x float64) float64
- func GammaRatio(x, y []float64) float64
- func GammaRegP(a, x float64) float64
- func GammaRegQ(a, x float64) float64
- func GammaSign(x float64) int
- func GegenbauerC(n int, a, x float64) float64
- func Harmonic(x float64) float64
- func HermiteH(n int, x float64) float64
- func HermiteHe(n int, x float64) float64
- func HypPFQ(a, b []float64, x float64) float64
- func JacobiP(n int, a, b, x float64) float64
- func LaguerreAL(n int, a, x float64) float64
- func LaguerreL(n int, x float64) float64
- func LambertW(k int, x float64) float64
- func LegendreAP(n, m int, x float64) float64
- func LegendreP(n int, x float64) float64
- func LegendreQ(n int, x float64) float64
- func LgammaRatio(x, y []float64) (float64, int)
- func Li(x float64) float64
- func Li2(x float64) float64
- func Poch(x, k float64) float64
- func Polygamma(n int, x float64) float64
- func Shi(x float64) float64
- func Si(x float64) float64
- func SphericalHarmonicY(l, m int, theta, phi float64) (float64, float64)
- func Trigamma(x float64) float64
- func ZernikeR(n, m int, x float64) float64
- func Zeta(x float64) float64
Constants ¶
const ( Cahen = 6434105462883380261822543077575647632865878602682395059870309203 // https://oeis.org/A118227 Catalan = 0.91596559417721901505460351493238411077414937428167213426649811 // https://oeis.org/A006752 EulerGamma = 0.57721566490153286060651209008240243104215933593992359880576723 // https://oeis.org/A001620 Glaisher = 1.28242712910062263687534256886979172776768892732500119206374002 // https://oeis.org/A074962 Omega = 0.56714329040978387299996866221035554975381578718651250813513107 // https://oeis.org/A030178 Plastic = 1.32471795724474602596090885447809734073440405690173336453401505 // https://oeis.org/A060006 )
Mathematical constants.
Variables ¶
This section is empty.
Functions ¶
func Beta ¶
Beta returns the complete beta function, defined by
Beta(x, y) = Gamma(x) Gamma(y) / Gamma(x+y)
where Gamma is the gamma function.
See http://mathworld.wolfram.com/BetaFunction.html for more information.
func ChebyshevT ¶
ChebyshevT returns the nth Chebyshev polynomial of the first kind at x.
See http://mathworld.wolfram.com/ChebyshevPolynomialoftheFirstKind.html for more information.
func ChebyshevU ¶
ChebyshevU returns the nth Chebyshev polynomial of the second kind at x.
See http://mathworld.wolfram.com/ChebyshevPolynomialoftheSecondKind.html for more information.
func Ci ¶
Ci returns the cosine integral, defined by
∞ x Ci(x) = - ∫ dt Cos(t) / t = γ + Log(x) + ∫ dt (Cos(t) - 1) / t t=x t=0
where γ is the Euler-Mascheroni constant.
See http://mathworld.wolfram.com/CosineIntegral.html for more information.
func Cin ¶
Cin returns the secondary cosine integral, defined by
x Cin(x) = ∫ dt (1 - Cos(t)) / t = γ + Log(x) - Ci(x) t=0
where γ is the Euler-Mascheroni constant and Ci is the primary cosine integral.
See http://mathworld.wolfram.com/CosineIntegral.html for more information.
func Digamma ¶
Digamma returns the first logarithmic derivative of the Gamma function, defined by
Digamma(x) = d/dx Lgamma(x)
See http://mathworld.wolfram.com/DigammaFunction.html for more information.
func Ei ¶
Ei returns the exponential integral of x, defined by
x Ei(x) = ∫ dt Exp(t) / t t=-∞
See http://mathworld.wolfram.com/ExponentialIntegral.html for more information.
func En ¶
En returns the En function, defined by
∞ En(n, x) = ∫ dt Exp(-x*t) / t**n t=1
See http://mathworld.wolfram.com/En-Function.html for more information.
func Eta ¶
Eta returns the Dirichlet eta function, defined by
∞ Eta(x) = ∑ (-1)**(n+1) / n**x = (1 - 2**(1-x)) Zeta(x) n=1
where Zeta is the Riemann zeta function.
See http://mathworld.wolfram.com/DirichletEtaFunction.html for more information.
func Fibonacci ¶
Fibonacci returns the nth Fibonacci. The Fibonacci numbers are defined, for integer n, by
F(n) = F(n-1) + F(n-2) F(0) = F(1) = 1
and can extended to non-integer n by
Fibonacci(n) = (φ**n - Cos(nπ)/φ**n) / √5
where φ = (1 + √5) / 2 is the golden ratio.
See http://mathworld.wolfram.com/FibonacciNumber.html for more information.
func GammaIncL ¶
GammaIncL returns the lower incomplete gamma function, defined by
x GammaIncL(a, x) = ∫ dt Exp(-t) * t**(a-1) t=0
GammaIncL also satisfies the identity
GammaIncL(a, x) + GammaIncU(a, x) = Gamma(a)
where GammaIncU is the upper incomplete gamma function.
See http://mathworld.wolfram.com/IncompleteGammaFunction.html for more information.
func GammaIncU ¶
GammaIncU returns the lower incomplete gamma function, defined by
∞ GammaIncU(a, x) = ∫ dt Exp(-t) * t**(a-1) t=x
GammaIncU also satisfies the identity
GammaIncL(a, x) + GammaIncU(a, x) = Gamma(a)
where GammaIncL is the lower incomplete gamma function.
See http://mathworld.wolfram.com/IncompleteGammaFunction.html for more information.
func GammaRatio ¶
GammaRatio returns the ratio of products of Gamma functions, i.e.
n-1 m-1 GammaRatio(x, y) = ∏ Gamma(x[i]) / ∏ Gamma(y[j]) i=0 j=0
where x = {x[0], ..., x[n-1]} and y = {y[0], ..., y[m-1]} are slices of length n and m respectively. The result is NaN if x and y contain a different number of infinite or NaN values.
See http://mathworld.wolfram.com/GammaFunction.html for more information.
func GammaRegP ¶
GammaRegP returns the regularised lower incomplete gamma function, defined by
x GammaRegP(a, x) = [1 / Gamma(a)] ∫ dt Exp(-t) * t**(a-1) t=0
The regularised lower incomplete gamma function has a series representation
∞ GammaRegP(a, x) = Exp(-x) a**x ∑ x**k / Gamma(a+k+1) k=0
and also satisfies the identity
GammaRegP(a, x) + GammaRegQ(a, x) = 1
where GammaRegQ is the regularised upper incomplete gamma function.
See http://mathworld.wolfram.com/RegularizedGammaFunction.html for more information.
func GammaRegQ ¶
GammaRegQ returns the regularised upper incomplete gamma function, defined by
∞ GammaRegQ(a, x) = [1 / Gamma(a)] ∫ dt Exp(-t) * t**(a-1) t=x
GammaRegQ also satisfies the identity
GammaRegP(a, x) + GammaRegQ(a, x) = 1
where GammaRegP is the regularised lower incomplete gamma function.
See http://mathworld.wolfram.com/RegularizedGammaFunction.html for more information.
func GammaSign ¶
GammaSign returns the sign of the Gamma function at x. For non-positive integer x, the sign is given by the sign of the residue, i.e. (-1)**|x|.
func GegenbauerC ¶
GegenbauerC returns the nth Gegenbauer polynomial with paramater a at x.
See http://mathworld.wolfram.com/GegenbauerPolynomial.html for more information.
func Harmonic ¶
Harmonic returns the harmonic numbers, defined for integer n by
n Harmonic(n) = ∑ 1/k k=1
and extended to non-integer x by
Harmonic(x) = EulerGamma + Digamma(x+1)
where Digamma is the logarithmic derivative of the Gamma function.
See http://mathworld.wolfram.com/HarmonicNumber.html for more information.
func HermiteH ¶
HermiteH returns the nth unnormalised, or physics, Hermite polynomial, which is related to the normalised Hermite polynomial by
H(n, x) = √2**n He(n, x√2)
where He is the normalised Hermite polynomial.
See http://mathworld.wolfram.com/HermitePolynomial.html for more information.
func HermiteHe ¶
HermiteHe returns the nth normalised Hermite polynomial, which is related to the "physics" Hermite polynomial by
H(n, x) = √2**n He(n, x√2)
where H is the unnormalised, or physics, Hermite polynomial.
See http://mathworld.wolfram.com/HermitePolynomial.html for more information.
func HypPFQ ¶
HypPFQ returns the type-(p,q) generalised hypergeometric function, defined by
∞ p-1 q-1 pFq(a; b; x) = ∑ x**k / k! * ∏ (a[i])_k / ∏ (b[j])_k k=0 i=0 j=0
where a and b are length p and q respectively and (x)_k is the k-th Pochhammer symbol of x. The function pFq is commonly denoted
| a[0], a[1], ..., a[p-1] | pFq| ; x | | b[0], b[1], ..., b[q-1] |
for p, q ≥ 2.
See http://mathworld.wolfram.com/HypergeometricFunction.html for more information.
func JacobiP ¶
JacobiP returns the nth Jacobi polynomial with parameters a, b at x.
See http://mathworld.wolfram.com/JacobiPolynomial.html for more information.
func LaguerreAL ¶
LaguerreAL returns the nth associated Laguerre polynomial with parameter a at x.
See http://mathworld.wolfram.com/AssociatedLaguerrePolynomial.html for more information.
func LaguerreL ¶
LaguerreL returns the nth Laguerre polynomial at x.
See http://mathworld.wolfram.com/LaguerrePolynomial.html for more information.
func LambertW ¶
LambertW returns the real branches of the Lambert W function, implicitly defined by
W(x) Exp(W(x)) = x
or, equivalently, as the inverse of the function
f(x) = x Exp(x)
where Exp is the exponential function. The principal branch (k=0) is defined on x ≥ -1/e and the secondary branch (k=-1) is defined over -1/e ≤ x < 0.
See http://mathworld.wolfram.com/LambertW-Function.html for more information.
func LegendreAP ¶
LegendreAP returns the nth associated Legendre polynomial of the first kind with parameter m at x.
See http://mathworld.wolfram.com/AssociatedLegendrePolynomial.html for more information.
func LegendreP ¶
LegendreP returns the nth Legendre polynomial of the first kind at x.
See http://mathworld.wolfram.com/LegendrePolynomial.html for more information.
func LegendreQ ¶
LegendreQ returns the nth Legendre polynomial of the second kind at x.
See http://mathworld.wolfram.com/LegendreFunctionoftheSecondKind.html for more information.
func LgammaRatio ¶
LgammaRatio returns the natural logarithm and sign of the ratio of products of Gamma functions, i.e.
n-1 m-1 LgammaRatio(x, y) = Log| ∏ Gamma(x[i]) / ∏ Gamma(y[j]) | i=0 j=0
where x = {x[0], ..., x[n-1]} and y = {y[0], ..., y[m-1]} are slices of length n and m respectively. The result is NaN if x and y contain a different number of infinite or NaN values.
See http://mathworld.wolfram.com/GammaFunction.html for more information.
func Li ¶
Li returns the logarithmic integral of x, defined for x ≥ 0 by
x Li(x) = ∫ dt / Log(t) = Ei(Log(x)) t=0
where Ei(x) is the exponential integral.
See http://mathworld.wolfram.com/LogarithmicIntegral.html for more information.
func Li2 ¶
Li2 returns the secondary logarithmic integral of x, defined for x ≥ 0 by
x Li2(x) = ∫ dt / Log(t) = Li(x) - Li(2) t=2
such that Li2(2) = 0, where Li(x) is the primary logarithmic integral.
See http://mathworld.wolfram.com/LogarithmicIntegral.html for more information.
func Poch ¶
Poch returns the kth Pochhammer symbol of x, defined by
Poch(x, k) = Gamma(x+k) / Gamma(x)
See http://mathworld.wolfram.com/PochhammerSymbol.html for more information.
func Polygamma ¶
Polygamma returns the nth derivative of the Digamma function.
Polygamma(n, x) = (d/dx)**n Digamma(x)
See http://mathworld.wolfram.com/PolygammaFunction.html for more information.
func Si ¶
Si returns the sine integral, defined by
x ∞ Si(x) = ∫ dt Sin(t) / t = π/2 - ∫ dt Sin(t) / t t=0 t=x
See http://mathworld.wolfram.com/SineIntegral.html for more information.
func SphericalHarmonicY ¶
SphericalHarmonicY returns the angular portion of the solutions to Laplace's equation in spherical coordinates, where theta is in [0, π], phi is in [0, 2π] and |l| ≤ m.
See http://mathworld.wolfram.com/SphericalHarmonic.html for more information.
func Trigamma ¶
Trigamma returns the logarithmic second derivative of Gamma(x), or, equivalently, the first derivative of the Digamma function.
Trigamma(x) = d/dx Digamma(x)
See http://mathworld.wolfram.com/TrigammaFunction.html for more information.
func ZernikeR ¶
ZernikeR returns the nth Zernike polynomial with parameter m at x.
See http://mathworld.wolfram.com/ZernikePolynomial.html for more information.
func Zeta ¶
Zeta returns the Riemann zeta function, defined by
∞ Zeta(x) = ∑ 1 / n**x n=1
although it has many other equivalent definitions. This definition is valud for x > 1, however the Zeta function can be analytically continued to the entire complex-plane; this implementation is valid for all real numbers.
See http://mathworld.wolfram.com/RiemannZetaFunction.html for more information.
Types ¶
This section is empty.
Source Files ¶
- beta.go
- chebyshevt.go
- chebyshevu.go
- const.go
- doc.go
- ei.go
- fibonacci.go
- gammainc.go
- gammaratio.go
- gammasign.go
- gegenbauer.go
- hermiteh.go
- hyp.go
- jacobip.go
- laguerreal.go
- laguerrel.go
- lambertw.go
- legendreap.go
- legendreaq.go
- legendrep.go
- legendreq.go
- polygamma.go
- shichi.go
- sici.go
- sphericalharmonicy.go
- utils.go
- zerniker.go
- zeta.go