package scipy

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
val get_py : string -> Py.Object.t

Get an attribute of this module as a Py.Object.t. This is useful to pass a Python function to another function.

val agm : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

agm(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

agm(a, b)

Compute the arithmetic-geometric mean of `a` and `b`.

Start with a_0 = a and b_0 = b and iteratively compute::

a_n+1 = (a_n + b_n)/2 b_n+1 = sqrt(a_n*b_n)

a_n and b_n converge to the same limit as n increases; their common limit is agm(a, b).

Parameters ---------- a, b : array_like Real values only. If the values are both negative, the result is negative. If one value is negative and the other is positive, `nan` is returned.

Returns ------- float The arithmetic-geometric mean of `a` and `b`.

Examples -------- >>> from scipy.special import agm >>> a, b = 24.0, 6.0 >>> agm(a, b) 13.458171481725614

Compare that result to the iteration:

>>> while a != b: ... a, b = (a + b)/2, np.sqrt(a*b) ... print('a = %19.16f b=%19.16f' % (a, b)) ... a = 15.0000000000000000 b=12.0000000000000000 a = 13.5000000000000000 b=13.4164078649987388 a = 13.4582039324993694 b=13.4581390309909850 a = 13.4581714817451772 b=13.4581714817060547 a = 13.4581714817256159 b=13.4581714817256159

When array-like arguments are given, broadcasting applies:

>>> a = np.array([1.5], [3], [6]) # a has shape (3, 1). >>> b = np.array(6, 12, 24, 48) # b has shape (4,). >>> agm(a, b) array([ 3.36454287, 5.42363427, 9.05798751, 15.53650756], [ 4.37037309, 6.72908574, 10.84726853, 18.11597502], [ 6. , 8.74074619, 13.45817148, 21.69453707])

val airy : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

airy(x, out1, out2, out3, out4, / , out=(None, None, None, None), *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

airy(z)

Airy functions and their derivatives.

Parameters ---------- z : array_like Real or complex argument.

Returns ------- Ai, Aip, Bi, Bip : ndarrays Airy functions Ai and Bi, and their derivatives Aip and Bip.

Notes ----- The Airy functions Ai and Bi are two independent solutions of

.. math:: y''(x) = x y(x).

For real `z` in -10, 10, the computation is carried out by calling the Cephes 1_ `airy` routine, which uses power series summation for small `z` and rational minimax approximations for large `z`.

Outside this range, the AMOS 2_ `zairy` and `zbiry` routines are employed. They are computed using power series for :math:`|z| < 1` and the following relations to modified Bessel functions for larger `z` (where :math:`t \equiv 2 z^

/2

/3`):

.. math::

Ai(z) = \frac

\pi \sqrt{3

}

K_

/3

(t)

Ai'(z) = -\fracz\pi \sqrt{3

}

K_

/3

(t)

Bi(z) = \sqrt\frac{z

}

\left(I_

1/3

}

(t) + I_

/3

(t) \right)

Bi'(z) = \fracz\sqrt{3

}

\left(I_

2/3

}

(t) + I_

/3

(t)\right)

See also -------- airye : exponentially scaled Airy functions.

References ---------- .. 1 Cephes Mathematical Functions Library, http://www.netlib.org/cephes/ .. 2 Donald E. Amos, 'AMOS, A Portable Package for Bessel Functions of a Complex Argument and Nonnegative Order', http://netlib.org/amos/

Examples -------- Compute the Airy functions on the interval -15, 5.

>>> from scipy import special >>> x = np.linspace(-15, 5, 201) >>> ai, aip, bi, bip = special.airy(x)

Plot Ai(x) and Bi(x).

>>> import matplotlib.pyplot as plt >>> plt.plot(x, ai, 'r', label='Ai(x)') >>> plt.plot(x, bi, 'b--', label='Bi(x)') >>> plt.ylim(-0.5, 1.0) >>> plt.grid() >>> plt.legend(loc='upper left') >>> plt.show()

val airye : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

