scipy.special.pdtrik#
- scipy.special.pdtrik(p, m, out=None) = <wrapped_ufunc 'pdtrik'>#
Inverse of
pdtrwith respect to k.- Parameters:
- parray_like
Probability
- marray_like
Shape parameter (nonnegative, real)
- outndarray, optional
Optional output array for the function results
- Returns:
- scalar or ndarray
The number of occurrences k such that
pdtr(k, m) = p
See also
Notes
This function relies on the
gamma_q_invafunction from the Boost Math C++ library [1].Array API Standard Support
pdtrikhas support for Python Array API Standard compatible backends in addition to NumPy. The following combinations of backend and device (or other capability) are supported.Library
CPU
GPU
NumPy
✅
n/a
CuPy
n/a
⛔
PyTorch
✅
⛔
JAX
✅
⛔
Dask
✅
n/a
For the NumPy backend, this function supports all NumPy ufunc keyword arguments. Other backends may support
out, but typically none of the other ufunc kwargs.outis typically supported for CuPy and PyTorch, but not currently in cases where SciPy relies on a generic Array API implementation or, for PyTorch on CPU, falls back to the NumPy backend.outis never supported for JAX because JAX arrays are immutable.pdtrikdoes not currently supportoutfor the PyTorch backend.See Support for the array API standard for more information.
References
[1]The Boost Developers. “Boost C++ Libraries”. https://www.boost.org/.
Examples
>>> import scipy.special as sc
Compute the CDF for several values of k:
>>> k = [1, 2, 3] >>> p = sc.pdtr(k, 2) >>> p array([0.40600585, 0.67667642, 0.85712346])
Compute the inverse. We recover the values of k, as expected:
>>> sc.pdtrik(p, 2) array([1., 2., 3.])