scipy.special.chdtriv#
- scipy.special.chdtriv(p, x, out=None) = <wrapped_ufunc 'chdtriv'>#
Inverse to
chdtrwith respect to v.Returns v such that
chdtr(v, x) == p.- Parameters:
- parray_like
Probability that the Chi square random variable is less than or equal to x.
- xarray_like
Nonnegative input.
- outndarray, optional
Optional output array for the function results.
- Returns:
- scalar or ndarray
Degrees of freedom.
Notes
This function wraps routines from the Boost Math C++ library [1].
Array API Standard Support
chdtrivhas 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.chdtrivdoes not currently supportoutfor the PyTorch backend.See Array API coverage for more information.
References
[1]The Boost Developers. “Boost C++ Libraries”. https://www.boost.org/.
[2]Chi-Square distribution, https://www.itl.nist.gov/div898/handbook/eda/section3/eda3666.htm
Examples
>>> import scipy.special as sc
It inverts
chdtr.>>> p, x = 0.5, 1 >>> sc.chdtr(sc.chdtriv(p, x), x) 0.5000000000000003 >>> v = 1 >>> sc.chdtriv(sc.chdtr(v, x), x) 1.0