airye(x, out1, out2, out3, out4, / , out=(None, None, None, None), *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

airye(z)

Exponentially scaled Airy functions and their derivatives.

Scaling::

eAi = Ai * exp(2.0/3.0*z*sqrt(z)) eAip = Aip * exp(2.0/3.0*z*sqrt(z)) eBi = Bi * exp(-abs(2.0/3.0*(z*sqrt(z)).real)) eBip = Bip * exp(-abs(2.0/3.0*(z*sqrt(z)).real))

Parameters ---------- z : array_like Real or complex argument.

Returns ------- eAi, eAip, eBi, eBip : array_like Airy functions Ai and Bi, and their derivatives Aip and Bip

Notes ----- Wrapper for the AMOS 1_ routines `zairy` and `zbiry`.

See also -------- airy

References ---------- .. 1 Donald E. Amos, 'AMOS, A Portable Package for Bessel Functions of a Complex Argument and Nonnegative Order', http://netlib.org/amos/

val bdtr : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

bdtr(x1, x2, x3, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

bdtr(k, n, p)

Binomial distribution cumulative distribution function.

Sum of the terms 0 through `k` of the Binomial probability density.

.. math:: \mathrmdtr(k, n, p) = \sum_j=0^k {n\choosej

}

p^j (1-p)^n-j

Parameters ---------- k : array_like Number of successes (int). n : array_like Number of events (int). p : array_like Probability of success in a single event (float).

Returns ------- y : ndarray Probability of `k` or fewer successes in `n` independent events with success probabilities of `p`.

Notes ----- The terms are not summed directly; instead the regularized incomplete beta function is employed, according to the formula,

.. math:: \mathrmdtr(k, n, p) = I_

- p

(n - k, k + 1).

Wrapper for the Cephes 1_ routine `bdtr`.

References ---------- .. 1 Cephes Mathematical Functions Library, http://www.netlib.org/cephes/

val bdtrc : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

bdtrc(x1, x2, x3, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

bdtrc(k, n, p)

Binomial distribution survival function.

Sum of the terms `k + 1` through `n` of the binomial probability density,

.. math:: \mathrmdtrc(k, n, p) = \sum_j=k+1^n {n\choosej

}

p^j (1-p)^n-j

Parameters ---------- k : array_like Number of successes (int). n : array_like Number of events (int) p : array_like Probability of success in a single event.

Returns ------- y : ndarray Probability of `k + 1` or more successes in `n` independent events with success probabilities of `p`.

See also -------- bdtr betainc

Notes ----- The terms are not summed directly; instead the regularized incomplete beta function is employed, according to the formula,

.. math:: \mathrmdtrc(k, n, p) = I_p(k + 1, n - k).

Wrapper for the Cephes 1_ routine `bdtrc`.

References ---------- .. 1 Cephes Mathematical Functions Library, http://www.netlib.org/cephes/

val bdtri : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

bdtri(x1, x2, x3, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

bdtri(k, n, y)

Inverse function to `bdtr` with respect to `p`.

Finds the event probability `p` such that the sum of the terms 0 through `k` of the binomial probability density is equal to the given cumulative probability `y`.

Parameters ---------- k : array_like Number of successes (float). n : array_like Number of events (float) y : array_like Cumulative probability (probability of `k` or fewer successes in `n` events).

Returns ------- p : ndarray The event probability such that `bdtr(k, n, p) = y`.

See also -------- bdtr betaincinv

Notes ----- The computation is carried out using the inverse beta integral function and the relation,::

1 - p = betaincinv(n - k, k + 1, y).

Wrapper for the Cephes 1_ routine `bdtri`.

References ---------- .. 1 Cephes Mathematical Functions Library, http://www.netlib.org/cephes/

val bdtrik : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

bdtrik(x1, x2, x3, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

bdtrik(y, n, p)

Inverse function to `bdtr` with respect to `k`.

Finds the number of successes `k` such that the sum of the terms 0 through `k` of the Binomial probability density for `n` events with probability `p` is equal to the given cumulative probability `y`.

Parameters ---------- y : array_like Cumulative probability (probability of `k` or fewer successes in `n` events). n : array_like Number of events (float). p : array_like Success probability (float).

Returns ------- k : ndarray The number of successes `k` such that `bdtr(k, n, p) = y`.

See also -------- bdtr

Notes ----- Formula 26.5.24 of 1_ is used to reduce the binomial distribution to the cumulative incomplete beta distribution.

Computation of `k` involves a search for a value that produces the desired value of `y`. The search relies on the monotonicity of `y` with `k`.

Wrapper for the CDFLIB 2_ Fortran routine `cdfbin`.

References ---------- .. 1 Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972. .. 2 Barry Brown, James Lovato, and Kathy Russell, CDFLIB: Library of Fortran Routines for Cumulative Distribution Functions, Inverses, and Other Parameters.

val bdtrin : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

bdtrin(x1, x2, x3, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

bdtrin(k, y, p)

Inverse function to `bdtr` with respect to `n`.

Finds the number of events `n` such that the sum of the terms 0 through `k` of the Binomial probability density for events with probability `p` is equal to the given cumulative probability `y`.

Parameters ---------- k : array_like Number of successes (float). y : array_like Cumulative probability (probability of `k` or fewer successes in `n` events). p : array_like Success probability (float).

Returns ------- n : ndarray The number of events `n` such that `bdtr(k, n, p) = y`.

See also -------- bdtr

Notes ----- Formula 26.5.24 of 1_ is used to reduce the binomial distribution to the cumulative incomplete beta distribution.

Computation of `n` involves a search for a value that produces the desired value of `y`. The search relies on the monotonicity of `y` with `n`.

Wrapper for the CDFLIB 2_ Fortran routine `cdfbin`.

References ---------- .. 1 Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972. .. 2 Barry Brown, James Lovato, and Kathy Russell, CDFLIB: Library of Fortran Routines for Cumulative Distribution Functions, Inverses, and Other Parameters.

val bei : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

bei(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

bei(x)

Kelvin function bei

val beip : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

beip(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

beip(x)

Derivative of the Kelvin function `bei`

val ber : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

ber(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

ber(x)

Kelvin function ber.

val berp : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

berp(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

berp(x)

Derivative of the Kelvin function `ber`

val besselpoly : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

besselpoly(x1, x2, x3, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

besselpoly(a, lmb, nu)

Weighted integral of a Bessel function.

.. math::

\int_0^1 x^\lambda J_\nu(2 a x) \, dx

where :math:`J_\nu` is a Bessel function and :math:`\lambda=lmb`, :math:`\nu=nu`.

val beta : ?out:[> `Ndarray ] Np.Obj.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

beta(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

beta(a, b, out=None)

Beta function.

This function is defined in 1_ as

.. math::

B(a, b) = \int_0^1 t^a-1(1-t)^-1dt = \frac\Gamma(a)\Gamma(b)\Gamma(a+b),

where :math:`\Gamma` is the gamma function.

Parameters ---------- a, b : array-like Real-valued arguments out : ndarray, optional Optional output array for the function result

Returns ------- scalar or ndarray Value of the beta function

See Also -------- gamma : the gamma function betainc : the incomplete beta function betaln : the natural logarithm of the absolute value of the beta function

References ---------- .. 1 NIST Digital Library of Mathematical Functions, Eq. 5.12.1. https://dlmf.nist.gov/5.12

Examples -------- >>> import scipy.special as sc

The beta function relates to the gamma function by the definition given above:

>>> sc.beta(2, 3) 0.08333333333333333 >>> sc.gamma(2)*sc.gamma(3)/sc.gamma(2 + 3) 0.08333333333333333

As this relationship demonstrates, the beta function is symmetric:

>>> sc.beta(1.7, 2.4) 0.16567527689031739 >>> sc.beta(2.4, 1.7) 0.16567527689031739

This function satisfies :math:`B(1, b) = 1/b`:

>>> sc.beta(1, 4) 0.25

val betainc : ?out:[> `Ndarray ] Np.Obj.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> Py.Object.t

betainc(x1, x2, x3, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

betainc(a, b, x, out=None)

Incomplete beta function.

Computes the incomplete beta function, defined as 1_:

.. math::

I_x(a, b) = \frac\Gamma(a+b)\Gamma(a)\Gamma(b) \int_0^x t^a-1(1-t)^-1dt,

for :math:`0 \leq x \leq 1`.

Parameters ---------- a, b : array-like Positive, real-valued parameters x : array-like Real-valued such that :math:`0 \leq x \leq 1`, the upper limit of integration out : ndarray, optional Optional output array for the function values

Returns ------- array-like Value of the incomplete beta function

See Also -------- beta : beta function betaincinv : inverse of the incomplete beta function

Notes ----- The incomplete beta function is also sometimes defined without the `gamma` terms, in which case the above definition is the so-called regularized incomplete beta function. Under this definition, you can get the incomplete beta function by multiplying the result of the SciPy function by `beta`.

References ---------- .. 1 NIST Digital Library of Mathematical Functions https://dlmf.nist.gov/8.17

Examples --------

Let :math:`B(a, b)` be the `beta` function.

>>> import scipy.special as sc

The coefficient in terms of `gamma` is equal to :math:`1/B(a, b)`. Also, when :math:`x=1` the integral is equal to :math:`B(a, b)`. Therefore, :math:`I_x=1(a, b) = 1` for any :math:`a, b`.

>>> sc.betainc(0.2, 3.5, 1.0) 1.0

It satisfies :math:`I_x(a, b) = x^a F(a, 1-b, a+1, x)/ (aB(a, b))`, where :math:`F` is the hypergeometric function `hyp2f1`:

>>> a, b, x = 1.4, 3.1, 0.5 >>> x**a * sc.hyp2f1(a, 1 - b, a + 1, x)/(a * sc.beta(a, b)) 0.8148904036225295 >>> sc.betainc(a, b, x) 0.8148904036225296

This functions satisfies the relationship :math:`I_x(a, b) = 1 - I_

-x

(b, a)`:

>>> sc.betainc(2.2, 3.1, 0.4) 0.49339638807619446 >>> 1 - sc.betainc(3.1, 2.2, 1 - 0.4) 0.49339638807619446

val betaincinv : ?out:[> `Ndarray ] Np.Obj.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

betaincinv(x1, x2, x3, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

betaincinv(a, b, y, out=None)

Inverse of the incomplete beta function.

Computes :math:`x` such that:

.. math::

y = I_x(a, b) = \frac\Gamma(a+b)\Gamma(a)\Gamma(b) \int_0^x t^a-1(1-t)^-1dt,

where :math:`I_x` is the normalized incomplete beta function `betainc` and :math:`\Gamma` is the `gamma` function 1_.

Parameters ---------- a, b : array-like Positive, real-valued parameters y : array-like Real-valued input out : ndarray, optional Optional output array for function values

Returns ------- array-like Value of the inverse of the incomplete beta function

See Also -------- betainc : incomplete beta function gamma : gamma function

References ---------- .. 1 NIST Digital Library of Mathematical Functions https://dlmf.nist.gov/8.17

Examples -------- >>> import scipy.special as sc

This function is the inverse of `betainc` for fixed values of :math:`a` and :math:`b`.

>>> a, b = 1.2, 3.1 >>> y = sc.betainc(a, b, 0.2) >>> sc.betaincinv(a, b, y) 0.2 >>> >>> a, b = 7.5, 0.4 >>> x = sc.betaincinv(a, b, 0.5) >>> sc.betainc(a, b, x) 0.5

val betaln : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

betaln(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

betaln(a, b)

Natural logarithm of absolute value of beta function.

Computes ``ln(abs(beta(a, b)))``.

val binom : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

binom(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

binom(n, k)

Binomial coefficient

See Also -------- comb : The number of combinations of N things taken k at a time.

val boxcox : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

boxcox(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

boxcox(x, lmbda)

Compute the Box-Cox transformation.

The Box-Cox transformation is::

y = (x**lmbda - 1) / lmbda if lmbda != 0 log(x) if lmbda == 0

Returns `nan` if ``x < 0``. Returns `-inf` if ``x == 0`` and ``lmbda < 0``.

Parameters ---------- x : array_like Data to be transformed. lmbda : array_like Power parameter of the Box-Cox transform.

Returns ------- y : array Transformed data.

Notes -----

.. versionadded:: 0.14.0

Examples -------- >>> from scipy.special import boxcox >>> boxcox(1, 4, 10, 2.5) array( 0. , 12.4 , 126.09110641) >>> boxcox(2, 0, 1, 2) array( 0.69314718, 1. , 1.5 )

val boxcox1p : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

boxcox1p(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

boxcox1p(x, lmbda)

Compute the Box-Cox transformation of 1 + `x`.

The Box-Cox transformation computed by `boxcox1p` is::

y = ((1+x)**lmbda - 1) / lmbda if lmbda != 0 log(1+x) if lmbda == 0

Returns `nan` if ``x < -1``. Returns `-inf` if ``x == -1`` and ``lmbda < 0``.

Parameters ---------- x : array_like Data to be transformed. lmbda : array_like Power parameter of the Box-Cox transform.

Returns ------- y : array Transformed data.

Notes -----

.. versionadded:: 0.14.0

Examples -------- >>> from scipy.special import boxcox1p >>> boxcox1p(1e-4, 0, 0.5, 1) array( 9.99950003e-05, 9.99975001e-05, 1.00000000e-04) >>> boxcox1p(0.01, 0.1, 0.25) array( 0.00996272, 0.09645476)

val btdtr : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

btdtr(x1, x2, x3, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

btdtr(a, b, x)

Cumulative distribution function of the beta distribution.

Returns the integral from zero to `x` of the beta probability density function,

.. math:: I = \int_0^x \frac\Gamma(a + b)\Gamma(a)\Gamma(b) t^a-1 (1-t)^-1\,dt

where :math:`\Gamma` is the gamma function.

Parameters ---------- a : array_like Shape parameter (a > 0). b : array_like Shape parameter (b > 0). x : array_like Upper limit of integration, in 0, 1.

Returns ------- I : ndarray Cumulative distribution function of the beta distribution with parameters `a` and `b` at `x`.

See Also -------- betainc

Notes ----- This function is identical to the incomplete beta integral function `betainc`.

Wrapper for the Cephes 1_ routine `btdtr`.

References ---------- .. 1 Cephes Mathematical Functions Library, http://www.netlib.org/cephes/

val btdtri : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

btdtri(x1, x2, x3, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

btdtri(a, b, p)

The `p`-th quantile of the beta distribution.

This function is the inverse of the beta cumulative distribution function, `btdtr`, returning the value of `x` for which `btdtr(a, b, x) = p`, or

.. math:: p = \int_0^x \frac\Gamma(a + b)\Gamma(a)\Gamma(b) t^a-1 (1-t)^-1\,dt

Parameters ---------- a : array_like Shape parameter (`a` > 0). b : array_like Shape parameter (`b` > 0). p : array_like Cumulative probability, in 0, 1.

Returns ------- x : ndarray The quantile corresponding to `p`.

See Also -------- betaincinv btdtr

Notes ----- The value of `x` is found by interval halving or Newton iterations.

Wrapper for the Cephes 1_ routine `incbi`, which solves the equivalent problem of finding the inverse of the incomplete beta integral.

References ---------- .. 1 Cephes Mathematical Functions Library, http://www.netlib.org/cephes/

val btdtria : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

btdtria(x1, x2, x3, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

btdtria(p, b, x)

Inverse of `btdtr` with respect to `a`.

This is the inverse of the beta cumulative distribution function, `btdtr`, considered as a function of `a`, returning the value of `a` for which `btdtr(a, b, x) = p`, or

.. math:: p = \int_0^x \frac\Gamma(a + b)\Gamma(a)\Gamma(b) t^a-1 (1-t)^-1\,dt

Parameters ---------- p : array_like Cumulative probability, in 0, 1. b : array_like Shape parameter (`b` > 0). x : array_like The quantile, in 0, 1.

Returns ------- a : ndarray The value of the shape parameter `a` such that `btdtr(a, b, x) = p`.

See Also -------- btdtr : Cumulative distribution function of the beta distribution. btdtri : Inverse with respect to `x`. btdtrib : Inverse with respect to `b`.

Notes ----- Wrapper for the CDFLIB 1_ Fortran routine `cdfbet`.

The cumulative distribution function `p` is computed using a routine by DiDinato and Morris 2_. Computation of `a` involves a search for a value that produces the desired value of `p`. The search relies on the monotonicity of `p` with `a`.

References ---------- .. 1 Barry Brown, James Lovato, and Kathy Russell, CDFLIB: Library of Fortran Routines for Cumulative Distribution Functions, Inverses, and Other Parameters. .. 2 DiDinato, A. R. and Morris, A. H., Algorithm 708: Significant Digit Computation of the Incomplete Beta Function Ratios. ACM Trans. Math. Softw. 18 (1993), 360-373.

val btdtrib : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

btdtrib(x1, x2, x3, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

btdtria(a, p, x)

Inverse of `btdtr` with respect to `b`.

This is the inverse of the beta cumulative distribution function, `btdtr`, considered as a function of `b`, returning the value of `b` for which `btdtr(a, b, x) = p`, or

.. math:: p = \int_0^x \frac\Gamma(a + b)\Gamma(a)\Gamma(b) t^a-1 (1-t)^-1\,dt

Parameters ---------- a : array_like Shape parameter (`a` > 0). p : array_like Cumulative probability, in 0, 1. x : array_like The quantile, in 0, 1.

Returns ------- b : ndarray The value of the shape parameter `b` such that `btdtr(a, b, x) = p`.

See Also -------- btdtr : Cumulative distribution function of the beta distribution. btdtri : Inverse with respect to `x`. btdtria : Inverse with respect to `a`.

Notes ----- Wrapper for the CDFLIB 1_ Fortran routine `cdfbet`.

The cumulative distribution function `p` is computed using a routine by DiDinato and Morris 2_. Computation of `b` involves a search for a value that produces the desired value of `p`. The search relies on the monotonicity of `p` with `b`.

References ---------- .. 1 Barry Brown, James Lovato, and Kathy Russell, CDFLIB: Library of Fortran Routines for Cumulative Distribution Functions, Inverses, and Other Parameters. .. 2 DiDinato, A. R. and Morris, A. H., Algorithm 708: Significant Digit Computation of the Incomplete Beta Function Ratios. ACM Trans. Math. Softw. 18 (1993), 360-373.

val cbrt : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> Py.Object.t

cbrt(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

cbrt(x)

Element-wise cube root of `x`.

Parameters ---------- x : array_like `x` must contain real numbers.

Returns ------- float The cube root of each value in `x`.

Examples -------- >>> from scipy.special import cbrt

>>> cbrt(8) 2.0 >>> cbrt(-8, -3, 0.125, 1.331) array(-2. , -1.44224957, 0.5 , 1.1 )

val chdtr : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

chdtr(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

chdtr(v, x)

Chi square cumulative distribution function

Returns the area under the left hand tail (from 0 to `x`) of the Chi square probability density function with `v` degrees of freedom::

1/(2**(v/2) * gamma(v/2)) * integral(t**(v/2-1) * exp(-t/2), t=0..x)

val chdtrc : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

chdtrc(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

chdtrc(v, x)

Chi square survival function

Returns the area under the right hand tail (from `x` to infinity) of the Chi square probability density function with `v` degrees of freedom::

1/(2**(v/2) * gamma(v/2)) * integral(t**(v/2-1) * exp(-t/2), t=x..inf)

val chdtri : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

chdtri(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

chdtri(v, p)

Inverse to `chdtrc`

Returns the argument x such that ``chdtrc(v, x) == p``.

val chdtriv : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

chdtriv(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

chdtriv(p, x)

Inverse to `chdtr` vs `v`

Returns the argument v such that ``chdtr(v, x) == p``.

val chndtr : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

chndtr(x1, x2, x3, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

chndtr(x, df, nc)

Non-central chi square cumulative distribution function

val chndtridf : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

chndtridf(x1, x2, x3, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

chndtridf(x, p, nc)

Inverse to `chndtr` vs `df`

val chndtrinc : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

chndtrinc(x1, x2, x3, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

chndtrinc(x, df, p)

Inverse to `chndtr` vs `nc`

val chndtrix : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

chndtrix(x1, x2, x3, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

chndtrix(p, df, nc)

Inverse to `chndtr` vs `x`

val cosdg : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

cosdg(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

cosdg(x)

Cosine of the angle `x` given in degrees.

val cosm1 : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

cosm1(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

cosm1(x)

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

val cotdg : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

cotdg(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

cotdg(x)

Cotangent of the angle `x` given in degrees.

val dawsn : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

dawsn(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

dawsn(x)

Dawson's integral.

Computes::

exp(-x**2) * integral(exp(t**2), t=0..x).

See Also -------- wofz, erf, erfc, erfcx, erfi

References ---------- .. 1 Steven G. Johnson, Faddeeva W function implementation. http://ab-initio.mit.edu/Faddeeva

Examples -------- >>> from scipy import special >>> import matplotlib.pyplot as plt >>> x = np.linspace(-15, 15, num=1000) >>> plt.plot(x, special.dawsn(x)) >>> plt.xlabel('$x$') >>> plt.ylabel('$dawsn(x)$') >>> plt.show()

val ellipe : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

ellipe(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

ellipe(m)

Complete elliptic integral of the second kind

This function is defined as

.. math:: E(m) = \int_0^\pi/2 1 - m \sin(t)^2^

/2

dt

Parameters ---------- m : array_like Defines the parameter of the elliptic integral.

Returns ------- E : ndarray Value of the elliptic integral.

Notes ----- Wrapper for the Cephes 1_ routine `ellpe`.

For `m > 0` the computation uses the approximation,

.. math:: E(m) \approx P(1-m) - (1-m) \log(1-m) Q(1-m),

where :math:`P` and :math:`Q` are tenth-order polynomials. For `m < 0`, the relation

.. math:: E(m) = E(m/(m - 1)) \sqrt(1-m)

is used.

The parameterization in terms of :math:`m` follows that of section 17.2 in 2_. Other parameterizations in terms of the complementary parameter :math:`1 - m`, modular angle :math:`\sin^2(\alpha) = m`, or modulus :math:`k^2 = m` are also used, so be careful that you choose the correct parameter.

See Also -------- ellipkm1 : Complete elliptic integral of the first kind, near `m` = 1 ellipk : Complete elliptic integral of the first kind ellipkinc : Incomplete elliptic integral of the first kind ellipeinc : Incomplete elliptic integral of the second kind

References ---------- .. 1 Cephes Mathematical Functions Library, http://www.netlib.org/cephes/ .. 2 Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972.

Examples -------- This function is used in finding the circumference of an ellipse with semi-major axis `a` and semi-minor axis `b`.

>>> from scipy import special

>>> a = 3.5 >>> b = 2.1 >>> e_sq = 1.0 - b**2/a**2 # eccentricity squared

Then the circumference is found using the following:

>>> C = 4*a*special.ellipe(e_sq) # circumference formula >>> C 17.868899204378693

When `a` and `b` are the same (meaning eccentricity is 0), this reduces to the circumference of a circle.

>>> 4*a*special.ellipe(0.0) # formula for ellipse with a = b 21.991148575128552 >>> 2*np.pi*a # formula for circle of radius a 21.991148575128552

val ellipeinc : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

ellipeinc(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

ellipeinc(phi, m)

Incomplete elliptic integral of the second kind

This function is defined as

.. math:: E(\phi, m) = \int_0^\phi 1 - m \sin(t)^2^

/2

dt

Parameters ---------- phi : array_like amplitude of the elliptic integral.

m : array_like parameter of the elliptic integral.

Returns ------- E : ndarray Value of the elliptic integral.

Notes ----- Wrapper for the Cephes 1_ routine `ellie`.

Computation uses arithmetic-geometric means algorithm.

The parameterization in terms of :math:`m` follows that of section 17.2 in 2_. Other parameterizations in terms of the complementary parameter :math:`1 - m`, modular angle :math:`\sin^2(\alpha) = m`, or modulus :math:`k^2 = m` are also used, so be careful that you choose the correct parameter.

See Also -------- ellipkm1 : Complete elliptic integral of the first kind, near `m` = 1 ellipk : Complete elliptic integral of the first kind ellipkinc : Incomplete elliptic integral of the first kind ellipe : Complete elliptic integral of the second kind

References ---------- .. 1 Cephes Mathematical Functions Library, http://www.netlib.org/cephes/ .. 2 Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972.

val ellipj : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

ellipj(x1, x2, out1, out2, out3, out4, / , out=(None, None, None, None), *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

ellipj(u, m)

Jacobian elliptic functions

Calculates the Jacobian elliptic functions of parameter `m` between 0 and 1, and real argument `u`.

Parameters ---------- m : array_like Parameter. u : array_like Argument.

Returns ------- sn, cn, dn, ph : ndarrays The returned functions::

sn(u|m), cn(u|m), dn(u|m)

The value `ph` is such that if `u = ellipkinc(ph, m)`, then `sn(u|m) = sin(ph)` and `cn(u|m) = cos(ph)`.

Notes ----- Wrapper for the Cephes 1_ routine `ellpj`.

These functions are periodic, with quarter-period on the real axis equal to the complete elliptic integral `ellipk(m)`.

Relation to incomplete elliptic integral: If `u = ellipkinc(phi,m)`, then `sn(u|m) = sin(phi)`, and `cn(u|m) = cos(phi)`. The `phi` is called the amplitude of `u`.

Computation is by means of the arithmetic-geometric mean algorithm, except when `m` is within 1e-9 of 0 or 1. In the latter case with `m` close to 1, the approximation applies only for `phi < pi/2`.

See also -------- ellipk : Complete elliptic integral of the first kind ellipkinc : Incomplete elliptic integral of the first kind

References ---------- .. 1 Cephes Mathematical Functions Library, http://www.netlib.org/cephes/

val ellipk : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

ellipk(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

ellipk(m)

Complete elliptic integral of the first kind.

This function is defined as

.. math:: K(m) = \int_0^\pi/2 1 - m \sin(t)^2^

1/2

}

dt

Parameters ---------- m : array_like The parameter of the elliptic integral.

Returns ------- K : array_like Value of the elliptic integral.

Notes ----- For more precision around point m = 1, use `ellipkm1`, which this function calls.

The parameterization in terms of :math:`m` follows that of section 17.2 in 1_. Other parameterizations in terms of the complementary parameter :math:`1 - m`, modular angle :math:`\sin^2(\alpha) = m`, or modulus :math:`k^2 = m` are also used, so be careful that you choose the correct parameter.

See Also -------- ellipkm1 : Complete elliptic integral of the first kind around m = 1 ellipkinc : Incomplete elliptic integral of the first kind ellipe : Complete elliptic integral of the second kind ellipeinc : Incomplete elliptic integral of the second kind

References ---------- .. 1 Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972.

val ellipkinc : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

ellipkinc(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

ellipkinc(phi, m)

Incomplete elliptic integral of the first kind

This function is defined as

.. math:: K(\phi, m) = \int_0^\phi 1 - m \sin(t)^2^

1/2

}

dt

This function is also called `F(phi, m)`.

Parameters ---------- phi : array_like amplitude of the elliptic integral

m : array_like parameter of the elliptic integral

Returns ------- K : ndarray Value of the elliptic integral

Notes ----- Wrapper for the Cephes 1_ routine `ellik`. The computation is carried out using the arithmetic-geometric mean algorithm.

The parameterization in terms of :math:`m` follows that of section 17.2 in 2_. Other parameterizations in terms of the complementary parameter :math:`1 - m`, modular angle :math:`\sin^2(\alpha) = m`, or modulus :math:`k^2 = m` are also used, so be careful that you choose the correct parameter.

See Also -------- ellipkm1 : Complete elliptic integral of the first kind, near `m` = 1 ellipk : Complete elliptic integral of the first kind ellipe : Complete elliptic integral of the second kind ellipeinc : Incomplete elliptic integral of the second kind

References ---------- .. 1 Cephes Mathematical Functions Library, http://www.netlib.org/cephes/ .. 2 Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972.

val ellipkm1 : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

ellipkm1(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

ellipkm1(p)

Complete elliptic integral of the first kind around `m` = 1

This function is defined as

.. math:: K(p) = \int_0^\pi/2 1 - m \sin(t)^2^

1/2

}

dt

where `m = 1 - p`.

Parameters ---------- p : array_like Defines the parameter of the elliptic integral as `m = 1 - p`.

Returns ------- K : ndarray Value of the elliptic integral.

Notes ----- Wrapper for the Cephes 1_ routine `ellpk`.

For `p <= 1`, computation uses the approximation,

.. math:: K(p) \approx P(p) - \log(p) Q(p),

where :math:`P` and :math:`Q` are tenth-order polynomials. The argument `p` is used internally rather than `m` so that the logarithmic singularity at `m = 1` will be shifted to the origin; this preserves maximum accuracy. For `p > 1`, the identity

.. math:: K(p) = K(1/p)/\sqrt(p)

is used.

See Also -------- ellipk : Complete elliptic integral of the first kind ellipkinc : Incomplete elliptic integral of the first kind ellipe : Complete elliptic integral of the second kind ellipeinc : Incomplete elliptic integral of the second kind

References ---------- .. 1 Cephes Mathematical Functions Library, http://www.netlib.org/cephes/

val entr : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

entr(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

entr(x)

Elementwise function for computing entropy.

.. math:: \textntr(x) = \begincases - x \log(x) & x > 0 \\ 0 & x = 0 \\ -\infty & \textotherwise \endcases

Parameters ---------- x : ndarray Input array.

Returns ------- res : ndarray The value of the elementwise entropy function at the given points `x`.

See Also -------- kl_div, rel_entr

Notes ----- This function is concave.

.. versionadded:: 0.15.0

val erf : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

erf(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

erf(z)

Returns the error function of complex argument.

It is defined as ``2/sqrt(pi)*integral(exp(-t**2), t=0..z)``.

Parameters ---------- x : ndarray Input array.

Returns ------- res : ndarray The values of the error function at the given points `x`.

See Also -------- erfc, erfinv, erfcinv, wofz, erfcx, erfi

Notes ----- The cumulative of the unit normal distribution is given by ``Phi(z) = 1/21 + erf(z/sqrt(2))``.

References ---------- .. 1 https://en.wikipedia.org/wiki/Error_function .. 2 Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972. http://www.math.sfu.ca/~cbm/aands/page_297.htm .. 3 Steven G. Johnson, Faddeeva W function implementation. http://ab-initio.mit.edu/Faddeeva

Examples -------- >>> from scipy import special >>> import matplotlib.pyplot as plt >>> x = np.linspace(-3, 3) >>> plt.plot(x, special.erf(x)) >>> plt.xlabel('$x$') >>> plt.ylabel('$erf(x)$') >>> plt.show()

val erfc : ?out:[> `Ndarray ] Np.Obj.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> Py.Object.t

erfc(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

erfc(x, out=None)

Complementary error function, ``1 - erf(x)``.

Parameters ---------- x : array_like Real or complex valued argument out : ndarray, optional Optional output array for the function results

Returns ------- scalar or ndarray Values of the complementary error function

See Also -------- erf, erfi, erfcx, dawsn, wofz

References ---------- .. 1 Steven G. Johnson, Faddeeva W function implementation. http://ab-initio.mit.edu/Faddeeva

Examples -------- >>> from scipy import special >>> import matplotlib.pyplot as plt >>> x = np.linspace(-3, 3) >>> plt.plot(x, special.erfc(x)) >>> plt.xlabel('$x$') >>> plt.ylabel('$erfc(x)$') >>> plt.show()

val erfcx : ?out:[> `Ndarray ] Np.Obj.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> Py.Object.t

erfcx(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

erfcx(x, out=None)

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

Parameters ---------- x : array_like Real or complex valued argument out : ndarray, optional Optional output array for the function results

Returns ------- scalar or ndarray Values of the scaled complementary error function

See Also -------- erf, erfc, erfi, dawsn, wofz

Notes -----

.. versionadded:: 0.12.0

References ---------- .. 1 Steven G. Johnson, Faddeeva W function implementation. http://ab-initio.mit.edu/Faddeeva

Examples -------- >>> from scipy import special >>> import matplotlib.pyplot as plt >>> x = np.linspace(-3, 3) >>> plt.plot(x, special.erfcx(x)) >>> plt.xlabel('$x$') >>> plt.ylabel('$erfcx(x)$') >>> plt.show()

val erfi : ?out:[> `Ndarray ] Np.Obj.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

erfi(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

erfi(z, out=None)

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

Parameters ---------- z : array_like Real or complex valued argument out : ndarray, optional Optional output array for the function results

Returns ------- scalar or ndarray Values of the imaginary error function

See Also -------- erf, erfc, erfcx, dawsn, wofz

Notes -----

.. versionadded:: 0.12.0

References ---------- .. 1 Steven G. Johnson, Faddeeva W function implementation. http://ab-initio.mit.edu/Faddeeva

Examples -------- >>> from scipy import special >>> import matplotlib.pyplot as plt >>> x = np.linspace(-3, 3) >>> plt.plot(x, special.erfi(x)) >>> plt.xlabel('$x$') >>> plt.ylabel('$erfi(x)$') >>> plt.show()

val eval_chebyc : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

eval_chebyc(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

eval_chebyc(n, x, out=None)

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

These polynomials are defined as

.. math::

C_n(x) = 2 T_n(x/2)

where :math:`T_n` is a Chebyshev polynomial of the first kind. See 22.5.11 in AS_ for details.

Parameters ---------- n : array_like Degree of the polynomial. If not an integer, the result is determined via the relation to `eval_chebyt`. x : array_like Points at which to evaluate the Chebyshev polynomial

Returns ------- C : ndarray Values of the Chebyshev polynomial

See Also -------- roots_chebyc : roots and quadrature weights of Chebyshev polynomials of the first kind on -2, 2 chebyc : Chebyshev polynomial object numpy.polynomial.chebyshev.Chebyshev : Chebyshev series eval_chebyt : evaluate Chebycshev polynomials of the first kind

References ---------- .. AS Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972.

Examples -------- >>> import scipy.special as sc

They are a scaled version of the Chebyshev polynomials of the first kind.

>>> x = np.linspace(-2, 2, 6) >>> sc.eval_chebyc(3, x) array(-2. , 1.872, 1.136, -1.136, -1.872, 2. ) >>> 2 * sc.eval_chebyt(3, x / 2) array(-2. , 1.872, 1.136, -1.136, -1.872, 2. )

val eval_chebys : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

eval_chebys(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

eval_chebys(n, x, out=None)

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

These polynomials are defined as

.. math::

S_n(x) = U_n(x/2)

where :math:`U_n` is a Chebyshev polynomial of the second kind. See 22.5.13 in AS_ for details.

Parameters ---------- n : array_like Degree of the polynomial. If not an integer, the result is determined via the relation to `eval_chebyu`. x : array_like Points at which to evaluate the Chebyshev polynomial

Returns ------- S : ndarray Values of the Chebyshev polynomial

See Also -------- roots_chebys : roots and quadrature weights of Chebyshev polynomials of the second kind on -2, 2 chebys : Chebyshev polynomial object eval_chebyu : evaluate Chebyshev polynomials of the second kind

References ---------- .. AS Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972.

Examples -------- >>> import scipy.special as sc

They are a scaled version of the Chebyshev polynomials of the second kind.

>>> x = np.linspace(-2, 2, 6) >>> sc.eval_chebys(3, x) array(-4. , 0.672, 0.736, -0.736, -0.672, 4. ) >>> sc.eval_chebyu(3, x / 2) array(-4. , 0.672, 0.736, -0.736, -0.672, 4. )

val eval_chebyt : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

eval_chebyt(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

eval_chebyt(n, x, out=None)

Evaluate Chebyshev polynomial of the first kind at a point.

The Chebyshev polynomials of the first kind can be defined via the Gauss hypergeometric function :math:`{

}

_2F_1` as

.. math::

T_n(x) = {

}

_2F_1(n, -n; 1/2; (1 - x)/2).

When :math:`n` is an integer the result is a polynomial of degree :math:`n`. See 22.5.47 in AS_ for details.

Parameters ---------- n : array_like Degree of the polynomial. If not an integer, the result is determined via the relation to the Gauss hypergeometric function. x : array_like Points at which to evaluate the Chebyshev polynomial

Returns ------- T : ndarray Values of the Chebyshev polynomial

See Also -------- roots_chebyt : roots and quadrature weights of Chebyshev polynomials of the first kind chebyu : Chebychev polynomial object eval_chebyu : evaluate Chebyshev polynomials of the second kind hyp2f1 : Gauss hypergeometric function numpy.polynomial.chebyshev.Chebyshev : Chebyshev series

Notes ----- This routine is numerically stable for `x` in ``-1, 1`` at least up to order ``10000``.

References ---------- .. AS Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972.

val eval_chebyu : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

eval_chebyu(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

eval_chebyu(n, x, out=None)

Evaluate Chebyshev polynomial of the second kind at a point.

The Chebyshev polynomials of the second kind can be defined via the Gauss hypergeometric function :math:`{

}

_2F_1` as

.. math::

U_n(x) = (n + 1) {

}

_2F_1(-n, n + 2; 3/2; (1 - x)/2).

When :math:`n` is an integer the result is a polynomial of degree :math:`n`. See 22.5.48 in AS_ for details.

Parameters ---------- n : array_like Degree of the polynomial. If not an integer, the result is determined via the relation to the Gauss hypergeometric function. x : array_like Points at which to evaluate the Chebyshev polynomial

Returns ------- U : ndarray Values of the Chebyshev polynomial

See Also -------- roots_chebyu : roots and quadrature weights of Chebyshev polynomials of the second kind chebyu : Chebyshev polynomial object eval_chebyt : evaluate Chebyshev polynomials of the first kind hyp2f1 : Gauss hypergeometric function

References ---------- .. AS Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972.

val eval_gegenbauer : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

eval_gegenbauer(x1, x2, x3, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

eval_gegenbauer(n, alpha, x, out=None)

Evaluate Gegenbauer polynomial at a point.

The Gegenbauer polynomials can be defined via the Gauss hypergeometric function :math:`{

}

_2F_1` as

.. math::

C_n^(\alpha) = \frac(2\alpha)_n\Gamma(n + 1) {

}

_2F_1(-n, 2\alpha + n; \alpha + 1/2; (1 - z)/2).

When :math:`n` is an integer the result is a polynomial of degree :math:`n`. See 22.5.46 in AS_ for details.

Parameters ---------- n : array_like Degree of the polynomial. If not an integer, the result is determined via the relation to the Gauss hypergeometric function. alpha : array_like Parameter x : array_like Points at which to evaluate the Gegenbauer polynomial

Returns ------- C : ndarray Values of the Gegenbauer polynomial

See Also -------- roots_gegenbauer : roots and quadrature weights of Gegenbauer polynomials gegenbauer : Gegenbauer polynomial object hyp2f1 : Gauss hypergeometric function

References ---------- .. AS Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972.

val eval_genlaguerre : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

eval_genlaguerre(x1, x2, x3, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

eval_genlaguerre(n, alpha, x, out=None)

Evaluate generalized Laguerre polynomial at a point.

The generalized Laguerre polynomials can be defined via the confluent hypergeometric function :math:`{

}

_1F_1` as

.. math::

L_n^(\alpha)(x) = \binomn + \alphan {

}

_1F_1(-n, \alpha + 1, x).

When :math:`n` is an integer the result is a polynomial of degree :math:`n`. See 22.5.54 in AS_ for details. The Laguerre polynomials are the special case where :math:`\alpha = 0`.

Parameters ---------- n : array_like Degree of the polynomial. If not an integer the result is determined via the relation to the confluent hypergeometric function. alpha : array_like Parameter; must have ``alpha > -1`` x : array_like Points at which to evaluate the generalized Laguerre polynomial

Returns ------- L : ndarray Values of the generalized Laguerre polynomial

See Also -------- roots_genlaguerre : roots and quadrature weights of generalized Laguerre polynomials genlaguerre : generalized Laguerre polynomial object hyp1f1 : confluent hypergeometric function eval_laguerre : evaluate Laguerre polynomials

References ---------- .. AS Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972.

val eval_hermite : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

eval_hermite(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

eval_hermite(n, x, out=None)

Evaluate physicist's Hermite polynomial at a point.

Defined by

.. math::

H_n(x) = (-1)^n e^x^2 \fracd^ndx^n e^

x^2

}

;

:math:`H_n` is a polynomial of degree :math:`n`. See 22.11.7 in AS_ for details.

Parameters ---------- n : array_like Degree of the polynomial x : array_like Points at which to evaluate the Hermite polynomial

Returns ------- H : ndarray Values of the Hermite polynomial

See Also -------- roots_hermite : roots and quadrature weights of physicist's Hermite polynomials hermite : physicist's Hermite polynomial object numpy.polynomial.hermite.Hermite : Physicist's Hermite series eval_hermitenorm : evaluate Probabilist's Hermite polynomials

References ---------- .. AS Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972.

val eval_hermitenorm : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

eval_hermitenorm(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

eval_hermitenorm(n, x, out=None)

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

Defined by

.. math::

He_n(x) = (-1)^n e^x^2/2 \fracd^ndx^n e^

x^2/2

}

;

:math:`He_n` is a polynomial of degree :math:`n`. See 22.11.8 in AS_ for details.

Parameters ---------- n : array_like Degree of the polynomial x : array_like Points at which to evaluate the Hermite polynomial

Returns ------- He : ndarray Values of the Hermite polynomial

See Also -------- roots_hermitenorm : roots and quadrature weights of probabilist's Hermite polynomials hermitenorm : probabilist's Hermite polynomial object numpy.polynomial.hermite_e.HermiteE : Probabilist's Hermite series eval_hermite : evaluate physicist's Hermite polynomials

References ---------- .. AS Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972.

val eval_jacobi : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

eval_jacobi(x1, x2, x3, x4, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

eval_jacobi(n, alpha, beta, x, out=None)

Evaluate Jacobi polynomial at a point.

The Jacobi polynomials can be defined via the Gauss hypergeometric function :math:`{

}

_2F_1` as

.. math::

P_n^(\alpha, \beta)(x) = \frac(\alpha + 1)_n\Gamma(n + 1) {

}

_2F_1(-n, 1 + \alpha + \beta + n; \alpha + 1; (1 - z)/2)

where :math:`(\cdot)_n` is the Pochhammer symbol; see `poch`. When :math:`n` is an integer the result is a polynomial of degree :math:`n`. See 22.5.42 in AS_ for details.

Parameters ---------- n : array_like Degree of the polynomial. If not an integer the result is determined via the relation to the Gauss hypergeometric function. alpha : array_like Parameter beta : array_like Parameter x : array_like Points at which to evaluate the polynomial

Returns ------- P : ndarray Values of the Jacobi polynomial

See Also -------- roots_jacobi : roots and quadrature weights of Jacobi polynomials jacobi : Jacobi polynomial object hyp2f1 : Gauss hypergeometric function

References ---------- .. AS Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972.

val eval_laguerre : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

eval_laguerre(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

eval_laguerre(n, x, out=None)

Evaluate Laguerre polynomial at a point.

The Laguerre polynomials can be defined via the confluent hypergeometric function :math:`{

}

_1F_1` as

.. math::

L_n(x) = {

}

_1F_1(-n, 1, x).

See 22.5.16 and 22.5.54 in AS_ for details. When :math:`n` is an integer the result is a polynomial of degree :math:`n`.

Parameters ---------- n : array_like Degree of the polynomial. If not an integer the result is determined via the relation to the confluent hypergeometric function. x : array_like Points at which to evaluate the Laguerre polynomial

Returns ------- L : ndarray Values of the Laguerre polynomial

See Also -------- roots_laguerre : roots and quadrature weights of Laguerre polynomials laguerre : Laguerre polynomial object numpy.polynomial.laguerre.Laguerre : Laguerre series eval_genlaguerre : evaluate generalized Laguerre polynomials

References ---------- .. AS Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972.

val eval_legendre : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

eval_legendre(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

eval_legendre(n, x, out=None)

Evaluate Legendre polynomial at a point.

The Legendre polynomials can be defined via the Gauss hypergeometric function :math:`{

}

_2F_1` as

.. math::

P_n(x) = {

}

_2F_1(-n, n + 1; 1; (1 - x)/2).

When :math:`n` is an integer the result is a polynomial of degree :math:`n`. See 22.5.49 in AS_ for details.

Parameters ---------- n : array_like Degree of the polynomial. If not an integer, the result is determined via the relation to the Gauss hypergeometric function. x : array_like Points at which to evaluate the Legendre polynomial

Returns ------- P : ndarray Values of the Legendre polynomial

See Also -------- roots_legendre : roots and quadrature weights of Legendre polynomials legendre : Legendre polynomial object hyp2f1 : Gauss hypergeometric function numpy.polynomial.legendre.Legendre : Legendre series

References ---------- .. AS Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972.

val eval_sh_chebyt : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

eval_sh_chebyt(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

eval_sh_chebyt(n, x, out=None)

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

These polynomials are defined as

.. math::

T_n^*(x) = T_n(2x - 1)

where :math:`T_n` is a Chebyshev polynomial of the first kind. See 22.5.14 in AS_ for details.

Parameters ---------- n : array_like Degree of the polynomial. If not an integer, the result is determined via the relation to `eval_chebyt`. x : array_like Points at which to evaluate the shifted Chebyshev polynomial

Returns ------- T : ndarray Values of the shifted Chebyshev polynomial

See Also -------- roots_sh_chebyt : roots and quadrature weights of shifted Chebyshev polynomials of the first kind sh_chebyt : shifted Chebyshev polynomial object eval_chebyt : evaluate Chebyshev polynomials of the first kind numpy.polynomial.chebyshev.Chebyshev : Chebyshev series

References ---------- .. AS Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972.

val eval_sh_chebyu : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

eval_sh_chebyu(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

eval_sh_chebyu(n, x, out=None)

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

These polynomials are defined as

.. math::

U_n^*(x) = U_n(2x - 1)

where :math:`U_n` is a Chebyshev polynomial of the first kind. See 22.5.15 in AS_ for details.

Parameters ---------- n : array_like Degree of the polynomial. If not an integer, the result is determined via the relation to `eval_chebyu`. x : array_like Points at which to evaluate the shifted Chebyshev polynomial

Returns ------- U : ndarray Values of the shifted Chebyshev polynomial

See Also -------- roots_sh_chebyu : roots and quadrature weights of shifted Chebychev polynomials of the second kind sh_chebyu : shifted Chebyshev polynomial object eval_chebyu : evaluate Chebyshev polynomials of the second kind

References ---------- .. AS Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972.

val eval_sh_jacobi : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

eval_sh_jacobi(x1, x2, x3, x4, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

eval_sh_jacobi(n, p, q, x, out=None)

Evaluate shifted Jacobi polynomial at a point.

Defined by

.. math::

G_n^(p, q)(x) = \binom

n + p - 1

n^

1

}

P_n^(p - q, q - 1)(2x - 1),

where :math:`P_n^(\cdot, \cdot)` is the n-th Jacobi polynomial. See 22.5.2 in AS_ for details.

Parameters ---------- n : int Degree of the polynomial. If not an integer, the result is determined via the relation to `binom` and `eval_jacobi`. p : float Parameter q : float Parameter

Returns ------- G : ndarray Values of the shifted Jacobi polynomial.

See Also -------- roots_sh_jacobi : roots and quadrature weights of shifted Jacobi polynomials sh_jacobi : shifted Jacobi polynomial object eval_jacobi : evaluate Jacobi polynomials

References ---------- .. AS Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972.

val eval_sh_legendre : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

eval_sh_legendre(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

eval_sh_legendre(n, x, out=None)

Evaluate shifted Legendre polynomial at a point.

These polynomials are defined as

.. math::

P_n^*(x) = P_n(2x - 1)

where :math:`P_n` is a Legendre polynomial. See 2.2.11 in AS_ for details.

Parameters ---------- n : array_like Degree of the polynomial. If not an integer, the value is determined via the relation to `eval_legendre`. x : array_like Points at which to evaluate the shifted Legendre polynomial

Returns ------- P : ndarray Values of the shifted Legendre polynomial

See Also -------- roots_sh_legendre : roots and quadrature weights of shifted Legendre polynomials sh_legendre : shifted Legendre polynomial object eval_legendre : evaluate Legendre polynomials numpy.polynomial.legendre.Legendre : Legendre series

References ---------- .. AS Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972.

val exp1 : ?out:[> `Ndarray ] Np.Obj.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

exp1(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

exp1(z, out=None)

Exponential integral E1.

For complex :math:`z \ne 0` the exponential integral can be defined as 1_

.. math::

E_1(z) = \int_z^\infty \frac^

t

}

}

dt,

where the path of the integral does not cross the negative real axis or pass through the origin.

Parameters ---------- z: array_like Real or complex argument. out: ndarray, optional Optional output array for the function results

Returns ------- scalar or ndarray Values of the exponential integral E1

See Also -------- expi : exponential integral :math:`Ei` expn : generalization of :math:`E_1`

Notes ----- For :math:`x > 0` it is related to the exponential integral :math:`Ei` (see `expi`) via the relation

.. math::

E_1(x) = -Ei(-x).

References ---------- .. 1 Digital Library of Mathematical Functions, 6.2.1 https://dlmf.nist.gov/6.2#E1

Examples -------- >>> import scipy.special as sc

It has a pole at 0.

>>> sc.exp1(0) inf

It has a branch cut on the negative real axis.

>>> sc.exp1(-1) nan >>> sc.exp1(complex(-1, 0)) (-1.8951178163559368-3.141592653589793j) >>> sc.exp1(complex(-1, -0.0)) (-1.8951178163559368+3.141592653589793j)

It approaches 0 along the positive real axis.

>>> sc.exp1(1, 10, 100, 1000) array(2.19383934e-01, 4.15696893e-06, 3.68359776e-46, 0.00000000e+00)

It is related to `expi`.

>>> x = np.array(1, 2, 3, 4) >>> sc.exp1(x) array(0.21938393, 0.04890051, 0.01304838, 0.00377935) >>> -sc.expi(-x) array(0.21938393, 0.04890051, 0.01304838, 0.00377935)

val exp10 : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> Py.Object.t

exp10(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

exp10(x)

Compute ``10**x`` element-wise.

Parameters ---------- x : array_like `x` must contain real numbers.

Returns ------- float ``10**x``, computed element-wise.

Examples -------- >>> from scipy.special import exp10

>>> exp10(3) 1000.0 >>> x = np.array([-1, -0.5, 0], [0.5, 1, 1.5]) >>> exp10(x) array([ 0.1 , 0.31622777, 1. ], [ 3.16227766, 10. , 31.6227766 ])

val exp2 : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> Py.Object.t

exp2(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

exp2(x)

Compute ``2**x`` element-wise.

Parameters ---------- x : array_like `x` must contain real numbers.

Returns ------- float ``2**x``, computed element-wise.

Examples -------- >>> from scipy.special import exp2

>>> exp2(3) 8.0 >>> x = np.array([-1, -0.5, 0], [0.5, 1, 1.5]) >>> exp2(x) array([ 0.5 , 0.70710678, 1. ], [ 1.41421356, 2. , 2.82842712])

val expi : ?out:[> `Ndarray ] Np.Obj.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> Py.Object.t

expi(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

expi(x, out=None)

Exponential integral Ei.

For real :math:`x`, the exponential integral is defined as 1_

.. math::

Ei(x) = \int_

\infty

}

^x \frac^t

dt.

For :math:`x > 0` the integral is understood as a Cauchy principle value.

It is extended to the complex plane by analytic continuation of the function on the interval :math:`(0, \infty)`. The complex variant has a branch cut on the negative real axis.

Parameters ---------- x: array_like Real or complex valued argument out: ndarray, optional Optional output array for the function results

Returns ------- scalar or ndarray Values of the exponential integral

Notes ----- The exponential integrals :math:`E_1` and :math:`Ei` satisfy the relation

.. math::

E_1(x) = -Ei(-x)

for :math:`x > 0`.

See Also -------- exp1 : Exponential integral :math:`E_1` expn : Generalized exponential integral :math:`E_n`

References ---------- .. 1 Digital Library of Mathematical Functions, 6.2.5 https://dlmf.nist.gov/6.2#E5

Examples -------- >>> import scipy.special as sc

It is related to `exp1`.

>>> x = np.array(1, 2, 3, 4) >>> -sc.expi(-x) array(0.21938393, 0.04890051, 0.01304838, 0.00377935) >>> sc.exp1(x) array(0.21938393, 0.04890051, 0.01304838, 0.00377935)

The complex variant has a branch cut on the negative real axis.

>>> import scipy.special as sc >>> sc.expi(-1 + 1e-12j) (-0.21938393439552062+3.1415926535894254j) >>> sc.expi(-1 - 1e-12j) (-0.21938393439552062-3.1415926535894254j)

As the complex variant approaches the branch cut, the real parts approach the value of the real variant.

>>> sc.expi(-1) -0.21938393439552062

The SciPy implementation returns the real variant for complex values on the branch cut.

>>> sc.expi(complex(-1, 0.0)) (-0.21938393439552062-0j) >>> sc.expi(complex(-1, -0.0)) (-0.21938393439552062-0j)

val expit : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

expit(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

expit(x)

Expit (a.k.a. logistic sigmoid) ufunc for ndarrays.

The expit function, also known as the logistic sigmoid function, is defined as ``expit(x) = 1/(1+exp(-x))``. It is the inverse of the logit function.

Parameters ---------- x : ndarray The ndarray to apply expit to element-wise.

Returns ------- out : ndarray An ndarray of the same shape as x. Its entries are `expit` of the corresponding entry of x.

See Also -------- logit

Notes ----- As a ufunc expit takes a number of optional keyword arguments. For more information see `ufuncs <https://docs.scipy.org/doc/numpy/reference/ufuncs.html>`_

.. versionadded:: 0.10.0

Examples -------- >>> from scipy.special import expit, logit

>>> expit(-np.inf, -1.5, 0, 1.5, np.inf) array( 0. , 0.18242552, 0.5 , 0.81757448, 1. )

`logit` is the inverse of `expit`:

>>> logit(expit(-2.5, 0, 3.1, 5.0)) array(-2.5, 0. , 3.1, 5. )

Plot expit(x) for x in -6, 6:

>>> import matplotlib.pyplot as plt >>> x = np.linspace(-6, 6, 121) >>> y = expit(x) >>> plt.plot(x, y) >>> plt.grid() >>> plt.xlim(-6, 6) >>> plt.xlabel('x') >>> plt.title('expit(x)') >>> plt.show()

val expm1 : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> Py.Object.t

expm1(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

expm1(x)

Compute ``exp(x) - 1``.

When `x` is near zero, ``exp(x)`` is near 1, so the numerical calculation of ``exp(x) - 1`` can suffer from catastrophic loss of precision. ``expm1(x)`` is implemented to avoid the loss of precision that occurs when `x` is near zero.

Parameters ---------- x : array_like `x` must contain real numbers.

Returns ------- float ``exp(x) - 1`` computed element-wise.

Examples -------- >>> from scipy.special import expm1

>>> expm1(1.0) 1.7182818284590451 >>> expm1(-0.2, -0.1, 0, 0.1, 0.2) array(-0.18126925, -0.09516258, 0. , 0.10517092, 0.22140276)

The exact value of ``exp(7.5e-13) - 1`` is::

7.5000000000028125000000007031250000001318...*10**-13.

Here is what ``expm1(7.5e-13)`` gives:

>>> expm1(7.5e-13) 7.5000000000028135e-13

Compare that to ``exp(7.5e-13) - 1``, where the subtraction results in a 'catastrophic' loss of precision:

>>> np.exp(7.5e-13) - 1 7.5006667543675576e-13

val expn : ?out:[> `Ndarray ] Np.Obj.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> Py.Object.t

expn(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

expn(n, x, out=None)

Generalized exponential integral En.

For integer :math:`n \geq 0` and real :math:`x \geq 0` the generalized exponential integral is defined as dlmf_

.. math::

E_n(x) = x^n - 1 \int_x^\infty \frac^

t

}

}

^n

dt.

Parameters ---------- n: array_like Non-negative integers x: array_like Real argument out: ndarray, optional Optional output array for the function results

Returns ------- scalar or ndarray Values of the generalized exponential integral

See Also -------- exp1 : special case of :math:`E_n` for :math:`n = 1` expi : related to :math:`E_n` when :math:`n = 1`

References ---------- .. dlmf Digital Library of Mathematical Functions, 8.19.2 https://dlmf.nist.gov/8.19#E2

Examples -------- >>> import scipy.special as sc

Its domain is nonnegative n and x.

>>> sc.expn(-1, 1.0), sc.expn(1, -1.0) (nan, nan)

It has a pole at ``x = 0`` for ``n = 1, 2``; for larger ``n`` it is equal to ``1 / (n - 1)``.

>>> sc.expn(0, 1, 2, 3, 4, 0) array( inf, inf, 1. , 0.5 , 0.33333333)

For n equal to 0 it reduces to ``exp(-x) / x``.

>>> x = np.array(1, 2, 3, 4) >>> sc.expn(0, x) array(0.36787944, 0.06766764, 0.01659569, 0.00457891) >>> np.exp(-x) / x array(0.36787944, 0.06766764, 0.01659569, 0.00457891)

For n equal to 1 it reduces to `exp1`.

>>> sc.expn(1, x) array(0.21938393, 0.04890051, 0.01304838, 0.00377935) >>> sc.exp1(x) array(0.21938393, 0.04890051, 0.01304838, 0.00377935)

val exprel : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> Py.Object.t

exprel(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

exprel(x)

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

When `x` is near zero, ``exp(x)`` is near 1, so the numerical calculation of ``exp(x) - 1`` can suffer from catastrophic loss of precision. ``exprel(x)`` is implemented to avoid the loss of precision that occurs when `x` is near zero.

Parameters ---------- x : ndarray Input array. `x` must contain real numbers.

Returns ------- float ``(exp(x) - 1)/x``, computed element-wise.

See Also -------- expm1

Notes ----- .. versionadded:: 0.17.0

Examples -------- >>> from scipy.special import exprel

>>> exprel(0.01) 1.0050167084168056 >>> exprel(-0.25, -0.1, 0, 0.1, 0.25) array( 0.88479687, 0.95162582, 1. , 1.05170918, 1.13610167)

Compare ``exprel(5e-9)`` to the naive calculation. The exact value is ``1.00000000250000000416...``.

>>> exprel(5e-9) 1.0000000025

>>> (np.exp(5e-9) - 1)/5e-9 0.99999999392252903

val fdtr : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

fdtr(x1, x2, x3, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

fdtr(dfn, dfd, x)

F cumulative distribution function.

Returns the value of the cumulative distribution function of the F-distribution, also known as Snedecor's F-distribution or the Fisher-Snedecor distribution.

The F-distribution with parameters :math:`d_n` and :math:`d_d` is the distribution of the random variable,

.. math:: X = \fracU_n/d_nU_d/d_d,

where :math:`U_n` and :math:`U_d` are random variables distributed :math:`\chi^2`, with :math:`d_n` and :math:`d_d` degrees of freedom, respectively.

Parameters ---------- dfn : array_like First parameter (positive float). dfd : array_like Second parameter (positive float). x : array_like Argument (nonnegative float).

Returns ------- y : ndarray The CDF of the F-distribution with parameters `dfn` and `dfd` at `x`.

Notes ----- The regularized incomplete beta function is used, according to the formula,

.. math:: F(d_n, d_d; x) = I_xd_n/(d_d + xd_n)(d_n/2, d_d/2).

Wrapper for the Cephes 1_ routine `fdtr`.

References ---------- .. 1 Cephes Mathematical Functions Library, http://www.netlib.org/cephes/

val fdtrc : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

fdtrc(x1, x2, x3, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

fdtrc(dfn, dfd, x)

F survival function.

Returns the complemented F-distribution function (the integral of the density from `x` to infinity).

Parameters ---------- dfn : array_like First parameter (positive float). dfd : array_like Second parameter (positive float). x : array_like Argument (nonnegative float).

Returns ------- y : ndarray The complemented F-distribution function with parameters `dfn` and `dfd` at `x`.

See also -------- fdtr

Notes ----- The regularized incomplete beta function is used, according to the formula,

.. math:: F(d_n, d_d; x) = I_d_d/(d_d + xd_n)(d_d/2, d_n/2).

Wrapper for the Cephes 1_ routine `fdtrc`.

References ---------- .. 1 Cephes Mathematical Functions Library, http://www.netlib.org/cephes/

val fdtri : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

fdtri(x1, x2, x3, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

fdtri(dfn, dfd, p)

The `p`-th quantile of the F-distribution.

This function is the inverse of the F-distribution CDF, `fdtr`, returning the `x` such that `fdtr(dfn, dfd, x) = p`.

Parameters ---------- dfn : array_like First parameter (positive float). dfd : array_like Second parameter (positive float). p : array_like Cumulative probability, in 0, 1.

Returns ------- x : ndarray The quantile corresponding to `p`.

Notes ----- The computation is carried out using the relation to the inverse regularized beta function, :math:`I^

1

}

_x(a, b)`. Let :math:`z = I^

1

}

_p(d_d/2, d_n/2).` Then,

.. math:: x = \fracd_d (1 - z)d_n z.

If `p` is such that :math:`x < 0.5`, the following relation is used instead for improved stability: let :math:`z' = I^

1

}

_

- p

(d_n/2, d_d/2).` Then,

.. math:: x = \fracd_d z'd_n (1 - z').

Wrapper for the Cephes 1_ routine `fdtri`.

References ---------- .. 1 Cephes Mathematical Functions Library, http://www.netlib.org/cephes/

val fdtridfd : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

fdtridfd(x1, x2, x3, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

fdtridfd(dfn, p, x)

Inverse to `fdtr` vs dfd

Finds the F density argument dfd such that ``fdtr(dfn, dfd, x) == p``.

val fresnel : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

fresnel(x, out1, out2, / , out=(None, None), *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

fresnel(z, out=None)

Fresnel integrals.

The Fresnel integrals are defined as

.. math::

S(z) &= \int_0^z \cos(\pi t^2 /2) dt \\ C(z) &= \int_0^z \sin(\pi t^2 /2) dt.

See dlmf_ for details.

Parameters ---------- z : array_like Real or complex valued argument out : 2-tuple of ndarrays, optional Optional output arrays for the function results

Returns ------- S, C : 2-tuple of scalar or ndarray Values of the Fresnel integrals

See Also -------- fresnel_zeros : zeros of the Fresnel integrals

References ---------- .. dlmf NIST Digital Library of Mathematical Functions https://dlmf.nist.gov/7.2#iii

Examples -------- >>> import scipy.special as sc

As z goes to infinity along the real axis, S and C converge to 0.5.

>>> S, C = sc.fresnel(0.1, 1, 10, 100, np.inf) >>> S array(0.00052359, 0.43825915, 0.46816998, 0.4968169 , 0.5 ) >>> C array(0.09999753, 0.7798934 , 0.49989869, 0.4999999 , 0.5 )

They are related to the error function `erf`.

>>> z = np.array(1, 2, 3, 4) >>> zeta = 0.5 * np.sqrt(np.pi) * (1 - 1j) * z >>> S, C = sc.fresnel(z) >>> C + 1j*S array(0.7798934 +0.43825915j, 0.48825341+0.34341568j, 0.60572079+0.496313j , 0.49842603+0.42051575j) >>> 0.5 * (1 + 1j) * sc.erf(zeta) array(0.7798934 +0.43825915j, 0.48825341+0.34341568j, 0.60572079+0.496313j , 0.49842603+0.42051575j)

val gamma : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

gamma(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

gamma(z)

Gamma function.

The Gamma function is defined as

.. math::

\Gamma(z) = \int_0^\infty t^z-1 e^

t

}

dt

for :math:`\Re(z) > 0` and is extended to the rest of the complex plane by analytic continuation. See dlmf_ for more details.

Parameters ---------- z : array_like Real or complex valued argument

Returns ------- scalar or ndarray Values of the Gamma function

Notes ----- The Gamma function is often referred to as the generalized factorial since :math:`\Gamma(n + 1) = n!` for natural numbers :math:`n`. More generally it satisfies the recurrence relation :math:`\Gamma(z + 1) = z \cdot \Gamma(z)` for complex :math:`z`, which, combined with the fact that :math:`\Gamma(1) = 1`, implies the above identity for :math:`z = n`.

References ---------- .. dlmf NIST Digital Library of Mathematical Functions https://dlmf.nist.gov/5.2#E1

Examples -------- >>> from scipy.special import gamma, factorial

>>> gamma(0, 0.5, 1, 5) array( inf, 1.77245385, 1. , 24. )

>>> z = 2.5 + 1j >>> gamma(z) (0.77476210455108352+0.70763120437959293j) >>> gamma(z+1), z*gamma(z) # Recurrence property ((1.2292740569981171+2.5438401155000685j), (1.2292740569981158+2.5438401155000658j))

>>> gamma(0.5)**2 # gamma(0.5) = sqrt(pi) 3.1415926535897927

Plot gamma(x) for real x

>>> x = np.linspace(-3.5, 5.5, 2251) >>> y = gamma(x)

>>> import matplotlib.pyplot as plt >>> plt.plot(x, y, 'b', alpha=0.6, label='gamma(x)') >>> k = np.arange(1, 7) >>> plt.plot(k, factorial(k-1), 'k*', alpha=0.6, ... label='(x-1)!, x = 1, 2, ...') >>> plt.xlim(-3.5, 5.5) >>> plt.ylim(-10, 25) >>> plt.grid() >>> plt.xlabel('x') >>> plt.legend(loc='lower right') >>> plt.show()

val gammainc : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> Py.Object.t

gammainc(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

gammainc(a, x)

Regularized lower incomplete gamma function.

It is defined as

.. math::

P(a, x) = \frac

\Gamma(a) \int_0^x t^a - 1e^

t

}

dt

for :math:`a > 0` and :math:`x \geq 0`. See dlmf_ for details.

Parameters ---------- a : array_like Positive parameter x : array_like Nonnegative argument

Returns ------- scalar or ndarray Values of the lower incomplete gamma function

Notes ----- The function satisfies the relation ``gammainc(a, x) + gammaincc(a, x) = 1`` where `gammaincc` is the regularized upper incomplete gamma function.

The implementation largely follows that of boost_.

See also -------- gammaincc : regularized upper incomplete gamma function gammaincinv : inverse of the regularized lower incomplete gamma function with respect to `x` gammainccinv : inverse of the regularized upper incomplete gamma function with respect to `x`

References ---------- .. dlmf NIST Digital Library of Mathematical functions https://dlmf.nist.gov/8.2#E4 .. boost Maddock et. al., 'Incomplete Gamma Functions', https://www.boost.org/doc/libs/1_61_0/libs/math/doc/html/math_toolkit/sf_gamma/igamma.html

Examples -------- >>> import scipy.special as sc

It is the CDF of the gamma distribution, so it starts at 0 and monotonically increases to 1.

>>> sc.gammainc(0.5, 0, 1, 10, 100) array(0. , 0.84270079, 0.99999226, 1. )

It is equal to one minus the upper incomplete gamma function.

>>> a, x = 0.5, 0.4 >>> sc.gammainc(a, x) 0.6289066304773024 >>> 1 - sc.gammaincc(a, x) 0.6289066304773024

val gammaincc : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> Py.Object.t

gammaincc(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

gammaincc(a, x)

Regularized upper incomplete gamma function.

It is defined as

.. math::

Q(a, x) = \frac

\Gamma(a) \int_x^\infty t^a - 1e^

t

}

dt

for :math:`a > 0` and :math:`x \geq 0`. See dlmf_ for details.

Parameters ---------- a : array_like Positive parameter x : array_like Nonnegative argument

Returns ------- scalar or ndarray Values of the upper incomplete gamma function

Notes ----- The function satisfies the relation ``gammainc(a, x) + gammaincc(a, x) = 1`` where `gammainc` is the regularized lower incomplete gamma function.

The implementation largely follows that of boost_.

See also -------- gammainc : regularized lower incomplete gamma function gammaincinv : inverse of the regularized lower incomplete gamma function with respect to `x` gammainccinv : inverse to of the regularized upper incomplete gamma function with respect to `x`

References ---------- .. dlmf NIST Digital Library of Mathematical functions https://dlmf.nist.gov/8.2#E4 .. boost Maddock et. al., 'Incomplete Gamma Functions', https://www.boost.org/doc/libs/1_61_0/libs/math/doc/html/math_toolkit/sf_gamma/igamma.html

Examples -------- >>> import scipy.special as sc

It is the survival function of the gamma distribution, so it starts at 1 and monotonically decreases to 0.

>>> sc.gammaincc(0.5, 0, 1, 10, 100, 1000) array(1.00000000e+00, 1.57299207e-01, 7.74421643e-06, 2.08848758e-45, 0.00000000e+00)

It is equal to one minus the lower incomplete gamma function.

>>> a, x = 0.5, 0.4 >>> sc.gammaincc(a, x) 0.37109336952269756 >>> 1 - sc.gammainc(a, x) 0.37109336952269756

val gammainccinv : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

gammainccinv(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

gammainccinv(a, y)

Inverse of the upper incomplete gamma function with respect to `x`

Given an input :math:`y` between 0 and 1, returns :math:`x` such that :math:`y = Q(a, x)`. Here :math:`Q` is the upper incomplete gamma function; see `gammaincc`. This is well-defined because the upper incomplete gamma function is monotonic as can be seen from its definition in dlmf_.

Parameters ---------- a : array_like Positive parameter y : array_like Argument between 0 and 1, inclusive

Returns ------- scalar or ndarray Values of the inverse of the upper incomplete gamma function

See Also -------- gammaincc : regularized upper incomplete gamma function gammainc : regularized lower incomplete gamma function gammaincinv : inverse of the regularized lower incomplete gamma function with respect to `x`

References ---------- .. dlmf NIST Digital Library of Mathematical Functions https://dlmf.nist.gov/8.2#E4

Examples -------- >>> import scipy.special as sc

It starts at infinity and monotonically decreases to 0.

>>> sc.gammainccinv(0.5, 0, 0.1, 0.5, 1) array( inf, 1.35277173, 0.22746821, 0. )

It inverts the upper incomplete gamma function.

>>> a, x = 0.5, 0, 0.1, 0.5, 1 >>> sc.gammaincc(a, sc.gammainccinv(a, x)) array(0. , 0.1, 0.5, 1. )

>>> a, x = 0.5, 0, 10, 50 >>> sc.gammainccinv(a, sc.gammaincc(a, x)) array( 0., 10., 50.)

val gammaincinv : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

gammaincinv(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

gammaincinv(a, y)

Inverse to the lower incomplete gamma function with respect to `x`.

Given an input :math:`y` between 0 and 1, returns :math:`x` such that :math:`y = P(a, x)`. Here :math:`P` is the regularized lower incomplete gamma function; see `gammainc`. This is well-defined because the lower incomplete gamma function is monotonic as can be seen from its definition in dlmf_.

Parameters ---------- a : array_like Positive parameter y : array_like Parameter between 0 and 1, inclusive

Returns ------- scalar or ndarray Values of the inverse of the lower incomplete gamma function

See Also -------- gammainc : regularized lower incomplete gamma function gammaincc : regularized upper incomplete gamma function gammainccinv : inverse of the regualizred upper incomplete gamma function with respect to `x`

References ---------- .. dlmf NIST Digital Library of Mathematical Functions https://dlmf.nist.gov/8.2#E4

Examples -------- >>> import scipy.special as sc

It starts at 0 and monotonically increases to infinity.

>>> sc.gammaincinv(0.5, 0, 0.1 ,0.5, 1) array(0. , 0.00789539, 0.22746821, inf)

It inverts the lower incomplete gamma function.

>>> a, x = 0.5, 0, 0.1, 0.5, 1 >>> sc.gammainc(a, sc.gammaincinv(a, x)) array(0. , 0.1, 0.5, 1. )

>>> a, x = 0.5, 0, 10, 25 >>> sc.gammaincinv(a, sc.gammainc(a, x)) array( 0. , 10. , 25.00001465)

val gammaln : ?out:[> `Ndarray ] Np.Obj.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> Py.Object.t

gammaln(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

gammaln(x, out=None)

Logarithm of the absolute value of the Gamma function.

Defined as

.. math::

\ln(\lvert\Gamma(x)\rvert)

where :math:`\Gamma` is the Gamma function. For more details on the Gamma function, see dlmf_.

Parameters ---------- x : array_like Real argument out : ndarray, optional Optional output array for the function results

Returns ------- scalar or ndarray Values of the log of the absolute value of Gamma

See Also -------- gammasgn : sign of the gamma function loggamma : principal branch of the logarithm of the gamma function

Notes ----- It is the same function as the Python standard library function :func:`math.lgamma`.

When used in conjunction with `gammasgn`, this function is useful for working in logspace on the real axis without having to deal with complex numbers via the relation ``exp(gammaln(x)) = gammasgn(x) * gamma(x)``.

For complex-valued log-gamma, use `loggamma` instead of `gammaln`.

References ---------- .. dlmf NIST Digital Library of Mathematical Functions https://dlmf.nist.gov/5

Examples -------- >>> import scipy.special as sc

It has two positive zeros.

>>> sc.gammaln(1, 2) array(0., 0.)

It has poles at nonpositive integers.

>>> sc.gammaln(0, -1, -2, -3, -4) array(inf, inf, inf, inf, inf)

It asymptotically approaches ``x * log(x)`` (Stirling's formula).

>>> x = np.array(1e10, 1e20, 1e40, 1e80) >>> sc.gammaln(x) array(2.20258509e+11, 4.50517019e+21, 9.11034037e+41, 1.83206807e+82) >>> x * np.log(x) array(2.30258509e+11, 4.60517019e+21, 9.21034037e+41, 1.84206807e+82)

val gammasgn : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> Py.Object.t

gammasgn(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

gammasgn(x)

Sign of the gamma function.

It is defined as

.. math::

\textgammasgn(x) = \begincases +1 & \Gamma(x) > 0 \\ -1 & \Gamma(x) < 0 \endcases

where :math:`\Gamma` is the Gamma function; see `gamma`. This definition is complete since the Gamma function is never zero; see the discussion after dlmf_.

Parameters ---------- x : array_like Real argument

Returns ------- scalar or ndarray Sign of the Gamma function

Notes ----- The Gamma function can be computed as ``gammasgn(x) * np.exp(gammaln(x))``.

See Also -------- gamma : the Gamma function gammaln : log of the absolute value of the Gamma function loggamma : analytic continuation of the log of the Gamma function

References ---------- .. dlmf NIST Digital Library of Mathematical Functions https://dlmf.nist.gov/5.2#E1

Examples -------- >>> import scipy.special as sc

It is 1 for `x > 0`.

>>> sc.gammasgn(1, 2, 3, 4) array(1., 1., 1., 1.)

It alternates between -1 and 1 for negative integers.

>>> sc.gammasgn(-0.5, -1.5, -2.5, -3.5) array(-1., 1., -1., 1.)

It can be used to compute the Gamma function.

>>> x = 1.5, 0.5, -0.5, -1.5 >>> sc.gammasgn(x) * np.exp(sc.gammaln(x)) array( 0.88622693, 1.77245385, -3.5449077 , 2.3632718 ) >>> sc.gamma(x) array( 0.88622693, 1.77245385, -3.5449077 , 2.3632718 )

val gdtr : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

gdtr(x1, x2, x3, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

gdtr(a, b, x)

Gamma distribution cumulative distribution function.

Returns the integral from zero to `x` of the gamma probability density function,

.. math::

F = \int_0^x \fraca^b\Gamma(b) t^-1 e^

at

}

\,dt,

where :math:`\Gamma` is the gamma function.

Parameters ---------- a : array_like The rate parameter of the gamma distribution, sometimes denoted :math:`\beta` (float). It is also the reciprocal of the scale parameter :math:`\theta`. b : array_like The shape parameter of the gamma distribution, sometimes denoted :math:`\alpha` (float). x : array_like The quantile (upper limit of integration; float).

See also -------- gdtrc : 1 - CDF of the gamma distribution.

Returns ------- F : ndarray The CDF of the gamma distribution with parameters `a` and `b` evaluated at `x`.

Notes ----- The evaluation is carried out using the relation to the incomplete gamma integral (regularized gamma function).

Wrapper for the Cephes 1_ routine `gdtr`.

References ---------- .. 1 Cephes Mathematical Functions Library, http://www.netlib.org/cephes/

val gdtrc : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

gdtrc(x1, x2, x3, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

gdtrc(a, b, x)

Gamma distribution survival function.

Integral from `x` to infinity of the gamma probability density function,

.. math::

F = \int_x^\infty \fraca^b\Gamma(b) t^-1 e^

at

}

\,dt,

where :math:`\Gamma` is the gamma function.

Parameters ---------- a : array_like The rate parameter of the gamma distribution, sometimes denoted :math:`\beta` (float). It is also the reciprocal of the scale parameter :math:`\theta`. b : array_like The shape parameter of the gamma distribution, sometimes denoted :math:`\alpha` (float). x : array_like The quantile (lower limit of integration; float).

Returns ------- F : ndarray The survival function of the gamma distribution with parameters `a` and `b` evaluated at `x`.

See Also -------- gdtr, gdtrix

Notes ----- The evaluation is carried out using the relation to the incomplete gamma integral (regularized gamma function).

Wrapper for the Cephes 1_ routine `gdtrc`.

References ---------- .. 1 Cephes Mathematical Functions Library, http://www.netlib.org/cephes/

val gdtria : ?out:[> `Ndarray ] Np.Obj.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

gdtria(x1, x2, x3, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

gdtria(p, b, x, out=None)

Inverse of `gdtr` vs a.

Returns the inverse with respect to the parameter `a` of ``p = gdtr(a, b, x)``, the cumulative distribution function of the gamma distribution.

Parameters ---------- p : array_like Probability values. b : array_like `b` parameter values of `gdtr(a, b, x)`. `b` is the 'shape' parameter of the gamma distribution. x : array_like Nonnegative real values, from the domain of the gamma distribution. out : ndarray, optional If a fourth argument is given, it must be a numpy.ndarray whose size matches the broadcast result of `a`, `b` and `x`. `out` is then the array returned by the function.

Returns ------- a : ndarray Values of the `a` parameter such that `p = gdtr(a, b, x)`. `1/a` is the 'scale' parameter of the gamma distribution.

See Also -------- gdtr : CDF of the gamma distribution. gdtrib : Inverse with respect to `b` of `gdtr(a, b, x)`. gdtrix : Inverse with respect to `x` of `gdtr(a, b, x)`.

Notes ----- Wrapper for the CDFLIB 1_ Fortran routine `cdfgam`.

The cumulative distribution function `p` is computed using a routine by DiDinato and Morris 2_. Computation of `a` involves a search for a value that produces the desired value of `p`. The search relies on the monotonicity of `p` with `a`.

References ---------- .. 1 Barry Brown, James Lovato, and Kathy Russell, CDFLIB: Library of Fortran Routines for Cumulative Distribution Functions, Inverses, and Other Parameters. .. 2 DiDinato, A. R. and Morris, A. H., Computation of the incomplete gamma function ratios and their inverse. ACM Trans. Math. Softw. 12 (1986), 377-393.

Examples -------- First evaluate `gdtr`.

>>> from scipy.special import gdtr, gdtria >>> p = gdtr(1.2, 3.4, 5.6) >>> print(p) 0.94378087442

Verify the inverse.

>>> gdtria(p, 3.4, 5.6) 1.2

val gdtrib : ?out:[> `Ndarray ] Np.Obj.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

gdtrib(x1, x2, x3, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

gdtrib(a, p, x, out=None)

Inverse of `gdtr` vs b.

Returns the inverse with respect to the parameter `b` of ``p = gdtr(a, b, x)``, the cumulative distribution function of the gamma distribution.

Parameters ---------- a : array_like `a` parameter values of `gdtr(a, b, x)`. `1/a` is the 'scale' parameter of the gamma distribution. p : array_like Probability values. x : array_like Nonnegative real values, from the domain of the gamma distribution. out : ndarray, optional If a fourth argument is given, it must be a numpy.ndarray whose size matches the broadcast result of `a`, `b` and `x`. `out` is then the array returned by the function.

Returns ------- b : ndarray Values of the `b` parameter such that `p = gdtr(a, b, x)`. `b` is the 'shape' parameter of the gamma distribution.

See Also -------- gdtr : CDF of the gamma distribution. gdtria : Inverse with respect to `a` of `gdtr(a, b, x)`. gdtrix : Inverse with respect to `x` of `gdtr(a, b, x)`.

Notes ----- Wrapper for the CDFLIB 1_ Fortran routine `cdfgam`.

The cumulative distribution function `p` is computed using a routine by DiDinato and Morris 2_. Computation of `b` involves a search for a value that produces the desired value of `p`. The search relies on the monotonicity of `p` with `b`.

References ---------- .. 1 Barry Brown, James Lovato, and Kathy Russell, CDFLIB: Library of Fortran Routines for Cumulative Distribution Functions, Inverses, and Other Parameters. .. 2 DiDinato, A. R. and Morris, A. H., Computation of the incomplete gamma function ratios and their inverse. ACM Trans. Math. Softw. 12 (1986), 377-393.

Examples -------- First evaluate `gdtr`.

>>> from scipy.special import gdtr, gdtrib >>> p = gdtr(1.2, 3.4, 5.6) >>> print(p) 0.94378087442

Verify the inverse.

>>> gdtrib(1.2, p, 5.6) 3.3999999999723882

val gdtrix : ?out:[> `Ndarray ] Np.Obj.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

gdtrix(x1, x2, x3, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

gdtrix(a, b, p, out=None)

Inverse of `gdtr` vs x.

Returns the inverse with respect to the parameter `x` of ``p = gdtr(a, b, x)``, the cumulative distribution function of the gamma distribution. This is also known as the p'th quantile of the distribution.

Parameters ---------- a : array_like `a` parameter values of `gdtr(a, b, x)`. `1/a` is the 'scale' parameter of the gamma distribution. b : array_like `b` parameter values of `gdtr(a, b, x)`. `b` is the 'shape' parameter of the gamma distribution. p : array_like Probability values. out : ndarray, optional If a fourth argument is given, it must be a numpy.ndarray whose size matches the broadcast result of `a`, `b` and `x`. `out` is then the array returned by the function.

Returns ------- x : ndarray Values of the `x` parameter such that `p = gdtr(a, b, x)`.

See Also -------- gdtr : CDF of the gamma distribution. gdtria : Inverse with respect to `a` of `gdtr(a, b, x)`. gdtrib : Inverse with respect to `b` of `gdtr(a, b, x)`.

Notes ----- Wrapper for the CDFLIB 1_ Fortran routine `cdfgam`.

The cumulative distribution function `p` is computed using a routine by DiDinato and Morris 2_. Computation of `x` involves a search for a value that produces the desired value of `p`. The search relies on the monotonicity of `p` with `x`.

References ---------- .. 1 Barry Brown, James Lovato, and Kathy Russell, CDFLIB: Library of Fortran Routines for Cumulative Distribution Functions, Inverses, and Other Parameters. .. 2 DiDinato, A. R. and Morris, A. H., Computation of the incomplete gamma function ratios and their inverse. ACM Trans. Math. Softw. 12 (1986), 377-393.

Examples -------- First evaluate `gdtr`.

>>> from scipy.special import gdtr, gdtrix >>> p = gdtr(1.2, 3.4, 5.6) >>> print(p) 0.94378087442

Verify the inverse.

>>> gdtrix(1.2, 3.4, p) 5.5999999999999996

val hankel1 : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

hankel1(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

hankel1(v, z)

Hankel function of the first kind

Parameters ---------- v : array_like Order (float). z : array_like Argument (float or complex).

Returns ------- out : Values of the Hankel function of the first kind.

Notes ----- A wrapper for the AMOS 1_ routine `zbesh`, which carries out the computation using the relation,

.. math:: H^(1)_v(z) = \frac

\imath\pi \exp(-\imath \pi v/2) K_v(z \exp(-\imath\pi/2))

where :math:`K_v` is the modified Bessel function of the second kind. For negative orders, the relation

.. math:: H^(1)_

v

}

(z) = H^(1)_v(z) \exp(\imath\pi v)

is used.

See also -------- hankel1e : this function with leading exponential behavior stripped off.

References ---------- .. 1 Donald E. Amos, 'AMOS, A Portable Package for Bessel Functions of a Complex Argument and Nonnegative Order', http://netlib.org/amos/

val hankel1e : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

hankel1e(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

hankel1e(v, z)

Exponentially scaled Hankel function of the first kind

Defined as::

hankel1e(v, z) = hankel1(v, z) * exp(-1j * z)

Parameters ---------- v : array_like Order (float). z : array_like Argument (float or complex).

Returns ------- out : Values of the exponentially scaled Hankel function.

Notes ----- A wrapper for the AMOS 1_ routine `zbesh`, which carries out the computation using the relation,

.. math:: H^(1)_v(z) = \frac

\imath\pi \exp(-\imath \pi v/2) K_v(z \exp(-\imath\pi/2))

where :math:`K_v` is the modified Bessel function of the second kind. For negative orders, the relation

.. math:: H^(1)_

v

}

(z) = H^(1)_v(z) \exp(\imath\pi v)

is used.

References ---------- .. 1 Donald E. Amos, 'AMOS, A Portable Package for Bessel Functions of a Complex Argument and Nonnegative Order', http://netlib.org/amos/

val hankel2 : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

hankel2(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

hankel2(v, z)

Hankel function of the second kind

Parameters ---------- v : array_like Order (float). z : array_like Argument (float or complex).

Returns ------- out : Values of the Hankel function of the second kind.

Notes ----- A wrapper for the AMOS 1_ routine `zbesh`, which carries out the computation using the relation,

.. math:: H^(2)_v(z) = -\frac

\imath\pi \exp(\imath \pi v/2) K_v(z \exp(\imath\pi/2))

where :math:`K_v` is the modified Bessel function of the second kind. For negative orders, the relation

.. math:: H^(2)_

v

}

(z) = H^(2)_v(z) \exp(-\imath\pi v)

is used.

See also -------- hankel2e : this function with leading exponential behavior stripped off.

References ---------- .. 1 Donald E. Amos, 'AMOS, A Portable Package for Bessel Functions of a Complex Argument and Nonnegative Order', http://netlib.org/amos/

val hankel2e : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

hankel2e(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

hankel2e(v, z)

Exponentially scaled Hankel function of the second kind

Defined as::

hankel2e(v, z) = hankel2(v, z) * exp(1j * z)

Parameters ---------- v : array_like Order (float). z : array_like Argument (float or complex).

Returns ------- out : Values of the exponentially scaled Hankel function of the second kind.

Notes ----- A wrapper for the AMOS 1_ routine `zbesh`, which carries out the computation using the relation,

.. math:: H^(2)_v(z) = -\frac

\imath\pi \exp(\frac\imath \pi v

) K_v(z exp(\frac\imath\pi

))

where :math:`K_v` is the modified Bessel function of the second kind. For negative orders, the relation

.. math:: H^(2)_

v

}

(z) = H^(2)_v(z) \exp(-\imath\pi v)

is used.

References ---------- .. 1 Donald E. Amos, 'AMOS, A Portable Package for Bessel Functions of a Complex Argument and Nonnegative Order', http://netlib.org/amos/

val huber : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

huber(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

huber(delta, r)

Huber loss function.

.. math:: \texthuber(\delta, r) = \begincases \infty & \delta < 0 \\ \frac

r^2 & 0 \le \delta, | r | \le \delta \\ \delta ( |r| - \frac

\delta ) & \textotherwise \endcases

Parameters ---------- delta : ndarray Input array, indicating the quadratic vs. linear loss changepoint. r : ndarray Input array, possibly representing residuals.

Returns ------- res : ndarray The computed Huber loss function values.

Notes ----- This function is convex in r.

.. versionadded:: 0.15.0

val hyp0f1 : ?out:[> `Ndarray ] Np.Obj.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

hyp0f1(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

hyp0f1(v, z, out=None)

Confluent hypergeometric limit function 0F1.

Parameters ---------- v : array_like Real valued parameter z : array_like Real or complex valued argument out : ndarray, optional Optional output array for the function results

Returns ------- scalar or ndarray The confluent hypergeometric limit function

Notes ----- This function is defined as:

.. math:: _0F_1(v, z) = \sum_k=0^\infty\fracz^k(v)_k k!.

It's also the limit as :math:`q \to \infty` of :math:`_1F_1(q; v; z/q)`, and satisfies the differential equation :math:`f''(z) + vf'(z) = f(z)`. See 1_ for more information.

References ---------- .. 1 Wolfram MathWorld, 'Confluent Hypergeometric Limit Function', http://mathworld.wolfram.com/ConfluentHypergeometricLimitFunction.html

Examples -------- >>> import scipy.special as sc

It is one when `z` is zero.

>>> sc.hyp0f1(1, 0) 1.0

It is the limit of the confluent hypergeometric function as `q` goes to infinity.

>>> q = np.array(1, 10, 100, 1000) >>> v = 1 >>> z = 1 >>> sc.hyp1f1(q, v, z / q) array(2.71828183, 2.31481985, 2.28303778, 2.27992985) >>> sc.hyp0f1(v, z) 2.2795853023360673

It is related to Bessel functions.

>>> n = 1 >>> x = np.linspace(0, 1, 5) >>> sc.jv(n, x) array(0. , 0.12402598, 0.24226846, 0.3492436 , 0.44005059) >>> (0.5 * x)**n / sc.factorial(n) * sc.hyp0f1(n + 1, -0.25 * x**2) array(0. , 0.12402598, 0.24226846, 0.3492436 , 0.44005059)

val hyp1f1 : ?out:[> `Ndarray ] Np.Obj.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> Py.Object.t

hyp1f1(x1, x2, x3, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

hyp1f1(a, b, x, out=None)

Confluent hypergeometric function 1F1.

The confluent hypergeometric function is defined by the series

.. math::

{

}

_1F_1(a; b; x) = \sum_k = 0^\infty \frac(a)_k(b)_k k! x^k.

See dlmf_ for more details. Here :math:`(\cdot)_k` is the Pochhammer symbol; see `poch`.

Parameters ---------- a, b : array_like Real parameters x : array_like Real or complex argument out : ndarray, optional Optional output array for the function results

Returns ------- scalar or ndarray Values of the confluent hypergeometric function

See also -------- hyperu : another confluent hypergeometric function hyp0f1 : confluent hypergeometric limit function hyp2f1 : Gaussian hypergeometric function

References ---------- .. dlmf NIST Digital Library of Mathematical Functions https://dlmf.nist.gov/13.2#E2

Examples -------- >>> import scipy.special as sc

It is one when `x` is zero:

>>> sc.hyp1f1(0.5, 0.5, 0) 1.0

It is singular when `b` is a nonpositive integer.

>>> sc.hyp1f1(0.5, -1, 0) inf

It is a polynomial when `a` is a nonpositive integer.

>>> a, b, x = -1, 0.5, np.array(1.0, 2.0, 3.0, 4.0) >>> sc.hyp1f1(a, b, x) array(-1., -3., -5., -7.) >>> 1 + (a / b) * x array(-1., -3., -5., -7.)

It reduces to the exponential function when `a = b`.

>>> sc.hyp1f1(2, 2, 1, 2, 3, 4) array( 2.71828183, 7.3890561 , 20.08553692, 54.59815003) >>> np.exp(1, 2, 3, 4) array( 2.71828183, 7.3890561 , 20.08553692, 54.59815003)

val hyp2f1 : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

hyp2f1(x1, x2, x3, x4, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

hyp2f1(a, b, c, z)

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

Parameters ---------- a, b, c : array_like Arguments, should be real-valued. z : array_like Argument, real or complex.

Returns ------- hyp2f1 : scalar or ndarray The values of the gaussian hypergeometric function.

See also -------- hyp0f1 : confluent hypergeometric limit function. hyp1f1 : Kummer's (confluent hypergeometric) function.

Notes ----- This function is defined for :math:`|z| < 1` as

.. math::

\mathrmhyp2f1(a, b, c, z) = \sum_n=0^\infty \frac(a)_n (b)_n(c)_n\fracz^nn!,

and defined on the rest of the complex z-plane by analytic continuation 1_. Here :math:`(\cdot)_n` is the Pochhammer symbol; see `poch`. When :math:`n` is an integer the result is a polynomial of degree :math:`n`.

The implementation for complex values of ``z`` is described in 2_.

References ---------- .. 1 NIST Digital Library of Mathematical Functions https://dlmf.nist.gov/15.2 .. 2 S. Zhang and J.M. Jin, 'Computation of Special Functions', Wiley 1996 .. 3 Cephes Mathematical Functions Library, http://www.netlib.org/cephes/

Examples -------- >>> import scipy.special as sc

It has poles when `c` is a negative integer.

>>> sc.hyp2f1(1, 1, -2, 1) inf

It is a polynomial when `a` or `b` is a negative integer.

>>> a, b, c = -1, 1, 1.5 >>> z = np.linspace(0, 1, 5) >>> sc.hyp2f1(a, b, c, z) array(1. , 0.83333333, 0.66666667, 0.5 , 0.33333333) >>> 1 + a * b * z / c array(1. , 0.83333333, 0.66666667, 0.5 , 0.33333333)

It is symmetric in `a` and `b`.

>>> a = np.linspace(0, 1, 5) >>> b = np.linspace(0, 1, 5) >>> sc.hyp2f1(a, b, 1, 0.5) array(1. , 1.03997334, 1.1803406 , 1.47074441, 2. ) >>> sc.hyp2f1(b, a, 1, 0.5) array(1. , 1.03997334, 1.1803406 , 1.47074441, 2. )

It contains many other functions as special cases.

>>> z = 0.5 >>> sc.hyp2f1(1, 1, 2, z) 1.3862943611198901 >>> -np.log(1 - z) / z 1.3862943611198906

>>> sc.hyp2f1(0.5, 1, 1.5, z**2) 1.098612288668109 >>> np.log((1 + z) / (1 - z)) / (2 * z) 1.0986122886681098

>>> sc.hyp2f1(0.5, 1, 1.5, -z**2) 0.9272952180016117 >>> np.arctan(z) / z 0.9272952180016123

val hyperu : ?out:[> `Ndarray ] Np.Obj.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> Py.Object.t

hyperu(x1, x2, x3, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

hyperu(a, b, x, out=None)

Confluent hypergeometric function U

It is defined as the solution to the equation

.. math::

x \fracd^2wdx^2 + (b - x) \fracdwdx - aw = 0

which satisfies the property

.. math::

U(a, b, x) \sim x^

a

}

as :math:`x \to \infty`. See dlmf_ for more details.

Parameters ---------- a, b : array_like Real valued parameters x : array_like Real valued argument out : ndarray Optional output array for the function values

Returns ------- scalar or ndarray Values of `U`

References ---------- .. dlmf NIST Digital Library of Mathematics Functions https://dlmf.nist.gov/13.2#E6

Examples -------- >>> import scipy.special as sc

It has a branch cut along the negative `x` axis.

>>> x = np.linspace(-0.1, -10, 5) >>> sc.hyperu(1, 1, x) array(nan, nan, nan, nan, nan)

It approaches zero as `x` goes to infinity.

>>> x = np.array(1, 10, 100) >>> sc.hyperu(1, 1, x) array(0.59634736, 0.09156333, 0.00990194)

It satisfies Kummer's transformation.

>>> a, b, x = 2, 1, 1 >>> sc.hyperu(a, b, x) 0.1926947246463881 >>> x**(1 - b) * sc.hyperu(a - b + 1, 2 - b, x) 0.1926947246463881

val i0 : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

i0(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

i0(x)

Modified Bessel function of order 0.

Defined as,

.. math:: I_0(x) = \sum_k=0^\infty \frac(x^2/4)^k(k!)^2 = J_0(\imath x),

where :math:`J_0` is the Bessel function of the first kind of order 0.

Parameters ---------- x : array_like Argument (float)

Returns ------- I : ndarray Value of the modified Bessel function of order 0 at `x`.

Notes ----- The range is partitioned into the two intervals 0, 8 and (8, infinity). Chebyshev polynomial expansions are employed in each interval.

This function is a wrapper for the Cephes 1_ routine `i0`.

See also -------- iv i0e

References ---------- .. 1 Cephes Mathematical Functions Library, http://www.netlib.org/cephes/

val i0e : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

i0e(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

i0e(x)

Exponentially scaled modified Bessel function of order 0.

Defined as::

i0e(x) = exp(-abs(x)) * i0(x).

Parameters ---------- x : array_like Argument (float)

Returns ------- I : ndarray Value of the exponentially scaled modified Bessel function of order 0 at `x`.

Notes ----- The range is partitioned into the two intervals 0, 8 and (8, infinity). Chebyshev polynomial expansions are employed in each interval. The polynomial expansions used are the same as those in `i0`, but they are not multiplied by the dominant exponential factor.

This function is a wrapper for the Cephes 1_ routine `i0e`.

See also -------- iv i0

References ---------- .. 1 Cephes Mathematical Functions Library, http://www.netlib.org/cephes/

val i1 : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

i1(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

i1(x)

Modified Bessel function of order 1.

Defined as,

.. math:: I_1(x) = \frac

x \sum_k=0^\infty \frac(x^2/4)^kk! (k + 1)! = -\imath J_1(\imath x),

where :math:`J_1` is the Bessel function of the first kind of order 1.

Parameters ---------- x : array_like Argument (float)

Returns ------- I : ndarray Value of the modified Bessel function of order 1 at `x`.

Notes ----- The range is partitioned into the two intervals 0, 8 and (8, infinity). Chebyshev polynomial expansions are employed in each interval.

This function is a wrapper for the Cephes 1_ routine `i1`.

See also -------- iv i1e

References ---------- .. 1 Cephes Mathematical Functions Library, http://www.netlib.org/cephes/

val i1e : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

i1e(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

i1e(x)

Exponentially scaled modified Bessel function of order 1.

Defined as::

i1e(x) = exp(-abs(x)) * i1(x)

Parameters ---------- x : array_like Argument (float)

Returns ------- I : ndarray Value of the exponentially scaled modified Bessel function of order 1 at `x`.

Notes ----- The range is partitioned into the two intervals 0, 8 and (8, infinity). Chebyshev polynomial expansions are employed in each interval. The polynomial expansions used are the same as those in `i1`, but they are not multiplied by the dominant exponential factor.

This function is a wrapper for the Cephes 1_ routine `i1e`.

See also -------- iv i1

References ---------- .. 1 Cephes Mathematical Functions Library, http://www.netlib.org/cephes/

val inv_boxcox : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

inv_boxcox(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

inv_boxcox(y, lmbda)

Compute the inverse of the Box-Cox transformation.

Find ``x`` such that::

y = (x**lmbda - 1) / lmbda if lmbda != 0 log(x) if lmbda == 0

Parameters ---------- y : array_like Data to be transformed. lmbda : array_like Power parameter of the Box-Cox transform.

Returns ------- x : array Transformed data.

Notes -----

.. versionadded:: 0.16.0

Examples -------- >>> from scipy.special import boxcox, inv_boxcox >>> y = boxcox(1, 4, 10, 2.5) >>> inv_boxcox(y, 2.5) array(1., 4., 10.)

val inv_boxcox1p : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

inv_boxcox1p(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

inv_boxcox1p(y, lmbda)

Compute the inverse of the Box-Cox transformation.

Find ``x`` such that::

y = ((1+x)**lmbda - 1) / lmbda if lmbda != 0 log(1+x) if lmbda == 0

Parameters ---------- y : array_like Data to be transformed. lmbda : array_like Power parameter of the Box-Cox transform.

Returns ------- x : array Transformed data.

Notes -----

.. versionadded:: 0.16.0

Examples -------- >>> from scipy.special import boxcox1p, inv_boxcox1p >>> y = boxcox1p(1, 4, 10, 2.5) >>> inv_boxcox1p(y, 2.5) array(1., 4., 10.)

val it2i0k0 : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t * Py.Object.t

it2i0k0(x, out1, out2, / , out=(None, None), *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

it2i0k0(x)

Integrals related to modified Bessel functions of order 0

Returns ------- ii0 ``integral((i0(t)-1)/t, t=0..x)`` ik0 ``integral(k0(t)/t, t=x..inf)``

val it2j0y0 : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t * Py.Object.t

it2j0y0(x, out1, out2, / , out=(None, None), *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

it2j0y0(x)

Integrals related to Bessel functions of order 0

Returns ------- ij0 ``integral((1-j0(t))/t, t=0..x)`` iy0 ``integral(y0(t)/t, t=x..inf)``

val it2struve0 : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

it2struve0(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

it2struve0(x)

Integral related to the Struve function of order 0.

Returns the integral,

.. math:: \int_x^\infty \fracH_0(t)

\,dt

where :math:`H_0` is the Struve function of order 0.

Parameters ---------- x : array_like Lower limit of integration.

Returns ------- I : ndarray The value of the integral.

See also -------- struve

Notes ----- Wrapper for a Fortran routine created by Shanjie Zhang and Jianming Jin 1_.

References ---------- .. 1 Zhang, Shanjie and Jin, Jianming. 'Computation of Special Functions', John Wiley and Sons, 1996. https://people.sc.fsu.edu/~jburkardt/f_src/special_functions/special_functions.html

val itairy : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> Py.Object.t * Py.Object.t * Py.Object.t * Py.Object.t

itairy(x, out1, out2, out3, out4, / , out=(None, None, None, None), *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

itairy(x)

Integrals of Airy functions

Calculates the integrals of Airy functions from 0 to `x`.

Parameters ----------

x: array_like Upper limit of integration (float).

Returns ------- Apt Integral of Ai(t) from 0 to x. Bpt Integral of Bi(t) from 0 to x. Ant Integral of Ai(-t) from 0 to x. Bnt Integral of Bi(-t) from 0 to x.

Notes -----

Wrapper for a Fortran routine created by Shanjie Zhang and Jianming Jin 1_.

References ----------

.. 1 Zhang, Shanjie and Jin, Jianming. 'Computation of Special Functions', John Wiley and Sons, 1996. https://people.sc.fsu.edu/~jburkardt/f_src/special_functions/special_functions.html

val iti0k0 : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

iti0k0(x, out1, out2, / , out=(None, None), *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

iti0k0(x)

Integrals of modified Bessel functions of order 0

Returns simple integrals from 0 to `x` of the zeroth order modified Bessel functions `i0` and `k0`.

Returns ------- ii0, ik0

val itj0y0 : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

itj0y0(x, out1, out2, / , out=(None, None), *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

itj0y0(x)

Integrals of Bessel functions of order 0

Returns simple integrals from 0 to `x` of the zeroth order Bessel functions `j0` and `y0`.

Returns ------- ij0, iy0

val itmodstruve0 : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

itmodstruve0(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

itmodstruve0(x)

Integral of the modified Struve function of order 0.

.. math:: I = \int_0^x L_0(t)\,dt

Parameters ---------- x : array_like Upper limit of integration (float).

Returns ------- I : ndarray The integral of :math:`L_0` from 0 to `x`.

Notes ----- Wrapper for a Fortran routine created by Shanjie Zhang and Jianming Jin 1_.

References ---------- .. 1 Zhang, Shanjie and Jin, Jianming. 'Computation of Special Functions', John Wiley and Sons, 1996. https://people.sc.fsu.edu/~jburkardt/f_src/special_functions/special_functions.html

val itstruve0 : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

itstruve0(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

itstruve0(x)

Integral of the Struve function of order 0.

.. math:: I = \int_0^x H_0(t)\,dt

Parameters ---------- x : array_like Upper limit of integration (float).

Returns ------- I : ndarray The integral of :math:`H_0` from 0 to `x`.

See also -------- struve

Notes ----- Wrapper for a Fortran routine created by Shanjie Zhang and Jianming Jin 1_.

References ---------- .. 1 Zhang, Shanjie and Jin, Jianming. 'Computation of Special Functions', John Wiley and Sons, 1996. https://people.sc.fsu.edu/~jburkardt/f_src/special_functions/special_functions.html

val iv : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

iv(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

iv(v, z)

Modified Bessel function of the first kind of real order.

Parameters ---------- v : array_like Order. If `z` is of real type and negative, `v` must be integer valued. z : array_like of float or complex Argument.

Returns ------- out : ndarray Values of the modified Bessel function.

Notes ----- For real `z` and :math:`v \in -50, 50`, the evaluation is carried out using Temme's method 1_. For larger orders, uniform asymptotic expansions are applied.

For complex `z` and positive `v`, the AMOS 2_ `zbesi` routine is called. It uses a power series for small `z`, the asymptotic expansion for large `abs(z)`, the Miller algorithm normalized by the Wronskian and a Neumann series for intermediate magnitudes, and the uniform asymptotic expansions for :math:`I_v(z)` and :math:`J_v(z)` for large orders. Backward recurrence is used to generate sequences or reduce orders when necessary.

The calculations above are done in the right half plane and continued into the left half plane by the formula,

.. math:: I_v(z \exp(\pm\imath\pi)) = \exp(\pm\pi v) I_v(z)

(valid when the real part of `z` is positive). For negative `v`, the formula

.. math:: I_

v

}

(z) = I_v(z) + \frac

\pi \sin(\pi v) K_v(z)

is used, where :math:`K_v(z)` is the modified Bessel function of the second kind, evaluated using the AMOS routine `zbesk`.

See also -------- kve : This function with leading exponential behavior stripped off.

References ---------- .. 1 Temme, Journal of Computational Physics, vol 21, 343 (1976) .. 2 Donald E. Amos, 'AMOS, A Portable Package for Bessel Functions of a Complex Argument and Nonnegative Order', http://netlib.org/amos/

val ive : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

ive(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

ive(v, z)

Exponentially scaled modified Bessel function of the first kind

Defined as::

ive(v, z) = iv(v, z) * exp(-abs(z.real))

Parameters ---------- v : array_like of float Order. z : array_like of float or complex Argument.

Returns ------- out : ndarray Values of the exponentially scaled modified Bessel function.

Notes ----- For positive `v`, the AMOS 1_ `zbesi` routine is called. It uses a power series for small `z`, the asymptotic expansion for large `abs(z)`, the Miller algorithm normalized by the Wronskian and a Neumann series for intermediate magnitudes, and the uniform asymptotic expansions for :math:`I_v(z)` and :math:`J_v(z)` for large orders. Backward recurrence is used to generate sequences or reduce orders when necessary.

The calculations above are done in the right half plane and continued into the left half plane by the formula,

.. math:: I_v(z \exp(\pm\imath\pi)) = \exp(\pm\pi v) I_v(z)

(valid when the real part of `z` is positive). For negative `v`, the formula

.. math:: I_

v

}

(z) = I_v(z) + \frac

\pi \sin(\pi v) K_v(z)

is used, where :math:`K_v(z)` is the modified Bessel function of the second kind, evaluated using the AMOS routine `zbesk`.

References ---------- .. 1 Donald E. Amos, 'AMOS, A Portable Package for Bessel Functions of a Complex Argument and Nonnegative Order', http://netlib.org/amos/

val j0 : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

j0(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

j0(x)

Bessel function of the first kind of order 0.

Parameters ---------- x : array_like Argument (float).

Returns ------- J : ndarray Value of the Bessel function of the first kind of order 0 at `x`.

Notes ----- The domain is divided into the intervals 0, 5 and (5, infinity). In the first interval the following rational approximation is used:

.. math::

J_0(x) \approx (w - r_1^2)(w - r_2^2) \fracP_3(w)Q_8(w),

where :math:`w = x^2` and :math:`r_1`, :math:`r_2` are the zeros of :math:`J_0`, and :math:`P_3` and :math:`Q_8` are polynomials of degrees 3 and 8, respectively.

In the second interval, the Hankel asymptotic expansion is employed with two rational functions of degree 6/6 and 7/7.

This function is a wrapper for the Cephes 1_ routine `j0`. It should not be confused with the spherical Bessel functions (see `spherical_jn`).

See also -------- jv : Bessel function of real order and complex argument. spherical_jn : spherical Bessel functions.

References ---------- .. 1 Cephes Mathematical Functions Library, http://www.netlib.org/cephes/

val j1 : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

j1(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

j1(x)

Bessel function of the first kind of order 1.

Parameters ---------- x : array_like Argument (float).

Returns ------- J : ndarray Value of the Bessel function of the first kind of order 1 at `x`.

Notes ----- The domain is divided into the intervals 0, 8 and (8, infinity). In the first interval a 24 term Chebyshev expansion is used. In the second, the asymptotic trigonometric representation is employed using two rational functions of degree 5/5.

This function is a wrapper for the Cephes 1_ routine `j1`. It should not be confused with the spherical Bessel functions (see `spherical_jn`).

See also -------- jv spherical_jn : spherical Bessel functions.

References ---------- .. 1 Cephes Mathematical Functions Library, http://www.netlib.org/cephes/

val jn : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

jv(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

jv(v, z)

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

Parameters ---------- v : array_like Order (float). z : array_like Argument (float or complex).

Returns ------- J : ndarray Value of the Bessel function, :math:`J_v(z)`.

Notes ----- For positive `v` values, the computation is carried out using the AMOS 1_ `zbesj` routine, which exploits the connection to the modified Bessel function :math:`I_v`,

.. math:: J_v(z) = \exp(v\pi\imath/2) I_v(-\imath z)\qquad (\Im z > 0)

J_v(z) = \exp(-v\pi\imath/2) I_v(\imath z)\qquad (\Im z < 0)

For negative `v` values the formula,

.. math:: J_

v

}

(z) = J_v(z) \cos(\pi v) - Y_v(z) \sin(\pi v)

is used, where :math:`Y_v(z)` is the Bessel function of the second kind, computed using the AMOS routine `zbesy`. Note that the second term is exactly zero for integer `v`; to improve accuracy the second term is explicitly omitted for `v` values such that `v = floor(v)`.

Not to be confused with the spherical Bessel functions (see `spherical_jn`).

See also -------- jve : :math:`J_v` with leading exponential behavior stripped off. spherical_jn : spherical Bessel functions.

References ---------- .. 1 Donald E. Amos, 'AMOS, A Portable Package for Bessel Functions of a Complex Argument and Nonnegative Order', http://netlib.org/amos/

val jv : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

jv(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

jv(v, z)

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

Parameters ---------- v : array_like Order (float). z : array_like Argument (float or complex).

Returns ------- J : ndarray Value of the Bessel function, :math:`J_v(z)`.

Notes ----- For positive `v` values, the computation is carried out using the AMOS 1_ `zbesj` routine, which exploits the connection to the modified Bessel function :math:`I_v`,

.. math:: J_v(z) = \exp(v\pi\imath/2) I_v(-\imath z)\qquad (\Im z > 0)

J_v(z) = \exp(-v\pi\imath/2) I_v(\imath z)\qquad (\Im z < 0)

For negative `v` values the formula,

.. math:: J_

v

}

(z) = J_v(z) \cos(\pi v) - Y_v(z) \sin(\pi v)

is used, where :math:`Y_v(z)` is the Bessel function of the second kind, computed using the AMOS routine `zbesy`. Note that the second term is exactly zero for integer `v`; to improve accuracy the second term is explicitly omitted for `v` values such that `v = floor(v)`.

Not to be confused with the spherical Bessel functions (see `spherical_jn`).

See also -------- jve : :math:`J_v` with leading exponential behavior stripped off. spherical_jn : spherical Bessel functions.

References ---------- .. 1 Donald E. Amos, 'AMOS, A Portable Package for Bessel Functions of a Complex Argument and Nonnegative Order', http://netlib.org/amos/

val jve : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

jve(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

jve(v, z)

Exponentially scaled Bessel function of order `v`.

Defined as::

jve(v, z) = jv(v, z) * exp(-abs(z.imag))

Parameters ---------- v : array_like Order (float). z : array_like Argument (float or complex).

Returns ------- J : ndarray Value of the exponentially scaled Bessel function.

Notes ----- For positive `v` values, the computation is carried out using the AMOS 1_ `zbesj` routine, which exploits the connection to the modified Bessel function :math:`I_v`,

.. math:: J_v(z) = \exp(v\pi\imath/2) I_v(-\imath z)\qquad (\Im z > 0)

J_v(z) = \exp(-v\pi\imath/2) I_v(\imath z)\qquad (\Im z < 0)

For negative `v` values the formula,

.. math:: J_

v

}

(z) = J_v(z) \cos(\pi v) - Y_v(z) \sin(\pi v)

is used, where :math:`Y_v(z)` is the Bessel function of the second kind, computed using the AMOS routine `zbesy`. Note that the second term is exactly zero for integer `v`; to improve accuracy the second term is explicitly omitted for `v` values such that `v = floor(v)`.

References ---------- .. 1 Donald E. Amos, 'AMOS, A Portable Package for Bessel Functions of a Complex Argument and Nonnegative Order', http://netlib.org/amos/

val k0 : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

k0(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

k0(x)

Modified Bessel function of the second kind of order 0, :math:`K_0`.

This function is also sometimes referred to as the modified Bessel function of the third kind of order 0.

Parameters ---------- x : array_like Argument (float).

Returns ------- K : ndarray Value of the modified Bessel function :math:`K_0` at `x`.

Notes ----- The range is partitioned into the two intervals 0, 2 and (2, infinity). Chebyshev polynomial expansions are employed in each interval.

This function is a wrapper for the Cephes 1_ routine `k0`.

See also -------- kv k0e

References ---------- .. 1 Cephes Mathematical Functions Library, http://www.netlib.org/cephes/

val k0e : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

k0e(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

k0e(x)

Exponentially scaled modified Bessel function K of order 0

Defined as::

k0e(x) = exp(x) * k0(x).

Parameters ---------- x : array_like Argument (float)

Returns ------- K : ndarray Value of the exponentially scaled modified Bessel function K of order 0 at `x`.

Notes ----- The range is partitioned into the two intervals 0, 2 and (2, infinity). Chebyshev polynomial expansions are employed in each interval.

This function is a wrapper for the Cephes 1_ routine `k0e`.

See also -------- kv k0

References ---------- .. 1 Cephes Mathematical Functions Library, http://www.netlib.org/cephes/

val k1 : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

k1(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

k1(x)

Modified Bessel function of the second kind of order 1, :math:`K_1(x)`.

Parameters ---------- x : array_like Argument (float)

Returns ------- K : ndarray Value of the modified Bessel function K of order 1 at `x`.

Notes ----- The range is partitioned into the two intervals 0, 2 and (2, infinity). Chebyshev polynomial expansions are employed in each interval.

This function is a wrapper for the Cephes 1_ routine `k1`.

See also -------- kv k1e

References ---------- .. 1 Cephes Mathematical Functions Library, http://www.netlib.org/cephes/

val k1e : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

k1e(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

k1e(x)

Exponentially scaled modified Bessel function K of order 1

Defined as::

k1e(x) = exp(x) * k1(x)

Parameters ---------- x : array_like Argument (float)

Returns ------- K : ndarray Value of the exponentially scaled modified Bessel function K of order 1 at `x`.

Notes ----- The range is partitioned into the two intervals 0, 2 and (2, infinity). Chebyshev polynomial expansions are employed in each interval.

This function is a wrapper for the Cephes 1_ routine `k1e`.

See also -------- kv k1

References ---------- .. 1 Cephes Mathematical Functions Library, http://www.netlib.org/cephes/

val kei : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

kei(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

kei(x)

Kelvin function ker

val keip : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

keip(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

keip(x)

Derivative of the Kelvin function kei

val kelvin : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

kelvin(x, out1, out2, out3, out4, / , out=(None, None, None, None), *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

kelvin(x)

Kelvin functions as complex numbers

Returns ------- Be, Ke, Bep, Kep The tuple (Be, Ke, Bep, Kep) contains complex numbers representing the real and imaginary Kelvin functions and their derivatives evaluated at `x`. For example, kelvin(x)0.real = ber x and kelvin(x)0.imag = bei x with similar relationships for ker and kei.

val ker : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

ker(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

ker(x)

Kelvin function ker

val kerp : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

kerp(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

kerp(x)

Derivative of the Kelvin function ker

val kl_div : ?out:[> `Ndarray ] Np.Obj.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

kl_div(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

kl_div(x, y, out=None)

Elementwise function for computing Kullback-Leibler divergence.

.. math::

\mathrmkl\_div(x, y) = \begincases x \log(x / y) - x + y & x > 0, y > 0 \\ y & x = 0, y \ge 0 \\ \infty & \textotherwise \endcases

Parameters ---------- x, y : array_like Real arguments out : ndarray, optional Optional output array for the function results

Returns ------- scalar or ndarray Values of the Kullback-Liebler divergence.

See Also -------- entr, rel_entr

Notes ----- .. versionadded:: 0.15.0

This function is non-negative and is jointly convex in `x` and `y`.

The origin of this function is in convex programming; see 1_ for details. This is why the the function contains the extra :math:`-x

  1. y` terms over what might be expected from the Kullback-Leibler divergence. For a version of the function without the extra terms, see `rel_entr`.

References ---------- .. 1 Grant, Boyd, and Ye, 'CVX: Matlab Software for Disciplined Convex Programming', http://cvxr.com/cvx/

val kn : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

kn(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

kn(n, x)

Modified Bessel function of the second kind of integer order `n`

Returns the modified Bessel function of the second kind for integer order `n` at real `z`.

These are also sometimes called functions of the third kind, Basset functions, or Macdonald functions.

Parameters ---------- n : array_like of int Order of Bessel functions (floats will truncate with a warning) z : array_like of float Argument at which to evaluate the Bessel functions

Returns ------- out : ndarray The results

Notes ----- Wrapper for AMOS 1_ routine `zbesk`. For a discussion of the algorithm used, see 2_ and the references therein.

See Also -------- kv : Same function, but accepts real order and complex argument kvp : Derivative of this function

References ---------- .. 1 Donald E. Amos, 'AMOS, A Portable Package for Bessel Functions of a Complex Argument and Nonnegative Order', http://netlib.org/amos/ .. 2 Donald E. Amos, 'Algorithm 644: A portable package for Bessel functions of a complex argument and nonnegative order', ACM TOMS Vol. 12 Issue 3, Sept. 1986, p. 265

Examples -------- Plot the function of several orders for real input:

>>> from scipy.special import kn >>> import matplotlib.pyplot as plt >>> x = np.linspace(0, 5, 1000) >>> for N in range(6): ... plt.plot(x, kn(N, x), label='$K_{

}

(x)$'.format(N)) >>> plt.ylim(0, 10) >>> plt.legend() >>> plt.title(r'Modified Bessel function of the second kind $K_n(x)$') >>> plt.show()

Calculate for a single value at multiple orders:

>>> kn(4, 5, 6, 1) array( 44.23241585, 360.9605896 , 3653.83831186)

val kolmogi : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

kolmogi(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

kolmogi(p)

Inverse Survival Function of Kolmogorov distribution

It is the inverse function to `kolmogorov`. Returns y such that ``kolmogorov(y) == p``.

Parameters ---------- p : float array_like Probability

Returns ------- float The value(s) of kolmogi(p)

Notes ----- `kolmogorov` is used by `stats.kstest` in the application of the Kolmogorov-Smirnov Goodness of Fit test. For historial reasons this function is exposed in `scpy.special`, but the recommended way to achieve the most accurate CDF/SF/PDF/PPF/ISF computations is to use the `stats.kstwobign` distribution.

See Also -------- kolmogorov : The Survival Function for the distribution scipy.stats.kstwobign : Provides the functionality as a continuous distribution smirnov, smirnovi : Functions for the one-sided distribution

Examples -------- >>> from scipy.special import kolmogi >>> kolmogi(0, 0.1, 0.25, 0.5, 0.75, 0.9, 1.0) array( inf, 1.22384787, 1.01918472, 0.82757356, 0.67644769, 0.57117327, 0. )

val kolmogorov : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

kolmogorov(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

kolmogorov(y)

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

Returns the complementary cumulative distribution function of Kolmogorov's limiting distribution (``D_n*\sqrt(n)`` as n goes to infinity) of a two-sided test for equality between an empirical and a theoretical distribution. It is equal to the (limit as n->infinity of the) probability that ``sqrt(n) * max absolute deviation > y``.

Parameters ---------- y : float array_like Absolute deviation between the Empirical CDF (ECDF) and the target CDF, multiplied by sqrt(n).

Returns ------- float The value(s) of kolmogorov(y)

Notes ----- `kolmogorov` is used by `stats.kstest` in the application of the Kolmogorov-Smirnov Goodness of Fit test. For historial reasons this function is exposed in `scpy.special`, but the recommended way to achieve the most accurate CDF/SF/PDF/PPF/ISF computations is to use the `stats.kstwobign` distribution.

See Also -------- kolmogi : The Inverse Survival Function for the distribution scipy.stats.kstwobign : Provides the functionality as a continuous distribution smirnov, smirnovi : Functions for the one-sided distribution

Examples -------- Show the probability of a gap at least as big as 0, 0.5 and 1.0.

>>> from scipy.special import kolmogorov >>> from scipy.stats import kstwobign >>> kolmogorov(0, 0.5, 1.0) array( 1. , 0.96394524, 0.26999967)

Compare a sample of size 1000 drawn from a Laplace(0, 1) distribution against the target distribution, a Normal(0, 1) distribution.

>>> from scipy.stats import norm, laplace >>> n = 1000 >>> np.random.seed(seed=233423) >>> lap01 = laplace(0, 1) >>> x = np.sort(lap01.rvs(n)) >>> np.mean(x), np.std(x) (-0.083073685397609842, 1.3676426568399822)

Construct the Empirical CDF and the K-S statistic Dn.

>>> target = norm(0,1) # Normal mean 0, stddev 1 >>> cdfs = target.cdf(x) >>> ecdfs = np.arange(n+1, dtype=float)/n >>> gaps = np.column_stack(cdfs - ecdfs[:n], ecdfs[1:] - cdfs) >>> Dn = np.max(gaps) >>> Kn = np.sqrt(n) * Dn >>> print('Dn=%f, sqrt(n)*Dn=%f' % (Dn, Kn)) Dn=0.058286, sqrt(n)*Dn=1.843153 >>> print(chr(10).join('For a sample of size n drawn from a N(0, 1) distribution:', ... ' the approximate Kolmogorov probability that sqrt(n)*Dn>=%f is %f' % (Kn, kolmogorov(Kn)), ... ' the approximate Kolmogorov probability that sqrt(n)*Dn<=%f is %f' % (Kn, kstwobign.cdf(Kn)))) For a sample of size n drawn from a N(0, 1) distribution: the approximate Kolmogorov probability that sqrt(n)*Dn>=1.843153 is 0.002240 the approximate Kolmogorov probability that sqrt(n)*Dn<=1.843153 is 0.997760

Plot the Empirical CDF against the target N(0, 1) CDF.

>>> import matplotlib.pyplot as plt >>> plt.step(np.concatenate([-3], x), ecdfs, where='post', label='Empirical CDF') >>> x3 = np.linspace(-3, 3, 100) >>> plt.plot(x3, target.cdf(x3), label='CDF for N(0, 1)') >>> plt.ylim(0, 1); plt.grid(True); plt.legend(); >>> # Add vertical lines marking Dn+ and Dn- >>> iminus, iplus = np.argmax(gaps, axis=0) >>> plt.vlines(x[iminus], ecdfsiminus, cdfsiminus, color='r', linestyle='dashed', lw=4) >>> plt.vlines(x[iplus], cdfsiplus, ecdfsiplus+1, color='r', linestyle='dashed', lw=4) >>> plt.show()

val kv : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

kv(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

kv(v, z)

Modified Bessel function of the second kind of real order `v`

Returns the modified Bessel function of the second kind for real order `v` at complex `z`.

These are also sometimes called functions of the third kind, Basset functions, or Macdonald functions. They are defined as those solutions of the modified Bessel equation for which,

.. math:: K_v(x) \sim \sqrt\pi/(2x) \exp(-x)

as :math:`x \to \infty` 3_.

Parameters ---------- v : array_like of float Order of Bessel functions z : array_like of complex Argument at which to evaluate the Bessel functions

Returns ------- out : ndarray The results. Note that input must be of complex type to get complex output, e.g. ``kv(3, -2+0j)`` instead of ``kv(3, -2)``.

Notes ----- Wrapper for AMOS 1_ routine `zbesk`. For a discussion of the algorithm used, see 2_ and the references therein.

See Also -------- kve : This function with leading exponential behavior stripped off. kvp : Derivative of this function

References ---------- .. 1 Donald E. Amos, 'AMOS, A Portable Package for Bessel Functions of a Complex Argument and Nonnegative Order', http://netlib.org/amos/ .. 2 Donald E. Amos, 'Algorithm 644: A portable package for Bessel functions of a complex argument and nonnegative order', ACM TOMS Vol. 12 Issue 3, Sept. 1986, p. 265 .. 3 NIST Digital Library of Mathematical Functions, Eq. 10.25.E3. https://dlmf.nist.gov/10.25.E3

Examples -------- Plot the function of several orders for real input:

>>> from scipy.special import kv >>> import matplotlib.pyplot as plt >>> x = np.linspace(0, 5, 1000) >>> for N in np.linspace(0, 6, 5): ... plt.plot(x, kv(N, x), label='$K_{{

}

}

(x)$'.format(N)) >>> plt.ylim(0, 10) >>> plt.legend() >>> plt.title(r'Modified Bessel function of the second kind $K_\nu(x)$') >>> plt.show()

Calculate for a single value at multiple orders:

>>> kv(4, 4.5, 5, 1+2j) array( 0.1992+2.3892j, 2.3493+3.6j , 7.2827+3.8104j)

val kve : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

kve(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

kve(v, z)

Exponentially scaled modified Bessel function of the second kind.

Returns the exponentially scaled, modified Bessel function of the second kind (sometimes called the third kind) for real order `v` at complex `z`::

kve(v, z) = kv(v, z) * exp(z)

Parameters ---------- v : array_like of float Order of Bessel functions z : array_like of complex Argument at which to evaluate the Bessel functions

Returns ------- out : ndarray The exponentially scaled modified Bessel function of the second kind.

Notes ----- Wrapper for AMOS 1_ routine `zbesk`. For a discussion of the algorithm used, see 2_ and the references therein.

References ---------- .. 1 Donald E. Amos, 'AMOS, A Portable Package for Bessel Functions of a Complex Argument and Nonnegative Order', http://netlib.org/amos/ .. 2 Donald E. Amos, 'Algorithm 644: A portable package for Bessel functions of a complex argument and nonnegative order', ACM TOMS Vol. 12 Issue 3, Sept. 1986, p. 265

val log1p : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

log1p(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

log1p(x)

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

val log_ndtr : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[ `Ndarray of [> `Ndarray ] Np.Obj.t | `PyObject of Py.Object.t ] -> unit -> Py.Object.t

log_ndtr(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

log_ndtr(x)

Logarithm of Gaussian cumulative distribution function.

Returns the log of the area under the standard Gaussian probability density function, integrated from minus infinity to `x`::

log(1/sqrt(2*pi) * integral(exp(-t**2 / 2), t=-inf..x))

Parameters ---------- x : array_like, real or complex Argument

Returns ------- ndarray The value of the log of the normal CDF evaluated at `x`

See Also -------- erf erfc scipy.stats.norm ndtr

val loggamma : ?out:[> `Ndarray ] Np.Obj.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

loggamma(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

loggamma(z, out=None)

Principal branch of the logarithm of the Gamma function.

Defined to be :math:`\log(\Gamma(x))` for :math:`x > 0` and extended to the complex plane by analytic continuation. The function has a single branch cut on the negative real axis.

.. versionadded:: 0.18.0

Parameters ---------- z : array-like Values in the complex plain at which to compute ``loggamma`` out : ndarray, optional Output array for computed values of ``loggamma``

Returns ------- loggamma : ndarray Values of ``loggamma`` at z.

Notes ----- It is not generally true that :math:`\log\Gamma(z) = \log(\Gamma(z))`, though the real parts of the functions do agree. The benefit of not defining `loggamma` as :math:`\log(\Gamma(z))` is that the latter function has a complicated branch cut structure whereas `loggamma` is analytic except for on the negative real axis.

The identities

.. math:: \exp(\log\Gamma(z)) &= \Gamma(z) \\ \log\Gamma(z + 1) &= \log(z) + \log\Gamma(z)

make `loggamma` useful for working in complex logspace.

On the real line `loggamma` is related to `gammaln` via ``exp(loggamma(x + 0j)) = gammasgn(x)*exp(gammaln(x))``, up to rounding error.

The implementation here is based on hare1997_.

See also -------- gammaln : logarithm of the absolute value of the Gamma function gammasgn : sign of the gamma function

References ---------- .. hare1997 D.E.G. Hare, *Computing the Principal Branch of log-Gamma*, Journal of Algorithms, Volume 25, Issue 2, November 1997, pages 221-236.

val logit : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

logit(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

logit(x)

Logit ufunc for ndarrays.

The logit function is defined as logit(p) = log(p/(1-p)). Note that logit(0) = -inf, logit(1) = inf, and logit(p) for p<0 or p>1 yields nan.

Parameters ---------- x : ndarray The ndarray to apply logit to element-wise.

Returns ------- out : ndarray An ndarray of the same shape as x. Its entries are logit of the corresponding entry of x.

See Also -------- expit

Notes ----- As a ufunc logit takes a number of optional keyword arguments. For more information see `ufuncs <https://docs.scipy.org/doc/numpy/reference/ufuncs.html>`_

.. versionadded:: 0.10.0

Examples -------- >>> from scipy.special import logit, expit

>>> logit(0, 0.25, 0.5, 0.75, 1) array( -inf, -1.09861229, 0. , 1.09861229, inf)

`expit` is the inverse of `logit`:

>>> expit(logit(0.1, 0.75, 0.999)) array( 0.1 , 0.75 , 0.999)

Plot logit(x) for x in 0, 1:

>>> import matplotlib.pyplot as plt >>> x = np.linspace(0, 1, 501) >>> y = logit(x) >>> plt.plot(x, y) >>> plt.grid() >>> plt.ylim(-6, 6) >>> plt.xlabel('x') >>> plt.title('logit(x)') >>> plt.show()

val lpmv : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

lpmv(x1, x2, x3, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

lpmv(m, v, x)

Associated Legendre function of integer order and real degree.

Defined as

.. math::

P_v^m = (-1)^m (1 - x^2)^m/2 \fracd^mdx^m P_v(x)

where

.. math::

P_v = \sum_k = 0^\infty \frac(-v)_k (v + 1)_k(k!)^2 \left(\frac

- x

\right)^k

is the Legendre function of the first kind. Here :math:`(\cdot)_k` is the Pochhammer symbol; see `poch`.

Parameters ---------- m : array_like Order (int or float). If passed a float not equal to an integer the function returns NaN. v : array_like Degree (float). x : array_like Argument (float). Must have ``|x| <= 1``.

Returns ------- pmv : ndarray Value of the associated Legendre function.

See Also -------- lpmn : Compute the associated Legendre function for all orders ``0, ..., m`` and degrees ``0, ..., n``. clpmn : Compute the associated Legendre function at complex arguments.

Notes ----- Note that this implementation includes the Condon-Shortley phase.

References ---------- .. 1 Zhang, Jin, 'Computation of Special Functions', John Wiley and Sons, Inc, 1996.

val mathieu_a : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

mathieu_a(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

mathieu_a(m, q)

Characteristic value of even Mathieu functions

Returns the characteristic value for the even solution, ``ce_m(z, q)``, of Mathieu's equation.

val mathieu_b : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

mathieu_b(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

mathieu_b(m, q)

Characteristic value of odd Mathieu functions

Returns the characteristic value for the odd solution, ``se_m(z, q)``, of Mathieu's equation.

val mathieu_cem : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t * Py.Object.t

mathieu_cem(x1, x2, x3, out1, out2, / , out=(None, None), *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

mathieu_cem(m, q, x)

Even Mathieu function and its derivative

Returns the even Mathieu function, ``ce_m(x, q)``, of order `m` and parameter `q` evaluated at `x` (given in degrees). Also returns the derivative with respect to `x` of ce_m(x, q)

Parameters ---------- m Order of the function q Parameter of the function x Argument of the function, *given in degrees, not radians*

Returns ------- y Value of the function yp Value of the derivative vs x

val mathieu_modcem1 : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t * Py.Object.t

mathieu_modcem1(x1, x2, x3, out1, out2, / , out=(None, None), *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

mathieu_modcem1(m, q, x)

Even modified Mathieu function of the first kind and its derivative

Evaluates the even modified Mathieu function of the first kind, ``Mc1m(x, q)``, and its derivative at `x` for order `m` and parameter `q`.

Returns ------- y Value of the function yp Value of the derivative vs x

val mathieu_modcem2 : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t * Py.Object.t

mathieu_modcem2(x1, x2, x3, out1, out2, / , out=(None, None), *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

mathieu_modcem2(m, q, x)

Even modified Mathieu function of the second kind and its derivative

Evaluates the even modified Mathieu function of the second kind, Mc2m(x, q), and its derivative at `x` (given in degrees) for order `m` and parameter `q`.

Returns ------- y Value of the function yp Value of the derivative vs x

val mathieu_modsem1 : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t * Py.Object.t

mathieu_modsem1(x1, x2, x3, out1, out2, / , out=(None, None), *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

mathieu_modsem1(m, q, x)

Odd modified Mathieu function of the first kind and its derivative

Evaluates the odd modified Mathieu function of the first kind, Ms1m(x, q), and its derivative at `x` (given in degrees) for order `m` and parameter `q`.

Returns ------- y Value of the function yp Value of the derivative vs x

val mathieu_modsem2 : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t * Py.Object.t

mathieu_modsem2(x1, x2, x3, out1, out2, / , out=(None, None), *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

mathieu_modsem2(m, q, x)

Odd modified Mathieu function of the second kind and its derivative

Evaluates the odd modified Mathieu function of the second kind, Ms2m(x, q), and its derivative at `x` (given in degrees) for order `m` and parameter q.

Returns ------- y Value of the function yp Value of the derivative vs x

val mathieu_sem : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t * Py.Object.t

mathieu_sem(x1, x2, x3, out1, out2, / , out=(None, None), *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

mathieu_sem(m, q, x)

Odd Mathieu function and its derivative

Returns the odd Mathieu function, se_m(x, q), of order `m` and parameter `q` evaluated at `x` (given in degrees). Also returns the derivative with respect to `x` of se_m(x, q).

Parameters ---------- m Order of the function q Parameter of the function x Argument of the function, *given in degrees, not radians*.

Returns ------- y Value of the function yp Value of the derivative vs x

val modfresnelm : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t * Py.Object.t

modfresnelm(x, out1, out2, / , out=(None, None), *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

modfresnelm(x)

Modified Fresnel negative integrals

Returns ------- fm Integral ``F_-(x)``: ``integral(exp(-1j*t*t), t=x..inf)`` km Integral ``K_-(x)``: ``1/sqrt(pi)*exp(1j*(x*x+pi/4))*fp``

val modfresnelp : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t * Py.Object.t

modfresnelp(x, out1, out2, / , out=(None, None), *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

modfresnelp(x)

Modified Fresnel positive integrals

Returns ------- fp Integral ``F_+(x)``: ``integral(exp(1j*t*t), t=x..inf)`` kp Integral ``K_+(x)``: ``1/sqrt(pi)*exp(-1j*(x*x+pi/4))*fp``

val modstruve : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

modstruve(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

modstruve(v, x)

Modified Struve function.

Return the value of the modified Struve function of order `v` at `x`. The modified Struve function is defined as,

.. math:: L_v(x) = -\imath \exp(-\pi\imath v/2) H_v(\imath x),

where :math:`H_v` is the Struve function.

Parameters ---------- v : array_like Order of the modified Struve function (float). x : array_like Argument of the Struve function (float; must be positive unless `v` is an integer).

Returns ------- L : ndarray Value of the modified Struve function of order `v` at `x`.

Notes ----- Three methods discussed in 1_ are used to evaluate the function:

  • power series
  • expansion in Bessel functions (if :math:`|x| < |v| + 20`)
  • asymptotic large-x expansion (if :math:`x \geq 0.7v + 12`)

Rounding errors are estimated based on the largest terms in the sums, and the result associated with the smallest error is returned.

See also -------- struve

References ---------- .. 1 NIST Digital Library of Mathematical Functions https://dlmf.nist.gov/11

val nbdtr : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

nbdtr(x1, x2, x3, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

nbdtr(k, n, p)

Negative binomial cumulative distribution function.

Returns the sum of the terms 0 through `k` of the negative binomial distribution probability mass function,

.. math::

F = \sum_j=0^k {n + j - 1\choosej

}

p^n (1 - p)^j.

In a sequence of Bernoulli trials with individual success probabilities `p`, this is the probability that `k` or fewer failures precede the nth success.

Parameters ---------- k : array_like The maximum number of allowed failures (nonnegative int). n : array_like The target number of successes (positive int). p : array_like Probability of success in a single event (float).

Returns ------- F : ndarray The probability of `k` or fewer failures before `n` successes in a sequence of events with individual success probability `p`.

See also -------- nbdtrc

Notes ----- If floating point values are passed for `k` or `n`, they will be truncated to integers.

The terms are not summed directly; instead the regularized incomplete beta function is employed, according to the formula,

.. math:: \mathrmnbdtr(k, n, p) = I_p(n, k + 1).

Wrapper for the Cephes 1_ routine `nbdtr`.

References ---------- .. 1 Cephes Mathematical Functions Library, http://www.netlib.org/cephes/

val nbdtrc : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

nbdtrc(x1, x2, x3, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

nbdtrc(k, n, p)

Negative binomial survival function.

Returns the sum of the terms `k + 1` to infinity of the negative binomial distribution probability mass function,

.. math::

F = \sum_j=k + 1^\infty {n + j - 1\choosej

}

p^n (1 - p)^j.

In a sequence of Bernoulli trials with individual success probabilities `p`, this is the probability that more than `k` failures precede the nth success.

Parameters ---------- k : array_like The maximum number of allowed failures (nonnegative int). n : array_like The target number of successes (positive int). p : array_like Probability of success in a single event (float).

Returns ------- F : ndarray The probability of `k + 1` or more failures before `n` successes in a sequence of events with individual success probability `p`.

Notes ----- If floating point values are passed for `k` or `n`, they will be truncated to integers.

The terms are not summed directly; instead the regularized incomplete beta function is employed, according to the formula,

.. math:: \mathrmnbdtrc(k, n, p) = I_

- p

(k + 1, n).

Wrapper for the Cephes 1_ routine `nbdtrc`.

References ---------- .. 1 Cephes Mathematical Functions Library, http://www.netlib.org/cephes/

val nbdtri : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

nbdtri(x1, x2, x3, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

nbdtri(k, n, y)

Inverse of `nbdtr` vs `p`.

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

Parameters ---------- k : array_like The maximum number of allowed failures (nonnegative int). n : array_like The target number of successes (positive int). y : array_like The probability of `k` or fewer failures before `n` successes (float).

Returns ------- p : ndarray Probability of success in a single event (float) such that `nbdtr(k, n, p) = y`.

See also -------- nbdtr : Cumulative distribution function of the negative binomial. nbdtrik : Inverse with respect to `k` of `nbdtr(k, n, p)`. nbdtrin : Inverse with respect to `n` of `nbdtr(k, n, p)`.

Notes ----- Wrapper for the Cephes 1_ routine `nbdtri`.

References ---------- .. 1 Cephes Mathematical Functions Library, http://www.netlib.org/cephes/

val nbdtrik : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

nbdtrik(x1, x2, x3, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

nbdtrik(y, n, p)

Inverse of `nbdtr` vs `k`.

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

Parameters ---------- y : array_like The probability of `k` or fewer failures before `n` successes (float). n : array_like The target number of successes (positive int). p : array_like Probability of success in a single event (float).

Returns ------- k : ndarray The maximum number of allowed failures such that `nbdtr(k, n, p) = y`.

See also -------- nbdtr : Cumulative distribution function of the negative binomial. nbdtri : Inverse with respect to `p` of `nbdtr(k, n, p)`. nbdtrin : Inverse with respect to `n` of `nbdtr(k, n, p)`.

Notes ----- Wrapper for the CDFLIB 1_ Fortran routine `cdfnbn`.

Formula 26.5.26 of 2_,

.. math:: \sum_j=k + 1^\infty {n + j - 1\choosej

}

p^n (1 - p)^j = I_

- p

(k + 1, n),

is used to reduce calculation of the cumulative distribution function to that of a regularized incomplete beta :math:`I`.

Computation of `k` involves a search for a value that produces the desired value of `y`. The search relies on the monotonicity of `y` with `k`.

References ---------- .. 1 Barry Brown, James Lovato, and Kathy Russell, CDFLIB: Library of Fortran Routines for Cumulative Distribution Functions, Inverses, and Other Parameters. .. 2 Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972.

val nbdtrin : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

nbdtrin(x1, x2, x3, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

nbdtrin(k, y, p)

Inverse of `nbdtr` vs `n`.

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

Parameters ---------- k : array_like The maximum number of allowed failures (nonnegative int). y : array_like The probability of `k` or fewer failures before `n` successes (float). p : array_like Probability of success in a single event (float).

Returns ------- n : ndarray The number of successes `n` such that `nbdtr(k, n, p) = y`.

See also -------- nbdtr : Cumulative distribution function of the negative binomial. nbdtri : Inverse with respect to `p` of `nbdtr(k, n, p)`. nbdtrik : Inverse with respect to `k` of `nbdtr(k, n, p)`.

Notes ----- Wrapper for the CDFLIB 1_ Fortran routine `cdfnbn`.

Formula 26.5.26 of 2_,

.. math:: \sum_j=k + 1^\infty {n + j - 1\choosej

}

p^n (1 - p)^j = I_

- p

(k + 1, n),

is used to reduce calculation of the cumulative distribution function to that of a regularized incomplete beta :math:`I`.

Computation of `n` involves a search for a value that produces the desired value of `y`. The search relies on the monotonicity of `y` with `n`.

References ---------- .. 1 Barry Brown, James Lovato, and Kathy Russell, CDFLIB: Library of Fortran Routines for Cumulative Distribution Functions, Inverses, and Other Parameters. .. 2 Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972.

val ncfdtr : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

ncfdtr(x1, x2, x3, x4, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

ncfdtr(dfn, dfd, nc, f)

Cumulative distribution function of the non-central F distribution.

The non-central F describes the distribution of,

.. math:: Z = \fracX/d_nY/d_d

where :math:`X` and :math:`Y` are independently distributed, with :math:`X` distributed non-central :math:`\chi^2` with noncentrality parameter `nc` and :math:`d_n` degrees of freedom, and :math:`Y` distributed :math:`\chi^2` with :math:`d_d` degrees of freedom.

Parameters ---------- dfn : array_like Degrees of freedom of the numerator sum of squares. Range (0, inf). dfd : array_like Degrees of freedom of the denominator sum of squares. Range (0, inf). nc : array_like Noncentrality parameter. Should be in range (0, 1e4). f : array_like Quantiles, i.e. the upper limit of integration.

Returns ------- cdf : float or ndarray The calculated CDF. If all inputs are scalar, the return will be a float. Otherwise it will be an array.

See Also -------- ncfdtri : Quantile function; inverse of `ncfdtr` with respect to `f`. ncfdtridfd : Inverse of `ncfdtr` with respect to `dfd`. ncfdtridfn : Inverse of `ncfdtr` with respect to `dfn`. ncfdtrinc : Inverse of `ncfdtr` with respect to `nc`.

Notes ----- Wrapper for the CDFLIB 1_ Fortran routine `cdffnc`.

The cumulative distribution function is computed using Formula 26.6.20 of 2_:

.. math:: F(d_n, d_d, n_c, f) = \sum_j=0^\infty e^

n_c/2

}

\frac(n_c/2)^jj! I_x(\fracd_n

  1. j, \fracd_d

    ),

where :math:`I` is the regularized incomplete beta function, and :math:`x = f d_n/(f d_n + d_d)`.

The computation time required for this routine is proportional to the noncentrality parameter `nc`. Very large values of this parameter can consume immense computer resources. This is why the search range is bounded by 10,000.

References ---------- .. 1 Barry Brown, James Lovato, and Kathy Russell, CDFLIB: Library of Fortran Routines for Cumulative Distribution Functions, Inverses, and Other Parameters. .. 2 Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972.

Examples -------- >>> from scipy import special >>> from scipy import stats >>> import matplotlib.pyplot as plt

Plot the CDF of the non-central F distribution, for nc=0. Compare with the F-distribution from scipy.stats:

>>> x = np.linspace(-1, 8, num=500) >>> dfn = 3 >>> dfd = 2 >>> ncf_stats = stats.f.cdf(x, dfn, dfd) >>> ncf_special = special.ncfdtr(dfn, dfd, 0, x)

>>> fig = plt.figure() >>> ax = fig.add_subplot(111) >>> ax.plot(x, ncf_stats, 'b-', lw=3) >>> ax.plot(x, ncf_special, 'r-') >>> plt.show()

val ncfdtri : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> float

ncfdtri(x1, x2, x3, x4, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

ncfdtri(dfn, dfd, nc, p)

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

See `ncfdtr` for more details.

Parameters ---------- dfn : array_like Degrees of freedom of the numerator sum of squares. Range (0, inf). dfd : array_like Degrees of freedom of the denominator sum of squares. Range (0, inf). nc : array_like Noncentrality parameter. Should be in range (0, 1e4). p : array_like Value of the cumulative distribution function. Must be in the range 0, 1.

Returns ------- f : float Quantiles, i.e. the upper limit of integration.

See Also -------- ncfdtr : CDF of the non-central F distribution. ncfdtridfd : Inverse of `ncfdtr` with respect to `dfd`. ncfdtridfn : Inverse of `ncfdtr` with respect to `dfn`. ncfdtrinc : Inverse of `ncfdtr` with respect to `nc`.

Examples -------- >>> from scipy.special import ncfdtr, ncfdtri

Compute the CDF for several values of `f`:

>>> f = 0.5, 1, 1.5 >>> p = ncfdtr(2, 3, 1.5, f) >>> p array( 0.20782291, 0.36107392, 0.47345752)

Compute the inverse. We recover the values of `f`, as expected:

>>> ncfdtri(2, 3, 1.5, p) array( 0.5, 1. , 1.5)

val ncfdtridfd : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> float

ncfdtridfd(x1, x2, x3, x4, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

ncfdtridfd(dfn, p, nc, f)

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

This is the inverse with respect to `dfd` of `ncfdtr`. See `ncfdtr` for more details.

Parameters ---------- dfn : array_like Degrees of freedom of the numerator sum of squares. Range (0, inf). p : array_like Value of the cumulative distribution function. Must be in the range 0, 1. nc : array_like Noncentrality parameter. Should be in range (0, 1e4). f : array_like Quantiles, i.e. the upper limit of integration.

Returns ------- dfd : float Degrees of freedom of the denominator sum of squares.

See Also -------- ncfdtr : CDF of the non-central F distribution. ncfdtri : Quantile function; inverse of `ncfdtr` with respect to `f`. ncfdtridfn : Inverse of `ncfdtr` with respect to `dfn`. ncfdtrinc : Inverse of `ncfdtr` with respect to `nc`.

Notes ----- The value of the cumulative noncentral F distribution is not necessarily monotone in either degrees of freedom. There thus may be two values that provide a given CDF value. This routine assumes monotonicity and will find an arbitrary one of the two values.

Examples -------- >>> from scipy.special import ncfdtr, ncfdtridfd

Compute the CDF for several values of `dfd`:

>>> dfd = 1, 2, 3 >>> p = ncfdtr(2, dfd, 0.25, 15) >>> p array( 0.8097138 , 0.93020416, 0.96787852)

Compute the inverse. We recover the values of `dfd`, as expected:

>>> ncfdtridfd(2, p, 0.25, 15) array( 1., 2., 3.)

val ncfdtridfn : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> float

ncfdtridfn(x1, x2, x3, x4, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

ncfdtridfn(p, dfd, nc, f)

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

This is the inverse with respect to `dfn` of `ncfdtr`. See `ncfdtr` for more details.

Parameters ---------- p : array_like Value of the cumulative distribution function. Must be in the range 0, 1. dfd : array_like Degrees of freedom of the denominator sum of squares. Range (0, inf). nc : array_like Noncentrality parameter. Should be in range (0, 1e4). f : float Quantiles, i.e. the upper limit of integration.

Returns ------- dfn : float Degrees of freedom of the numerator sum of squares.

See Also -------- ncfdtr : CDF of the non-central F distribution. ncfdtri : Quantile function; inverse of `ncfdtr` with respect to `f`. ncfdtridfd : Inverse of `ncfdtr` with respect to `dfd`. ncfdtrinc : Inverse of `ncfdtr` with respect to `nc`.

Notes ----- The value of the cumulative noncentral F distribution is not necessarily monotone in either degrees of freedom. There thus may be two values that provide a given CDF value. This routine assumes monotonicity and will find an arbitrary one of the two values.

Examples -------- >>> from scipy.special import ncfdtr, ncfdtridfn

Compute the CDF for several values of `dfn`:

>>> dfn = 1, 2, 3 >>> p = ncfdtr(dfn, 2, 0.25, 15) >>> p array( 0.92562363, 0.93020416, 0.93188394)

Compute the inverse. We recover the values of `dfn`, as expected:

>>> ncfdtridfn(p, 2, 0.25, 15) array( 1., 2., 3.)

val ncfdtrinc : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> float

ncfdtrinc(x1, x2, x3, x4, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

ncfdtrinc(dfn, dfd, p, f)

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

This is the inverse with respect to `nc` of `ncfdtr`. See `ncfdtr` for more details.

Parameters ---------- dfn : array_like Degrees of freedom of the numerator sum of squares. Range (0, inf). dfd : array_like Degrees of freedom of the denominator sum of squares. Range (0, inf). p : array_like Value of the cumulative distribution function. Must be in the range 0, 1. f : array_like Quantiles, i.e. the upper limit of integration.

Returns ------- nc : float Noncentrality parameter.

See Also -------- ncfdtr : CDF of the non-central F distribution. ncfdtri : Quantile function; inverse of `ncfdtr` with respect to `f`. ncfdtridfd : Inverse of `ncfdtr` with respect to `dfd`. ncfdtridfn : Inverse of `ncfdtr` with respect to `dfn`.

Examples -------- >>> from scipy.special import ncfdtr, ncfdtrinc

Compute the CDF for several values of `nc`:

>>> nc = 0.5, 1.5, 2.0 >>> p = ncfdtr(2, 3, nc, 15) >>> p array( 0.96309246, 0.94327955, 0.93304098)

Compute the inverse. We recover the values of `nc`, as expected:

>>> ncfdtrinc(2, 3, p, 15) array( 0.5, 1.5, 2. )

val nctdtr : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

nctdtr(x1, x2, x3, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

nctdtr(df, nc, t)

Cumulative distribution function of the non-central `t` distribution.

Parameters ---------- df : array_like Degrees of freedom of the distribution. Should be in range (0, inf). nc : array_like Noncentrality parameter. Should be in range (-1e6, 1e6). t : array_like Quantiles, i.e. the upper limit of integration.

Returns ------- cdf : float or ndarray The calculated CDF. If all inputs are scalar, the return will be a float. Otherwise it will be an array.

See Also -------- nctdtrit : Inverse CDF (iCDF) of the non-central t distribution. nctdtridf : Calculate degrees of freedom, given CDF and iCDF values. nctdtrinc : Calculate non-centrality parameter, given CDF iCDF values.

Examples -------- >>> from scipy import special >>> from scipy import stats >>> import matplotlib.pyplot as plt

Plot the CDF of the non-central t distribution, for nc=0. Compare with the t-distribution from scipy.stats:

>>> x = np.linspace(-5, 5, num=500) >>> df = 3 >>> nct_stats = stats.t.cdf(x, df) >>> nct_special = special.nctdtr(df, 0, x)

>>> fig = plt.figure() >>> ax = fig.add_subplot(111) >>> ax.plot(x, nct_stats, 'b-', lw=3) >>> ax.plot(x, nct_special, 'r-') >>> plt.show()

val nctdtridf : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

nctdtridf(x1, x2, x3, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

nctdtridf(p, nc, t)

Calculate degrees of freedom for non-central t distribution.

See `nctdtr` for more details.

Parameters ---------- p : array_like CDF values, in range (0, 1]. nc : array_like Noncentrality parameter. Should be in range (-1e6, 1e6). t : array_like Quantiles, i.e. the upper limit of integration.

val nctdtrinc : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

nctdtrinc(x1, x2, x3, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

nctdtrinc(df, p, t)

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

See `nctdtr` for more details.

Parameters ---------- df : array_like Degrees of freedom of the distribution. Should be in range (0, inf). p : array_like CDF values, in range (0, 1]. t : array_like Quantiles, i.e. the upper limit of integration.

val nctdtrit : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

nctdtrit(x1, x2, x3, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

nctdtrit(df, nc, p)

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

See `nctdtr` for more details.

Parameters ---------- df : array_like Degrees of freedom of the distribution. Should be in range (0, inf). nc : array_like Noncentrality parameter. Should be in range (-1e6, 1e6). p : array_like CDF values, in range (0, 1].

val ndtr : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[ `Ndarray of [> `Ndarray ] Np.Obj.t | `PyObject of Py.Object.t ] -> unit -> Py.Object.t

ndtr(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

ndtr(x)

Gaussian cumulative distribution function.

Returns the area under the standard Gaussian probability density function, integrated from minus infinity to `x`

.. math::

\frac

\sqrt{2\pi

}

\int_

\infty

}

^x \exp(-t^2/2) dt

Parameters ---------- x : array_like, real or complex Argument

Returns ------- ndarray The value of the normal CDF evaluated at `x`

See Also -------- erf erfc scipy.stats.norm log_ndtr

val ndtri : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

ndtri(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

ndtri(y)

Inverse of `ndtr` vs x

Returns the argument x for which the area under the Gaussian probability density function (integrated from minus infinity to `x`) is equal to y.

val nrdtrimn : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> Py.Object.t

nrdtrimn(x1, x2, x3, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

nrdtrimn(p, x, std)

Calculate mean of normal distribution given other params.

Parameters ---------- p : array_like CDF values, in range (0, 1]. x : array_like Quantiles, i.e. the upper limit of integration. std : array_like Standard deviation.

Returns ------- mn : float or ndarray The mean of the normal distribution.

See Also -------- nrdtrimn, ndtr

val nrdtrisd : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

nrdtrisd(x1, x2, x3, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

nrdtrisd(p, x, mn)

Calculate standard deviation of normal distribution given other params.

Parameters ---------- p : array_like CDF values, in range (0, 1]. x : array_like Quantiles, i.e. the upper limit of integration. mn : float or ndarray The mean of the normal distribution.

Returns ------- std : array_like Standard deviation.

See Also -------- ndtr

val obl_ang1 : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t * Py.Object.t

obl_ang1(x1, x2, x3, x4, out1, out2, / , out=(None, None), *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

obl_ang1(m, n, c, x)

Oblate spheroidal angular function of the first kind and its derivative

Computes the oblate spheroidal angular function of the first kind and its derivative (with respect to `x`) for mode parameters m>=0 and n>=m, spheroidal parameter `c` and ``|x| < 1.0``.

Returns ------- s Value of the function sp Value of the derivative vs x

val obl_ang1_cv : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t * Py.Object.t

obl_ang1_cv(x1, x2, x3, x4, x5, out1, out2, / , out=(None, None), *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

obl_ang1_cv(m, n, c, cv, x)

Oblate spheroidal angular function obl_ang1 for precomputed characteristic value

Computes the oblate spheroidal angular function of the first kind and its derivative (with respect to `x`) for mode parameters m>=0 and n>=m, spheroidal parameter `c` and ``|x| < 1.0``. Requires pre-computed characteristic value.

Returns ------- s Value of the function sp Value of the derivative vs x

val obl_cv : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

obl_cv(x1, x2, x3, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

obl_cv(m, n, c)

Characteristic value of oblate spheroidal function

Computes the characteristic value of oblate spheroidal wave functions of order `m`, `n` (n>=m) and spheroidal parameter `c`.

val obl_rad1 : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t * Py.Object.t

obl_rad1(x1, x2, x3, x4, out1, out2, / , out=(None, None), *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

obl_rad1(m, n, c, x)

Oblate spheroidal radial function of the first kind and its derivative

Computes the oblate spheroidal radial function of the first kind and its derivative (with respect to `x`) for mode parameters m>=0 and n>=m, spheroidal parameter `c` and ``|x| < 1.0``.

Returns ------- s Value of the function sp Value of the derivative vs x

val obl_rad1_cv : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t * Py.Object.t

obl_rad1_cv(x1, x2, x3, x4, x5, out1, out2, / , out=(None, None), *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

obl_rad1_cv(m, n, c, cv, x)

Oblate spheroidal radial function obl_rad1 for precomputed characteristic value

Computes the oblate spheroidal radial function of the first kind and its derivative (with respect to `x`) for mode parameters m>=0 and n>=m, spheroidal parameter `c` and ``|x| < 1.0``. Requires pre-computed characteristic value.

Returns ------- s Value of the function sp Value of the derivative vs x

val obl_rad2 : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t * Py.Object.t

obl_rad2(x1, x2, x3, x4, out1, out2, / , out=(None, None), *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

obl_rad2(m, n, c, x)

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

Computes the oblate spheroidal radial function of the second kind and its derivative (with respect to `x`) for mode parameters m>=0 and n>=m, spheroidal parameter `c` and ``|x| < 1.0``.

Returns ------- s Value of the function sp Value of the derivative vs x

val obl_rad2_cv : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t * Py.Object.t

obl_rad2_cv(x1, x2, x3, x4, x5, out1, out2, / , out=(None, None), *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

obl_rad2_cv(m, n, c, cv, x)

Oblate spheroidal radial function obl_rad2 for precomputed characteristic value

Computes the oblate spheroidal radial function of the second kind and its derivative (with respect to `x`) for mode parameters m>=0 and n>=m, spheroidal parameter `c` and ``|x| < 1.0``. Requires pre-computed characteristic value.

Returns ------- s Value of the function sp Value of the derivative vs x

val owens_t : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

owens_t(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

owens_t(h, a)

Owen's T Function.

The function T(h, a) gives the probability of the event (X > h and 0 < Y < a * X) where X and Y are independent standard normal random variables.

Parameters ---------- h: array_like Input value. a: array_like Input value.

Returns ------- t: scalar or ndarray Probability of the event (X > h and 0 < Y < a * X), where X and Y are independent standard normal random variables.

Examples -------- >>> from scipy import special >>> a = 3.5 >>> h = 0.78 >>> special.owens_t(h, a) 0.10877216734852274

References ---------- .. 1 M. Patefield and D. Tandy, 'Fast and accurate calculation of Owen's T Function', Statistical Software vol. 5, pp. 1-25, 2000.

val pbdv : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t * Py.Object.t

pbdv(x1, x2, out1, out2, / , out=(None, None), *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

pbdv(v, x)

Parabolic cylinder function D

Returns (d, dp) the parabolic cylinder function Dv(x) in d and the derivative, Dv'(x) in dp.

Returns ------- d Value of the function dp Value of the derivative vs x

val pbvv : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t * Py.Object.t

pbvv(x1, x2, out1, out2, / , out=(None, None), *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

pbvv(v, x)

Parabolic cylinder function V

Returns the parabolic cylinder function Vv(x) in v and the derivative, Vv'(x) in vp.

Returns ------- v Value of the function vp Value of the derivative vs x

val pbwa : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> Py.Object.t * Py.Object.t

pbwa(x1, x2, out1, out2, / , out=(None, None), *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

pbwa(a, x)

Parabolic cylinder function W.

The function is a particular solution to the differential equation

.. math::

y'' + \left(\frac

x^2 - a\right)y = 0,

for a full definition see section 12.14 in 1_.

Parameters ---------- a : array_like Real parameter x : array_like Real argument

Returns ------- w : scalar or ndarray Value of the function wp : scalar or ndarray Value of the derivative in x

Notes ----- The function is a wrapper for a Fortran routine by Zhang and Jin 2_. The implementation is accurate only for ``|a|, |x| < 5`` and returns NaN outside that range.

References ---------- .. 1 Digital Library of Mathematical Functions, 14.30. https://dlmf.nist.gov/14.30 .. 2 Zhang, Shanjie and Jin, Jianming. 'Computation of Special Functions', John Wiley and Sons, 1996. https://people.sc.fsu.edu/~jburkardt/f_src/special_functions/special_functions.html

val pdtr : ?out:[> `Ndarray ] Np.Obj.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

pdtr(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

pdtr(k, m, out=None)

Poisson cumulative distribution function.

Defined as the probability that a Poisson-distributed random variable with event rate :math:`m` is less than or equal to :math:`k`. More concretely, this works out to be 1_

.. math::

\exp(-m) \sum_j = 0^\lfloor{k\rfloor

}

\fracm^jm!.

Parameters ---------- k : array_like Nonnegative real argument m : array_like Nonnegative real shape parameter out : ndarray Optional output array for the function results

See Also -------- pdtrc : Poisson survival function pdtrik : inverse of `pdtr` with respect to `k` pdtri : inverse of `pdtr` with respect to `m`

Returns ------- scalar or ndarray Values of the Poisson cumulative distribution function

References ---------- .. 1 https://en.wikipedia.org/wiki/Poisson_distribution

Examples -------- >>> import scipy.special as sc

It is a cumulative distribution function, so it converges to 1 monotonically as `k` goes to infinity.

>>> sc.pdtr(1, 10, 100, np.inf, 1) array(0.73575888, 0.99999999, 1. , 1. )

It is discontinuous at integers and constant between integers.

>>> sc.pdtr(1, 1.5, 1.9, 2, 1) array(0.73575888, 0.73575888, 0.73575888, 0.9196986 )

val pdtrc : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

pdtrc(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

pdtrc(k, m)

Poisson survival function

Returns the sum of the terms from k+1 to infinity of the Poisson distribution: sum(exp(-m) * m**j / j!, j=k+1..inf) = gammainc( k+1, m). Arguments must both be non-negative doubles.

val pdtri : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

pdtri(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

pdtri(k, y)

Inverse to `pdtr` vs m

Returns the Poisson variable `m` such that the sum from 0 to `k` of the Poisson density is equal to the given probability `y`: calculated by gammaincinv(k+1, y). `k` must be a nonnegative integer and `y` between 0 and 1.

val pdtrik : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

pdtrik(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

pdtrik(p, m)

Inverse to `pdtr` vs k

Returns the quantile k such that ``pdtr(k, m) = p``

val poch : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

poch(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

poch(z, m)

Pochhammer symbol.

The Pochhammer symbol (rising factorial) is defined as

.. math::

(z)_m = \frac\Gamma(z + m)\Gamma(z)

For positive integer `m` it reads

.. math::

(z)_m = z (z + 1) ... (z + m - 1)

See dlmf_ for more details.

Parameters ---------- z, m : array_like Real-valued arguments.

Returns ------- scalar or ndarray The value of the function.

References ---------- .. dlmf Nist, Digital Library of Mathematical Functions https://dlmf.nist.gov/5.2#iii

Examples -------- >>> import scipy.special as sc

It is 1 when m is 0.

>>> sc.poch(1, 2, 3, 4, 0) array(1., 1., 1., 1.)

For z equal to 1 it reduces to the factorial function.

>>> sc.poch(1, 5) 120.0 >>> 1 * 2 * 3 * 4 * 5 120

It can be expressed in terms of the Gamma function.

>>> z, m = 3.7, 2.1 >>> sc.poch(z, m) 20.529581933776953 >>> sc.gamma(z + m) / sc.gamma(z) 20.52958193377696

val pro_ang1 : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t * Py.Object.t

pro_ang1(x1, x2, x3, x4, out1, out2, / , out=(None, None), *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

pro_ang1(m, n, c, x)

Prolate spheroidal angular function of the first kind and its derivative

Computes the prolate spheroidal angular function of the first kind and its derivative (with respect to `x`) for mode parameters m>=0 and n>=m, spheroidal parameter `c` and ``|x| < 1.0``.

Returns ------- s Value of the function sp Value of the derivative vs x

val pro_ang1_cv : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t * Py.Object.t

pro_ang1_cv(x1, x2, x3, x4, x5, out1, out2, / , out=(None, None), *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

pro_ang1_cv(m, n, c, cv, x)

Prolate spheroidal angular function pro_ang1 for precomputed characteristic value

Computes the prolate spheroidal angular function of the first kind and its derivative (with respect to `x`) for mode parameters m>=0 and n>=m, spheroidal parameter `c` and ``|x| < 1.0``. Requires pre-computed characteristic value.

Returns ------- s Value of the function sp Value of the derivative vs x

val pro_cv : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

pro_cv(x1, x2, x3, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

pro_cv(m, n, c)

Characteristic value of prolate spheroidal function

Computes the characteristic value of prolate spheroidal wave functions of order `m`, `n` (n>=m) and spheroidal parameter `c`.

val pro_rad1 : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t * Py.Object.t

pro_rad1(x1, x2, x3, x4, out1, out2, / , out=(None, None), *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

pro_rad1(m, n, c, x)

Prolate spheroidal radial function of the first kind and its derivative

Computes the prolate spheroidal radial function of the first kind and its derivative (with respect to `x`) for mode parameters m>=0 and n>=m, spheroidal parameter `c` and ``|x| < 1.0``.

Returns ------- s Value of the function sp Value of the derivative vs x

val pro_rad1_cv : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t * Py.Object.t

pro_rad1_cv(x1, x2, x3, x4, x5, out1, out2, / , out=(None, None), *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

pro_rad1_cv(m, n, c, cv, x)

Prolate spheroidal radial function pro_rad1 for precomputed characteristic value

Computes the prolate spheroidal radial function of the first kind and its derivative (with respect to `x`) for mode parameters m>=0 and n>=m, spheroidal parameter `c` and ``|x| < 1.0``. Requires pre-computed characteristic value.

Returns ------- s Value of the function sp Value of the derivative vs x

val pro_rad2 : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t * Py.Object.t

pro_rad2(x1, x2, x3, x4, out1, out2, / , out=(None, None), *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

pro_rad2(m, n, c, x)

Prolate spheroidal radial function of the second kind and its derivative

Computes the prolate spheroidal radial function of the second kind and its derivative (with respect to `x`) for mode parameters m>=0 and n>=m, spheroidal parameter `c` and ``|x| < 1.0``.

Returns ------- s Value of the function sp Value of the derivative vs x

val pro_rad2_cv : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t * Py.Object.t

pro_rad2_cv(x1, x2, x3, x4, x5, out1, out2, / , out=(None, None), *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

pro_rad2_cv(m, n, c, cv, x)

Prolate spheroidal radial function pro_rad2 for precomputed characteristic value

Computes the prolate spheroidal radial function of the second kind and its derivative (with respect to `x`) for mode parameters m>=0 and n>=m, spheroidal parameter `c` and ``|x| < 1.0``. Requires pre-computed characteristic value.

Returns ------- s Value of the function sp Value of the derivative vs x

val pseudo_huber : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

pseudo_huber(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

pseudo_huber(delta, r)

Pseudo-Huber loss function.

.. math:: \mathrmpseudo\_huber(\delta, r) = \delta^2 \left( \sqrt 1 + \left( \frac{r\delta \right)^2

}

  • 1 \right)

Parameters ---------- delta : ndarray Input array, indicating the soft quadratic vs. linear loss changepoint. r : ndarray Input array, possibly representing residuals.

Returns ------- res : ndarray The computed Pseudo-Huber loss function values.

Notes ----- This function is convex in :math:`r`.

.. versionadded:: 0.15.0

val psi : ?out:[> `Ndarray ] Np.Obj.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

psi(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

psi(z, out=None)

The digamma function.

The logarithmic derivative of the gamma function evaluated at ``z``.

Parameters ---------- z : array_like Real or complex argument. out : ndarray, optional Array for the computed values of ``psi``.

Returns ------- digamma : ndarray Computed values of ``psi``.

Notes ----- For large values not close to the negative real axis ``psi`` is computed using the asymptotic series (5.11.2) from 1_. For small arguments not close to the negative real axis the recurrence relation (5.5.2) from 1_ is used until the argument is large enough to use the asymptotic series. For values close to the negative real axis the reflection formula (5.5.4) from 1_ is used first. Note that ``psi`` has a family of zeros on the negative real axis which occur between the poles at nonpositive integers. Around the zeros the reflection formula suffers from cancellation and the implementation loses precision. The sole positive zero and the first negative zero, however, are handled separately by precomputing series expansions using 2_, so the function should maintain full accuracy around the origin.

References ---------- .. 1 NIST Digital Library of Mathematical Functions https://dlmf.nist.gov/5 .. 2 Fredrik Johansson and others. 'mpmath: a Python library for arbitrary-precision floating-point arithmetic' (Version 0.19) http://mpmath.org/

val radian : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

radian(x1, x2, x3, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

radian(d, m, s)

Convert from degrees to radians

Returns the angle given in (d)egrees, (m)inutes, and (s)econds in radians.

val rel_entr : ?out:[> `Ndarray ] Np.Obj.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

rel_entr(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

rel_entr(x, y, out=None)

Elementwise function for computing relative entropy.

.. math::

\mathrmrel\_entr(x, y) = \begincases x \log(x / y) & x > 0, y > 0 \\ 0 & x = 0, y \ge 0 \\ \infty & \textotherwise \endcases

Parameters ---------- x, y : array_like Input arrays out : ndarray, optional Optional output array for the function results

Returns ------- scalar or ndarray Relative entropy of the inputs

See Also -------- entr, kl_div

Notes ----- .. versionadded:: 0.15.0

This function is jointly convex in x and y.

The origin of this function is in convex programming; see 1_. Given two discrete probability distributions :math:`p_1, \ldots, p_n` and :math:`q_1, \ldots, q_n`, to get the relative entropy of statistics compute the sum

.. math::

\sum_= 1^n \mathrmrel\_entr(p_i, q_i).

See 2_ for details.

References ---------- .. 1 Grant, Boyd, and Ye, 'CVX: Matlab Software for Disciplined Convex Programming', http://cvxr.com/cvx/ .. 2 Kullback-Leibler divergence, https://en.wikipedia.org/wiki/Kullback%E2%80%93Leibler_divergence

val rgamma : ?out:[> `Ndarray ] Np.Obj.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

rgamma(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

rgamma(z, out=None)

Reciprocal of the Gamma function.

Defined as :math:`1 / \Gamma(z)`, where :math:`\Gamma` is the Gamma function. For more on the Gamma function see `gamma`.

Parameters ---------- z : array_like Real or complex valued input out : ndarray, optional Optional output array for the function results

Returns ------- scalar or ndarray Function results

Notes ----- The Gamma function has no zeros and has simple poles at nonpositive integers, so `rgamma` is an entire function with zeros at the nonpositive integers. See the discussion in dlmf_ for more details.

See Also -------- gamma, gammaln, loggamma

References ---------- .. dlmf Nist, Digital Library of Mathematical functions, https://dlmf.nist.gov/5.2#i

Examples -------- >>> import scipy.special as sc

It is the reciprocal of the Gamma function.

>>> sc.rgamma(1, 2, 3, 4) array(1. , 1. , 0.5 , 0.16666667) >>> 1 / sc.gamma(1, 2, 3, 4) array(1. , 1. , 0.5 , 0.16666667)

It is zero at nonpositive integers.

>>> sc.rgamma(0, -1, -2, -3) array(0., 0., 0., 0.)

It rapidly underflows to zero along the positive real axis.

>>> sc.rgamma(10, 100, 179) array(2.75573192e-006, 1.07151029e-156, 0.00000000e+000)

val round : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

round(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

round(x)

Round to nearest integer

Returns the nearest integer to `x` as a double precision floating point result. If `x` ends in 0.5 exactly, the nearest even integer is chosen.

val shichi : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t * [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

shichi(x, out1, out2, / , out=(None, None), *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

shichi(x, out=None)

Hyperbolic sine and cosine integrals.

The hyperbolic sine integral is

.. math::

\int_0^x \frac\sinh{t

}

dt

and the hyperbolic cosine integral is

.. math::

\gamma + \log(x) + \int_0^x \frac\cosh{t - 1

}

dt

where :math:`\gamma` is Euler's constant and :math:`\log` is the principle branch of the logarithm.

Parameters ---------- x : array_like Real or complex points at which to compute the hyperbolic sine and cosine integrals.

Returns ------- si : ndarray Hyperbolic sine integral at ``x`` ci : ndarray Hyperbolic cosine integral at ``x``

Notes ----- For real arguments with ``x < 0``, ``chi`` is the real part of the hyperbolic cosine integral. For such points ``chi(x)`` and ``chi(x

  1. 0j)`` differ by a factor of ``1j*pi``.

For real arguments the function is computed by calling Cephes' 1_ *shichi* routine. For complex arguments the algorithm is based on Mpmath's 2_ *shi* and *chi* routines.

References ---------- .. 1 Cephes Mathematical Functions Library, http://www.netlib.org/cephes/ .. 2 Fredrik Johansson and others. 'mpmath: a Python library for arbitrary-precision floating-point arithmetic' (Version 0.19) http://mpmath.org/

val sici : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t * [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

sici(x, out1, out2, / , out=(None, None), *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

sici(x, out=None)

Sine and cosine integrals.

The sine integral is

.. math::

\int_0^x \frac\sin{t

}

dt

and the cosine integral is

.. math::

\gamma + \log(x) + \int_0^x \frac\cos{t - 1

}

dt

where :math:`\gamma` is Euler's constant and :math:`\log` is the principle branch of the logarithm.

Parameters ---------- x : array_like Real or complex points at which to compute the sine and cosine integrals.

Returns ------- si : ndarray Sine integral at ``x`` ci : ndarray Cosine integral at ``x``

Notes ----- For real arguments with ``x < 0``, ``ci`` is the real part of the cosine integral. For such points ``ci(x)`` and ``ci(x + 0j)`` differ by a factor of ``1j*pi``.

For real arguments the function is computed by calling Cephes' 1_ *sici* routine. For complex arguments the algorithm is based on Mpmath's 2_ *si* and *ci* routines.

References ---------- .. 1 Cephes Mathematical Functions Library, http://www.netlib.org/cephes/ .. 2 Fredrik Johansson and others. 'mpmath: a Python library for arbitrary-precision floating-point arithmetic' (Version 0.19) http://mpmath.org/

val sindg : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

sindg(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

sindg(x)

Sine of angle given in degrees

val smirnov : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

smirnov(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

smirnov(n, d)

Kolmogorov-Smirnov complementary cumulative distribution function

Returns the exact Kolmogorov-Smirnov complementary cumulative distribution function,(aka the Survival Function) of Dn+ (or Dn-) for a one-sided test of equality between an empirical and a theoretical distribution. It is equal to the probability that the maximum difference between a theoretical distribution and an empirical one based on `n` samples is greater than d.

Parameters ---------- n : int Number of samples d : float array_like Deviation between the Empirical CDF (ECDF) and the target CDF.

Returns ------- float The value(s) of smirnov(n, d), Prob(Dn+ >= d) (Also Prob(Dn- >= d))

Notes ----- `smirnov` is used by `stats.kstest` in the application of the Kolmogorov-Smirnov Goodness of Fit test. For historial reasons this function is exposed in `scpy.special`, but the recommended way to achieve the most accurate CDF/SF/PDF/PPF/ISF computations is to use the `stats.ksone` distribution.

See Also -------- smirnovi : The Inverse Survival Function for the distribution scipy.stats.ksone : Provides the functionality as a continuous distribution kolmogorov, kolmogi : Functions for the two-sided distribution

Examples -------- >>> from scipy.special import smirnov

Show the probability of a gap at least as big as 0, 0.5 and 1.0 for a sample of size 5

>>> smirnov(5, 0, 0.5, 1.0) array( 1. , 0.056, 0. )

Compare a sample of size 5 drawn from a source N(0.5, 1) distribution against a target N(0, 1) CDF.

>>> from scipy.stats import norm >>> n = 5 >>> gendist = norm(0.5, 1) # Normal distribution, mean 0.5, stddev 1 >>> np.random.seed(seed=233423) # Set the seed for reproducibility >>> x = np.sort(gendist.rvs(size=n)) >>> x array(-0.20946287, 0.71688765, 0.95164151, 1.44590852, 3.08880533) >>> target = norm(0, 1) >>> cdfs = target.cdf(x) >>> cdfs array( 0.41704346, 0.76327829, 0.82936059, 0.92589857, 0.99899518) # Construct the Empirical CDF and the K-S statistics (Dn+, Dn-, Dn) >>> ecdfs = np.arange(n+1, dtype=float)/n >>> cols = np.column_stack(x, ecdfs[1:], cdfs, cdfs - ecdfs[:n], ecdfs[1:] - cdfs) >>> np.set_printoptions(precision=3) >>> cols array([ -2.095e-01, 2.000e-01, 4.170e-01, 4.170e-01, -2.170e-01], [ 7.169e-01, 4.000e-01, 7.633e-01, 5.633e-01, -3.633e-01], [ 9.516e-01, 6.000e-01, 8.294e-01, 4.294e-01, -2.294e-01], [ 1.446e+00, 8.000e-01, 9.259e-01, 3.259e-01, -1.259e-01], [ 3.089e+00, 1.000e+00, 9.990e-01, 1.990e-01, 1.005e-03]) >>> gaps = cols:, -2: >>> Dnpm = np.max(gaps, axis=0) >>> print('Dn-=%f, Dn+=%f' % (Dnpm0, Dnpm1)) Dn-=0.563278, Dn+=0.001005 >>> probs = smirnov(n, Dnpm) >>> print(chr(10).join('For a sample of size %d drawn from a N(0, 1) distribution:' % n, ... ' Smirnov n=%d: Prob(Dn- >= %f) = %.4f' % (n, Dnpm[0], probs[0]), ... ' Smirnov n=%d: Prob(Dn+ >= %f) = %.4f' % (n, Dnpm[1], probs[1]))) For a sample of size 5 drawn from a N(0, 1) distribution: Smirnov n=5: Prob(Dn- >= 0.563278) = 0.0250 Smirnov n=5: Prob(Dn+ >= 0.001005) = 0.9990

Plot the Empirical CDF against the target N(0, 1) CDF

>>> import matplotlib.pyplot as plt >>> plt.step(np.concatenate([-3], x), ecdfs, where='post', label='Empirical CDF') >>> x3 = np.linspace(-3, 3, 100) >>> plt.plot(x3, target.cdf(x3), label='CDF for N(0, 1)') >>> plt.ylim(0, 1); plt.grid(True); plt.legend(); # Add vertical lines marking Dn+ and Dn- >>> iminus, iplus = np.argmax(gaps, axis=0) >>> plt.vlines(x[iminus], ecdfsiminus, cdfsiminus, color='r', linestyle='dashed', lw=4) >>> plt.vlines(x[iplus], cdfsiplus, ecdfsiplus+1, color='m', linestyle='dashed', lw=4) >>> plt.show()

val smirnovi : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

smirnovi(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

smirnovi(n, p)

Inverse to `smirnov`

Returns `d` such that ``smirnov(n, d) == p``, the critical value corresponding to `p`.

Parameters ---------- n : int Number of samples p : float array_like Probability

Returns ------- float The value(s) of smirnovi(n, p), the critical values.

Notes ----- `smirnov` is used by `stats.kstest` in the application of the Kolmogorov-Smirnov Goodness of Fit test. For historial reasons this function is exposed in `scpy.special`, but the recommended way to achieve the most accurate CDF/SF/PDF/PPF/ISF computations is to use the `stats.ksone` distribution.

See Also -------- smirnov : The Survival Function (SF) for the distribution scipy.stats.ksone : Provides the functionality as a continuous distribution kolmogorov, kolmogi, scipy.stats.kstwobign : Functions for the two-sided distribution

val spence : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

spence(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

spence(z, out=None)

Spence's function, also known as the dilogarithm.

It is defined to be

.. math:: \int_0^z \frac\log(t)

- t

dt

for complex :math:`z`, where the contour of integration is taken to avoid the branch cut of the logarithm. Spence's function is analytic everywhere except the negative real axis where it has a branch cut.

Parameters ---------- z : array_like Points at which to evaluate Spence's function

Returns ------- s : ndarray Computed values of Spence's function

Notes ----- There is a different convention which defines Spence's function by the integral

.. math:: -\int_0^z \frac\log(1 - t)

dt;

this is our ``spence(1 - z)``.

val sph_harm : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

sph_harm(x1, x2, x3, x4, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

sph_harm(m, n, theta, phi)

Compute spherical harmonics.

The spherical harmonics are defined as

.. math::

Y^m_n(\theta,\phi) = \sqrt\frac{2n+1

\pi

\frac(n-m)!(n+m)!

}

e^m \theta P^m_n(\cos(\phi))

where :math:`P_n^m` are the associated Legendre functions; see `lpmv`.

Parameters ---------- m : array_like Order of the harmonic (int); must have ``|m| <= n``. n : array_like Degree of the harmonic (int); must have ``n >= 0``. This is often denoted by ``l`` (lower case L) in descriptions of spherical harmonics. theta : array_like Azimuthal (longitudinal) coordinate; must be in ``0, 2*pi``. phi : array_like Polar (colatitudinal) coordinate; must be in ``0, pi``.

Returns ------- y_mn : complex float The harmonic :math:`Y^m_n` sampled at ``theta`` and ``phi``.

Notes ----- There are different conventions for the meanings of the input arguments ``theta`` and ``phi``. In SciPy ``theta`` is the azimuthal angle and ``phi`` is the polar angle. It is common to see the opposite convention, that is, ``theta`` as the polar angle and ``phi`` as the azimuthal angle.

Note that SciPy's spherical harmonics include the Condon-Shortley phase 2_ because it is part of `lpmv`.

With SciPy's conventions, the first several spherical harmonics are

.. math::

Y_0^0(\theta, \phi) &= \frac

\sqrt\frac{1\pi

}

\\ Y_1^

1

}

(\theta, \phi) &= \frac

\sqrt\frac{3

\pi

}

e^

i\theta

}

\sin(\phi) \\ Y_1^0(\theta, \phi) &= \frac

\sqrt\frac{3\pi

}

\cos(\phi) \\ Y_1^1(\theta, \phi) &= -\frac

\sqrt\frac{3

\pi

}

e^\theta \sin(\phi).

References ---------- .. 1 Digital Library of Mathematical Functions, 14.30. https://dlmf.nist.gov/14.30 .. 2 https://en.wikipedia.org/wiki/Spherical_harmonics#Condon.E2.80.93Shortley_phase

val stdtr : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

stdtr(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

stdtr(df, t)

Student t distribution cumulative distribution function

Returns the integral from minus infinity to t of the Student t distribution with df > 0 degrees of freedom::

gamma((df+1)/2)/(sqrt(df*pi)*gamma(df/2)) * integral((1+x**2/df)**(-df/2-1/2), x=-inf..t)

val stdtridf : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

stdtridf(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

stdtridf(p, t)

Inverse of `stdtr` vs df

Returns the argument df such that stdtr(df, t) is equal to `p`.

val stdtrit : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

stdtrit(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

stdtrit(df, p)

Inverse of `stdtr` vs `t`

Returns the argument `t` such that stdtr(df, t) is equal to `p`.

val struve : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

struve(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

struve(v, x)

Struve function.

Return the value of the Struve function of order `v` at `x`. The Struve function is defined as,

.. math:: H_v(x) = (z/2)^

+ 1} \sum_{n=0}^\infty \frac{(-1)^n (z/2)^{2n}}{\Gamma(n + \frac{3}{2}) \Gamma(n + v + \frac{3}{2})},

where :math:`\Gamma` is the gamma function.

Parameters
----------
v : array_like
    Order of the Struve function (float).
x : array_like
    Argument of the Struve function (float; must be positive unless `v` is
    an integer).

Returns
-------
H : ndarray
    Value of the Struve function of order `v` at `x`.

Notes
-----
Three methods discussed in [1]_ are used to evaluate the Struve function:

- power series
- expansion in Bessel functions (if :math:`|z| < |v| + 20`)
- asymptotic large-z expansion (if :math:`z \geq 0.7v + 12`)

Rounding errors are estimated based on the largest terms in the sums, and
the result associated with the smallest error is returned.

See also
--------
modstruve

References
----------
.. [1] NIST Digital Library of Mathematical Functions
       https://dlmf.nist.gov/11
val tandg : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

tandg(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

tandg(x)

Tangent of angle x given in degrees.

val tklmbda : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

tklmbda(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

tklmbda(x, lmbda)

Tukey-Lambda cumulative distribution function

val voigt_profile : ?out:[> `Ndarray ] Np.Obj.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> Py.Object.t

voigt_profile(x1, x2, x3, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

voigt_profile(x, sigma, gamma, out=None)

Voigt profile.

The Voigt profile is a convolution of a 1D Normal distribution with standard deviation ``sigma`` and a 1D Cauchy distribution with half-width at half-maximum ``gamma``.

Parameters ---------- x : array_like Real argument sigma : array_like The standard deviation of the Normal distribution part gamma : array_like The half-width at half-maximum of the Cauchy distribution part out : ndarray, optional Optional output array for the function values

Returns ------- scalar or ndarray The Voigt profile at the given arguments

Notes ----- It can be expressed in terms of Faddeeva function

.. math:: V(x; \sigma, \gamma) = \frac

ew(z)

\sigma\sqrt{2\pi

}

, .. math:: z = \fracx + i\gamma\sqrt{2\sigma

}

where :math:`w(z)` is the Faddeeva function.

See Also -------- wofz : Faddeeva function

References ---------- .. 1 https://en.wikipedia.org/wiki/Voigt_profile

val wofz : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> Py.Object.t

wofz(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

wofz(z)

Faddeeva function

Returns the value of the Faddeeva function for complex argument::

exp(-z**2) * erfc(-i*z)

See Also -------- dawsn, erf, erfc, erfcx, erfi

References ---------- .. 1 Steven G. Johnson, Faddeeva W function implementation. http://ab-initio.mit.edu/Faddeeva

Examples -------- >>> from scipy import special >>> import matplotlib.pyplot as plt

>>> x = np.linspace(-3, 3) >>> z = special.wofz(x)

>>> plt.plot(x, z.real, label='wofz(x).real') >>> plt.plot(x, z.imag, label='wofz(x).imag') >>> plt.xlabel('$x$') >>> plt.legend(framealpha=1, shadow=True) >>> plt.grid(alpha=0.25) >>> plt.show()

val wrightomega : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

wrightomega(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

wrightomega(z, out=None)

Wright Omega function.

Defined as the solution to

.. math::

\omega + \log(\omega) = z

where :math:`\log` is the principal branch of the complex logarithm.

Parameters ---------- z : array_like Points at which to evaluate the Wright Omega function

Returns ------- omega : ndarray Values of the Wright Omega function

Notes ----- .. versionadded:: 0.19.0

The function can also be defined as

.. math::

\omega(z) = W_K(z)(e^z)

where :math:`K(z) = \lceil (\Im(z) - \pi)/(2\pi) \rceil` is the unwinding number and :math:`W` is the Lambert W function.

The implementation here is taken from 1_.

See Also -------- lambertw : The Lambert W function

References ---------- .. 1 Lawrence, Corless, and Jeffrey, 'Algorithm 917: Complex Double-Precision Evaluation of the Wright :math:`\omega` Function.' ACM Transactions on Mathematical Software, 2012. :doi:`10.1145/2168773.2168779`.

val xlog1py : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

xlog1py(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

xlog1py(x, y)

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

Parameters ---------- x : array_like Multiplier y : array_like Argument

Returns ------- z : array_like Computed x*log1p(y)

Notes -----

.. versionadded:: 0.13.0

val xlogy : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

xlogy(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

xlogy(x, y)

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

Parameters ---------- x : array_like Multiplier y : array_like Argument

Returns ------- z : array_like Computed x*log(y)

Notes -----

.. versionadded:: 0.13.0

val y0 : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

y0(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

y0(x)

Bessel function of the second kind of order 0.

Parameters ---------- x : array_like Argument (float).

Returns ------- Y : ndarray Value of the Bessel function of the second kind of order 0 at `x`.

Notes -----

The domain is divided into the intervals 0, 5 and (5, infinity). In the first interval a rational approximation :math:`R(x)` is employed to compute,

.. math::

Y_0(x) = R(x) + \frac

\log(x) J_0(x)

\pi,

where :math:`J_0` is the Bessel function of the first kind of order 0.

In the second interval, the Hankel asymptotic expansion is employed with two rational functions of degree 6/6 and 7/7.

This function is a wrapper for the Cephes 1_ routine `y0`.

See also -------- j0 yv

References ---------- .. 1 Cephes Mathematical Functions Library, http://www.netlib.org/cephes/

val y1 : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

y1(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

y1(x)

Bessel function of the second kind of order 1.

Parameters ---------- x : array_like Argument (float).

Returns ------- Y : ndarray Value of the Bessel function of the second kind of order 1 at `x`.

Notes -----

The domain is divided into the intervals 0, 8 and (8, infinity). In the first interval a 25 term Chebyshev expansion is used, and computing :math:`J_1` (the Bessel function of the first kind) is required. In the second, the asymptotic trigonometric representation is employed using two rational functions of degree 5/5.

This function is a wrapper for the Cephes 1_ routine `y1`.

See also -------- j1 yn yv

References ---------- .. 1 Cephes Mathematical Functions Library, http://www.netlib.org/cephes/

val yn : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

yn(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

yn(n, x)

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

Parameters ---------- n : array_like Order (integer). z : array_like Argument (float).

Returns ------- Y : ndarray Value of the Bessel function, :math:`Y_n(x)`.

Notes ----- Wrapper for the Cephes 1_ routine `yn`.

The function is evaluated by forward recurrence on `n`, starting with values computed by the Cephes routines `y0` and `y1`. If `n = 0` or 1, the routine for `y0` or `y1` is called directly.

See also -------- yv : For real order and real or complex argument.

References ---------- .. 1 Cephes Mathematical Functions Library, http://www.netlib.org/cephes/

val yv : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

yv(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

yv(v, z)

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

Parameters ---------- v : array_like Order (float). z : array_like Argument (float or complex).

Returns ------- Y : ndarray Value of the Bessel function of the second kind, :math:`Y_v(x)`.

Notes ----- For positive `v` values, the computation is carried out using the AMOS 1_ `zbesy` routine, which exploits the connection to the Hankel Bessel functions :math:`H_v^(1)` and :math:`H_v^(2)`,

.. math:: Y_v(z) = \frac

\imath

(H_v^(1) - H_v^(2)).

For negative `v` values the formula,

.. math:: Y_

v

}

(z) = Y_v(z) \cos(\pi v) + J_v(z) \sin(\pi v)

is used, where :math:`J_v(z)` is the Bessel function of the first kind, computed using the AMOS routine `zbesj`. Note that the second term is exactly zero for integer `v`; to improve accuracy the second term is explicitly omitted for `v` values such that `v = floor(v)`.

See also -------- yve : :math:`Y_v` with leading exponential behavior stripped off.

References ---------- .. 1 Donald E. Amos, 'AMOS, A Portable Package for Bessel Functions of a Complex Argument and Nonnegative Order', http://netlib.org/amos/

val yve : ?out:Py.Object.t -> ?where:Py.Object.t -> x:Py.Object.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

yve(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

yve(v, z)

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

Returns the exponentially scaled Bessel function of the second kind of real order `v` at complex `z`::

yve(v, z) = yv(v, z) * exp(-abs(z.imag))

Parameters ---------- v : array_like Order (float). z : array_like Argument (float or complex).

Returns ------- Y : ndarray Value of the exponentially scaled Bessel function.

Notes ----- For positive `v` values, the computation is carried out using the AMOS 1_ `zbesy` routine, which exploits the connection to the Hankel Bessel functions :math:`H_v^(1)` and :math:`H_v^(2)`,

.. math:: Y_v(z) = \frac

\imath

(H_v^(1) - H_v^(2)).

For negative `v` values the formula,

.. math:: Y_

v

}

(z) = Y_v(z) \cos(\pi v) + J_v(z) \sin(\pi v)

is used, where :math:`J_v(z)` is the Bessel function of the first kind, computed using the AMOS routine `zbesj`. Note that the second term is exactly zero for integer `v`; to improve accuracy the second term is explicitly omitted for `v` values such that `v = floor(v)`.

References ---------- .. 1 Donald E. Amos, 'AMOS, A Portable Package for Bessel Functions of a Complex Argument and Nonnegative Order', http://netlib.org/amos/

val zetac : ?out:Py.Object.t -> ?where:Py.Object.t -> x:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

zetac(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True, signature, extobj)

zetac(x)

Riemann zeta function minus 1.

This function is defined as

.. math:: \zeta(x) = \sum_k=2^\infty 1 / k^x,

where ``x > 1``. For ``x < 1`` the analytic continuation is computed. For more information on the Riemann zeta function, see dlmf_.

Parameters ---------- x : array_like of float Values at which to compute zeta(x) - 1 (must be real).

Returns ------- out : array_like Values of zeta(x) - 1.

See Also -------- zeta

Examples -------- >>> from scipy.special import zetac, zeta

Some special values:

>>> zetac(2), np.pi**2/6 - 1 (0.64493406684822641, 0.6449340668482264)

>>> zetac(-1), -1.0/12 - 1 (-1.0833333333333333, -1.0833333333333333)

Compare ``zetac(x)`` to ``zeta(x) - 1`` for large `x`:

>>> zetac(60), zeta(60) - 1 (8.673617380119933e-19, 0.0)

References ---------- .. dlmf NIST Digital Library of Mathematical Functions https://dlmf.nist.gov/25

OCaml

Innovation. Community. Security.