Special functions (scipy.special)#

Almost all of the functions below accept NumPy arrays as input arguments as well as single numbers. This means they follow broadcasting and automatic array-looping rules. Technically, they are NumPy universal functions. Functions which do not accept NumPy arrays are marked by a warning in the section description.

See also

scipy.special.cython_special – Typed Cython versions of special functions

Error handling#

Errors are handled by returning NaNs or other appropriate values. Some of the special function routines can emit warnings or raise exceptions when an error occurs. By default this is disabled; to query and control the current error handling state the following functions are provided.

geterr()

Get the current way of handling special-function errors.

seterr(**kwargs)

Set how special-function errors are handled.

errstate(**kwargs)

Context manager for special-function error handling.

SpecialFunctionWarning

Warning that can be emitted by special functions.

SpecialFunctionError

Exception that can be raised by special functions.

Available functions#

Airy functions#

airy(z[, out])

Airy functions and their derivatives.

airye(z[, out])

Exponentially scaled Airy functions and their derivatives.

ai_zeros(nt)

Compute nt zeros and values of the Airy function Ai and its derivative.

bi_zeros(nt)

Compute nt zeros and values of the Airy function Bi and its derivative.

itairy(x[, out])

Integrals of Airy functions

Elliptic functions and integrals#

ellipj(u, m[, out])

Jacobian elliptic functions

ellipk(m[, out])

Complete elliptic integral of the first kind.

ellipkm1(p[, out])

Complete elliptic integral of the first kind around m = 1

ellipkinc(phi, m[, out])

Incomplete elliptic integral of the first kind

ellipe(m[, out])

Complete elliptic integral of the second kind

ellipeinc(phi, m[, out])

Incomplete elliptic integral of the second kind

elliprc(x, y[, out])

Degenerate symmetric elliptic integral.

elliprd(x, y, z[, out])

Symmetric elliptic integral of the second kind.

elliprf(x, y, z[, out])

Completely-symmetric elliptic integral of the first kind.

elliprg(x, y, z[, out])

Completely-symmetric elliptic integral of the second kind.

elliprj(x, y, z, p[, out])

Symmetric elliptic integral of the third kind.

Bessel functions#

jv(v, z[, out])

Bessel function of the first kind of real order and complex argument.

jve(v, z[, out])

Exponentially scaled Bessel function of the first kind of order v.

yn(n, x[, out])

Bessel function of the second kind of integer order and real argument.

yv(v, z[, out])

Bessel function of the second kind of real order and complex argument.

yve(v, z[, out])

Exponentially scaled Bessel function of the second kind of real order.

kn(n, x[, out])

Modified Bessel function of the second kind of integer order n

kv(v, z[, out])

Modified Bessel function of the second kind of real order v

kve(v, z[, out])

Exponentially scaled modified Bessel function of the second kind.

iv(v, z[, out])

Modified Bessel function of the first kind of real order.

ive(v, z[, out])

Exponentially scaled modified Bessel function of the first kind.

hankel1(v, z[, out])

Hankel function of the first kind

hankel1e(v, z[, out])

Exponentially scaled Hankel function of the first kind

hankel2(v, z[, out])

Hankel function of the second kind

hankel2e(v, z[, out])

Exponentially scaled Hankel function of the second kind

wright_bessel(a, b, x[, out])

Wright's generalized Bessel function.

log_wright_bessel(a, b, x[, out])

Natural logarithm of Wright's generalized Bessel function, see wright_bessel.

The following function does not accept NumPy arrays (it is not a universal function):

lmbda(v, x)

Jahnke-Emden Lambda function, Lambdav(x).

Zeros of Bessel functions#

The following functions do not accept NumPy arrays (they are not universal functions):

jnjnp_zeros(nt)

Compute zeros of integer-order Bessel functions Jn and Jn'.

jnyn_zeros(n, nt)

Compute nt zeros of Bessel functions Jn(x), Jn'(x), Yn(x), and Yn'(x).

jn_zeros(n, nt)

Compute zeros of integer-order Bessel functions Jn.

jnp_zeros(n, nt)

Compute zeros of integer-order Bessel function derivatives Jn'.

yn_zeros(n, nt)

