Functions
SpecialFunctions.erf — Functionerf(x)Compute the error function of $x$, defined by
erf(x, y)Accurate version of erf(y) - erf(x) (for real arguments only).
External links: DLMF, Wikipedia.
See also: erfc(x), erfcx(x), erfi(x), dawson(x), erfinv(x), erfcinv(x).
Implementation by
SpecialFunctions.erfc — Functionerfc(x)Compute the complementary error function of $x$, defined by
This is the accurate version of 1-erf(x) for large $x$.
External links: DLMF, Wikipedia.
See also: erf(x).
Implementation by
SpecialFunctions.erfcx — Functionerfcx(x)Compute the scaled complementary error function of $x$, defined by
This is the accurate version of $e^{x^2} \operatorname{erfc}(x)$ for large $x$. Note also that $\operatorname{erfcx}(-ix)$ computes the Faddeeva function w(x).
External links: DLMF, Wikipedia.
See also: erfc(x).
Implementation by
Float32/Float64: C standard math library libm.BigFloat: MPFR has an open TODO item for this function until then, we use DLMF 7.12.1 for the tail.
SpecialFunctions.logerfc — Functionlogerfc(x)Compute the natural logarithm of the complementary error function of $x$, that is
This is the accurate version of $\operatorname{ln}(\operatorname{erfc}(x))$ for large $x$.
External links: Wikipedia.
See also: erfcx(x).
Implementation
Based on the erfc(x) and erfcx(x) functions. Currently only implemented for Float32, Float64, and BigFloat.
SpecialFunctions.logerfcx — Functionlogerfcx(x)Compute the natural logarithm of the scaled complementary error function of $x$, that is
This is the accurate version of $\operatorname{ln}(\operatorname{erfcx}(x))$ for large and negative $x$.
External links: Wikipedia.
See also: erfcx(x).
Implementation
Based on the erfc(x) and erfcx(x) functions. Currently only implemented for Float32, Float64, and BigFloat.
SpecialFunctions.erfi — Functionerfi(x)Compute the imaginary error function of $x$, defined by
External links: Wikipedia.
See also: erf(x).
Implementation by
Float32/Float64: C standard math library libm.
SpecialFunctions.dawson — Functiondawson(x)Compute the Dawson function (scaled imaginary error function) of $x$, defined by
This is the accurate version of $\frac{\sqrt{\pi}}{2} e^{-x^2} \operatorname{erfi}(x)$ for large $x$.
External links: DLMF, Wikipedia.
See also: erfi(x).
Implementation by
Float32/Float64: C standard math library libm.
SpecialFunctions.erfinv — Functionerfinv(x)Compute the inverse error function of a real $x$, that is
External links: Wikipedia.
See also: erf(x).
Implementation
Using the rational approximants tabulated in:
J. M. Blair, C. A. Edwards, and J. H. Johnson, "Rational Chebyshev approximations for the inverse of the error function", Math. Comp. 30, pp. 827–830 (1976). https://doi.org/10.1090/S0025-5718-1976-0421040-7, http://www.jstor.org/stable/2005402
SpecialFunctions.erfcinv — Functionerfcinv(x)Compute the inverse error complementary function of a real $x$, that is
External links: Wikipedia.
See also: erfc(x).
Implementation
Using the rational approximants tabulated in:
J. M. Blair, C. A. Edwards, and J. H. Johnson, "Rational Chebyshev approximations for the inverse of the error function", Math. Comp. 30, pp. 827–830 (1976). https://doi.org/10.1090/S0025-5718-1976-0421040-7, http://www.jstor.org/stable/2005402
SpecialFunctions.sinint — Functionsinint(x)Compute the sine integral function of $x$, defined by
External links: DLMF, Wikipedia.
See also: cosint(x).
Implementation
Using the rational approximants tabulated in:
A.J. MacLeod, "Rational approximations, software and test methods for sine and cosine integrals", Numer. Algor. 12, pp. 259–272 (1996). https://doi.org/10.1007/BF02142806, https://link.springer.com/article/10.1007/BF02142806.
Note: the second zero of $\text{Ci}(x)$ has a typo that is fixed: $r_1 = 3.38418 0422\mathbf{8} 51186 42639 78511 46402$ in the article, but is in fact: $r_1 = 3.38418 0422\mathbf{5} 51186 42639 78511 46402$.
SpecialFunctions.cosint — Functioncosint(x)Compute the cosine integral function of $x$, defined by
where $\gamma$ is the Euler-Mascheroni constant.
External links: DLMF, Wikipedia.
See also: sinint(x).
Implementation
Using the rational approximants tabulated in:
A.J. MacLeod, "Rational approximations, software and test methods for sine and cosine integrals", Numer. Algor. 12, pp. 259–272 (1996). https://doi.org/10.1007/BF02142806, https://link.springer.com/article/10.1007/BF02142806.
Note: the second zero of $\text{Ci}(x)$ has a typo that is fixed: $r_1 = 3.38418 0422\mathbf{8} 51186 42639 78511 46402$ in the article, but is in fact: $r_1 = 3.38418 0422\mathbf{5} 51186 42639 78511 46402$.
SpecialFunctions.digamma — Functiondigamma(x)Compute the digamma function of x (the logarithmic derivative of gamma(x)).
SpecialFunctions.invdigamma — Functioninvdigamma(x)Compute the inverse digamma function of x.
SpecialFunctions.trigamma — Functiontrigamma(x)Compute the trigamma function of x (the logarithmic second derivative of gamma(x)).
SpecialFunctions.polygamma — Functionpolygamma(m, x)Compute the polygamma function of order m of argument x (the (m+1)th derivative of the logarithm of gamma(x))
External links: Wikipedia
See also: gamma(z)
SpecialFunctions.airyai — Functionairyai(x)Airy function of the first kind $\operatorname{Ai}(x)$.
External links: DLMF, Wikipedia
See also: airyaix, airyaiprime, airybi
SpecialFunctions.airyaiprime — Functionairyaiprime(x)Derivative of the Airy function of the first kind $\operatorname{Ai}'(x)$.
External links: DLMF, Wikipedia
See also: airyaiprimex, airyai, airybi
SpecialFunctions.airyaix — Functionairyaix(x)Scaled Airy function of the first kind $\operatorname{Ai}(x) e^{\frac{2}{3} x \sqrt{x}}$. Throws DomainError for negative Real arguments.
External links: DLMF, Wikipedia
See also: airyai, airyaiprime, airybi
SpecialFunctions.airyaiprimex — Functionairyaiprimex(x)Scaled derivative of the Airy function of the first kind $\operatorname{Ai}'(x) e^{\frac{2}{3} x \sqrt{x}}$. Throws DomainError for negative Real arguments.
External links: DLMF, Wikipedia
See also: airyaiprime, airyai, airybi
SpecialFunctions.airybi — Functionairybi(x)Airy function of the second kind $\operatorname{Bi}(x)$.
External links: DLMF, Wikipedia
See also: airybix, airybiprime, airyai
SpecialFunctions.airybiprime — Functionairybiprime(x)Derivative of the Airy function of the second kind $\operatorname{Bi}'(x)$.
External links: DLMF, Wikipedia
See also: airybiprimex, airybi, airyai
SpecialFunctions.airybix — Functionairybix(x)Scaled Airy function of the second kind $\operatorname{Bi}(x) e^{- \left| \operatorname{Re} \left( \frac{2}{3} x \sqrt{x} \right) \right|}$.
External links: DLMF, Wikipedia
See also: airybi, airybiprime, airyai
SpecialFunctions.airybiprimex — Functionairybiprimex(x)Scaled derivative of the Airy function of the second kind $\operatorname{Bi}'(x) e^{- \left| \operatorname{Re} \left( \frac{2}{3} x \sqrt{x} \right) \right|}$.
External links: DLMF, Wikipedia
See also: airybiprime, airybi, airyai
SpecialFunctions.besselj0 — Functionbesselj0(x)Bessel function of the first kind of order 0, $J_0(x)$.
External links: DLMF, Wikipedia
See also: besselj(nu,x)
SpecialFunctions.besselj1 — Functionbesselj1(x)Bessel function of the first kind of order 1, $J_1(x)$.
External links: DLMF, Wikipedia
See also: besselj(nu,x)
SpecialFunctions.besselj — Functionbesselj(nu, x)Bessel function of the first kind of order nu, $J_\nu(x)$.
External links: DLMF, Wikipedia
See also: besseljx(nu,x), besseli(nu,x), besselk(nu,x)
SpecialFunctions.besseljx — Functionbesseljx(nu, x)Scaled Bessel function of the first kind of order nu, $J_\nu(x) e^{- | \operatorname{Im}(x) |}$.
External links: DLMF, Wikipedia
See also: besselj(nu,x), besseli(nu,x), besselk(nu,x)
SpecialFunctions.sphericalbesselj — Functionsphericalbesselj(nu, x)Spherical bessel function of the first kind at order nu, $j_ν(x)$. This is the non-singular solution to the radial part of the Helmholz equation in spherical coordinates.
SpecialFunctions.bessely0 — Functionbessely0(x)Bessel function of the second kind of order 0, $Y_0(x)$.
External links: DLMF, Wikipedia
See also: bessely(nu,x)
SpecialFunctions.bessely1 — Functionbessely1(x)Bessel function of the second kind of order 1, $Y_1(x)$.
External links: DLMF, Wikipedia
See also: bessely(nu,x)
SpecialFunctions.bessely — Functionbessely(nu, x)Bessel function of the second kind of order nu, $Y_\nu(x)$.
External links: DLMF, Wikipedia
See also besselyx(nu,x) for a scaled variant.
SpecialFunctions.besselyx — Functionbesselyx(nu, x)Scaled Bessel function of the second kind of order nu, $Y_\nu(x) e^{- | \operatorname{Im}(x) |}$.
External links: DLMF, Wikipedia
See also bessely(nu,x)
SpecialFunctions.sphericalbessely — Functionsphericalbessely(nu, x)Spherical bessel function of the second kind at order nu, $y_ν(x)$. This is the singular solution to the radial part of the Helmholz equation in spherical coordinates. Sometimes known as a spherical Neumann function.
SpecialFunctions.hankelh1 — Functionhankelh1(nu, x)Bessel function of the third kind of order nu, $H^{(1)}_\nu(x)$.
External links: DLMF, Wikipedia
See also: hankelh1x
SpecialFunctions.hankelh1x — Functionhankelh1x(nu, x)Scaled Bessel function of the third kind of order nu, $H^{(1)}_\nu(x) e^{-x i}$.
External links: DLMF, Wikipedia
See also: hankelh1
SpecialFunctions.hankelh2 — Functionhankelh2(nu, x)Bessel function of the third kind of order nu, $H^{(2)}_\nu(x)$.
External links: DLMF, Wikipedia
See also: hankelh2x(nu,x)
SpecialFunctions.hankelh2x — Functionhankelh2x(nu, x)Scaled Bessel function of the third kind of order nu, $H^{(2)}_\nu(x) e^{x i}$.
External links: DLMF, Wikipedia
See also: hankelh2(nu,x)
SpecialFunctions.besselh — Functionbesselh(nu, [k=1,] x)Bessel function of the third kind of order nu (the Hankel function). k is either 1 or 2, selecting hankelh1 or hankelh2, respectively. k defaults to 1 if it is omitted.
External links: DLMF and DLMF, Wikipedia
See also: besselhx for an exponentially scaled variant.
SpecialFunctions.besselhx — Functionbesselhx(nu, [k=1,] z)Compute the scaled Hankel function $\exp(∓iz) H_ν^{(k)}(z)$, where $k$ is 1 or 2, $H_ν^{(k)}(z)$ is besselh(nu, k, z), and $∓$ is $-$ for $k=1$ and $+$ for $k=2$. k defaults to 1 if it is omitted.
The reason for this function is that $H_ν^{(k)}(z)$ is asymptotically proportional to $\exp(∓iz)/\sqrt{z}$ for large $|z|$, and so the besselh function is susceptible to overflow or underflow when z has a large imaginary part. The besselhx function cancels this exponential factor (analytically), so it avoids these problems.
External links: DLMF, Wikipedia
See also: besselh
SpecialFunctions.besseli — Functionbesseli(nu, x)Modified Bessel function of the first kind of order nu, $I_\nu(x)$.
External links: DLMF, Wikipedia
See also: besselix(nu,x), besselj(nu,x), besselk(nu,x)
SpecialFunctions.besselix — Functionbesselix(nu, x)Scaled modified Bessel function of the first kind of order nu, $I_\nu(x) e^{- | \operatorname{Re}(x) |}$.
External links: DLMF, Wikipedia
See also: besseli(nu,x), besselj(nu,x), besselk(nu,x)
SpecialFunctions.besselk — Functionbesselk(nu, x)Modified Bessel function of the second kind of order nu, $K_\nu(x)$.
External links: DLMF, Wikipedia
See also: See also: besselkx(nu,x), besseli(nu,x), besselj(nu,x)
SpecialFunctions.besselkx — Functionbesselkx(nu, x)Scaled modified Bessel function of the second kind of order nu, $K_\nu(x) e^x$.
External links: DLMF, Wikipedia
See also: besselk(nu,x), besseli(nu,x), besselj(nu,x)
SpecialFunctions.ellipk — Functionellipk(m)Computes Complete Elliptic Integral of 1st kind $K(m)$ for parameter $m$ given by
External links: DLMF, Wikipedia.
See also: ellipe(m).
Arguments
m: parameter $m$, restricted to the domain $(-\infty,1]$, is related to the elliptic modulus $k$ by $k^2=m$ and to the modular angle $\alpha$ by $k=\sin \alpha$.
Implementation
Using piecewise approximation polynomial as given in
'Fast Computation of Complete Elliptic Integrals and Jacobian Elliptic Functions', Fukushima, Toshio. (2014). F09-FastEI. Celest Mech Dyn Astr, DOI 10.1007/s10569-009-9228-z, https://pdfs.semanticscholar.org/8112/c1f56e833476b61fc54d41e194c962fbe647.pdf
For $m<0$, followed by
Fukushima, Toshio. (2014). 'Precise, compact, and fast computation of complete elliptic integrals by piecewise minimax rational function approximation'. Journal of Computational and Applied Mathematics. 282. DOI 10.13140/2.1.1946.6245., https://www.researchgate.net/publication/267330394
As suggested in this paper, the domain is restricted to $(-\infty,1]$.
SpecialFunctions.ellipe — Functionellipe(m)Computes Complete Elliptic Integral of 2nd kind $E(m)$ for parameter $m$ given by
External links: DLMF, Wikipedia.
See also: ellipk(m).
Arguments
m: parameter $m$, restricted to the domain $(-\infty,1]$, is related to the elliptic modulus $k$ by $k^2=m$ and to the modular angle $\alpha$ by $k=\sin \alpha$.
Implementation
Using piecewise approximation polynomial as given in
'Fast Computation of Complete Elliptic Integrals and Jacobian Elliptic Functions', Fukushima, Toshio. (2014). F09-FastEI. Celest Mech Dyn Astr, DOI 10.1007/s10569-009-9228-z, https://pdfs.semanticscholar.org/8112/c1f56e833476b61fc54d41e194c962fbe647.pdf
For $m<0$, followed by
Fukushima, Toshio. (2014). 'Precise, compact, and fast computation of complete elliptic integrals by piecewise minimax rational function approximation'. Journal of Computational and Applied Mathematics. 282. DOI 10.13140/2.1.1946.6245., https://www.researchgate.net/publication/267330394
As suggested in this paper, the domain is restricted to $(-\infty,1]$.
SpecialFunctions.eta — Functioneta(x)Dirichlet eta function $\eta(s) = \sum^\infty_{n=1}(-1)^{n-1}/n^{s}$.
SpecialFunctions.zeta — Functionzeta(s, z)Generalized zeta function defined by
where any term with $k+z=0$ is excluded. For $\Re z > 0$, this definition is equivalent to the Hurwitz zeta function $\sum_{k=0}^\infty (k+z)^{-s}$.
The Riemann zeta function is recovered as $\zeta(s)=\zeta(s,1)$.
External links: Riemann zeta function, Hurwitz zeta function
zeta(s)Riemann zeta function
External links: Wikipedia
SpecialFunctions.gamma — Functiongamma(z)Compute the gamma function for complex $z$, defined by
and by analytic continuation in the whole complex plane.
External links: DLMF, Wikipedia.
See also: loggamma(z).
Implementation by
SpecialFunctions.gamma_inc — Functiongamma_inc(a,x,IND)Returns a tuple $(p, q)$ where $p + q = 1$, and $p=P(a,x)$ is the Incomplete gamma function ratio given by:
and $q=Q(a,x)$ is the Incomplete gamma function ratio given by:
IND ∈ [0,1,2] sets accuracy: IND=0 means 14 significant digits accuracy, IND=1 means 6 significant digit, and IND=2 means only 3 digit accuracy.
External links: DLMF, Wikipedia
See also gamma(z), gamma_inc_inv(a,p,q)
SpecialFunctions.gamma_inc_inv — Functiongamma_inc_inv(a,p,q)Inverts the gamma_inc(a,x) function, by computing x given a,p,q in $P(a,x)=p$ and $Q(a,x)=q$.
External links: DLMF, Wikipedia
See also: gamma_inc(a,x,ind).
SpecialFunctions.beta_inc — Functionbeta_inc(a,b,x)Returns a tuple $(I_{x}(a,b),1.0-I_{x}(a,b))$ where the Regularized Incomplete Beta Function is given by:
where $B(a,b) = \Gamma(a)\Gamma(b)/\Gamma(a+b)$.
External links: DLMF, Wikipedia
See also: beta_inc_inv(a,b,p,q)
SpecialFunctions.loggamma — Functionloggamma(x)Computes the logarithm of gamma for given x. If x is a Real, then it throws a DomainError if gamma(x) is negative.
See also logabsgamma.
SpecialFunctions.logabsgamma — Functionlogabsgamma(x)Compute the logarithm of absolute value of gamma for Real xand returns a tuple (log(abs(gamma(x))), sign(gamma(x))).
See also loggamma.
SpecialFunctions.logfactorial — Functionlogfactorial(x)Compute the logarithmic factorial of a nonnegative integer x. Equivalent to loggamma of x + 1, but loggamma extends this function to non-integer x.
SpecialFunctions.beta — Functionbeta(x, y)Euler integral of the first kind $\operatorname{B}(x,y) = \Gamma(x)\Gamma(y)/\Gamma(x+y)$.
SpecialFunctions.logbeta — Functionlogbeta(x, y)Natural logarithm of the beta function $\log(|\operatorname{B}(x,y)|)$.
See also logabsbeta.
SpecialFunctions.logabsbeta — Functionlogabsbeta(x, y)Compute the natural logarithm of the absolute value of the beta function, returning a tuple (log(abs(beta(x,y))), sign(beta(x,y)))
See also logbeta.
SpecialFunctions.logabsbinomial — Functionlogabsbinomial(n, k)Accurate natural logarithm of the absolute value of the binomial coefficient binomial(n, k) for large n and k near n/2.
Returns a tuple (log(abs(binomial(n,k))), sign(binomial(n,k))).