添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

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.

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.

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.

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 .

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.

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.

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.

kolmogorov (y[, out])

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

kolmogi (p[, out])

Inverse Survival Function of Kolmogorov distribution

tklmbda (x, lmbda[, out])

Cumulative distribution function of the Tukey lambda distribution.

owens_t (h, a[, out])

Owen's T Function.

betainccinv (a, b, y[, out])

Inverse of the complemented regularized incomplete beta function.

psi (z[, out])

The digamma function.

rgamma (z[, out])

Reciprocal of the gamma function.

polygamma (n, x)

Polygamma functions.

multigammaln (a, d)

Returns the log of multivariate gamma, also sometimes called the generalized gamma.

digamma (z[, out])

The digamma function.

poch (z, m[, out])

Pochhammer symbol.

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.

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).

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.

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 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.

mathieu_even_coef (m, q)

Fourier coefficients for even Mathieu and modified Mathieu functions.

mathieu_odd_coef (m, q)

Fourier coefficients for even Mathieu and modified Mathieu functions.

mathieu_modcem1 (m, q, x[, out])

Even modified Mathieu function of the first kind and its derivative

mathieu_modcem2 (m, q, x[, out])

Even modified Mathieu function of the second kind and its derivative

mathieu_modsem1 (m, q, x[, out])

Odd modified Mathieu function of the first kind and its derivative

mathieu_modsem2 (m, q, x[, out])

Odd modified Mathieu function of the second kind and its derivative

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.

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

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.

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.

  • Zeros of Bessel functions
  • Faster versions of common Bessel functions
  • Integrals of Bessel functions
  • Derivatives of Bessel functions
  • Spherical Bessel functions
  • Riccati-Bessel functions
  • Struve functions
  • Raw statistical functions
  •