Compute zeros of integer-order Bessel function Yn(x).

ynp_zeros(n, nt)

Compute zeros of integer-order Bessel function derivatives Yn'(x).

y0_zeros(nt[, complex])

Compute nt zeros of Bessel function Y0(z), and derivative at each zero.

y1_zeros(nt[, complex])

Compute nt zeros of Bessel function Y1(z), and derivative at each zero.

y1p_zeros(nt[, complex])

Compute nt zeros of Bessel derivative Y1'(z), and value at each zero.

Faster versions of common Bessel functions#

j0(x[, out])

Bessel function of the first kind of order 0.

j1(x[, out])

Bessel function of the first kind of order 1.

y0(x[, out])

Bessel function of the second kind of order 0.

y1(x[, out])

Bessel function of the second kind of order 1.

i0(x[, out])

Modified Bessel function of order 0.

i0e(x[, out])

Exponentially scaled modified Bessel function of order 0.

i1(x[, out])

Modified Bessel function of order 1.

i1e(x[, out])

Exponentially scaled modified Bessel function of order 1.

k0(x[, out])

Modified Bessel function of the second kind of order 0, \(K_0\).

k0e(x[, out])

Exponentially scaled modified Bessel function K of order 0

k1(x[, out])

Modified Bessel function of the second kind of order 1, \(K_1(x)\).

k1e(x[, out])

Exponentially scaled modified Bessel function K of order 1

Integrals of Bessel functions#

itj0y0(x[, out])

Integrals of Bessel functions of the first kind of order 0.

it2j0y0(x[, out])

Integrals related to Bessel functions of the first kind of order 0.

iti0k0(x[, out])

Integrals of modified Bessel functions of order 0.

it2i0k0(x[, out])

Integrals related to modified Bessel functions of order 0.

besselpoly(a, lmb, nu[, out])

Weighted integral of the Bessel function of the first kind.

Derivatives of Bessel functions#

jvp(v, z[, n])

Compute derivatives of Bessel functions of the first kind.

yvp(v, z[, n])

Compute derivatives of Bessel functions of the second kind.

kvp(v, z[, n])

Compute derivatives of real-order modified Bessel function Kv(z)

ivp(v, z[, n])

Compute derivatives of modified Bessel functions of the first kind.

h1vp(v, z[, n])

Compute derivatives of Hankel function H1v(z) with respect to z.

h2vp(v, z[, n])

Compute derivatives of Hankel function H2v(z) with respect to z.

Spherical Bessel functions#

spherical_jn(n, z[, derivative])

Spherical Bessel function of the first kind or its derivative.

spherical_yn(n, z[, derivative])

Spherical Bessel function of the second kind or its derivative.

spherical_in(n, z[, derivative])

Modified spherical Bessel function of the first kind or its derivative.

spherical_kn(n, z[, derivative])

Modified spherical Bessel function of the second kind or its derivative.

Riccati-Bessel functions#

The following functions do not accept NumPy arrays (they are not universal functions):

riccati_jn(n, x)

Compute Ricatti-Bessel function of the first kind and its derivative.

riccati_yn(n, x)

Compute Ricatti-Bessel function of the second kind and its derivative.

Struve functions#

struve(v, x[, out])

Struve function.

modstruve(v, x[, out])

Modified Struve function.

itstruve0(x[, out])

Integral of the Struve function of order 0.

it2struve0(x[, out])

Integral related to the Struve function of order 0.

itmodstruve0(x[, out])

Integral of the modified Struve function of order 0.

Raw statistical functions#

See also

scipy.stats: Friendly versions of these functions.

Binomial distribution#

bdtr(k, n, p[, out])

Binomial distribution cumulative distribution function.

bdtrc(k, n, p[, out])

Binomial distribution survival function.

bdtri(k, n, y[, out])

Inverse function to bdtr with respect to p.

bdtrik(y, n, p[, out])

Inverse function to bdtr with respect to k.

bdtrin(k, y, p[, out])

Inverse function to bdtr with respect to n.

Beta distribution#

btdtr(a, b, x[, out])

Cumulative distribution function of the beta distribution.

btdtri(a, b, p[, out])

The p-th quantile of the beta distribution.

btdtria(p, b, x[, out])

