Special functions (scipy.special) — SciPy v1.16.0 Manual (original) (raw)

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.

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, except for memory allocation errors, which result in an exception being raised. To query and control the current error handling state the following functions are provided.

Available functions#

Airy functions#

Elliptic functions and integrals#

Bessel functions#

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

Zeros of Bessel functions#

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

Faster versions of common Bessel functions#

Integrals of Bessel functions#

Derivatives of Bessel functions#

Spherical Bessel functions#

Riccati-Bessel functions#

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

Struve functions#

Raw statistical functions#

See also

scipy.stats: Friendly versions of these functions.

Binomial distribution#

Beta distribution#

F distribution#

Gamma distribution#

Negative binomial distribution#

Noncentral F distribution#

Noncentral t distribution#

Normal distribution#

Poisson distribution#

Student t distribution#

Chi square distribution#

Non-central chi square distribution#

Kolmogorov distribution#

Box-Cox transformation#

Sigmoidal functions#

Miscellaneous#

Information Theory functions#

Error function and Fresnel integrals#

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

Legendre functions#

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

Ellipsoidal harmonics#

Orthogonal polynomials#

The following functions evaluate values of orthogonal polynomials:

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

The functions below, in turn, return the polynomial coefficients inorthopoly1d 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.

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#

Parabolic cylinder functions#

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

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

The following return both function and first derivative:

Spheroidal wave functions#

The following functions require pre-computed characteristic value:

Kelvin functions#

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

Combinatorics#

Other special functions#

Convenience functions#