Inverse of btdtr with respect to a.

btdtrib(a, p, x[, out])

Inverse of btdtr with respect to b.

F distribution#

fdtr(dfn, dfd, x[, out])

F cumulative distribution function.

fdtrc(dfn, dfd, x[, out])

F survival function.

fdtri(dfn, dfd, p[, out])

The p-th quantile of the F-distribution.

fdtridfd(dfn, p, x[, out])

Inverse to fdtr vs dfd

Gamma distribution#

gdtr(a, b, x[, out])

Gamma distribution cumulative distribution function.

gdtrc(a, b, x[, out])

Gamma distribution survival function.

gdtria(p, b, x[, out])

Inverse of gdtr vs a.

gdtrib(a, p, x[, out])

Inverse of gdtr vs b.

gdtrix(a, b, p[, out])

Inverse of gdtr vs x.

Negative binomial distribution#

nbdtr(k, n, p[, out])

Negative binomial cumulative distribution function.

nbdtrc(k, n, p[, out])

Negative binomial survival function.

nbdtri(k, n, y[, out])

Returns the inverse with respect to the parameter p of y = nbdtr(k, n, p), the negative binomial cumulative distribution function.

nbdtrik(y, n, p[, out])

Negative binomial percentile function.

nbdtrin(k, y, p[, out])

Inverse of nbdtr vs n.

Noncentral F distribution#

ncfdtr(dfn, dfd, nc, f[, out])

Cumulative distribution function of the non-central F distribution.

ncfdtridfd(dfn, p, nc, f[, out])

Calculate degrees of freedom (denominator) for the noncentral F-distribution.

ncfdtridfn(p, dfd, nc, f[, out])

Calculate degrees of freedom (numerator) for the noncentral F-distribution.

ncfdtri(dfn, dfd, nc, p[, out])

Inverse with respect to f of the CDF of the non-central F distribution.

ncfdtrinc(dfn, dfd, p, f[, out])

Calculate non-centrality parameter for non-central F distribution.

Noncentral t distribution#

nctdtr(df, nc, t[, out])

Cumulative distribution function of the non-central t distribution.

nctdtridf(p, nc, t[, out])

Calculate degrees of freedom for non-central t distribution.

nctdtrit(df, nc, p[, out])

Inverse cumulative distribution function of the non-central t distribution.

nctdtrinc(df, p, t[, out])

Calculate non-centrality parameter for non-central t distribution.

Normal distribution#

nrdtrimn(p, std, x[, out])

Calculate mean of normal distribution given other params.

nrdtrisd(mn, p, x[, out])

Calculate standard deviation of normal distribution given other params.

ndtr(x[, out])

Cumulative distribution of the standard normal distribution.

log_ndtr(x[, out])

Logarithm of Gaussian cumulative distribution function.

ndtri(y[, out])

Inverse of ndtr vs x

ndtri_exp(y[, out])

Inverse of log_ndtr vs x.

Poisson distribution#

pdtr(k, m[, out])

Poisson cumulative distribution function.

pdtrc(k, m[, out])

Poisson survival function

pdtri(k, y[, out])

Inverse to pdtr vs m

pdtrik(p, m[, out])

Inverse to pdtr vs k.

Student t distribution#

stdtr(df, t[, out])

Student t distribution cumulative distribution function

stdtridf(p, t[, out])

Inverse of stdtr vs df

stdtrit(df, p[, out])

The p-th quantile of the student t distribution.

Chi square distribution#

chdtr(v, x[, out])

Chi square cumulative distribution function.

chdtrc(v, x[, out])

Chi square survival function.

chdtri(v, p[, out])

Inverse to chdtrc with respect to x.

chdtriv(p, x[, out])

Inverse to chdtr with respect to v.

Non-central chi square distribution#

chndtr(x, df, nc[, out])

Non-central chi square cumulative distribution function

chndtridf(x, p, nc[, out])

Inverse to chndtr vs df

chndtrinc(x, df, p[, out])

Inverse to chndtr vs nc

chndtrix(p, df, nc[, out])

Inverse to chndtr vs x

Kolmogorov distribution#

smirnov(n, d[, out])

Kolmogorov-Smirnov complementary cumulative distribution function

smirnovi(n, p[, out])

Inverse to smirnov

kolmogorov(y[, out])

Complementary cumulative distribution (Survival Function) function of Kolmogorov distribution.

kolmogi(p[, out])

Inverse Survival Function of Kolmogorov distribution

Box-Cox transformation#

boxcox(x, lmbda[, out])

Compute the Box-Cox transformation.

boxcox1p(x, lmbda[, out])

Compute the Box-Cox transformation of 1 + x.

inv_boxcox(y, lmbda[, out])

Compute the inverse of the Box-Cox transformation.

inv_boxcox1p(y, lmbda[, out])

Compute the inverse of the Box-Cox transformation.

Sigmoidal functions#

logit(x[, out])

Logit ufunc for ndarrays.

expit(x[, out])

Expit (a.k.a.

log_expit(x[, out])

Logarithm of the logistic sigmoid function.

Miscellaneous#

tklmbda(x, lmbda[, out])

Cumulative distribution function of the Tukey lambda distribution.

owens_t(h, a[, out])

Owen's T Function.

Information Theory functions#

entr(x[, out])

Elementwise function for computing entropy.

rel_entr(x, y[, out])

Elementwise function for computing relative entropy.

kl_div(x, y[, out])

Elementwise function for computing Kullback-Leibler divergence.

huber(delta, r[, out])

Huber loss function.

pseudo_huber(delta, r[, out])

Pseudo-Huber loss function.

Error function and Fresnel integrals#

erf(z[, out])

Returns the error function of complex argument.

erfc(x[, out])

Complementary error function, 1 - erf(x).

erfcx(x[, out])

Scaled complementary error function, exp(x**2) * erfc(x).

erfi(z[, out])

Imaginary error function, -i erf(i z).

erfinv(y[, out])

Inverse of the error function.

erfcinv(y[, out])

Inverse of the complementary error function.

wofz(z[, out])

Faddeeva function

dawsn(x[, out])

Dawson's integral.

fresnel(z[, out])

Fresnel integrals.

fresnel_zeros(nt)

Compute nt complex zeros of sine and cosine Fresnel integrals S(z) and C(z).

modfresnelp(x[, out])

Modified Fresnel positive integrals

modfresnelm(x[, out])

Modified Fresnel negative integrals

voigt_profile(x, sigma, gamma[, out])

Voigt profile.

The following functions do not accept NumPy arrays (they are not universal functions):

erf_zeros(nt)

Compute the first nt zero in the first quadrant, ordered by absolute value.

fresnelc_zeros(nt)

Compute nt complex zeros of cosine Fresnel integral C(z).

fresnels_zeros(nt)

Compute nt complex zeros of sine Fresnel integral S(z).

Legendre functions#

legendre_p(n, z, *[, diff_n])

Legendre polynomial of the first kind.

legendre_p_all(n, z, *[, diff_n])

All Legendre polynomials of the first kind up to the specified degree n.

assoc_legendre_p(n, m, z, *[, branch_cut, ...])

Associated Legendre polynomial of the first kind.

assoc_legendre_p_all(n, m, z, *[, ...])

All associated Legendre polynomials of the first kind up to the specified degree n and order m.

sph_legendre_p(n, m, theta, *[, diff_n])

Spherical Legendre polynomial of the first kind.

sph_legendre_p_all(n, m, theta, *[, diff_n])

All spherical Legendre polynomials of the first kind up to the specified degree n and order m.

sph_harm_y(n, m, theta, phi, *[, diff_n])

Spherical harmonics.

sph_harm_y_all(n, m, theta, phi, *[, diff_n])

All spherical harmonics up to the specified degree n and order m.

The following functions are in the process of being deprecated in favor of the above, which provide a more flexible and consistent interface.

lpmv(m, v, x[, out])

Associated Legendre function of integer order and real degree.

sph_harm(m, n, theta, phi[, out])

Compute spherical harmonics.

clpmn(m, n, z[, type])

Associated Legendre function of the first kind for complex arguments.

lpn(n, z)

Legendre function of the first kind.

lqn(n, z)

Legendre function of the second kind.

lpmn(m, n, z)

Sequence of associated Legendre functions of the first kind.

lqmn(m, n, z)

Sequence of associated Legendre functions of the second kind.

Ellipsoidal harmonics#

ellip_harm(h2, k2, n, p, s[, signm, signn])

Ellipsoidal harmonic functions E^p_n(l)

ellip_harm_2(h2, k2, n, p, s)

Ellipsoidal harmonic functions F^p_n(l)

ellip_normal(h2, k2, n, p)

Ellipsoidal harmonic normalization constants gamma^p_n

Orthogonal polynomials#

The following functions evaluate values of orthogonal polynomials:

assoc_laguerre(x, n[, k])

Compute the generalized (associated) Laguerre polynomial of degree n and order k.

eval_legendre(n, x[, out])

Evaluate Legendre polynomial at a point.

eval_chebyt(n, x[, out])

Evaluate Chebyshev polynomial of the first kind at a point.

eval_chebyu(n, x[, out])

Evaluate Chebyshev polynomial of the second kind at a point.

eval_chebyc(n, x[, out])

Evaluate Chebyshev polynomial of the first kind on [-2, 2] at a point.

eval_chebys(n, x[, out])

Evaluate Chebyshev polynomial of the second kind on [-2, 2] at a point.

eval_jacobi(n, alpha, beta, x[, out])

Evaluate Jacobi polynomial at a point.

eval_laguerre(n, x[, out])

Evaluate Laguerre polynomial at a point.

eval_genlaguerre(n, alpha, x[, out])

Evaluate generalized Laguerre polynomial at a point.

eval_hermite(n, x[, out])

Evaluate physicist's Hermite polynomial at a point.

eval_hermitenorm(n, x[, out])

Evaluate probabilist's (normalized) Hermite polynomial at a point.

eval_gegenbauer(n, alpha, x[, out])

Evaluate Gegenbauer polynomial at a point.

eval_sh_legendre(n, x[, out])

Evaluate shifted Legendre polynomial at a point.

eval_sh_chebyt(n, x[, out])

Evaluate shifted Chebyshev polynomial of the first kind at a point.

eval_sh_chebyu(n, x[, out])

Evaluate shifted Chebyshev polynomial of the second kind at a point.

eval_sh_jacobi(n, p, q, x[, out])

Evaluate shifted Jacobi polynomial at a point.

The following functions compute roots and quadrature weights for orthogonal polynomials:

roots_legendre(n[, mu])

Gauss-Legendre quadrature.

roots_chebyt(n[, mu])

Gauss-Chebyshev (first kind) quadrature.

roots_chebyu(n[, mu])

Gauss-Chebyshev (second kind) quadrature.

roots_chebyc(n[, mu])

Gauss-Chebyshev (first kind) quadrature.

roots_chebys(n[, mu])

Gauss-Chebyshev (second kind) quadrature.

roots_jacobi(n, alpha, beta[, mu])

Gauss-Jacobi quadrature.

roots_laguerre(n[, mu])

Gauss-Laguerre quadrature.

roots_genlaguerre(n, alpha[, mu])

Gauss-generalized Laguerre quadrature.

roots_hermite(n[, mu])

Gauss-Hermite (physicist's) quadrature.

roots_hermitenorm(n[, mu])

Gauss-Hermite (statistician's) quadrature.

roots_gegenbauer(n, alpha[, mu])

Gauss-Gegenbauer quadrature.

roots_sh_legendre(n[, mu])

Gauss-Legendre (shifted) quadrature.

roots_sh_chebyt(n[, mu])

Gauss-Chebyshev (first kind, shifted) quadrature.

roots_sh_chebyu(n[, mu])

Gauss-Chebyshev (second kind, shifted) quadrature.

roots_sh_jacobi(n, p1, q1[, mu])

Gauss-Jacobi (shifted) quadrature.

The functions below, in turn, return the polynomial coefficients in orthopoly1d objects, which function similarly as numpy.poly1d. The orthopoly1d class also has an attribute weights, which returns the roots, weights, and total weights for the appropriate form of Gaussian quadrature. These are returned in an n x 3 array with roots in the first column, weights in the second column, and total weights in the final column. Note that orthopoly1d objects are converted to poly1d when doing arithmetic, and lose information of the original orthogonal polynomial.

legendre(n[, monic])

Legendre polynomial.

chebyt(n[, monic])

Chebyshev polynomial of the first kind.

chebyu(n[, monic])

Chebyshev polynomial of the second kind.

chebyc(n[, monic])

Chebyshev polynomial of the first kind on \([-2, 2]\).

chebys(n[, monic])

Chebyshev polynomial of the second kind on \([-2, 2]\).

jacobi(n, alpha, beta[, monic])

Jacobi polynomial.

laguerre(n[, monic])

Laguerre polynomial.

genlaguerre(n, alpha[, monic])

Generalized (associated) Laguerre polynomial.

hermite(n[, monic])

Physicist's Hermite polynomial.

hermitenorm(n[, monic])

Normalized (probabilist's) Hermite polynomial.

gegenbauer(n, alpha[, monic])

Gegenbauer (ultraspherical) polynomial.

sh_legendre(n[, monic])

Shifted Legendre polynomial.

sh_chebyt(n[, monic])

Shifted Chebyshev polynomial of the first kind.

sh_chebyu(n[, monic])

Shifted Chebyshev polynomial of the second kind.

sh_jacobi(n, p, q[, monic])

Shifted Jacobi polynomial.

Warning

Computing values of high-order polynomials (around order > 20) using polynomial coefficients is numerically unstable. To evaluate polynomial values, the eval_* functions should be used instead.

Hypergeometric functions#

hyp2f1(a, b, c, z[, out])

Gauss hypergeometric function 2F1(a, b; c; z)

hyp1f1(a, b, x[, out])

Confluent hypergeometric function 1F1.

hyperu(a, b, x[, out])

Confluent hypergeometric function U

hyp0f1(v, z[, out])

Confluent hypergeometric limit function 0F1.

Parabolic cylinder functions#

pbdv(v, x[, out])

Parabolic cylinder function D

pbvv(v, x[, out])

Parabolic cylinder function V

pbwa(a, x[, out])

Parabolic cylinder function W.

The following functions do not accept NumPy arrays (they are not universal functions):

pbdv_seq(v, x)

Parabolic cylinder functions Dv(x) and derivatives.

pbvv_seq(v, x)

Parabolic cylinder functions Vv(x) and derivatives.

pbdn_seq(n, z)

Parabolic cylinder functions Dn(z) and derivatives.

Spheroidal wave functions#

pro_ang1(m, n, c, x[, out])

Prolate spheroidal angular function of the first kind and its derivative

pro_rad1(m, n, c, x[, out])

Prolate spheroidal radial function of the first kind and its derivative

pro_rad2(m, n, c, x[, out])

Prolate spheroidal radial function of the second kind and its derivative

obl_ang1(m, n, c, x[, out])

Oblate spheroidal angular function of the first kind and its derivative

obl_rad1(m, n, c, x[, out])

Oblate spheroidal radial function of the first kind and its derivative

obl_rad2(m, n, c, x[, out])

Oblate spheroidal radial function of the second kind and its derivative.

pro_cv(m, n, c[, out])

Characteristic value of prolate spheroidal function

obl_cv(m, n, c[, out])

Characteristic value of oblate spheroidal function

pro_cv_seq(m, n, c)

Characteristic values for prolate spheroidal wave functions.

obl_cv_seq(m, n, c)

Characteristic values for oblate spheroidal wave functions.

The following functions require pre-computed characteristic value:

pro_ang1_cv(m, n, c, cv, x[, out])

Prolate spheroidal angular function pro_ang1 for precomputed characteristic value

pro_rad1_cv(m, n, c, cv, x[, out])

Prolate spheroidal radial function pro_rad1 for precomputed characteristic value

pro_rad2_cv(m, n, c, cv, x[, out])

Prolate spheroidal radial function pro_rad2 for precomputed characteristic value

obl_ang1_cv(m, n, c, cv, x[, out])

Oblate spheroidal angular function obl_ang1 for precomputed characteristic value

obl_rad1_cv(m, n, c, cv, x[, out])

Oblate spheroidal radial function obl_rad1 for precomputed characteristic value

obl_rad2_cv(m, n, c, cv, x[, out])

Oblate spheroidal radial function obl_rad2 for precomputed characteristic value

Kelvin functions#

kelvin(x[, out])

Kelvin functions as complex numbers

kelvin_zeros(nt)

Compute nt zeros of all Kelvin functions.

ber(x[, out])

Kelvin function ber.

bei(x[, out])

Kelvin function bei.

berp(x[, out])

Derivative of the Kelvin function ber.

beip(x[, out])

Derivative of the Kelvin function bei.

ker(x[, out])

Kelvin function ker.

kei(x[, out])

Kelvin function kei.

kerp(x[, out])

Derivative of the Kelvin function ker.

keip(x[, out])

Derivative of the Kelvin function kei.

The following functions do not accept NumPy arrays (they are not universal functions):

ber_zeros(nt)

Compute nt zeros of the Kelvin function ber.

bei_zeros(nt)

Compute nt zeros of the Kelvin function bei.

berp_zeros(nt)

Compute nt zeros of the derivative of the Kelvin function ber.

beip_zeros(nt)

Compute nt zeros of the derivative of the Kelvin function bei.

ker_zeros(nt)

Compute nt zeros of the Kelvin function ker.

kei_zeros(nt)

Compute nt zeros of the Kelvin function kei.

kerp_zeros(nt)

Compute nt zeros of the derivative of the Kelvin function ker.

keip_zeros(nt)

Compute nt zeros of the derivative of the Kelvin function kei.

Combinatorics#

comb(N, k, *[, exact, repetition])

The number of combinations of N things taken k at a time.

perm(N, k[, exact])

Permutations of N things taken k at a time, i.e., k-permutations of N.

stirling2(N, K, *[, exact])

Generate Stirling number(s) of the second kind.

Other special functions#

agm(a, b[, out])

Compute the arithmetic-geometric mean of a and b.

bernoulli(n)

Bernoulli numbers B0..Bn (inclusive).

binom(x, y[, out])

Binomial coefficient considered as a function of two real variables.

diric(x, n)

Periodic sinc function, also called the Dirichlet function.

euler(n)

Euler numbers E(0), E(1), ..., E(n).

expn(n, x[, out])

Generalized exponential integral En.

exp1(z[, out])

Exponential integral E1.

expi(x[, out])

Exponential integral Ei.

factorial(n[, exact])

The factorial of a number or array of numbers.

factorial2(n[, exact])

Double factorial.

factorialk(n, k[, exact])

Multifactorial of n of order k, n(!!...!).

shichi(x[, out])

Hyperbolic sine and cosine integrals.

sici(x[, out])

Sine and cosine integrals.

softmax(x[, axis])

Compute the softmax function.

log_softmax(x[, axis])

Compute the logarithm of the softmax function.

spence(z[, out])

Spence's function, also known as the dilogarithm.

zeta(x[, q, out])

Riemann or Hurwitz zeta function.

zetac(x[, out])

Riemann zeta function minus 1.

Convenience functions#

cbrt(x[, out])

Element-wise cube root of x.

exp10(x[, out])

Compute 10**x element-wise.

exp2(x[, out])

Compute 2**x element-wise.

radian(d, m, s[, out])

Convert from degrees to radians.

cosdg(x[, out])

Cosine of the angle x given in degrees.

sindg(x[, out])

Sine of the angle x given in degrees.

tandg(x[, out])

Tangent of angle x given in degrees.

cotdg(x[, out])

Cotangent of the angle x given in degrees.

log1p(x[, out])

Calculates log(1 + x) for use when x is near zero.

expm1(x[, out])

Compute exp(x) - 1.

cosm1(x[, out])

cos(x) - 1 for use when x is near zero.

powm1(x, y[, out])

Computes x**y - 1.

round(x[, out])

Round to the nearest integer.

xlogy(x, y[, out])

Compute x*log(y) so that the result is 0 if x = 0.

xlog1py(x, y[, out])

Compute x*log1p(y) so that the result is 0 if x = 0.

logsumexp(a[, axis, b, keepdims, return_sign])

Compute the log of the sum of exponentials of input elements.

exprel(x[, out])

Relative error exponential, (exp(x) - 1)/x.

sinc(x)

Return the normalized sinc function.